Additional changed features
for Purchase Order Layout sets
REPORT ZPOCHANGE.
************************************************************************************
* This is a subroutine perform in the Purchase order Layout sets.
* Description : To retreive the details of changed remarks in
PO output and to capture the retrival date
*
Additional features with the previous changed appearing. e.g. from
.... to
* Note : If the latest
modification details required
* Please Uncomment the lines mentioned under 'Last Modified Remarks
only'
************************************************************************************
* Information
* /: PERFORM CHDATE IN PROGRAM ZPOCHANGE
* /:
USING &EKKO-EBELN&
* /:
CHANGING &RVDATE2&
* /: ENDPERFORM.
* /: IF &RVDATE2& EQ ' '.
* / Revision Date: NIL
* /: ELSE.
* / Revision Date: &RVDATE2&
* /: ENDIF.
* Main Window
* /E CHANGE_REMARKS
* /: PERFORM CHDET IN PROGRAM ZPOCHANGE
* /:
USING &EKPO-EBELP&
* /:
USING &EKKO-EBELN&
* /:
USING &T166T-CHTXT&
* /:
USING &T166T-CTXNR&
* /:
CHANGING &ITAB1-F_NEW&
* /:
CHANGING &ITAB1-F_OLD&
* /:ENDPERFORM.
* /:IF &ITAB1-F_NEW& NE ' '
* = &ITAB1-F_OLD(C)& CHANGED TO &ITAB1-F_NEW(C)&
* /:ENDIF
*
* You might need to apply Note 373524 - Message determination and printing
TABLES : CDSHW , "Change documents, formatting table
CDHDR , "Change document
header
EKPO , "Purchasing
Document Item
EKKO , "Purchasing
Document Header
T166C . "Print-Relevant
Purchasing Document Changes
DATA : ITAB1 LIKE CDSHW OCCURS 100 WITH HEADER LINE.
DATA : ITAB2 LIKE EKPO OCCURS 100 WITH HEADER LINE.
DATA : DOCUM LIKE EKKO OCCURS 100 WITH HEADER LINE.
DATA : TABKEY LIKE CDSHW-TABKEY.
data : begin of ctab occurs 10,
tname like t166c-tname,
fname like t166c-fname,
TABKEY LIKE
CDSHW-TABKEY,
FLAG(3),
end of ctab.
DATA : VAL1(15), VAL2(15).
DATA : M1(20), M2(10), M3(10),M4(5).
DATA : RVDATE(10),RVDATE2(10) , EBELN LIKE EKKO-EBELN, COUNT TYPE I.
* Text number for change text(CTXNR), CHANGE TEXT(CHTXT), Purchase
order
* Number and item number are passed from Layoutset
*---------------------------------------------------------------------*
* FORM CHDET
*
*---------------------------------------------------------------------*
* ........
*
*---------------------------------------------------------------------*
* --> ITAB
*
* --> OTAB
*
*---------------------------------------------------------------------*
FORM CHDET TABLES ITAB STRUCTURE ITCSY
OTAB STRUCTURE ITCSY.
LOOP AT ITAB.
CASE ITAB-NAME.
WHEN 'T166T-CHTXT'.
MOVE ITAB-VALUE TO M1.
WHEN 'T166T-CTXNR'.
MOVE ITAB-VALUE TO M2.
WHEN 'EKKO-EBELN'.
MOVE ITAB-VALUE TO M3.
WHEN 'EKPO-EBELP'.
MOVE ITAB-VALUE TO M4.
ENDCASE.
ENDLOOP.
* Throught this function change details are retrived into itab1.
CALL FUNCTION 'ME_CHANGES_READ'
EXPORTING
DOCUMENT_CATEGORY = 'F'
DOCUMENT_NUMBER = M3
TABLES
XCDSHW
= itab1.
SELECT SINGLE * FROM T166C WHERE CTXNR = M2.
IF SY-SUBRC = 0.
CONCATENATE M3 M4 INTO TABKEY.
*********Last Modified Remarks only***********************
* read table ctab with key tname = T166C-TNAME
*
tabkey = tabkey
*
fname = T166C-FNAME.
* if sy-subrc ne 0.
**********************************************************
LOOP AT ITAB1 WHERE TABNAME = T166C-TNAME
AND TABKEY+3(15) = TABKEY
AND FNAME = T166C-FNAME.
**********Last Modified Remarks only***********************
* ctab-tname = t166c-tname.
* ctab-fname = t166c-fname.
* ctab-tabkey = tabkey.
* append ctab.
***********************************************************
delete itab1.
exit.
endloop.
* Captured details are exported to Layoutset
LOOP AT OTAB.
CASE OTAB-NAME.
WHEN 'ITAB1-F_OLD'.
OTAB-VALUE =
ITAB1-F_OLD.
MODIFY OTAB.
CLEAR : ITAB1-F_OLD.
WHEN 'ITAB1-F_NEW'.
OTAB-VALUE =
ITAB1-F_NEW.
MODIFY OTAB.
CLEAR : ITAB1-F_NEW.
ENDCASE.
endloop.
endif.
*******Last Modified Remarks only*****************
* ENDIF.
**************************************************
clear ctab.
ENDFORM.
*---------------------------------------------------------------------*
* FORM CHDATE
*
*---------------------------------------------------------------------*
* ........
*
*---------------------------------------------------------------------*
* --> ITAB
*
* --> OTAB
*
*---------------------------------------------------------------------*
* Form for revision date retrival. PO no. is passed from layoutset
* and in the change document header latest modified date is captured
* and passed to revision date field in Layoutset.
FORM CHDATE TABLES ITAB STRUCTURE ITCSY
OTAB STRUCTURE ITCSY.
CLEAR : RVDATE, EBELN.
LOOP AT ITAB.
CASE ITAB-NAME.
WHEN 'EKKO-EBELN'.
MOVE ITAB-VALUE TO EBELN.
ENDCASE.
ENDLOOP.
SELECT UDATE INTO CDHDR-UDATE FROM CDHDR WHERE OBJECTCLAS = 'EINKBELEG'
AND OBJECTID = EBELN.
IF RVDATE < CDHDR-UDATE.
RVDATE = CDHDR-UDATE.
ENDIF.
COUNT = COUNT + 1.
ENDSELECT.
LOOP AT OTAB.
CASE OTAB-NAME.
WHEN 'RVDATE2'.
CONCATENATE RVDATE+6(2) '.' RVDATE+4(2) '.'
RVDATE(4) INTO RVDATE2.
IF COUNT = 1.
RVDATE2 = ''.
ENDIF.
MOVE RVDATE2 TO OTAB-VALUE.
MODIFY OTAB.
ENDCASE.
ENDLOOP.
CLEAR : COUNT.
ENDFORM.
More Function Module
Functions / SAP
Script / ALV
Tables
Database Table
ABAP Books List
ABAP/4 Certification,
Programming, Smartforms, Sapscripts and Object Oriented Programming Books
Smart Forms
SAP Smartforms
ABAP Menu:
ABAP Example Hints
and Tips
Return to Index:-
SAP ABAP/4 Programming,
Basis Administration, Configuration Hints and Tips
(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.
Information used on this site is at your own risk.
All product names are trademarks of their respective
companies. The site www.gotothings.com is in no way affiliated with
SAP AG.
Any unauthorised copying or mirroring is prohibited.
|