*&---------------------------------------------------------------------*
*& Report ZVVF_M043_GRNOTE1 *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*
REPORT ZVVF_M043_GRNOTE1 .
FORM GET_DATA TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
*VARIABLES FOR IN_TAB DATA
DATA : LW_EXNUM TYPE J_1IGRXREF-EXNUM,
LW_EXDAT TYPE J_1IGRXREF-EXDAT,
LW_TLIFNR TYPE GOFREIGHT-LIFNR,
LW_VENDORNAME TYPE LFA1-NAME1,"GOFREIGHT-VENDORNAME,
LW_FRBNR TYPE GOHEAD-FRBNR,
LW_XBLNR TYPE GOHEAD-XBLNR,
*VARIABLES FOR OUT_TAB DATA
LW_MBLNR TYPE MKPF-MBLNR,
LW_MJAHR TYPE MKPF-MJAHR,
LW_EBELN TYPE MSEG-EBELN,
LW_EBELP TYPE MSEG-EBELP.
*SELECTING THE VALUES FOR EXCISE INVOICE NUMBER AND DATE.
READ TABLE IN_TAB WITH KEY 'W_MBLNR'.
CHECK SY-SUBRC = 0.
LW_MBLNR = IN_TAB-VALUE.
READ TABLE IN_TAB WITH KEY 'W_MJAHR'.
CHECK SY-SUBRC = 0.
LW_MJAHR = IN_TAB-VALUE.
SELECT SINGLE EXNUM EXDAT FROM J_1IGRXREF
INTO (LW_EXNUM,LW_EXDAT)
WHERE MBLNR = LW_MBLNR AND
MJAHR = LW_MJAHR.
IF SY-SUBRC = 0.
READ TABLE OUT_TAB WITH KEY 'W_EXNUM'.
CHECK SY-SUBRC = 0.
OUT_TAB-VALUE = LW_EXNUM.
MODIFY OUT_TAB INDEX SY-TABIX.
READ TABLE OUT_TAB WITH KEY 'W_EXDAT'.
CHECK SY-SUBRC = 0.
CONCATENATE LW_EXDAT+6(2) '.' LW_EXDAT+4(2) '.' LW_EXDAT+2(2) INTO LW_EXDAT.
OUT_TAB-VALUE = LW_EXDAT.
MODIFY OUT_TAB INDEX SY-TABIX.
ENDIF.
***********************SELECTING THE DATA FOR TRANSPORTER AND TRUCK NUMBER.
READ TABLE IN_TAB WITH KEY 'W_EBELN'.
CHECK SY-SUBRC = 0.
LW_EBELN = IN_TAB-VALUE.
READ TABLE IN_TAB WITH KEY 'W_EBELP'.
CHECK SY-SUBRC = 0.
LW_EBELP = IN_TAB-VALUE.
SELECT SINGLE FRBNR XBLNR FROM EKBZ
INTO (LW_FRBNR,LW_XBLNR)
WHERE EBELN = LW_EBELN AND
EBELP = LW_EBELP AND
BELNR = LW_MBLNR.
IF SY-SUBRC = 0.
READ TABLE OUT_TAB WITH KEY 'W_FRBNR'.
CHECK SY-SUBRC = 0.
OUT_TAB-VALUE = LW_FRBNR.
MODIFY OUT_TAB INDEX SY-TABIX.
READ TABLE OUT_TAB WITH KEY 'W_XBLNR'.
CHECK SY-SUBRC = 0.
OUT_TAB-VALUE = LW_XBLNR.
MODIFY OUT_TAB INDEX SY-TABIX.
ENDIF.
SELECT SINGLE LIFNR FROM EKBZ
INTO (LW_TLIFNR)
WHERE EBELN = LW_EBELN AND
EBELP = LW_EBELP AND
BELNR = LW_MBLNR AND
KSCHL IN ('ZFA1','ZFB1','ZFC1').
IF SY-SUBRC = 0.
READ TABLE OUT_TAB WITH KEY 'W_TLIFNR'.
CHECK SY-SUBRC = 0.
SHIFT LW_TLIFNR LEFT DELETING LEADING '0'.
OUT_TAB-VALUE = LW_TLIFNR.
MODIFY OUT_TAB INDEX SY-TABIX.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = LW_TLIFNR
IMPORTING
OUTPUT = LW_TLIFNR
.
SELECT SINGLE NAME1 INTO LW_VENDORNAME
FROM LFA1
WHERE LIFNR = LW_TLIFNR.
IF SY-SUBRC = 0.
READ TABLE OUT_TAB WITH KEY 'W_VENDORNAME'.
CHECK SY-SUBRC = 0.
OUT_TAB-VALUE = LW_VENDORNAME.
MODIFY OUT_TAB INDEX SY-TABIX.
ENDIF.
ENDFORM.
No comments:
Post a Comment