ALV LAYOUT DISPLAY SAMPLE CODE

TYPE-POOLS:slis.

TABLES:ekko.

SELECT-OPTIONS:so_ebeln FOR ekko-ebeln.

PARAMETERS: VARIANT LIKE DISVARIANT-VARIANT.

DATA:BEGIN OF it_ekko OCCURS 0,
ebeln LIKE ekko-ebeln, "PURCHASE DOCUMENT NUMBER
bukrs LIKE ekko-bukrs, "COMPANY CODE
bstyp LIKE ekko-bstyp, "PURCHASE DOCUMENT CATEGORY
bsart LIKE ekko-bsart, "PUCHASE DOCUMENT TYPE
END OF it_ekko.

*FIELD CATALOG AND EVENT CATALOG TABLE DECLARATION.

DATA:i_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
i_eventcat TYPE slis_t_event WITH HEADER LINE,
I_LAYOUT TYPE SLIS_LAYOUT_ALV .

* ZDLAYOUT1 TYPE SLIS_LAYOUT_ALV .

DATA:W_VARIANT LIKE DISVARIANT,
W_VARIANT1 LIKE DISVARIANT.

INITIALIZATION.
MOVE: SY-REPID TO W_VARIANT-REPORT,
SY-REPID TO W_VARIANT1-REPORT.

CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
I_SAVE = 'A'
CHANGING
cs_variant = W_VARIANT.
MOVE W_VARIANT-VARIANT TO w_VARIANT1.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR VARIANT.
DATA: L_EXIT.

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
EXPORTING
is_variant = W_VARIANT1
* I_TABNAME_HEADER =
* I_TABNAME_ITEM =
* IT_DEFAULT_FIELDCAT =
* I_SAVE = 'A'
* I_DISPLAY_VIA_GRID = ' '

IMPORTING
E_EXIT = L_EXIT
ES_VARIANT = W_VARIANT.

START-OF-SELECTION.

*INTERNAL TABLE POPULATION
SELECT ebeln
bukrs
bstyp
bsart
FROM ekko
INTO TABLE it_ekko
WHERE ebeln IN so_ebeln.

*POPULATING FIELD CATALOG BY USING FUNCTION MODULE

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-cprog
i_internal_tabname = 'IT_EKKO'
i_inclname = sy-cprog
CHANGING
ct_fieldcat = i_fieldcat[].

*DISPLAYING ALV GRID WITH MULTIPLE LAYOUTSETS

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 = ' '
* 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 = 'ZDLAYOUT1'
IT_FIELDCAT = I_FIELDCAT[]
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
I_SAVE = 'A' "'U' "'X'
* IS_VARIANT = 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
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* I_HTML_HEIGHT_TOP =
* I_HTML_HEIGHT_END =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = IT_EKKO.

RELATED POSTS

ALV INTERACTIVE REPORT SAMPLE CODE
INTERACTIVE REPORT SAMPLE CODE 2

No comments :

Post a Comment