(精選文檔)sap表修改記錄查詢_第1頁
(精選文檔)sap表修改記錄查詢_第2頁
(精選文檔)sap表修改記錄查詢_第3頁
(精選文檔)sap表修改記錄查詢_第4頁
(精選文檔)sap表修改記錄查詢_第5頁
已閱讀5頁,還剩7頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、目錄SAP表修改記錄查詢1更改記錄表CDHDR和CDPOS2SAP保存操作記錄CDHDR和CDPOS表2通過CDHDR CDPOS獲取增量數(shù)據(jù)7其他方式11SAP表修改記錄查詢SAP中修改頻率較低的定制表(T001等)一般都會有修改記錄存在,查看一個表有沒有修改記錄可以在SE11中查看他的技術(shù)設(shè)置,如果其中的LOG DATA CHANGES選中則表示此表有歷史修改記錄存在。要查看他的修改記錄可以使用Tcode:SCU3 。菜單路徑:工具定制IMGIMG Logging參考說明: . cfab6d/frameset.htm系統(tǒng)讀取歷史修改記錄的Function : DBLOG_READ_WITH

2、_STATISTIC轉(zhuǎn)載:SE16N 通過&sap_edit 可以修改表,修改表后如何查看呢。 分兩步進(jìn)行。1. 事務(wù)碼 SE16N, 然后輸入表SE16N_CD_Key, 輸入相應(yīng)的查詢條件。例如 table 名,查出相應(yīng)的ID2. 事務(wù)碼 SE16N,然后輸入表 SE16N_CD_DATA, 輸入相應(yīng)的ID,就可以查詢到修改的內(nèi)容。其他方式: 表DBTABLOGCDHDR更改日志表頭CDPOS更改日志行項目查詢用戶的最近一次登陸日期和時間,USR02中有個上次登陸日期和登陸時間;或者用SE38跑下RSUSR200,輸入用戶名即可查詢上次登陸日期還有個方法是ST03N,專家模式,選擇時間段,

3、選擇user和user profile,可惜,小弟權(quán)限不夠沒法測試更改記錄表CDHDR和CDPOSSE16N查詢CDPOS表,在字段OBJECTCLAS(更改文檔對象,VERKBELEG表示銷售憑證,不同的憑證類別代碼不同的文檔對象,如需查看文檔對象,可使用事務(wù)代碼SCDO,相關(guān)表為TCDOB/TCDOBT)中輸入:VERKBELEG,TABNAME(表名)輸入:VBAK/VBAP(VBAK查詢整張訂單、VBAP查詢訂單行項目),CHNGIND(修改標(biāo)識符)輸入:D(U表示更新,I表示插入,E表示刪除單個字段,D表示刪除整行或整個單據(jù)),執(zhí)行后,字段OBJECTID(對象價值)表示訂單號碼,字

4、段TABKEY(表鍵)中的最后兩位表示訂單行號,同理,我們可查看其他刪除或修改的各種單據(jù)和憑證。SAP保存操作記錄CDHDR和CDPOS表轉(zhuǎn)載自sap的字段和對象的修改都會保存舊值,數(shù)據(jù)保存在CDHDR和CDPOS表中,提取舊值可以采用兩種方法1)使用sap的標(biāo)準(zhǔn)函數(shù)CHANGEDOCUMENT_READ_HEADERS和CHANGEDOCUMENT_READ_POSITIONSCALL FUNCTION CHANGEDOCUMENT_READ_POSITIONS Change document: Read change document itemsEXPORTING*archive_hand

5、le = 0 sy-tabixHandle on Open Archive Fileschangenumber = cdpos-changenrChange document number*tablekey = SPACE cdpos-tabkeyObject class table key*tablename = SPACE cdpos-tabnameObject class table name*tablekey254 = SPACE cdpos_uid-tabkeyTable Key for CDPOS in Character 254*keyguid = SPACE cdpos_uid

6、-keyguidUUID in Character Format*keyguid_str = SPACE cdpos_str-keyguidUUID in Character FormatIMPORTINGheader = cdhdrChange document header (structure CDHDR)et_cdred_str = cdred_str_tabAdditional Change Document - Table for STRINGs* TABLES*editpos = cdshwTable with edited change document itemsEDITPO

7、S_WITH_HEADER=CDRED更改文檔,顯示結(jié)構(gòu)EXCEPTIONSNO_POSITION_FOUND = 1No item founWRONG_ACCESS_TO_ARCHIVE = 2incorrect access to archive2)使用select語句直接從表中讀取。直接使用SELECT語句讀取數(shù)據(jù)的示例:*提取信用額度字段修改的抬頭信息select cdhdrchangenr cdhdrudate cdhdrutime into corresponding fields of table p_cdhdr from cdhdr where cdhdrobjectclas

8、= KLIM and cdhdrobjectid = wa_customerinfo-kunnr. if sy-subrc = 0. *提取信用額度字段修改的字段值select cdposchangenr cdposvalue_old cdposvalue_new into corresponding fields of table p_cdpos from cdpos for all entries in p_cdhdr where cdposobjectclas = KLIM and cdposobjectid = wa_customerinfo-kunnr and cdposchange

9、nr = p_cdhdr-changenr and cdpostabname = KNKK and cdposfname = KLIMK. if sy-subrc = 0. endif. endif.可以在CHANGEDOCUMENT_READ_HEADERS中設(shè)置中斷獲得對象類型。ex.提取有變動的Acc. changesSELECT SINGLE tabkey value_newINTO (cdpos-tabkey,ikoinh)FROM cdposWHEREobjectclas = KREDAND objectid = itab-lifnrAND changenr = itab-chan

10、genrAND tabname = LFBKAND fname = KOINH.提取有變動的vendor最新日期SELECT MAX( udate ) INTO itab-cndate FROM cdhdrWHERE objectclas = KRED AND objectid = itab-lifnr.-抓取所有有變動的程序report ztest001.TYPE-POOLS slis.DATA : cdhdr TYPE cdhdr.SELECT-OPTIONS :s_objcls FOR cdhdr-objectclas OBLIGATORY,s_objtid FOR cdhdr-obje

11、ctid,s_chngnr FOR cdhdr-changenr,s_usrnam FOR cdhdr-username DEFAULT sy-uname,s_udateFOR cdhdr-udateDEFAULT sy-datum,s_timeFOR cdhdr-utime,s_tcodeFOR cdhdr-tcode,s_plncnr FOR cdhdr-planchngnr,s_chngno FOR cdhdr-act_chngno,s_wsplnd FOR cdhdr-was_plannd,s_chngid FOR cdhdr-change_ind.SELECTION-SCREEN S

12、KIP.PARAMETERS p_max TYPE numc3 OBLIGATORY DEFAULT 200.*-*TYPES :BEGIN OF ty_s_cdhdr.INCLUDE STRUCTURE cdhdr.TYPES : checkbox,END OF ty_s_cdhdr,BEGIN OF ty_s_cdpos.INCLUDE STRUCTURE cdpos.TYPES : checkbox,END OF ty_s_cdpos.*-*DATA :* Layout for ALVgs_layout TYPE slis_layout_alv,* Change document hea

13、dert_cdhdr TYPE TABLE OF ty_s_cdhdr.*-*START-OF-SELECTION.* Read Change document headerSELECT * INTO TABLE t_cdhdrUP TO p_max ROWSFROM cdhdrWHERE objectclas IN s_objclsand objectidin s_objtidand changenrin s_chngnrAND usernameIN s_usrnamAND udateIN s_udateAND utimeIN s_timeAND tcodeIN s_tcodeAND pla

14、nchngnr IN s_plncnrAND act_chngno IN s_chngnoAND was_plannd IN s_wsplndAND change_ind IN s_chngid.gs_layout-zebra = X.gs_layout-colwidth_optimize = X.gs_layout-box_fieldname = CHECKBOX.* Display ALVCALL FUNCTION REUSE_ALV_GRID_DISPLAYEXPORTINGi_callback_program= sy-cprogi_callback_user_command = USE

15、R_COMMANDi_structure_name= CDHDRis_layout= gs_layoutTABLESt_outtab= t_cdhdr.*-*FORM USER_COMMAND*-*FORM user_command USING u_ucommTYPE syucommus_selfield TYPE slis_selfield.#EC CALLED* Macro definitionDEFINE m_sort.add 1 to ls_sort-spos.ls_sort-fieldname = &1.ls_sort-up = X.append ls_sort to lt_sort

16、.END-OF-DEFINITION.DATA :ls_cdhdr TYPE ty_s_cdhdr,ls_sortTYPE slis_sortinfo_alv,lt_sortTYPE slis_t_sortinfo_alv,*Change document itemslt_cdpos TYPE TABLE OF ty_s_cdpos.CASE u_ucomm.WHEN &IC1.PERFORM check_marked USING us_selfield.*Read Change document itemsLOOP AT t_cdhdr INTO ls_cdhdr WHERE checkbo

17、x = X.SELECT * APPENDING TABLE lt_cdposFROM cdposWHERE objectclas = ls_cdhdr-objectclasAND objectid= ls_cdhdr-objectidAND changenr= ls_cdhdr-changenr.ENDLOOP.m_sort CHANGENR.*Display ALVCALL FUNCTION REUSE_ALV_GRID_DISPLAYEXPORTINGi_structure_name = CDPOSis_layout= gs_layoutit_sort= lt_sortTABLESt_o

18、uttab= lt_cdpos.ENDCASE.ENDFORM. USER_COMMAND*-FORM check_marked USING us_selfield TYPE slis_selfield.FIELD-SYMBOLS : TYPE ty_s_cdhdr.READ TABLE t_cdhdr TRANSPORTING NO FIELDS WITH KEY checkbox = X.IF NOT sy-subrc IS INITIAL ANDNOT us_selfield-tabindex IS INITIAL.READ TABLE t_cdhdr INDEX us_selfield

19、-tabindex ASSIGNING .-checkbox = X.ENDIF.ENDFORM.通過CDHDR CDPOS獲取增量數(shù)據(jù)REPORT zscm_vendor2 LINE-SIZE 1023.DATA: BEGIN OF itab OCCURS 0, spras LIKE lfa1-spras, lifnr LIKE lfa1-lifnr, name1 LIKE adrc-name1, name3 LIKE adrc-name3, regio LIKE lfa1-regio, stras LIKE lfa1-stras, str_suppl1 LIKE adrc-str_supp

20、l1, pstlz LIKE lfa1-pstlz, telf1 LIKE lfa1-telf1, telfx LIKE lfa1-telfx, name2 LIKE knvk-name1, smtp_addr LIKE adr6-smtp_addr, buy_id(12) TYPE c, stceg LIKE lfa1-stceg, banka LIKE bnka-banka, bankn LIKE lfbk-bankn, vendor_type(3) TYPE c,*balance_type(4) TYPE c, END OF itab.DATA: BEGIN OF itab_temp O

21、CCURS 0 , adrnr LIKE lfa1-adrnr. INCLUDE STRUCTURE itab.DATA: END OF itab_temp.DATA: BEGIN OF itab_adrc OCCURS 0,addrnumber LIKE adrc-addrnumber,name1 LIKE adrc-name1,name3 LIKE adrc-name3,str_suppl1 LIKE adrc-str_suppl1,smtp_addr LIKE adr6-smtp_addr, END OF itab_adrc.DATA: BEGIN OF itab_knvk OCCURS

22、 0, lifnr LIKE lfa1-lifnr, name2 LIKE knvk-name1, END OF itab_knvk.DATA: BEGIN OF itab_bnka OCCURS 0, lifnr LIKE lfbk-lifnr, banka LIKE bnka-banka, bankn LIKE lfbk-bankn, END OF itab_bnka.DATA: BEGIN OF itab_lfb1 OCCURS 0, lifnr LIKE lfb1-lifnr, bukrs LIKE lfb1-bukrs, zterm LIKE lfb1-zterm, END OF i

23、tab_lfb1.DATA: changenr LIKE zcdhdr_max-changenr.PARAMETER: date TYPE syst-datum.DATA: BEGIN OF itab_object OCCURS 0, objectid LIKE lfa1-lifnr , END OF itab_object.PERFORM getvendordata.*&-*& Form getvendordata*&-*FORM getvendordata.* get max changenr* SELECT MAX( zcdhdr_maxchangenr )* INTO changenr

24、* FROM zcdhdr_max* WHERE zcdhdr_maxerdat changenr AND cdhdrudate = date . LOOP AT itab_object. IF itab_object-objectid+0(1) = B.“B為公司職員 DELETE itab_object. ENDIF. ENDLOOP.* DELETE ADJACENT data SORT itab_object. DELETE ADJACENT DUPLICATES FROM itab_object. CHECK NOT itab_object IS INITIAL. SELECT lf

25、a1spras lfa1lifnr lfa1stceg lfa1regio lfa1stras lfa1pstlz lfa1telf1 lfa1telfx lfa1adrnr lfa1ernam AS buy_id lfa1ktokk AS vendor_type INTO CORRESPONDING FIELDS OF TABLE itab_temp FROM lfa1 FOR ALL ENTRIES IN itab_object WHERE lfa1lifnr = itab_object-objectid. SELECT knvklifnr knvkname1 AS name2 INTO

26、CORRESPONDING FIELDS OF TABLE itab_knvk FROM knvk FOR ALL ENTRIES IN itab_object WHERE knvklifnr = itab_object-objectid. SELECT lfbklifnr bnkabanka lfbkbankn INTO CORRESPONDING FIELDS OF TABLE itab_bnka FROM lfbk INNER JOIN bnka ON lfbkbanks = bnkabanks AND lfbkbankl = bnkabankl FOR ALL entries IN itab_object WHERE lfbklifnr = itab_object-objectid. CHECK NOT itab_temp IS INITIAL. SELECT adrcaddrnumber adrcstr_suppl1 adrcname1 adrcname3 adr6smtp_addr INTO CORRESPONDING FIELDS OF TABLE itab_adrc FROM adrc LEFT JOIN adr6 ON adrcaddrnumber = adr6addrnumber FOR ALL entries I

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論