REPORT ZVVF_MR002_PURREQ NO STANDARD PAGE HEADING
LINE-COUNT 55(12)
LINE-SIZE 170.
*---------------------------------------------------------------------*
* *
* MODULE : Material Management *
* *
*---------------------------------------------------------------------*
* Objective : Report for printing Purchase Requisition *
*
* *
* Program : Update Tables( ) Download Data( ) Outputs List (X) *
* Technical Specs No : *
* Date Created : *
* Author : *
* Location : *
* LDB : *
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
* Tables *
*---------------------------------------------------------------------*
TABLES : EBAN,
EBKN,
STXH,
T16FS.
*----------------------------------------------------------------------*
*Types *
*----------------------------------------------------------------------*
TYPES : BEGIN OF T_HEAD ,
BANFN LIKE EBAN-BANFN,
BADAT LIKE EBAN-BADAT,
BNFPO LIKE EBAN-BNFPO,
KOSTL LIKE EBKN-KOSTL,
ANLN1 LIKE EBKN-ANLN1,
AUFNR LIKE EBKN-AUFNR,
SAKTO LIKE EBKN-SAKTO,
MATNR LIKE EBAN-MATNR,
TXZ01 LIKE EBAN-TXZ01,
MENGE LIKE EBAN-MENGE,
MEINS LIKE EBAN-MEINS,
PREIS LIKE EBAN-PREIS,
WAERS LIKE EBAN-WAERS,
LFDAT LIKE EBAN-LFDAT,
WERKS LIKE EBAN-WERKS,
EKGRP LIKE EBAN-EKGRP,
EKORG LIKE EBAN-EKORG,
AFNAM LIKE EBAN-AFNAM,
BEDNR LIKE EBAN-BEDNR,
ESTKZ LIKE EBAN-ESTKZ,
ERNAM LIKE EBAN-ERNAM,
FRGGR LIKE EBAN-FRGGR,
FRGST LIKE EBAN-FRGST,
PSTYP LIKE EBAN-PSTYP,
PACKNO LIKE EBAN-PACKNO,
END OF T_HEAD.
TYPES : BEGIN OF TY_EBKN,
BANFN TYPE EBKN-BANFN,
BNFPO TYPE EBKN-BNFPO,
KOSTL TYPE EBKN-KOSTL,
ANLN1 TYPE EBKN-ANLN1,
AUFNR TYPE EBKN-AUFNR,
SAKTO TYPE EBKN-SAKTO,
ZEBKN TYPE EBKN-ZEBKN,
END OF TY_EBKN.
TYPES : BEGIN OF T_DETAIL,
FRGGR LIKE T16FD-FRGGR,
FRGCO LIKE T16FD-FRGCO,
FRGCT LIKE T16FD-FRGCT,
FRGSX LIKE T16FS-FRGSX,
FRGC1 LIKE T16FS-FRGC1,
FRGC2 LIKE T16FS-FRGC2,
FRGC3 LIKE T16FS-FRGC3,
FRGC4 LIKE T16FS-FRGC4,
FRGC5 LIKE T16FS-FRGC5,
FRGC6 LIKE T16FS-FRGC6,
FRGC7 LIKE T16FS-FRGC7,
FRGC8 LIKE T16FS-FRGC8,
END OF T_DETAIL.
TYPES : BEGIN OF TY_ESLL,
BANFN LIKE EBAN-BANFN,
BNFPO LIKE EBAN-BNFPO,
PACKNO LIKE ESLL-PACKNO,
EXTROW LIKE ESLL-EXTROW,
SRVPOS LIKE ESLL-SRVPOS,
KTEXT1 LIKE ESLL-KTEXT1,
MENGE LIKE ESLL-MENGE,
MEINS LIKE ESLL-MEINS,
TBTWR LIKE ESLL-TBTWR,
INTROW LIKE ESLL-INTROW,
KOSTL LIKE EBKN-KOSTL,
ZEBKN LIKE ESKL-ZEKKN,
END OF TY_ESLL.
TYPES : BEGIN OF TY_ESKL,
PACKNO LIKE ESKL-PACKNO,
INTROW LIKE ESKL-INTROW,
ZEKKN LIKE ESKL-ZEKKN,
END OF TY_ESKL.
TYPES : BEGIN OF T_EBKN,
BANFN LIKE EBKN-BANFN,
BNFPO LIKE EBKN-BNFPO,
ZEBKN LIKE EBKN-ZEBKN,
KOSTL LIKE EBKN-KOSTL,
END OF T_EBKN.
*---------------------------------------------------------------------*
* INTERNAL TABLE Begin with IT *
*---------------------------------------------------------------------*
DATA : BEGIN OF IT_STAT OCCURS 0,
FRGGR LIKE T16FD-FRGGR,
FRGCO LIKE T16FD-FRGCO,
FRGCT LIKE T16FD-FRGCT,
END OF IT_STAT.
DATA : IT_HEAD TYPE STANDARD TABLE OF T_HEAD WITH HEADER LINE.
DATA : IT_EBKN TYPE STANDARD TABLE OF TY_EBKN WITH HEADER LINE.
DATA : IT_EBKN1 TYPE STANDARD TABLE OF T_EBKN WITH HEADER LINE.
DATA : IT_DETAIL TYPE STANDARD TABLE OF T_DETAIL WITH HEADER LINE.
DATA : IT_LINE TYPE STANDARD TABLE OF TLINE WITH HEADER LINE.
DATA : IT_STXH TYPE STANDARD TABLE OF STXH WITH HEADER LINE.
DATA : IT_ESLL TYPE STANDARD TABLE OF TY_ESLL WITH HEADER LINE.
DATA : IT_ESKL TYPE STANDARD TABLE OF TY_ESKL WITH HEADER LINE.
*---------------------------------------------------------------------*
* WORK AREAS Begin with WA *
*---------------------------------------------------------------------*
DATA : WA_HEAD TYPE T_HEAD.
DATA : WA_DETAIL TYPE T_DETAIL.
DATA : W_SUB_PACKNO TYPE ESLL-SUB_PACKNO.
*---------------------------------------------------------------------*
* parameters *
*---------------------------------------------------------------------*
PARAMETERS : P_BANFN LIKE EBAN-BANFN.
*---------------------------------------------------------------------*
* Data Variables Begin with w_
*
*---------------------------------------------------------------------*
DATA : W_ESTKZ LIKE EBAN-ESTKZ,
* W_BANFN LIKE EBAN-BANFN,
W_FRGST LIKE EBAN-FRGST,
W_FRGCO LIKE T16FD-FRGCO,
W_FRGCT LIKE T16FD-FRGCT,
LNO TYPE P VALUE 0.
DATA : ST_T16FS TYPE T16FS .
DATA : WA_MENGE(20) TYPE C.
DATA : WA_EST(11) TYPE C.
DATA : W_KOSTL TYPE EBKN-KOSTL,
W_ANLN1 TYPE EBKN-ANLN1,
W_BANFN TYPE EBKN-BANFN,
W_BADAT TYPE EBAN-BADAT,
W_WERKS TYPE EBAN-WERKS,
W_EKORG TYPE EBAN-EKORG,
W_MATNR(10) TYPE C,
WA_ANLN1(11) TYPE C,
W_SAKTO(10) TYPE C,
W_AUFNR(12) TYPE C,
W_TEMP(24) TYPE C,
W_ERNAM(34) TYPE C,
W_NAME(20) TYPE C,
W_TDOBJECT(10) TYPE C,
W_TDNAME(70) TYPE C,
W_TDID(4) TYPE C,
W_TEXT(500) TYPE C,
W_TEXTNAME LIKE THEAD-TDNAME.
* W_NAME TYPE THEAD-TDNAME,
* W_OBJECT TYPE THEAD-TDOBJECT.
*---------------------------------------------------------------------*
* FIELD-SYMBOLS Begin with FS *
*---------------------------------------------------------------------*
FIELD-SYMBOLS
FIELD-SYMBOLS
FIELD-SYMBOLS
*---------------------------------------------------------------------*
* AT SELECTION-SCREEN. *
*---------------------------------------------------------------------*
AT SELECTION-SCREEN.
PERFORM F001_VALIDATE.
*---------------------------------------------------------------------*
* START-OF-SELECTION. *
*---------------------------------------------------------------------*
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM _F002_ASSIGN_VALUES.
*---------------------------------------------------------------------*
* END-OF-SELECTION. *
*---------------------------------------------------------------------*
END-OF-SELECTION.
PERFORM DISPLAY_DATA.
*---------------------------------------------------------------------*
* TOP OF PAGE. *
*---------------------------------------------------------------------*
TOP-OF-PAGE.
PERFORM F001_HEAD.
*---------------------------------------------------------------------*
* END OF PAGE. *
*---------------------------------------------------------------------*
END-OF-PAGE.
PERFORM FOOTER_DISPLAY.
*&---------------------------------------------------------------------*
*& Form GET_DATA
*&---------------------------------------------------------------------*
FORM GET_DATA .
* SELECT A~BANFN A~BADAT A~BNFPO A~MATNR A~TXZ01 A~MENGE A~MEINS
* A~PREIS A~WAERS A~LFDAT A~WERKS A~EKGRP A~EKORG A~AFNAM
* A~BEDNR A~ESTKZ A~ERNAM A~FRGGR A~FRGST
* B~KOSTL B~ANLN1 B~AUFNR B~SAKTO
* INTO CORRESPONDING FIELDS OF TABLE IT_HEAD
* FROM EBAN AS A
* INNER JOIN EBKN AS B
* ON A~BANFN = B~BANFN
* WHERE A~BANFN = P_BANFN AND
* A~BNFPO = B~BNFPO.
*
LOOP AT IT_HEAD .
READ TABLE IT_EBKN WITH KEY BANFN = IT_HEAD-BANFN
BNFPO = IT_HEAD-BNFPO.
IF SY-SUBRC = 0.
IT_HEAD-KOSTL = IT_EBKN-KOSTL.
IT_HEAD-ANLN1 = IT_EBKN-ANLN1.
IT_HEAD-AUFNR = IT_EBKN-AUFNR.
IT_HEAD-SAKTO = IT_EBKN-SAKTO.
MODIFY IT_HEAD TRANSPORTING KOSTL ANLN1 AUFNR SAKTO
WHERE BANFN = IT_EBKN-BANFN AND
BNFPO = IT_EBKN-BNFPO.
ENDIF.
ENDLOOP.
READ TABLE IT_HEAD ASSIGNING
SELECT SINGLE *
FROM T16FS
WHERE FRGGR EQ
AND FRGSX EQ
IF T16FS-FRGC1 IS NOT INITIAL.
SELECT SINGLE FRGCT
INTO IT_STAT-FRGCT
FROM T16FD
WHERE FRGGR EQ
AND FRGCO EQ T16FS-FRGC1.
MOVE
MOVE T16FS-FRGC1 TO IT_STAT-FRGCO.
APPEND IT_STAT.
ENDIF.
IF T16FS-FRGC2 IS NOT INITIAL.
SELECT SINGLE FRGCT
INTO IT_STAT-FRGCT
FROM T16FD
WHERE FRGGR EQ
AND FRGCO EQ T16FS-FRGC2.
MOVE
MOVE T16FS-FRGC2 TO IT_STAT-FRGCO.
APPEND IT_STAT.
ENDIF.
ENDFORM. " GET_DATA
*&---------------------------------------------------------------------*
*& Form DISPLAY_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DISPLAY_DATA .
SORT IT_HEAD BY BNFPO.
LOOP AT IT_HEAD INTO WA_HEAD.
CONCATENATE P_BANFN WA_HEAD-BNFPO INTO W_NAME."FOR GETTING THE DATA FROM STXH USING W_NAME
WA_MENGE = WA_HEAD-MENGE.
WA_EST = WA_HEAD-PREIS.
CONDENSE WA_MENGE.
CONDENSE WA_EST.
SHIFT WA_HEAD-BNFPO LEFT DELETING LEADING '0'.
SHIFT WA_HEAD-ANLN1 LEFT DELETING LEADING '0'.
SHIFT WA_HEAD-MATNR LEFT DELETING LEADING '0'.
SHIFT WA_HEAD-SAKTO LEFT DELETING LEADING '0'.
SHIFT WA_HEAD-AUFNR LEFT DELETING LEADING '0'.
WA_ANLN1 = WA_HEAD-ANLN1.
W_MATNR = WA_HEAD-MATNR.
W_SAKTO = WA_HEAD-SAKTO.
W_AUFNR = WA_HEAD-AUFNR.
IF WA_ANLN1 IS NOT INITIAL.
WRITE : /3 SY-VLINE, 4 WA_HEAD-BNFPO CENTERED,7
SY-VLINE, 8 WA_ANLN1 CENTERED,20
SY-VLINE, 21 W_AUFNR CENTERED,33
SY-VLINE, 34 W_SAKTO CENTERED,44
SY-VLINE, 45 W_MATNR CENTERED,55
SY-VLINE, 56 WA_HEAD-TXZ01 ,94
SY-VLINE, 95 WA_MENGE LEFT-JUSTIFIED,108
SY-VLINE, 109 WA_HEAD-MEINS CENTERED,113
SY-VLINE, 114 WA_EST CENTERED,125
SY-VLINE, 126 WA_HEAD-WAERS CENTERED,131
SY-VLINE, 132 WA_HEAD-LFDAT CENTERED,142
SY-VLINE, 143 WA_HEAD-EKGRP CENTERED,147
SY-VLINE, 148 WA_HEAD-AFNAM CENTERED,159
SY-VLINE, 160 WA_HEAD-BEDNR CENTERED,170
SY-VLINE.
ELSE.
WRITE : /3 SY-VLINE, 4 WA_HEAD-BNFPO CENTERED,7
SY-VLINE, 8 WA_HEAD-KOSTL CENTERED,20
SY-VLINE, 21 W_AUFNR CENTERED,33
SY-VLINE, 34 W_SAKTO CENTERED,44
SY-VLINE, 45 W_MATNR CENTERED,55
SY-VLINE, 56 WA_HEAD-TXZ01 ,94
SY-VLINE, 95 WA_MENGE LEFT-JUSTIFIED,108
SY-VLINE, 109 WA_HEAD-MEINS CENTERED,113
SY-VLINE, 114 WA_EST CENTERED,125
SY-VLINE, 126 WA_HEAD-WAERS CENTERED,131
SY-VLINE, 132 WA_HEAD-LFDAT CENTERED,142
SY-VLINE, 143 WA_HEAD-EKGRP CENTERED,147
SY-VLINE, 148 WA_HEAD-AFNAM CENTERED,159
SY-VLINE, 160 WA_HEAD-BEDNR CENTERED,170
SY-VLINE.
ENDIF.
ULINE AT /3(170).
*----------------------- FOR CHECKING WHETHER ITS SERVICE PO OR NOT.
IF WA_HEAD-PSTYP NE '9'."IF ITEM CATEGORY IS 'D' OR NOT.
PERFORM F003_GET_ITEM_TEXT.
*------------------------IF IT IS SERVICE PO.
ELSE.
PERFORM F004_SERVICE_PR.
ENDIF.
ENDLOOP.
IF SY-LINNO < 43.
SKIP TO LINE 44.
ENDIF.
ENDFORM. " DISPLAY_DATA
*&---------------------------------------------------------------------*
*& Form FOOTER_DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FOOTER_DISPLAY .
ULINE AT /3(170).
SKIP 2.
ULINE AT 3(170).
WRITE : /3 SY-VLINE, 4(24) 'Creation Details' CENTERED,28
SY-VLINE, 29(34) 'Created By' CENTERED,63
SY-VLINE, 64(75) 'Authorised By' CENTERED,139
SY-VLINE, 140(30) 'Subsequent Requisition Changes' CENTERED,170
SY-VLINE.
ULINE AT /3(170).
IF
W_TEMP = 'CREATED MANUALLY'.
W_ERNAM =
WRITE : /3 SY-VLINE, 4 W_TEMP CENTERED,28
SY-VLINE, 29 W_ERNAM CENTERED,63
SY-VLINE,139
SY-VLINE, 140(30) 'REFER ANNEXURE' CENTERED,170
SY-VLINE.
ELSEIF
W_TEMP = 'PRODUCTION ORDER'.
W_ERNAM =
WRITE : /3 SY-VLINE, 4 W_TEMP CENTERED,28
SY-VLINE, 29 W_ERNAM CENTERED,63
SY-VLINE,139
SY-VLINE,140(30) 'REFER ANNEXURE' CENTERED,170
SY-VLINE.
ELSEIF
W_TEMP = 'CONVERTED PLANNED ORDER'.
W_ERNAM =
WRITE : /3 SY-VLINE, 4 W_TEMP CENTERED,28
SY-VLINE, 29 W_ERNAM CENTERED,63
SY-VLINE,139
SY-VLINE,140(30) 'REFER ANNEXURE' CENTERED,170
SY-VLINE.
ELSEIF
W_TEMP = 'CREATED BY MRP'.
W_ERNAM =
WRITE : /3 SY-VLINE, 4 W_TEMP CENTERED,28
SY-VLINE, 21 W_ERNAM CENTERED,63
SY-VLINE,139
SY-VLINE,140(30) 'REFER ANNEXURE' CENTERED,170
SY-VLINE.
ENDIF.
LOOP AT IT_STAT.
WRITE : /3 SY-VLINE,28
SY-VLINE,63
SY-VLINE,64 IT_STAT-FRGCO CENTERED,139
SY-VLINE,68 IT_STAT-FRGCT,170
SY-VLINE.
ENDLOOP.
ULINE AT /3(170).
ENDFORM. " FOOTER_DISPLAY
*&---------------------------------------------------------------------*
*& Form F001_HEAD
*&---------------------------------------------------------------------*
FORM F001_HEAD .
FORMAT COLOR 1 INTENSIFIED OFF.
IF W_WERKS EQ 'P071'.
WRITE : /3(170) 'VITA-BIO PHARMA PVT LTD' CENTERED.
WRITE : /3(170) 'PURCHASE REQUISITION' CENTERED.
ELSE.
WRITE : /3(170) 'VVF LIMITED' CENTERED.
WRITE : /3(170) 'PURCHASE REQUISITION' CENTERED.
ENDIF.
FORMAT RESET.
SKIP 1.
WRITE : /5 'Requisition No :',W_BANFN,120
'Plant :',W_WERKS.
SKIP 1.
WRITE : /5 'Requisition Date :',W_BADAT,120
'Purchasing Org :',W_EKORG.
SKIP 1.
ULINE AT 3(170).
IF W_ANLN1 IS NOT INITIAL.
WRITE : /3 SY-VLINE, 4(3) 'INO' CENTERED,7
SY-VLINE, 8(12) 'ASSET' CENTERED,20
SY-VLINE, 21(12) 'ORDER NO' CENTERED,33
SY-VLINE, 34(10) 'GL ACCOUNT' CENTERED,44
SY-VLINE, 45(10) 'MATERIAL' CENTERED,55
SY-VLINE, 56(38) 'MATERIAL DESC' CENTERED,94
SY-VLINE, 95(13) 'QUANTITY' CENTERED,108
SY-VLINE, 109(4) 'UOM' CENTERED,113
SY-VLINE, 114(11) 'EST PRICE' CENTERED,125
SY-VLINE, 126(5) 'CURR' CENTERED,131
SY-VLINE, 132(10) 'DEL DATE' CENTERED,142
SY-VLINE, 143(4) 'PRGRP' CENTERED,147
SY-VLINE, 148(11) 'REQNR' CENTERED,159
SY-VLINE, 160(9) 'TRACK NO' CENTERED,170
SY-VLINE.
ELSE.
WRITE : /3 SY-VLINE, 4(3) 'INO' CENTERED,7
SY-VLINE, 8(12) 'COST CENTER' CENTERED,20
SY-VLINE, 21(12) 'ORDER NO' CENTERED,33
SY-VLINE, 34(10) 'GL ACCOUNT' CENTERED,44
SY-VLINE, 45(10) 'MATERIAL' CENTERED,55
SY-VLINE, 56(38) 'MATERIAL DESC' CENTERED,94
SY-VLINE, 95(13) 'QUANTITY' CENTERED,108
SY-VLINE, 109(4) 'UOM' CENTERED,113
SY-VLINE, 114(11) 'EST PRICE' CENTERED,125
SY-VLINE, 126(5) 'CURR' CENTERED,131
SY-VLINE, 132(10) 'DEL DATE' CENTERED,142
SY-VLINE, 143(4) 'PRGRP' CENTERED,147
SY-VLINE, 148(11) 'REQNR' CENTERED,159
SY-VLINE, 160(9) 'TRACK NO' CENTERED,170
SY-VLINE.
ENDIF.
ULINE AT /3(170).
ENDFORM. " F001_HEAD
*&---------------------------------------------------------------------*
*& Form F001_VALIDATE
*&---------------------------------------------------------------------*
FORM F001_VALIDATE .
SELECT BANFN BADAT BNFPO MATNR TXZ01 MENGE MEINS
PREIS WAERS LFDAT WERKS EKGRP EKORG AFNAM
BEDNR ESTKZ ERNAM FRGGR FRGST PSTYP PACKNO
INTO CORRESPONDING FIELDS OF TABLE IT_HEAD
FROM EBAN
WHERE BANFN = P_BANFN AND
LOEKZ NE 'X'.
IF SY-SUBRC = 0.
SELECT BANFN BNFPO KOSTL ANLN1 AUFNR SAKTO ZEBKN
FROM EBKN
INTO CORRESPONDING FIELDS OF TABLE IT_EBKN
FOR ALL ENTRIES IN IT_HEAD
WHERE BANFN = IT_HEAD-BANFN AND
BNFPO = IT_HEAD-BNFPO.
ELSE.
MESSAGE E000(ZVVF_MR012_MESSAGE).
ENDIF.
ENDFORM. " F001_VALIDATE
*&---------------------------------------------------------------------*
*& Form _F002_ASSIGN_VALUES
*&---------------------------------------------------------------------*
FORM _F002_ASSIGN_VALUES .
SORT IT_HEAD BY KOSTL DESCENDING.
READ TABLE IT_HEAD INDEX 1 INTO WA_HEAD.
W_KOSTL = WA_HEAD-KOSTL.
W_BANFN = WA_HEAD-BANFN.
W_BADAT = WA_HEAD-BADAT.
W_WERKS = WA_HEAD-WERKS.
W_EKORG = WA_HEAD-EKORG.
SORT IT_HEAD BY ANLN1 DESCENDING.
READ TABLE IT_HEAD INDEX 1 INTO WA_HEAD.
W_ANLN1 = WA_HEAD-ANLN1.
ENDFORM. " _F002_ASSIGN_VALUES
*&---------------------------------------------------------------------*
*& Form F003_GET_ITEM_TEXT
*&---------------------------------------------------------------------*
FORM F003_GET_ITEM_TEXT .
SELECT TDOBJECT TDNAME TDID INTO CORRESPONDING FIELDS OF TABLE IT_STXH "(W_TDOBJECT,W_TDNAME,W_TDID)
FROM STXH
WHERE TDNAME = W_NAME.
LOOP AT IT_STXH.
IF IT_STXH-TDOBJECT IS NOT INITIAL AND IT_STXH-TDNAME IS NOT INITIAL AND IT_STXH-TDID IS NOT INITIAL.
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = IT_STXH-TDID
LANGUAGE = 'E'
NAME = IT_STXH-TDNAME
OBJECT = IT_STXH-TDOBJECT
TABLES
LINES = IT_LINE.
* EXCEPTIONS
* ID = 1
* LANGUAGE = 2
* NAME = 3
* NOT_FOUND = 4
* OBJECT = 5
* REFERENCE_CHECK = 6
* WRONG_ACCESS_TO_ARCHIVE = 7
* OTHERS = 8.
* IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
ENDIF.
IF IT_LINE[] IS NOT INITIAL.
LOOP AT IT_LINE.
CONCATENATE W_TEXT IT_LINE INTO W_TEXT.
ENDLOOP.
IF W_TEXT+0(165) IS NOT INITIAL.
WRITE : /3 SY-VLINE, 4 W_TEXT+0(165),
170 SY-VLINE.
ENDIF.
IF W_TEXT+165(165) IS NOT INITIAL.
WRITE : /3 SY-VLINE, 4 W_TEXT+165(165),
170 SY-VLINE.
ENDIF.
IF W_TEXT+330(165) IS NOT INITIAL.
WRITE : /3 SY-VLINE, 4 W_TEXT+330(165),
170 SY-VLINE.
ENDIF.
CLEAR : IT_STXH.
CLEAR : W_TEXT.
CLEAR IT_LINE.
REFRESH IT_LINE.
ULINE AT /3(170).
ENDIF.
ENDLOOP.
ENDFORM. " F003_GET_ITEM_TEXT
*&---------------------------------------------------------------------*
*& Form F004_SERVICE_PR
*&---------------------------------------------------------------------*
FORM F004_SERVICE_PR .
SELECT TDOBJECT TDNAME TDID INTO CORRESPONDING FIELDS OF TABLE IT_STXH "(W_TDOBJECT,W_TDNAME,W_TDID)
FROM STXH
WHERE TDNAME = W_NAME.
LOOP AT IT_STXH.
IF IT_STXH-TDOBJECT IS NOT INITIAL AND IT_STXH-TDNAME IS NOT INITIAL AND IT_STXH-TDID EQ 'B04'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = IT_STXH-TDID
LANGUAGE = 'E'
NAME = IT_STXH-TDNAME
OBJECT = IT_STXH-TDOBJECT
TABLES
LINES = IT_LINE.
* EXCEPTIONS
* ID = 1
* LANGUAGE = 2
* NAME = 3
* NOT_FOUND = 4
* OBJECT = 5
* REFERENCE_CHECK = 6
* WRONG_ACCESS_TO_ARCHIVE = 7
* OTHERS = 8.
* IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
ENDIF.
IF IT_LINE[] IS NOT INITIAL.
LOOP AT IT_LINE.
CONCATENATE W_TEXT IT_LINE INTO W_TEXT.
ENDLOOP.
IF W_TEXT+0(165) IS NOT INITIAL.
WRITE : /3 SY-VLINE, 4 W_TEXT+0(165),
170 SY-VLINE.
ENDIF.
IF W_TEXT+165(165) IS NOT INITIAL.
WRITE : /3 SY-VLINE, 4 W_TEXT+165(165),
170 SY-VLINE.
ENDIF.
IF W_TEXT+330(165) IS NOT INITIAL.
WRITE : /3 SY-VLINE, 4 W_TEXT+330(165),
170 SY-VLINE.
ENDIF.
CLEAR : IT_STXH.
CLEAR : W_TEXT.
CLEAR IT_LINE.
REFRESH IT_LINE.
ULINE AT /3(170).
ENDIF.
ENDLOOP.
SELECT SINGLE SUB_PACKNO INTO W_SUB_PACKNO
FROM ESLL
WHERE PACKNO = WA_HEAD-PACKNO.
IF SY-SUBRC = 0.
SELECT PACKNO EXTROW SRVPOS KTEXT1 MENGE MEINS TBTWR INTROW
INTO CORRESPONDING FIELDS OF TABLE IT_ESLL
FROM ESLL
WHERE PACKNO = W_SUB_PACKNO.
IF SY-SUBRC = 0.
LOOP AT IT_ESLL.
READ TABLE IT_HEAD WITH KEY PACKNO = WA_HEAD-PACKNO.
IF SY-SUBRC = 0.
IT_ESLL-BANFN = IT_HEAD-BANFN.
IT_ESLL-BNFPO = IT_HEAD-BNFPO.
MODIFY IT_ESLL.
ENDIF.
SELECT PACKNO INTROW ZEKKN INTO CORRESPONDING FIELDS OF TABLE IT_ESKL
FROM ESKL
FOR ALL ENTRIES IN IT_ESLL
WHERE PACKNO = IT_ESLL-PACKNO AND
INTROW = IT_ESLL-INTROW.
READ TABLE IT_ESKL WITH KEY PACKNO = IT_ESLL-PACKNO INTROW = IT_ESLL-INTROW.
IF SY-SUBRC = 0.
IT_ESLL-ZEBKN = IT_ESKL-ZEKKN.
MODIFY IT_ESLL TRANSPORTING ZEBKN WHERE PACKNO = IT_ESKL-PACKNO AND
INTROW = IT_ESKL-INTROW.
ENDIF.
READ TABLE IT_EBKN WITH KEY BANFN = IT_ESLL-BANFN BNFPO = IT_ESLL-BNFPO
ZEBKN = IT_ESLL-ZEBKN.
IF SY-SUBRC = 0.
IT_ESLL-KOSTL = IT_EBKN-KOSTL.
MODIFY IT_ESLL." TRANSPORTING ZEKKN WHERE PACKNO = IT_ESKL-PACKNO AND
" INTROW = IT_ESKL-INTROW.
ENDIF.
ENDLOOP.
ENDIF.
WRITE : /3 SY-VLINE,4'THE ABOVE ITEM CONSISTS OF THE FOLLOWING SERVICES:',170
SY-VLINE.
ULINE AT /3(170).
WRITE : /3 SY-VLINE,7
SY-VLINE,9 'LINE' CENTERED,20
SY-VLINE,21 'SER NO' CENTERED,42
SY-VLINE,43 'SHORT TEXT' CENTERED,85
SY-VLINE,86 'QUANTITY' CENTERED,111
SY-VLINE,112 'UOM' CENTERED,118
SY-VLINE,119 'GROSS PRICE' CENTERED,140
SY-VLINE,141 'COST CENTER' CENTERED,170
SY-VLINE.
ULINE AT /3(170).
LOOP AT IT_ESLL.
SHIFT IT_ESLL-EXTROW LEFT DELETING LEADING '0'.
WRITE : /3 SY-VLINE,7
SY-VLINE,9 IT_ESLL-EXTROW ,20
SY-VLINE,21 IT_ESLL-SRVPOS,42
SY-VLINE,43 IT_ESLL-KTEXT1,85
SY-VLINE,86 IT_ESLL-MENGE,111
SY-VLINE,112 IT_ESLL-MEINS,118
SY-VLINE,119 IT_ESLL-TBTWR,140
SY-VLINE,141 IT_ESLL-KOSTL,170
SY-VLINE.
ULINE AT /3(170).
IF IT_ESLL-SRVPOS IS NOT INITIAL.
W_TEXTNAME = IT_ESLL-SRVPOS.
CLEAR IT_STXH.
SELECT TDOBJECT TDNAME TDID INTO CORRESPONDING FIELDS OF TABLE IT_STXH "(W_TDOBJECT,W_TDNAME,W_TDID)
FROM STXH
WHERE TDNAME = W_TEXTNAME.
LOOP AT IT_STXH.
IF IT_STXH-TDOBJECT IS NOT INITIAL AND IT_STXH-TDNAME IS NOT INITIAL AND IT_STXH-TDID EQ 'LTXT'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = IT_STXH-TDID
LANGUAGE = 'E'
NAME = W_TEXTNAME
OBJECT = IT_STXH-TDOBJECT
TABLES
LINES = IT_LINE.
* EXCEPTIONS
* ID = 1
* LANGUAGE = 2
* NAME = 3
* NOT_FOUND = 4
* OBJECT = 5
* REFERENCE_CHECK = 6
* WRONG_ACCESS_TO_ARCHIVE = 7
* OTHERS = 8.
* IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
CLEAR W_TEXTNAME.
IF IT_LINE[] IS NOT INITIAL.
LOOP AT IT_LINE.
CONCATENATE W_TEXT IT_LINE INTO W_TEXT.
ENDLOOP.
IF W_TEXT+0(165) IS NOT INITIAL.
WRITE : /3 SY-VLINE, 4 W_TEXT+0(165),
170 SY-VLINE.
ENDIF.
IF W_TEXT+165(165) IS NOT INITIAL.
WRITE : /3 SY-VLINE, 4 W_TEXT+165(165),
170 SY-VLINE.
ENDIF.
IF W_TEXT+330(165) IS NOT INITIAL.
WRITE : /3 SY-VLINE, 4 W_TEXT+330(165),
170 SY-VLINE.
ENDIF.
CLEAR : IT_STXH.
CLEAR : W_TEXT.
CLEAR IT_LINE.
REFRESH IT_LINE.
ULINE AT /3(170).
ENDIF.
ENDIF.
ENDLOOP.
ELSE.
CONCATENATE IT_ESLL-PACKNO IT_ESLL-INTROW INTO W_TEXTNAME.
CLEAR IT_STXH.
SELECT TDOBJECT TDNAME TDID INTO CORRESPONDING FIELDS OF TABLE IT_STXH " (W_TDOBJECT,W_TDNAME,W_TDID)
FROM STXH
WHERE TDNAME = W_TEXTNAME.
LOOP AT IT_STXH.
IF IT_STXH-TDOBJECT IS NOT INITIAL AND IT_STXH-TDNAME IS NOT INITIAL AND IT_STXH-TDID EQ 'LLTX'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = IT_STXH-TDID
LANGUAGE = 'E'
NAME = W_TEXTNAME
OBJECT = IT_STXH-TDOBJECT
TABLES
LINES = IT_LINE.
* EXCEPTIONS
* ID = 1
* LANGUAGE = 2
* NAME = 3
* NOT_FOUND = 4
* OBJECT = 5
* REFERENCE_CHECK = 6
* WRONG_ACCESS_TO_ARCHIVE = 7
* OTHERS = 8.
* IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
CLEAR W_TEXTNAME.
IF IT_LINE[] IS NOT INITIAL.
LOOP AT IT_LINE.
CONCATENATE W_TEXT IT_LINE INTO W_TEXT.
ENDLOOP.
IF W_TEXT+0(165) IS NOT INITIAL.
WRITE : /3 SY-VLINE, 4 W_TEXT+0(165),
170 SY-VLINE.
ENDIF.
IF W_TEXT+165(165) IS NOT INITIAL.
WRITE : /3 SY-VLINE, 4 W_TEXT+165(165),
170 SY-VLINE.
ENDIF.
IF W_TEXT+330(165) IS NOT INITIAL.
WRITE : /3 SY-VLINE, 4 W_TEXT+330(165),
170 SY-VLINE.
ENDIF.
CLEAR : IT_STXH.
CLEAR : W_TEXT.
CLEAR IT_LINE.
REFRESH IT_LINE.
ULINE AT /3(170).
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
WRITE : /3 SY-VLINE, ' ',
170 SY-VLINE.
ULINE AT /3(170).
ENDIF.
ENDFORM. " F004_SERVICE_PR
No comments:
Post a Comment