REPORT ZVVF_MR002_PURREQANNEX NO STANDARD PAGE HEADING
LINE-COUNT 55(12)
LINE-SIZE 170.
*---------------------------------------------------------------------*
* *
* MODULE : Material Management *
* *
*---------------------------------------------------------------------*
* Objective : Report for printing Purchase Requisition Annexure *
*
* *
* Program : Update Tables( ) Download Data( ) Outputs List (X) *
* Technical Specs No : *
* Date Created : *
* Author : *
* Location : *
* LDB : *
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
* Tables *
*---------------------------------------------------------------------*
TABLES : CDPOS .
*----------------------------------------------------------------------*
*Types *
*----------------------------------------------------------------------*
TYPES : BEGIN OF T_RECORD,
OBJECTID LIKE CDPOS-OBJECTID,
TABKEY LIKE CDPOS-TABKEY,
FNAME LIKE CDPOS-FNAME,
VALUE_OLD LIKE CDPOS-VALUE_OLD,
VALUE_NEW LIKE CDPOS-VALUE_NEW,
MEOLD LIKE CDPOS-VALUE_OLD,
MENEW LIKE CDPOS-VALUE_NEW,
RLOLD LIKE CDPOS-VALUE_OLD,
RLNEW LIKE CDPOS-VALUE_NEW,
MATNR LIKE EBAN-MATNR,
TXZ01 LIKE EBAN-TXZ01,
ERNAM LIKE EBAN-ERNAM,
END OF T_RECORD.
*---------------------------------------------------------------------*
* parameters *
*---------------------------------------------------------------------*
PARAMETERS : P_BANFN LIKE EBAN-BANFN ,
PA_TBNME LIKE CDPOS-TABNAME DEFAULT 'EBAN'.
*---------------------------------------------------------------------*
* INTERNAL TABLE Begin with IT *
*---------------------------------------------------------------------*
DATA : IT_EBAN TYPE STANDARD TABLE OF EBAN WITH HEADER LINE.
DATA : IT_RECORD TYPE STANDARD TABLE OF T_RECORD WITH HEADER LINE.
*---------------------------------------------------------------------*
* Data Variables Begin with w_
*
*---------------------------------------------------------------------*
DATA : W_MEOLD(20) TYPE C,
W_MENEW(20) TYPE C,
W_RLOLD(20) TYPE C,
W_RLNEW(20) TYPE C,
W_MATNR(10) TYPE C,
TEMP TYPE CDPOS-TABKEY.
*---------------------------------------------------------------------*
* WORK AREAS Begin with wA_ *
*
*---------------------------------------------------------------------*
DATA : WA_RECORD TYPE T_RECORD,
WA_CDPOS TYPE CDPOS.
*---------------------------------------------------------------------*
* FIELD-SYMBOLS Begin with FS *
*---------------------------------------------------------------------*
FIELD-SYMBOLS
*---------------------------------------------------------------------*
* AT SELECTION-SCREEN. *
*---------------------------------------------------------------------*
AT SELECTION-SCREEN.
PERFORM F002_VALIDATE.
*---------------------------------------------------------------------*
* START-OF-SELECTION . *
*---------------------------------------------------------------------*
START-OF-SELECTION.
PERFORM GET_DATA.
*---------------------------------------------------------------------*
* END-OF-SELECTION . *
*---------------------------------------------------------------------*
END-OF-SELECTION.
PERFORM DISPLAY_DATA.
*---------------------------------------------------------------------*
* TOP-OF-PAGE . *
*---------------------------------------------------------------------*
TOP-OF-PAGE.
PERFORM F001_HEAD.
*---------------------------------------------------------------------*
* END-OF-PAGE . *
*---------------------------------------------------------------------*
END-OF-PAGE.
*&---------------------------------------------------------------------*
*& Form GET_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> pa_banfn Requisition Number
* <-- p2 text
*----------------------------------------------------------------------*
FORM GET_DATA .
SELECT * FROM EBAN
INTO CORRESPONDING FIELDS OF TABLE IT_EBAN
WHERE BANFN = P_BANFN.
READ TABLE IT_RECORD ASSIGNING
SORT IT_RECORD.
DELETE ADJACENT DUPLICATES FROM IT_RECORD.
LOOP AT IT_RECORD.
SELECT SINGLE * FROM CDPOS INTO WA_CDPOS
WHERE OBJECTID EQ P_BANFN
AND TABNAME ='EBAN'
AND FNAME = 'RLWRT'
AND TABKEY EQ IT_RECORD-TABKEY.
IT_RECORD-VALUE_OLD = WA_CDPOS-VALUE_OLD.
IT_RECORD-VALUE_NEW = WA_CDPOS-VALUE_NEW.
IF WA_CDPOS-FNAME = 'RLWRT'.
IT_RECORD-RLOLD = WA_CDPOS-VALUE_OLD.
IT_RECORD-RLNEW = WA_CDPOS-VALUE_NEW.
ENDIF.
CLEAR WA_CDPOS.
SELECT SINGLE * FROM CDPOS INTO WA_CDPOS
WHERE OBJECTID EQ P_BANFN
AND TABNAME ='EBAN'
AND FNAME = 'MENGE'
AND TABKEY EQ IT_RECORD-TABKEY.
IF WA_CDPOS-FNAME = 'MENGE'.
IT_RECORD-MEOLD = WA_CDPOS-VALUE_OLD.
IT_RECORD-MENEW = WA_CDPOS-VALUE_NEW.
ENDIF.
CLEAR WA_CDPOS.
MODIFY IT_RECORD.
READ TABLE IT_EBAN WITH KEY BNFPO = IT_RECORD-TABKEY+13(5).
IF SY-SUBRC = 0.
IT_RECORD-MATNR = IT_EBAN-MATNR.
IT_RECORD-TXZ01 = IT_EBAN-TXZ01.
IT_RECORD-ERNAM = IT_EBAN-ERNAM.
MODIFY IT_RECORD TRANSPORTING MATNR TXZ01 ERNAM.
ENDIF.
ENDLOOP.
* SELECT *
* FROM CDPOS
* WHERE OBJECTID EQ P_BANFN
* AND TABNAME ='EBAN'
* AND ( FNAME = 'MENGE' OR FNAME = 'RLWRT' )
* AND TABKEY EQ IT_RECORD-TABKEY.
*
* IT_RECORD-VALUE_OLD = CDPOS-VALUE_OLD.
* IT_RECORD-VALUE_NEW = CDPOS-VALUE_NEW.
*
* IF CDPOS-FNAME = 'MENGE'.
* IT_RECORD-MEOLD = CDPOS-VALUE_OLD.
* IT_RECORD-MENEW = CDPOS-VALUE_NEW.
* ENDIF.
*
* IF CDPOS-FNAME = 'RLWRT'.
* IT_RECORD-RLOLD = CDPOS-VALUE_OLD.
* IT_RECORD-RLNEW = CDPOS-VALUE_NEW.
* ENDIF.
* ENDSELECT.
ENDFORM. "GET_DATA
*&---------------------------------------------------------------------*
*& Form DISPLAY_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DISPLAY_DATA .
LOOP AT IT_RECORD INTO WA_RECORD.
TEMP = WA_RECORD-TABKEY .
SHIFT WA_RECORD-MATNR LEFT DELETING LEADING '0'.
W_MEOLD = WA_RECORD-MEOLD.
W_MENEW = WA_RECORD-MENEW.
W_RLOLD = WA_RECORD-RLOLD.
W_RLNEW = WA_RECORD-RLNEW.
W_MATNR = WA_RECORD-MATNR.
CONDENSE W_MENEW.
CONDENSE W_RLOLD.
CONDENSE W_MEOLD.
CONDENSE W_RLNEW.
WRITE : /3 SY-VLINE, 4 TEMP+16(2) CENTERED,12
SY-VLINE, 13 W_MEOLD CENTERED,33
SY-VLINE, 34 W_MENEW CENTERED,54
SY-VLINE, 55 W_RLOLD CENTERED,75
SY-VLINE, 76 W_RLNEW CENTERED,96
SY-VLINE, 97 W_MATNR CENTERED,117
SY-VLINE, 118 WA_RECORD-TXZ01,158
SY-VLINE, 159
SY-VLINE.
ULINE AT /3(170).
ENDLOOP.
ENDFORM. " DISPLAY_DATA
*&---------------------------------------------------------------------*
*& Form F001_HEAD
*&---------------------------------------------------------------------*
FORM F001_HEAD .
FORMAT COLOR 1 INTENSIFIED OFF.
WRITE : /3(170) 'VVF LIMITED' CENTERED.
WRITE : /3(170) 'PURCHASE REQUISITION ANNEXURE' CENTERED.
FORMAT RESET.
SKIP 1.
WRITE : /5 'Requisition No :',
SKIP 1.
ULINE AT 3(170).
WRITE : /3 SY-VLINE, 4(8) 'ITEM NO' CENTERED,12
SY-VLINE, 13(20) 'OLD QTY' CENTERED,33
SY-VLINE, 34(20) 'NEW QTY' CENTERED,54
SY-VLINE, 55(20) 'OLD VALUE' CENTERED,75
SY-VLINE, 76(20) 'NEW VALUE' CENTERED,96
SY-VLINE, 97(20) 'MATERIAL' CENTERED,117
SY-VLINE, 118(40) 'MATERIAL DESC' CENTERED,158
SY-VLINE, 159(11) 'CHNGD BY' CENTERED,170
SY-VLINE.
ULINE AT /3(170).
ENDFORM. " F001_HEAD
*&---------------------------------------------------------------------*
*& Form F002_VALIDATE
*&---------------------------------------------------------------------*
FORM F002_VALIDATE .
SELECT OBJECTID TABKEY " FNAME value_old value_new
FROM CDPOS
INTO CORRESPONDING FIELDS OF TABLE IT_RECORD
WHERE TABNAME ='EBAN' AND ( FNAME = 'MENGE' OR FNAME = 'RLWRT' )
AND OBJECTID = P_BANFN.
IF SY-SUBRC NE 0.
MESSAGE E000(ZVVF_MR012_MESSAGE).
ENDIF.
ENDFORM. " F002_VALIDATE
No comments:
Post a Comment