Skip to content

Commit

Permalink
Update z2ui5_cl_demo_app_132.clas.abap (#150)
Browse files Browse the repository at this point in the history
* Update z2ui5_cl_demo_app_132.clas.abap

Update

* Update z2ui5_cl_demo_app_132.clas.abap

Update

* Update z2ui5_cl_demo_app_132.clas.abap

Update

* Update z2ui5_cl_demo_app_132.clas.abap

Update

* Update z2ui5_cl_demo_app_132.clas.abap

Update
  • Loading branch information
abapsheep authored Mar 27, 2024
1 parent d50c2db commit ea6b149
Showing 1 changed file with 90 additions and 16 deletions.
106 changes: 90 additions & 16 deletions src/z2ui5_cl_demo_app_132.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ CLASS z2ui5_cl_demo_app_132 DEFINITION
CREATE PUBLIC.

PUBLIC SECTION.

INTERFACES if_serializable_object.
INTERFACES z2ui5_if_app.

DATA mv_view_display TYPE abap_bool.
DATA mo_parent_view TYPE REF TO z2ui5_cl_xml_view.

DATA mv_perc type string.
DATA mv_perc TYPE string.
DATA mt_table TYPE REF TO data.
DATA mt_table_tmp TYPE REF TO data.
DATA ms_table_row TYPE REF TO data.
DATA mt_table_del TYPE REF TO data.

methods set_app_data
importing
!DATA type STRING .
METHODS set_app_data
IMPORTING !data TYPE string.

PROTECTED SECTION.


DATA client TYPE REF TO z2ui5_if_client.
DATA check_initialized TYPE abap_bool.

Expand All @@ -28,6 +28,10 @@ DATA mv_perc type string.
METHODS Render_main.

PRIVATE SECTION.
METHODS get_data.

METHODS get_comp
RETURNING VALUE(result) TYPE abap_component_tab.

ENDCLASS.

Expand All @@ -44,11 +48,11 @@ CLASS z2ui5_cl_demo_app_132 IMPLEMENTATION.
ENDMETHOD.

METHOD on_init.
get_Data( ).
Render_main( ).
ENDMETHOD.

METHOD render_main.

IF mo_parent_view IS INITIAL.

DATA(page) = z2ui5_cl_xml_view=>factory( ).
Expand All @@ -59,14 +63,13 @@ CLASS z2ui5_cl_demo_app_132 IMPLEMENTATION.

ENDIF.

DATA(layout) = page->vertical_layout( class = `sapUiContentPadding` width = `100%` ).
DATA(layout) = page->vertical_layout( class = `sapUiContentPadding`
width = `100%` ).
layout->label( 'ProgressIndicator'
)->progress_indicator(
percentvalue = mv_perc
displayvalue = '0,44GB of 32GB used'
showvalue = abap_true
state = 'Success' ).

)->progress_indicator( percentvalue = mv_perc
displayvalue = '0,44GB of 32GB used'
showvalue = abap_true
state = 'Success' ).

IF mo_parent_view IS INITIAL.

Expand All @@ -93,9 +96,80 @@ CLASS z2ui5_cl_demo_app_132 IMPLEMENTATION.
ENDMETHOD.

METHOD set_app_data.
mv_perc = data.
ENDMETHOD.

METHOD get_data.
FIELD-SYMBOLS <table> TYPE STANDARD TABLE.
FIELD-SYMBOLS <table_tmp> TYPE STANDARD TABLE.

DATA(t_comp) = get_comp( ).

TRY.

DATA(new_struct_desc) = cl_abap_structdescr=>create( t_comp ).

DATA(new_table_desc) = cl_abap_tabledescr=>create( p_line_type = new_struct_desc
p_table_kind = cl_abap_tabledescr=>tablekind_std ).

CREATE DATA mt_table TYPE HANDLE new_table_desc.
CREATE DATA mt_table_del TYPE HANDLE new_table_desc.
CREATE DATA mt_table_tmp TYPE HANDLE new_table_desc.
CREATE DATA ms_table_row TYPE HANDLE new_struct_desc.

ASSIGN mt_table->* TO <table>.

SELECT * FROM Z2UI5_T_UTIL_01
INTO CORRESPONDING FIELDS OF TABLE @<table>
UP TO '100' ROWS.

CATCH cx_root.

ENDTRY.

ASSIGN mt_table_tmp->* TO <table_tmp>.

<table_tmp> = <table>.
ENDMETHOD.

METHOD get_comp.
TRY.

DATA index TYPE int4.

TRY.

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

DATA(structdesc) = CAST cl_abap_structdescr( typedesc ).

DATA(comp) = structdesc->get_components( ).

LOOP AT comp INTO DATA(com).

IF com-as_include = abap_false.

APPEND com TO result.

ENDIF.

ENDLOOP.

CATCH cx_root INTO DATA(root). " TODO: variable is assigned but never used (ABAP cleaner)

ENDTRY.

DATA(component) = VALUE cl_abap_structdescr=>component_table(
( name = 'ROW_ID'
type = CAST #( cl_abap_datadescr=>describe_by_data( index ) ) ) ).

mv_perc = data.
APPEND LINES OF component TO result.

CATCH cx_root.
ENDTRY.
ENDMETHOD.

ENDCLASS.

0 comments on commit ea6b149

Please sign in to comment.