REPORT ZASS4
LINE-COUNT 30(3)
LINE-SIZE 300
NO STANDARD PAGE HEADING.
TABLES:VBRK,VBRP.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
SELECT-OPTIONS S_VBELN FOR VBRK-VBELN.
PARAMETERS:P_VKORG TYPE VBRK-VKORG.
SELECT-OPTIONS S_FKDAT FOR VBRK-FKDAT.
PARAMETERS:P_WERKS TYPE VBRP-WERKS.
SELECTION-SCREEN END OF BLOCK B1.
TYPES:BEGIN OF TY_VBRP,
VBELN TYPE VBRP-VBELN,
POSNR TYPE VBRP-POSNR,
WERKS TYPE VBRP-WERKS,
FKIMG TYPE VBRP-FKIMG,
MEINS TYPE VBRP-MEINS,
AUBEL TYPE VBRP-AUBEL,
AUPOS TYPE VBRP-AUPOS,
END OF TY_VBRP.
TYPES:BEGIN OF TY_VBRK,
VBELN TYPE VBRK-VBELN,
FKART TYPE VBRK-FKART,
VTWEG TYPE VBRK-VTWEG,
VKORG TYPE VBRK-VKORG,
FKDAT TYPE VBRK-FKDAT,
END OF TY_VBRK.
TYPES:BEGIN OF TY_FINAL,
VBELN TYPE VBRK-VBELN,
POSNR TYPE VBRP-POSNR,
WERKS TYPE VBRP-WERKS,
FKART TYPE VBRK-FKART,
VKORG TYPE VBRK-VKORG,
VTWEG TYPE VBRK-VTWEG,
FKDAT TYPE VBRK-FKDAT,
FKIMG TYPE VBRP-FKIMG,
MEINS TYPE VBRP-MEINS,
AUBEL TYPE VBRP-AUBEL,
AUPOS TYPE VBRP-AUPOS,
END OF TY_FINAL.
DATA:IT_VBRP TYPE STANDARD TABLE OF TY_VBRP,
WA_VBRP TYPE TY_VBRP.
DATA: IT_VBRK TYPE STANDARD TABLE OF TY_VBRK,
WA_VBRK TYPE TY_VBRK.
DATA: IT_FINAL TYPE STANDARD TABLE OF TY_FINAL,
WA_FINAL TYPE TY_FINAL.
TYPE-POOLS:SLIS.
DATA:IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
WA_FIELDCAT-COL_POS = '1'.
WA_FIELDCAT-FIELDNAME = 'VBELN'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-SELTEXT_L = 'BILLING DOCUMENT'.
WA_FIELDCAT-OUTPUTLEN = '20'.
WA_FIELDCAT-EMPHASIZE = 'C1'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = '2'.
WA_FIELDCAT-FIELDNAME = 'POSNR'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-SELTEXT_L = 'BILLING ITEM'.
WA_FIELDCAT-OUTPUTLEN = '20'.
WA_FIELDCAT-EMPHASIZE = 'C2'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = '3'.
WA_FIELDCAT-FIELDNAME = 'WERKS'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-SELTEXT_L = 'PLANT'.
WA_FIELDCAT-OUTPUTLEN = '20'.
WA_FIELDCAT-EMPHASIZE = 'C3'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = '4'.
WA_FIELDCAT-FIELDNAME = 'FKART'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-SELTEXT_L = 'BILLING TYPE'.
WA_FIELDCAT-OUTPUTLEN = '20'.
WA_FIELDCAT-EMPHASIZE = 'C4'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = '5'.
WA_FIELDCAT-FIELDNAME = 'VKORG'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-SELTEXT_L = 'SALES ORG'.
WA_FIELDCAT-OUTPUTLEN = '20'.
WA_FIELDCAT-EMPHASIZE = 'C5'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = '6'.
WA_FIELDCAT-FIELDNAME = 'VTWEG'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-SELTEXT_L = 'DISTRIBUTION CHANNEL'.
WA_FIELDCAT-OUTPUTLEN = '20'.
WA_FIELDCAT-EMPHASIZE = 'C6'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = '7'.
WA_FIELDCAT-FIELDNAME = 'FKDAT'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-SELTEXT_L = 'BILLING DATE'.
WA_FIELDCAT-OUTPUTLEN = '20'.
WA_FIELDCAT-EMPHASIZE = 'C7'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = '8'.
WA_FIELDCAT-FIELDNAME = 'FKIMG'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-SELTEXT_L = 'QUANTITY'.
WA_FIELDCAT-OUTPUTLEN = '20'.
WA_FIELDCAT-EMPHASIZE = 'C8'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = '9'.
WA_FIELDCAT-FIELDNAME = 'MEINS'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-SELTEXT_L = 'UOM'.
WA_FIELDCAT-OUTPUTLEN = '20'.
WA_FIELDCAT-EMPHASIZE = 'C9'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = '10'.
WA_FIELDCAT-FIELDNAME = 'AUBEL'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-SELTEXT_L = 'SALES ORDER'.
WA_FIELDCAT-OUTPUTLEN = '20'.
WA_FIELDCAT-EMPHASIZE = 'C10'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-COL_POS = '11'.
WA_FIELDCAT-FIELDNAME = 'AUPOS'.
WA_FIELDCAT-TABNAME = 'IT_FINAL'.
WA_FIELDCAT-SELTEXT_L = 'SALES ORDER ITEM'.
WA_FIELDCAT-OUTPUTLEN = '20'.
WA_FIELDCAT-EMPHASIZE = 'C11'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
SELECT VBRK~VBELN, VBRP~POSNR, VBRP~WERKS ,VBRK~FKART, VBRK~VKORG, VBRK~VTWEG, VBRK~FKDAT, VBRP~FKIMG, VBRP~MEINS, VBRP~AUBEL, VBRP~AUPOS INTO TABLE @it_final
FROM VBRK INNER JOIN VBRP ON VBRK~VBELN = VBRP~VBELN
WHERE VBRK~VBELN IN @S_Vbeln
AND VBRK~VKORG = @P_VKORG
AND VBRK~FKDAT IN @S_FKDAT
AND VBRP~WERKS = @P_WERKS.(""unable to display data using this select query please provide me the correct syntax.)""
LOOP AT IT_FINAL INTO WA_FINAL.
WRITE:/ WA_FINAL-VBELN ,
WA_FINAL-POSNR,
WA_FINAL-WERKS ,
WA_FINAL-FKART,
WA_FINAL-VKORG ,
WA_FINAL-VTWEG ,
WA_FINAL-FKDAT ,
WA_FINAL-FKIMG,
WA_FINAL-MEINS ,
WA_FINAL-AUBEL ,
WA_FINAL-AUPOS.
*APPEND WA_FINAL TO IT_FINAL.
CLEAR:WA_FINAL.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
I_GRID_TITLE = 'BILLING DOCUMENT DATA'
* I_GRID_SETTINGS =
* IS_LAYOUT =
IT_FIELDCAT = IT_FIELDCAT
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* 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_FINAL
* EXCEPTIONS
* PROGRAM_ERROR = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.