Skip to content

Update RTTI Samples for Deep Structures #508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 6 additions & 42 deletions src/z2ui5_cl_demo_app_190.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ CLASS z2ui5_cl_demo_app_190 DEFINITION

DATA mv_table TYPE string.
DATA mt_table TYPE REF TO data.
DATA mt_table_tmp TYPE REF TO data.

DATA mt_comp TYPE abap_component_tab.
DATA ms_fixval TYPE REF TO data.

DATA mv_init type abap_bool.

METHODS set_app_data
IMPORTING !count TYPE string
Expand All @@ -34,7 +33,7 @@ CLASS z2ui5_cl_demo_app_190 DEFINITION
METHODS get_comp
RETURNING VALUE(result) TYPE abap_component_tab.

METHODS get_fixval.

ENDCLASS.

CLASS z2ui5_cl_demo_app_190 IMPLEMENTATION.
Expand Down Expand Up @@ -112,8 +111,8 @@ CLASS z2ui5_cl_demo_app_190 IMPLEMENTATION.
METHOD z2ui5_if_app~main.
me->client = client.

IF client->check_on_init( ).

IF mv_init = abap_false.
mv_init = abap_true.
on_init( ).

ENDIF.
Expand Down Expand Up @@ -143,7 +142,7 @@ CLASS z2ui5_cl_demo_app_190 IMPLEMENTATION.

CREATE DATA mt_table TYPE HANDLE new_table_desc.

CREATE DATA mt_table_tmp TYPE HANDLE new_table_desc.
* CREATE DATA mt_table_tmp TYPE HANDLE new_table_desc.


ASSIGN mt_table->* TO <table>.
Expand All @@ -157,43 +156,8 @@ CLASS z2ui5_cl_demo_app_190 IMPLEMENTATION.

ENDTRY.

ASSIGN mt_table_tmp->* TO <table_tmp>.

<table_tmp> = <table>.
get_fixval( ).

ENDMETHOD.

METHOD get_fixval.

TYPES:
BEGIN OF fixvalue,
low TYPE string,
high TYPE string,
option TYPE string,
ddlanguage TYPE string,
ddtext TYPE string,
END OF fixvalue.
TYPES fixvalues TYPE STANDARD TABLE OF fixvalue WITH DEFAULT KEY.

DATA comp TYPE cl_abap_structdescr=>component_table.
DATA structdescr TYPE REF TO cl_abap_structdescr.
DATA lt_fixval TYPE fixvalues.

LOOP AT mt_comp REFERENCE INTO DATA(dfies).

comp = VALUE cl_abap_structdescr=>component_table(
BASE comp
( name = dfies->name
type = CAST #( cl_abap_datadescr=>describe_by_data( lt_fixval ) ) ) ).
ENDLOOP.

structdescr = cl_abap_structdescr=>create( comp ).

CREATE DATA ms_fixval TYPE HANDLE structdescr.


ENDMETHOD.

METHOD get_comp.
DATA index TYPE int4.
Expand Down
8 changes: 4 additions & 4 deletions src/z2ui5_cl_demo_app_191.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ CLASS Z2UI5_CL_DEMO_APP_191 IMPLEMENTATION.

METHOD on_init.

mt_t002 = VALUE #( ( id = '1' class = 'Z2UI5_CL_DEMO_APP_190' count = '10' table = 'Z2UI5_T001' )
( id = '2' class = 'Z2UI5_CL_DEMO_APP_190' count = '20' table = 'Z2UI5_T002' )
( id = '3' class = 'Z2UI5_CL_DEMO_APP_190' count = '30' table = 'Z2UI5_TOOL_T_001' )
( id = '4' class = 'Z2UI5_CL_DEMO_APP_190' count = '40' table = 'Z2UI5_TOOL_T_002' ) ).
mt_t002 = VALUE #( ( id = '1' class = 'Z2UI5_CL_DEMO_APP_190' count = '10' table = 'Z2UI5_T_11' )
( id = '2' class = 'Z2UI5_CL_DEMO_APP_190' count = '20' table = 'Z2UI5_T_12' )
( id = '3' class = 'Z2UI5_CL_DEMO_APP_190' count = '30' table = 'Z2UI5_T_11' )
( id = '4' class = 'Z2UI5_CL_DEMO_APP_190' count = '40' table = 'Z2UI5_T_12' ) ).

mv_selectedkey = '1'.

Expand Down
26 changes: 13 additions & 13 deletions src/z2ui5_cl_demo_app_194.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ CLASS z2ui5_cl_demo_app_194 DEFINITION
DATA ms_table_row TYPE REF TO data.
DATA mt_comp TYPE abap_component_tab.
DATA ms_fixval TYPE REF TO data.
DATA mv_init TYPE abap_bool.

METHODS set_app_data
IMPORTING !count TYPE string
!table TYPE string.
IMPORTING
!table TYPE string.

PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.

DATA client TYPE REF TO z2ui5_if_client.

METHODS on_init.
METHODS on_event.
Expand All @@ -32,11 +32,13 @@ CLASS z2ui5_cl_demo_app_194 DEFINITION
METHODS get_data.

METHODS get_comp
RETURNING VALUE(result) TYPE abap_component_tab.
RETURNING
VALUE(result) TYPE abap_component_tab.

METHODS get_fixval.
ENDCLASS.


CLASS z2ui5_cl_demo_app_194 IMPLEMENTATION.

METHOD on_event.
Expand Down Expand Up @@ -82,7 +84,6 @@ CLASS z2ui5_cl_demo_app_194 IMPLEMENTATION.
page = mo_parent_view->get( `Page` ).
ENDIF.


ASSIGN mt_table->* TO <tab>.

DATA(table) = page->table( growing = 'true'
Expand All @@ -105,7 +106,7 @@ CLASS z2ui5_cl_demo_app_194 IMPLEMENTATION.
)->cells( ).

LOOP AT mt_comp INTO comp.
cells->object_identifier( text = '{' && comp-name && '}' ).
cells->object_identifier( text = |\{{ comp-name }\}| ).
ENDLOOP.

page->footer( )->overflow_toolbar(
Expand All @@ -128,7 +129,8 @@ CLASS z2ui5_cl_demo_app_194 IMPLEMENTATION.
METHOD z2ui5_if_app~main.
me->client = client.

IF client->check_on_init( ).
IF mv_init = abap_false.
mv_init = abap_true.

on_init( ).

Expand Down Expand Up @@ -193,8 +195,8 @@ CLASS z2ui5_cl_demo_app_194 IMPLEMENTATION.
TYPES fixvalues TYPE STANDARD TABLE OF fixvalue WITH DEFAULT KEY.

DATA comp TYPE cl_abap_structdescr=>component_table.
DATA structdescr TYPE REF TO cl_abap_structdescr.
DATA lt_fixval TYPE fixvalues.
DATA structdescr TYPE REF TO cl_abap_structdescr.

LOOP AT mt_comp REFERENCE INTO DATA(dfies).

Expand All @@ -208,19 +210,17 @@ CLASS z2ui5_cl_demo_app_194 IMPLEMENTATION.

CREATE DATA ms_fixval TYPE HANDLE structdescr.


ENDMETHOD.

METHOD get_comp.
DATA index TYPE int4.
TRY.


TRY.

TRY.

cl_abap_typedescr=>describe_by_name( EXPORTING p_name = mv_table
RECEIVING p_descr_ref = DATA(typedesc)
RECEIVING p_descr_ref = DATA(typedesc)
EXCEPTIONS type_not_found = 1
OTHERS = 2 ).

Expand Down