*&---------------------------------------------------------------------*
*& Report ZGDEMO_ALV_FIELD_CAT_MANUAL
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZGDEMO_ALV_FIELD_CAT_MANUAL.
TYPE-POOLS SLIS.
TYPES : BEGIN OF TY_T001,
BUKRS TYPE BUKRS,
BUTXT TYPE BUTXT,
LAND1 TYPE LAND1,
END OF TY_T001.
DATA : IT_T001 TYPE TABLE OF TY_T001.
DATA : IT_FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCATALOG TYPE LINE OF SLIS_T_FIELDCAT_ALV.
START-OF-SELECTION.
PERFORM READ_DATA.
PERFORM FILL_FIELD_CATALOG.
PERFORM DISPLAY_ALV.
*&---------------------------------------------------------------------*
*& Form READ_DATA
*&---------------------------------------------------------------------*
FORM READ_DATA .
SELECT BUKRS BUTXT LAND1 INTO TABLE IT_T001 FROM T001
UP TO 15 ROWS.
ENDFORM. " READ_DATA
*&---------------------------------------------------------------------*
*& Form FILL_FIELD_CATALOG
*&---------------------------------------------------------------------*
FORM FILL_FIELD_CATALOG .
*LAND1
CLEAR WA_FIELDCATALOG.
WA_FIELDCATALOG-col_pos = 3.
WA_FIELDCATALOG-fieldname = 'LAND1'.
WA_FIELDCATALOG-REPTEXT_DDIC = 'LAND1'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
*BUKRS
CLEAR WA_FIELDCATALOG.
WA_FIELDCATALOG-col_pos = 1.
WA_FIELDCATALOG-fieldname = 'BUKRS'.
WA_FIELDCATALOG-REPTEXT_DDIC = 'BUKRS'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
*BUTXT
CLEAR WA_FIELDCATALOG.
WA_FIELDCATALOG-col_pos = 2.
WA_FIELDCATALOG-fieldname = 'BUTXT'.
WA_FIELDCATALOG-REPTEXT_DDIC = 'BUTXT'.
WA_FIELDCATALOG-EDIT = 'X'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
ENDFORM. " FILL_FIELD_CATALOG
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV
*&---------------------------------------------------------------------*
FORM DISPLAY_ALV .
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 =
* I_GRID_SETTINGS =
* IS_LAYOUT =
IT_FIELDCAT = IT_FIELDCATALOG
* 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_T001
* 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.
ENDFORM. " DISPLAY_ALV
*& Report ZGDEMO_ALV_FIELD_CAT_MANUAL
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZGDEMO_ALV_FIELD_CAT_MANUAL.
TYPE-POOLS SLIS.
TYPES : BEGIN OF TY_T001,
BUKRS TYPE BUKRS,
BUTXT TYPE BUTXT,
LAND1 TYPE LAND1,
END OF TY_T001.
DATA : IT_T001 TYPE TABLE OF TY_T001.
DATA : IT_FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCATALOG TYPE LINE OF SLIS_T_FIELDCAT_ALV.
START-OF-SELECTION.
PERFORM READ_DATA.
PERFORM FILL_FIELD_CATALOG.
PERFORM DISPLAY_ALV.
*&---------------------------------------------------------------------*
*& Form READ_DATA
*&---------------------------------------------------------------------*
FORM READ_DATA .
SELECT BUKRS BUTXT LAND1 INTO TABLE IT_T001 FROM T001
UP TO 15 ROWS.
ENDFORM. " READ_DATA
*&---------------------------------------------------------------------*
*& Form FILL_FIELD_CATALOG
*&---------------------------------------------------------------------*
FORM FILL_FIELD_CATALOG .
*LAND1
CLEAR WA_FIELDCATALOG.
WA_FIELDCATALOG-col_pos = 3.
WA_FIELDCATALOG-fieldname = 'LAND1'.
WA_FIELDCATALOG-REPTEXT_DDIC = 'LAND1'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
*BUKRS
CLEAR WA_FIELDCATALOG.
WA_FIELDCATALOG-col_pos = 1.
WA_FIELDCATALOG-fieldname = 'BUKRS'.
WA_FIELDCATALOG-REPTEXT_DDIC = 'BUKRS'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
*BUTXT
CLEAR WA_FIELDCATALOG.
WA_FIELDCATALOG-col_pos = 2.
WA_FIELDCATALOG-fieldname = 'BUTXT'.
WA_FIELDCATALOG-REPTEXT_DDIC = 'BUTXT'.
WA_FIELDCATALOG-EDIT = 'X'.
APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
ENDFORM. " FILL_FIELD_CATALOG
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV
*&---------------------------------------------------------------------*
FORM DISPLAY_ALV .
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 =
* I_GRID_SETTINGS =
* IS_LAYOUT =
IT_FIELDCAT = IT_FIELDCATALOG
* 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_T001
* 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.
ENDFORM. " DISPLAY_ALV
No comments:
Post a Comment