REPORT zmmchghistory NO STANDARD PAGE HEADING LINE-SIZE 195 LINE-COUNT 60.
* Change doc listing
* Grouped into 3 chg types: 1. Part revision 2. Price change 3. Others
TABLES:
cdhdr, cdpos, mara, makt, mard.
FIELD-GROUPS: header.
DATA: BEGIN OF chgdoc OCCURS 50.
INCLUDE STRUCTURE cdred.
DATA: END OF chgdoc.
DATA:
chgtype(1),
plant(4),
matnr1 LIKE chgdoc-objectid.
SELECT-OPTIONS:
xmatnr FOR cdhdr-objectid, "Material
xudate FOR cdhdr-udate, "Change Date
xuname FOR cdhdr-username, "User Name
xtcode FOR cdhdr-tcode, "Transaction Code
xwerks FOR mard-werks. "Plants
SELECTION-SCREEN SKIP.
*Filter change type
SELECTION-SCREEN BEGIN OF BLOCK chg0 WITH FRAME TITLE text-001.
PARAMETERS : xchg1 AS CHECKBOX DEFAULT 'X',
xchg2 AS CHECKBOX DEFAULT 'X',
xchg3 AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK chg0.
CHECK: chgdoc-udate IN xudate,
chgdoc-username IN xuname,
chgdoc-tcode IN xtcode.
* Chg type: 1. Part revision, 2. Price change, 3. Others
CASE chgdoc-tcode.
WHEN 'MM01' OR 'MM02' OR 'MM03'. chgtype = '1'.
WHEN 'MR21'. chgtype = '2'.
WHEN OTHERS. chgtype = '3'.
ENDCASE.
* Filter chg type
IF ( chgtype = '1' AND xchg1 <> 'X' ) OR
( chgtype = '2' AND xchg2 <> 'X' ) OR
( chgtype = '3' AND xchg3 <> 'X' ).
CONTINUE.
ENDIF.
* Plant is a substring of tabkey
plant = chgdoc-tabkey+21(4).
IF NOT ( xwerks IS INITIAL ) AND NOT ( plant IS INITIAL ).
CHECK plant IN xwerks.
ENDIF.
EXTRACT header.
ENDLOOP.
ENDSELECT.
END-OF-SELECTION.
SORT.
LOOP.
* Material
AT NEW chgdoc-objectid.
SELECT SINGLE * FROM makt WHERE matnr = chgdoc-objectid.
FORMAT INTENSIFIED ON.
SKIP. SKIP.
WRITE:/' *** Material:', (18) chgdoc-objectid, makt-maktx.
ENDAT.
* Change type
AT NEW chgtype.
FORMAT INTENSIFIED ON.
SKIP.
CASE chgtype.
WHEN '1'. WRITE:/ ' ** Change type: PARTS REVISION'.
WHEN '2'. WRITE:/ ' ** Change type: PRICE CHANGE'.
WHEN '3'. WRITE:/ ' ** Change type: OTHERS'.
ENDCASE.
SKIP.
ENDAT.
SHIFT chgdoc-f_old LEFT DELETING LEADING space.
SHIFT chgdoc-f_new LEFT DELETING LEADING space.
FORMAT INTENSIFIED OFF.
WRITE:
/ plant UNDER 'Plant',
(50) chgdoc-ftext UNDER 'Field',
(45) chgdoc-f_old UNDER 'Old value',
(45) chgdoc-f_new UNDER 'New value'.
AT NEW chgdoc-changenr.
FORMAT INTENSIFIED OFF.
WRITE:
chgdoc-changenr UNDER 'Change doc',
chgdoc-tcode UNDER 'Tcod',
chgdoc-username UNDER 'User name ',
chgdoc-udate UNDER 'Date ' DD/MM/YY.
ENDAT.
AT END OF chgdoc-objectid.
SKIP.
ULINE.
SKIP.
ENDAT.
ENDLOOP.
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.