Friday, May 29, 2026

IDA 5: Field Catalog in IDA

SAP code:

*&---------------------------------------------------------------------*

*& Report ZIDA_PROGRAM

*&---------------------------------------------------------------------*

REPORT zida_program.


*&... Get the reference of IDA ALV Object

TRY.

DATA(lo_alv_ida_cds) = cl_salv_gui_table_ida=>create_for_cds_view( iv_cds_view_name = 'DEMO_SFLIGHT' ).

CATCH cx_salv_db_connection INTO DATA(lx_salv_db_connection).

CATCH cx_salv_db_table_not_supported INTO DATA(lx_salv_not_supported).

CATCH cx_salv_ida_contract_violation INTO DATA(lx_salv_cont_violation).

CATCH cx_salv_function_not_supported INTO DATA(lx_salv_fun_not_supported).

ENDTRY.


IF lo_alv_ida_cds IS BOUND.


*&... Get the reference of ALV Full Screen mode

TRY.

DATA(lo_fullscreen_cds) = lo_alv_ida_cds->fullscreen( ).

CATCH cx_salv_ida_contract_violation. " IDA API contract violated by caller

ENDTRY.


DATA(lo_display_options) = lo_alv_ida_cds->display_options( ).


*&... Set title

lo_display_options->set_title( iv_title = TEXT-001 ).

*&.. Set zebra pattern

lo_display_options->enable_alternating_row_pattern( ).


*&... Fill Field catalog

DATA(lo_field_catalog) = lo_alv_ida_cds->field_catalog( ).

IF lo_field_catalog IS BOUND.

"&... Get the All table field detail

lo_field_catalog->get_all_fields( IMPORTING ets_field_names = DATA(lt_field_name) ).

LOOP AT lt_field_name ASSIGNING FIELD-SYMBOL(<lfs_field_name>).

TRY.

CASE <lfs_field_name>.

WHEN 'CARRID'.

lo_field_catalog->set_field_header_texts( iv_field_name = <lfs_field_name>

iv_header_text = TEXT-003

iv_tooltip_text = TEXT-003

iv_tooltip_text_long = TEXT-003 ).

WHEN 'CONNID'.


lo_field_catalog->set_field_header_texts( iv_field_name = <lfs_field_name>

iv_header_text = TEXT-002

iv_tooltip_text = TEXT-002

iv_tooltip_text_long = TEXT-002 ).

ENDCASE.

CATCH cx_salv_ida_unknown_name INTO DATA(lx_ida_unknown_name).

CATCH cx_salv_call_after_1st_display INTO DATA(lx_call_after_display).

ENDTRY.

ENDLOOP.

ENDIF.


*&... Display data on UI

IF lo_alv_ida_cds IS BOUND.


lo_fullscreen_cds->display( ).


ENDIF.

ENDIF.


Output:












Key Concept:






No comments:

Post a Comment

RAP8: Early numbering

In this post will show you how to use early numbering . Step 1: Add early numbering key word in interface behavior definition and activate b...