REUSE_ALV_GRID_DISPLAY_LVC- 04

light111Field catalog fields- TECH & NO_OUT use 

The previous post REUSE_ALV_GRID_DISPLAY_LVC- 03 shows how to make use of lvc layout. This post shows how to how to make use of the TECH & NO_OUT field of the field catalog. If NO_OUT field is enabled for columns, these columns are hidden in the ALV display but can be made visible by making change in the layout. If TECH field is enabled for columns, these fields not at all  displayed in the ALV nit even by changing the 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.

LOOP AT lt_fcat ASSIGNING FIELD-SYMBOL(<fs_fcat>).
CASE <fs_fcat>-fieldname.
WHEN ‘COUNTRYFR’ OR ‘COUNTRYTO’.
<fs_fcat>-tech = abap_true.
WHEN ‘CITYFROM’ OR ‘CITYTO’.
<fs_fcat>-no_out = abap_true.
WHEN OTHERS.
ENDCASE.
ENDLOOP.
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: Select the change layout button.

4

In the column set section, only those fields are available for which NO_OUT is marked as true.

5


 

Advertisements

One thought on “REUSE_ALV_GRID_DISPLAY_LVC- 04

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