REPORT ZHRA.
TYPES:BEGIN OF T_LIKP,
VKORG TYPE LIKP-VKORG,
KUNNR TYPE LIKP-KUNNR,
VBELN TYPE LIKP-VBELN,
VSTEL TYPE LIKP-VSTEL,
LFART TYPE LIKP-LFART,
LDDAT TYPE LIKP-LDDAT,
LFDAT TYPE LIKP-LFDAT,
END OF T_LIKP.
TYPES:BEGIN OF T_LIPS,
VBELN TYPE LIKP-VBELN,
POSNR TYPE LIPS-POSNR,
MATNR TYPE LIPS-MATNR,
MATKL TYPE LIPS-MATKL,
LFIMG TYPE LIPS-LFIMG,
MEINS TYPE LIPS-MEINS,
BRGEW TYPE LIPS-BRGEW,
GEWEI TYPE LIPS-GEWEI,
END OF T_LIPS.
TYPES:BEGIN OF T_LIKP1 ,
VBELN TYPE LIKP-VBELN,
CHK(1) TYPE C,
VKORG TYPE LIKP-VKORG,
KUNNR TYPE LIKP-KUNNR,
VSTEL TYPE LIKP-VSTEL,
LFART TYPE LIKP-LFART,
LDDAT TYPE LIKP-LDDAT,
LFDAT TYPE LIKP-LFDAT,
DELDAYS TYPE I,
POSNR TYPE LIPS-POSNR,
MATNR TYPE LIPS-MATNR,
MATKL TYPE LIPS-MATKL,
LFIMG TYPE LIPS-LFIMG,
MEINS TYPE LIPS-MEINS,
BRGEW TYPE LIPS-BRGEW,
GEWEI TYPE LIPS-GEWEI,
END OF T_LIKP1.
DATA: IT_LIKP TYPE TABLE OF T_LIKP,
WA_LIKP TYPE T_LIKP,
IT_LIPS TYPE TABLE OF T_LIPS,
WA_LIPS TYPE T_LIPS,
IT_LIKP1 TYPE TABLE OF T_LIKP1,
WA_LIKP1 TYPE T_LIKP1.
TYPE-POOLS SLIS.
DATA: IT_HEADER TYPE SLIS_T_LISTHEADER,
WA_HEADER TYPE SLIS_LISTHEADER,
IT_FIELDS TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDS TYPE SLIS_FIELDCAT_ALV,
IT_SORT TYPE SLIS_T_SORTINFO_ALV,
WA_SORT TYPE SLIS_SORTINFO_ALV,
WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
**************
SELECT-OPTIONS: S_VKORG FOR WA_LIKP-VKORG NO INTERVALS,
S_KUNNR FOR WA_LIKP-KUNNR.
INITIALIZATION.
S_VKORG-SIGN = 'I'.
S_VKORG-OPTION = 'EQ'.
S_VKORG-LOW = 1000.
APPEND S_VKORG.
CLEAR S_VKORG.
S_VKORG-SIGN = 'I'.
S_VKORG-OPTION = 'EQ'.
S_VKORG-LOW = 2000.
APPEND S_VKORG.
CLEAR S_VKORG.
S_VKORG-SIGN = 'I'.
S_VKORG-OPTION = 'EQ'.
S_VKORG-LOW = 3000.
APPEND S_VKORG.
CLEAR S_VKORG.
START-OF-SELECTION.
SELECT VKORG
KUNNR
VBELN
VSTEL
LFART
LDDAT
LFDAT INTO CORRESPONDING FIELDS OF TABLE IT_LIKP
FROM LIKP
WHERE VKORG IN S_VKORG
AND KUNNR IN S_KUNNR.
IF NOT IT_LIKP[] IS INITIAL.
SELECT VBELN
POSNR
MATNR
MATKL
LFIMG
MEINS
BRGEW
GEWEI INTO CORRESPONDING FIELDS OF TABLE IT_LIPS
FROM LIPS
FOR ALL ENTRIES IN IT_LIKP
WHERE VBELN = IT_LIKP-VBELN.
ENDIF.
END-OF-SELECTION.
LOOP AT IT_LIPS INTO WA_LIPS.
READ TABLE IT_LIKP INTO WA_LIKP WITH KEY VBELN = WA_LIPS-VBELN.
MOVE: WA_LIKP-VBELN TO WA_LIKP1-VBELN,
WA_LIKP-VKORG TO WA_LIKP1-VKORG,
WA_LIKP-KUNNR TO WA_LIKP1-KUNNR,
WA_LIKP-VSTEL TO WA_LIKP1-VSTEL,
WA_LIKP-LFART TO WA_LIKP1-LFART,
WA_LIKP-LDDAT TO WA_LIKP1-LDDAT,
WA_LIKP-LFDAT TO WA_LIKP1-LFDAT,
WA_LIPS-POSNR TO WA_LIKP1-POSNR,
WA_LIPS-MATNR TO WA_LIKP1-MATNR,
WA_LIPS-MATKL TO WA_LIKP1-MATKL,
WA_LIPS-LFIMG TO WA_LIKP1-LFIMG,
WA_LIPS-MEINS TO WA_LIKP1-MEINS,
WA_LIPS-BRGEW TO WA_LIKP1-BRGEW,
WA_LIPS-GEWEI TO WA_LIKP1-GEWEI.
APPEND WA_LIKP1 TO IT_LIKP1 .
CLEAR WA_LIKP1.
ENDLOOP.
WA_LIKP1-DELDAYS = WA_LIKP-LFDAT - WA_LIKP-LDDAT.
PERFORM BUILD_FIELDS USING 'KUNNR' 'CUSTOMER' 15 'X' ' ' ' ' 'C201 ' .
PERFORM BUILD_FIELDS USING 'VBELN' 'DELIVERY' 20 ' ' 'X ' ' ' 'C101 '.
PERFORM BUILD_FIELDS USING 'VSTEL' 'SHIPING POINT' 15 ' ' ' ' ' ' 'C301 '.
PERFORM BUILD_FIELDS USING 'VKORG' 'SALES' 20 ' ' ' ' ' ' 'C310 '.
PERFORM BUILD_FIELDS USING 'LFART' 'DELIVERY TYPE' 20 ' ' ' ' ' ' ' '.
PERFORM BUILD_FIELDS USING 'LDDAT' 'LOADING DATE' 15 ' ' ' ' '__-__-____ ' 'C501 '.
PERFORM BUILD_FIELDS USING 'LFDAT' 'DELIVERY DATE' 15 ' ' ' ' '__-__-____ ' 'C501 '.
PERFORM BUILD_FIELDS USING 'POSNR' 'DELIVERY ITEM' 15 ' ' ' ' ' ' 'C610 '.
PERFORM BUILD_FIELDS USING 'MATNR' 'MATIRIAL NO' 15 ' ' ' ' ' ' ' '.
PERFORM BUILD_FIELDS USING 'MATKL' 'MATIRIAL GROUP' 15 ' ' ' ' ' ' ' '.
PERFORM BUILD_FIELDS USING 'LFIMG' 'QUANTITY' 15 ' ' 'X' ' ' ' '.
PERFORM BUILD_FIELDS USING 'MEINS' 'MESURE' 15 ' ' ' ' ' ' 'C501 '.
PERFORM BUILD_FIELDS USING 'BRGEW' 'GROSS WEIGHT' 15 ' ' ' ' ' ' 'C601 '.
PERFORM BUILD_FIELDS USING 'GEWEI' 'WEIGHT UNIT' 15 ' ' ' ' ' ' 'C701 '.
WA_LAYOUT-ZEBRA = 'X'.
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
*--
WA_SORT-FIELDNAME = 'VBELN'.
WA_SORT-UP = 'X'.
WA_SORT-SUBTOT = 'X'.
APPEND WA_SORT TO IT_SORT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-CPROG
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
I_CALLBACK_TOP_OF_PAGE = 'PAGE'
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDS
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
IT_SORT = IT_SORT
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_LIKP1
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*&---------------------------------------------------------------------*
*& Form BUILD_FIELDS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0385 text
* -->P_0386 text
* -->P_0387 text
*----------------------------------------------------------------------*
FORM PAGE .
WA_HEADER-TYP = 'H'.
WA_HEADER-INFO = 'Delivery Document Header Details'.
APPEND WA_HEADER TO IT_HEADER.
WA_HEADER-TYP = 'A'.
WA_HEADER-INFO = 'System Date:'.
WA_HEADER-KEY = 'System Date:'.
CONCATENATE SY-DATUM+6(2)
SY-DATUM+4(2)
SY-DATUM+0(4) INTO WA_HEADER-INFO SEPARATED BY '-'.
APPEND WA_HEADER TO IT_HEADER.
WA_HEADER-TYP = 'A'.
WA_HEADER-INFO = 'delivery Document Header Details'.
APPEND WA_HEADER TO IT_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_HEADER
I_LOGO = 'ZH100'
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
.
ENDFORM. " PAGE
FORM BUILD_FIELDS USING VALUE(P_0385)
VALUE(P_0386)
VALUE(P_0387)
VALUE(P_0388)
VALUE(P_0389)
VALUE(P_0390)
VALUE(P_0391).
WA_FIELDS-FIELDNAME = P_0385.
WA_FIELDS-SELTEXT_L = P_0386.
WA_FIELDS-OUTPUTLEN = P_0387.
WA_FIELDS-KEY = P_0388.
WA_FIELDS-DO_SUM = P_0389.
WA_FIELDS-EDIT_MASK = P_0390.
WA_FIELDS-EMPHASIZE = P_0391.
APPEND WA_FIELDS TO IT_FIELDS.
CLEAR WA_FIELDS.
ENDFORM. " BUILD_FIELDS
*&---------------------------------------------------------------------*
*& Form PAGE
*&---------------------------------------------------------------------*
input:
output:
No comments:
Post a Comment