TABLES VBAK.
TYPE-POOLS SLIS.
TYPES: BEGIN OF T_VBAK,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
ERNAM TYPE VBAK-ERNAM,
AUDAT TYPE VBAK-AUDAT,
VBTYP TYPE VBAK-VBTYP,
NETWR TYPE VBAK-NETWR,
VKORG TYPE VBAK-VKORG,
VKGRP TYPE VBAK-VKGRP,
END OF T_VBAK.
DATA IT_VBAK TYPE STANDARD TABLE OF T_VBAK INITIAL SIZE 0.
DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV,
W_FLDCAT TYPE SLIS_FIELDCAT_ALV,
GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
GD_REPID TYPE SY-REPID.
START-OF-SELECTION.
PERFORM DATA_RETRIEVAL.
PERFORM BLD_FLDCAT.
PERFORM BLD_LAYOUT.
PERFORM DISPLAY_ALV_REPORT.
*---------------------------------------------------
* FORM BLD_FLDCAT.
*---------------------------------------------------
FORM BLD_FLDCAT.
W_FLDCAT-FIELDNAME = 'VBELN'.
W_FLDCAT-SELTEXT_M = 'Sales Document'.
W_FLDCAT-COL_POS = 0.
W_FLDCAT-OUTPUTLEN = 20.
W_FLDCAT-KEY = 'X'.
W_FLDCAT-ICON = 'X'.
APPEND W_FLDCAT TO FLDCAT.
CLEAR W_FLDCAT.
W_FLDCAT-FIELDNAME = 'ERDAT'.
W_FLDCAT-SELTEXT_L = 'Record Date created'.
W_FLDCAT-COL_POS = 1.
W_FLDCAT-KEY = 'X'.
APPEND W_FLDCAT TO FLDCAT.
CLEAR W_FLDCAT.
W_FLDCAT-FIELDNAME = 'ERNAM'.
W_FLDCAT-SELTEXT_L = 'Cteated Object Person Name'.
APPEND W_FLDCAT TO FLDCAT.
CLEAR W_FLDCAT.
W_FLDCAT-FIELDNAME = 'AUDAT'.
W_FLDCAT-SELTEXT_M = 'Document Date'.
W_FLDCAT-COL_POS = 3.
W_FLDCAT-EMPHASIZE = 'C110'.
APPEND W_FLDCAT TO FLDCAT.
CLEAR W_FLDCAT.
W_FLDCAT-FIELDNAME = 'VBTYP'.
W_FLDCAT-SELTEXT_L = 'SD Document category'.
W_FLDCAT-COL_POS = 4.
APPEND W_FLDCAT TO FLDCAT.
CLEAR W_FLDCAT.
W_FLDCAT-FIELDNAME = 'NETWR'.
W_FLDCAT-SELTEXT_L = 'Net Value of the SO in Document Currency'.
W_FLDCAT-COL_POS = 5.
W_FLDCAT-OUTPUTLEN = 60.
W_FLDCAT-DO_SUM = 'X'.
W_FLDCAT-DATATYPE = 'CURR'.
APPEND W_FLDCAT TO FLDCAT.
CLEAR W_FLDCAT.
W_FLDCAT-FIELDNAME = 'VKORG'.
W_FLDCAT-SELTEXT_L = 'Sales Organization'.
W_FLDCAT-COL_POS = 6.
APPEND W_FLDCAT TO FLDCAT.
CLEAR W_FLDCAT.
W_FLDCAT-FIELDNAME = 'VKGRP'.
W_FLDCAT-SELTEXT_M = 'Sales Group'.
W_FLDCAT-COL_POS = 7.
W_FLDCAT-EMPHASIZE = 'C801'.
APPEND W_FLDCAT TO FLDCAT.
CLEAR W_FLDCAT.
ENDFORM.
*---------------------------------------------------
* FORM BLD_LAYOUT.
*---------------------------------------------------
FORM BLD_LAYOUT.
GD_LAYOUT-NO_INPUT = 'X'.
GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
GD_LAYOUT-BOX_FIELDNAME = 'VBELN'.
ENDFORM.
*---------------------------------------------------
* FORM DISPLAY_ALV_REPORT.
*---------------------------------------------------
FORM DISPLAY_ALV_REPORT.
GD_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = GD_REPID
IS_LAYOUT = GD_LAYOUT
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
IT_FIELDCAT = FLDCAT[]
I_SAVE = 'X'
I_GRID_TITLE = 'WELCOME TO ALV'
TABLES
T_OUTTAB = IT_VBAK .
ENDFORM.
*---------------------------------------------------
* FORM DATA_RETRIEVAL.
*---------------------------------------------------
FORM DATA_RETRIEVAL.
SELECT VBELN ERDAT ERNAM AUDAT VBTYP NETWR VKORG
UP TO 50 ROWS
FROM VBAK
INTO TABLE IT_VBAK.
ENDFORM.
*---------------------------------------------------
* FORM TOP_OF_PAGE.
*---------------------------------------------------
FORM TOP_OF_PAGE.
DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
W_HEADER TYPE SLIS_LISTHEADER.
W_HEADER-TYP = 'H'.
W_HEADER-INFO = 'WELCOME HEADER LIST'.
APPEND W_HEADER TO T_HEADER.
W_HEADER-TYP = 'S'.
W_HEADER-KEY = 'REPORT:'.
W_HEADER-INFO = SY-REPID.
APPEND W_HEADER TO T_HEADER.
W_HEADER-TYP = 'S'.
W_HEADER-KEY = 'DATE:'.
CONCATENATE SY-DATUM+4(2)
' / '
SY-DATUM+6(2)
' / '
SY-DATUM(4)
INTO W_HEADER-INFO.
APPEND W_HEADER TO T_HEADER.
CLEAR W_HEADER.
W_HEADER-TYP = 'S'.
W_HEADER-KEY = 'Page No:'.
W_HEADER-INFO = SY-PAGNO.
APPEND W_HEADER TO T_HEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_HEADER.
ENDFORM.
ALSO READ:
- Calling A Transacton From ALV Grid/List Report.
- Simple ALV Grid/List With Save Layout.
- Checkbox In ALV Program.
- ALV Header With Logo.
..... Back To Index On ALV List/ Grid Display.
..... Back To MAIN INDEX.
No comments:
Post a Comment