Posted: Sat Jan 19, 2008 11:07 pm Post subject: Display Material Master changes occured in a period
Code:
REPORT ztrace_material.
TABLES: mara,
cdhdr,
cdpos.
SELECT-OPTIONS: period FOR cdhdr-udate,
name FOR cdhdr-username,
material FOR mara-matnr.
DATA: wchangenr LIKE cdhdr-changenr.
DATA: wtext(80) TYPE c.
DATA : BEGIN OF t_mara OCCURS 0,
matnr LIKE mara-matnr,
END OF t_mara.
DATA: BEGIN OF icdhdr OCCURS 50.
INCLUDE STRUCTURE cdhdr.
DATA: END OF icdhdr.
DATA: BEGIN OF icdshw OCCURS 50.
INCLUDE STRUCTURE cdshw.
DATA: END OF icdshw.
DATA : w_matnr LIKE mara-matnr.
DATA: BEGIN OF itab OCCURS 50,
matnr LIKE mara-matnr,
changenr LIKE cdhdr-changenr,
udate LIKE cdhdr-udate,
utime LIKE cdhdr-utime,
username LIKE cdhdr-username,
chngind LIKE cdshw-chngind,
ftext LIKE cdshw-ftext,
outlen LIKE cdshw-outlen,
f_old LIKE cdshw-f_old,
f_new LIKE cdshw-f_new,
END OF itab.
FIELD-SYMBOLS: <value_old>, <value_new>.
SELECT matnr
INTO TABLE t_mara
FROM mara WHERE matnr IN material.
clear t_mara.
LOOP AT t_mara.
* Get Changes
PERFORM changedocument_read.
ENDLOOP.
LOOP AT itab.
CLEAR: wtext, w_matnr.
CASE itab-chngind.
WHEN 'U'.
wtext(50) = 'Updated field'.
wtext+51 = itab-ftext.
CONDENSE wtext.
WHEN 'D'.
wtext = text-021.
WHEN 'E'.
wtext(5) = itab-ftext.
wtext+51 = ' text : E'.
CONDENSE wtext.
WHEN 'I'.
wtext = ' text : I'.
ENDCASE.
RESERVE 5 LINES.
IF wchangenr NE itab-changenr.
wchangenr = itab-changenr.
w_matnr = itab-matnr.
WRITE:/ itab-udate UNDER 'Change Date',
itab-utime UNDER 'Time',
itab-username UNDER 'User Name',
itab-matnr UNDER 'Material No',
wtext UNDER 'Changes'.
ELSEIF itab-matnr NE w_matnr.
WRITE:/ wtext UNDER 'Changes'.
ENDIF.
CASE itab-chngind.
WHEN 'U'.
ASSIGN itab-f_old(itab-outlen) TO <value_old>.
ASSIGN itab-f_new(itab-outlen) TO <value_new>.
WRITE: / text-023 UNDER 'Changes',
<value_old>.
WRITE: / text-024 UNDER 'Changes',
<value_new>.
WHEN 'E'.
ASSIGN itab-f_old(itab-outlen) TO <value_old>.
WRITE: text-023 UNDER 'Changes',
<value_old>.
ENDCASE.
SKIP.
ENDLOOP.
TOP-OF-PAGE.
WRITE: / sy-repid,
50 'Material Changes'.
Skip to line 4.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.