REUSE_ALV_GRID_DISPLAY_LVC- 05

light111Controlling Grid Title by layout setting

 

 

The previous post REUSE_ALV_GRID_DISPLAY_LVC- 04  shows how to make use of field catalog fields such as NO_OUT & TECH. This post shows how to set grid title & then controlling the size by layout.


Code Snippet:


DATA: lt_spfli TYPE TABLE OF spfli.
DATA: lt_fcat TYPE lvc_t_fcat.
DATA: ls_layout TYPE lvc_s_layo.

START-OF-SELECTION.
PERFORM data_select.
PERFORM build_layout.
PERFORM build_fieldcat.
PERFORM display_grid_alv.
*&———————————————————————*
*& Form DATA_SELECT
*&———————————————————————*
FORM data_select.
SELECT * FROM spfli INTO TABLE lt_spfli.
ENDFORM. ” DATA_SELECT

*&———————————————————————*
*& Form BUILD_LAYOUT
*&———————————————————————*
FORM build_layout.
ls_layout-zebra = abap_true.
ls_layout-cwidth_opt = abap_true.
ENDFORM. ” BUILD_LAYOUT

*&———————————————————————*
*& Form BUILD_FIELDCAT
*&———————————————————————*
FORM build_fieldcat.
CALL FUNCTION ‘LVC_FIELDCATALOG_MERGE’
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = ‘SPFLI’
* I_CLIENT_NEVER_DISPLAY = ‘X’
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = lt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
ENDFORM. ” BUILD_FIELDCAT

*&———————————————————————*
*& Form DISPLAY_GRID_ALV
*&———————————————————————*
* text
*———————————————————————-*
FORM display_grid_alv.
CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY_LVC’
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 = ‘Flight Information’
* I_GRID_SETTINGS =
is_layout_lvc = ls_layout
it_fieldcat_lvc = lt_fcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS_LVC =
* IT_SORT_LVC =
* IT_FILTER_LVC =
* IT_HYPERLINK =
* IS_SEL_HIDE =
* I_DEFAULT = ‘X’
* I_SAVE = ‘ ‘
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT_LVC =
* IS_REPREP_ID_LVC =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP =
* I_HTML_HEIGHT_END =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO_LVC =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = lt_spfli
EXCEPTIONS
program_error = 1
OTHERS = 2.

ENDFORM. ” DISPLAY_GRID_ALV


Output:

6.jpg


Code Snippet:


DATA: lt_spfli TYPE TABLE OF spfli.
DATA: lt_fcat TYPE lvc_t_fcat.
DATA: ls_layout TYPE lvc_s_layo.

START-OF-SELECTION.
PERFORM data_select.
PERFORM build_layout.
PERFORM build_fieldcat.
PERFORM display_grid_alv.
*&———————————————————————*
*& Form DATA_SELECT
*&———————————————————————*
FORM data_select.
SELECT * FROM spfli INTO TABLE lt_spfli.
ENDFORM. ” DATA_SELECT

*&———————————————————————*
*& Form BUILD_LAYOUT
*&———————————————————————*
FORM build_layout.
ls_layout-zebra = abap_true.
ls_layout-cwidth_opt = abap_true.
ls_layout-smalltitle = abap_true.
ENDFORM. ” BUILD_LAYOUT

*&———————————————————————*
*& Form BUILD_FIELDCAT
*&———————————————————————*
FORM build_fieldcat.
CALL FUNCTION ‘LVC_FIELDCATALOG_MERGE’
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = ‘SPFLI’
* I_CLIENT_NEVER_DISPLAY = ‘X’
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = lt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
ENDFORM. ” BUILD_FIELDCAT

*&———————————————————————*
*& Form DISPLAY_GRID_ALV
*&———————————————————————*
* text
*———————————————————————-*
FORM display_grid_alv.
CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY_LVC’
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 = ‘Flight Information’
* I_GRID_SETTINGS =
is_layout_lvc = ls_layout
it_fieldcat_lvc = lt_fcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS_LVC =
* IT_SORT_LVC =
* IT_FILTER_LVC =
* IT_HYPERLINK =
* IS_SEL_HIDE =
* I_DEFAULT = ‘X’
* I_SAVE = ‘ ‘
* IS_VARIANT =
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT_LVC =
* IS_REPREP_ID_LVC =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP =
* I_HTML_HEIGHT_END =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO_LVC =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = lt_spfli
EXCEPTIONS
program_error = 1
OTHERS = 2.

ENDFORM. ” DISPLAY_GRID_ALV


Output:

7.jpg


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s