SAP searches for user change history

Source: Internet
Author: User

For front-end business changes, the system will save the changed users, change time, change location (data source), change content (New Value and old value ).Of course, for Po and other items, you can also view changes. for areas where the system does not provide changes, we can use the following method to find

1. Use table:

Cdhdr

Change credential Header

Cdpos

Change credential item

2. Use function:

Changedocument_read_headers

Retrieve change credential Header

Changedocument_read_positions

Get change credential item

 

If objectclass is not used, the search process will be quite slow. The following is a commonly used objectclass. However, some objectclasses correspond to multiple T-codes, and the T-code displayed in the other two tables is sometimes not the true t-code of our operation.

  • Adresse-xk01
  • Adresse3-su01
  • Banf-me54n
  • Beleg-vf21
  • Betrieb-vd02
  • Cond_a-me31k
  • Debi-xd02
  • Einkbeleg-me22n 
  • Entrysheet-ml85
  • Feature-ct04
  • Incominginvoice-mrbr
  • Infosatz-me13
  • Klasse-cl02
  • Kred-xk02, xk01
  • Lieferung-vl03n
  • Material-mm01
  • Mm_service-me22n
  • Mrp_area-mm01
  • Nrinterval-omh6
  • Pfcg-pfcg
  • Revision-me32k
  • Sach-fs00
  • Spec_tmp-ml10
  • STLV-ml02
  • Vasmd-ac03
  • Verkbeleg-va02

In addition, the followingProgramIt can also be displayed (from http://www.cnblogs.com/jackcnblogs/articles/580342.html ).
Tables cdhdr and cdpos)

Report z_alv_cdhdr_cdpos.
Type-pools slis.
Data: cdhdr type cdhdr.
Select-options:
S_objcls for cdhdr-objectclas obligatory,
S_objtid for cdhdr-objectid,
S_chngnr for cdhdr-changenr,
S_usnam for cdhdr-username default sy-uname,
S_udate for cdhdr-udate default sy-datum,
S_time for cdhdr-utime,
S_tcode for 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 Skip.
Parameters p_max type numc3 obligatory default '20140901 '.

*---------------------------------------------------------------------*
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 ALV
Gs_layout type slis_layout_alv,
* Change Document Header
T_cdhdr type table of ty_s_cdhdr.

*---------------------------------------------------------------------*
Start-of-selection.

* Read change Document Header
Select * into Table t_cdhdr
Up to p_max rows
From cdhdr
Where objectclas in s_objcls
And objectid in s_objtid
And changenr in s_chngnr
And username in s_usnam
And udate in s_udate
And utime in s_time
And tcode in s_tcode
And planchngnr in s_plncnr
And act_chngno in s_chngno
And was_plannd in s_wsplnd
And change_ind in s_chngid.

Gs_layout-zebra = 'x '.
Gs_layout-colwidth_optimize = 'x '.
Gs_layout-box_fieldname = 'checkbox '.

* display ALV
call function 'reuse _ alv_grid_display '
exporting
I _callback_program = sy-cprog
I _callback_user_command = 'User _ command'
I _structure_name = 'cdhdr '
is_layout = gs_layout
tables
t_outtab = t_cdhdr.

* operator *
* Form user_command *
* operator *
form user_command using u_ucomm type syucomm
us_selfield type slis_selfield. "# EC called

* Macro definition
Define m_sort.
Add 1 to ls_sort-spos.
Ls_sort-fieldname = & 1.
Ls_sort-up = 'x '.
Append ls_sort to lt_sort.
End-of-definition.

Data:
Ls_cdhdr type ty_s_cdhdr,
Ls_sort type slis_sortinfo_alv,
Lt_sort type slis_t_sortinfo_alv,
* Change document items
Lt_cdpos type table of ty_s_cdpos.

Case u_ucomm.
When' & ic1 '.
Perform check_marked using us_selfield.

* Read change document items
Loop at t_cdhdr into ls_cdhdr where checkbox = 'x '.
Select * appending table lt_cdpos
From cdpos
Where objectclas = ls_cdhdr-objectclas
And objectid = ls_cdhdr-objectid
And changenr = ls_cdhdr-changenr.
Endloop.

M_sort 'changenr '.

* Display ALV
Call function 'reuse _ alv_grid_display'
Exporting
I _structure_name = 'cdpos'
Is_layout = gs_layout
It_sort = lt_sort
Tables
T_outtab = lt_cdpos.

Endcase.

Endform."User_command
*---------------------------------------------------------------------*
* Form check_marked
*---------------------------------------------------------------------*
* What has been marked in t_cdhdr
*---------------------------------------------------------------------*
Form check_marked using us_selfield type slis_selfield.

Field-symbols:
<Cdhdr> type ty_s_cdhdr.

Read Table t_cdhdr transporting no fields with key checkbox = 'x '.
If not sy-subrc is initial and
Not us_selfield-tabindex is initial.
Read Table t_cdhdr index Co., us_selfield-tabindex. Assigning <cdhdr>.
<Cdhdr>-checkbox = 'x '.
Endif.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.