gen data binding (#151)

* bugfixes

* bugfixes

* geeric binding

* binding gen data

* abaplint fixes

* abaplint fixes
This commit is contained in:
oblomov 2023-04-10 19:30:47 +02:00
parent 7ccb75b8b1
commit 64d939e125
17 changed files with 239 additions and 102 deletions

View File

@ -46,8 +46,6 @@ CLASS z2ui5_cl_app_demo_01 IMPLEMENTATION.
)->content( 'form'
)->title( 'Input'
)->label( 'quantity'
)->input( client->_bind( quantity )
)->label( 'quantity'
)->input( client->_bind( quantity )
)->label( 'product'
)->input(

View File

@ -109,7 +109,7 @@ CLASS Z2UI5_CL_APP_DEMO_02 IMPLEMENTATION.
METHOD z2ui5_on_rendering.
DATA(page) = z2ui5_cl_xml_view_helper=>factory(
DATA(page) = z2ui5_cl_xml_view_helper=>factory( )->shell(
)->page(
title = 'abap2UI5 - Selection-Screen Example'
navbuttonpress = client->_event( 'BACK' )

View File

@ -77,11 +77,11 @@ CLASS Z2UI5_CL_APP_DEMO_04 IMPLEMENTATION.
WHEN 'MAIN'.
DATA(page) = z2ui5_cl_xml_view_helper=>factory(
DATA(page) = z2ui5_cl_xml_view_helper=>factory( )->shell(
)->page(
title = 'abap2UI5 - Controller'
navbuttonpress = client->_event( 'BACK' )
shownavbutton = abap_true
shownavbutton = abap_true
)->header_content(
)->link(
text = 'Source_Code'
@ -109,10 +109,12 @@ CLASS Z2UI5_CL_APP_DEMO_04 IMPLEMENTATION.
WHEN 'SECOND'.
page = z2ui5_cl_xml_view_helper=>factory(
page = z2ui5_cl_xml_view_helper=>factory( )->shell(
)->page(
title = 'abap2UI5 - Controller'
navbuttonpress = client->_event( 'BACK' ) ).
navbuttonpress = client->_event( 'BACK' )
shownavbutton = abap_true
).
page->grid( 'L12 M12 S12' )->content( 'l'
)->simple_form( 'View Second' )->content( 'form'

View File

@ -33,6 +33,7 @@ CLASS z2ui5_cl_app_demo_05 DEFINITION PUBLIC.
end of ty_S_token.
data mt_token type STANDARD TABLE OF ty_S_token with empty key.
data mt_token_sugg type STANDARD TABLE OF ty_S_token with empty key.
PROTECTED SECTION.
PRIVATE SECTION.
@ -50,11 +51,17 @@ CLASS Z2UI5_CL_APP_DEMO_05 IMPLEMENTATION.
mt_token = value #(
( key = 'VAL1' text = 'value_1' selkz = abap_true visible = abap_true )
( key = 'VAL2' text = 'value_2' selkz = abap_false )
( key = 'VAL3' text = 'value_3' selkz = abap_false visible = abap_true )
( key = 'VAL4' text = 'value_4' selkz = abap_true )
).
mt_token_sugg = value #(
( key = 'VAL1' text = 'value_1' )
( key = 'VAL2' text = 'value_2' )
( key = 'VAL3' text = 'value_3' )
( key = 'VAL4' text = 'value_4' )
).
screen = VALUE #(
check_initialized = abap_true
check_is_active = abap_true
@ -84,7 +91,7 @@ CLASS Z2UI5_CL_APP_DEMO_05 IMPLEMENTATION.
ENDCASE.
DATA(page) = z2ui5_cl_xml_view_helper=>factory(
DATA(page) = z2ui5_cl_xml_view_helper=>factory( )->shell(
)->page(
title = 'abap2UI5 - Selection-Screen more Controls'
navbuttonpress = client->_event( 'BACK' )
@ -165,7 +172,7 @@ CLASS Z2UI5_CL_APP_DEMO_05 IMPLEMENTATION.
tokens = client->_bind( mt_token )
showclearicon = abap_true
showvaluehelp = abap_true
suggestionitems = client->_bind_one( mt_token )
suggestionitems = client->_bind( mt_token_sugg )
)->item(
key = `{KEY}`
text = `{TEXT}`

View File

@ -73,7 +73,7 @@ CLASS Z2UI5_CL_APP_DEMO_06 IMPLEMENTATION.
ENDCASE.
DATA(page) = z2ui5_cl_xml_view_helper=>factory(
DATA(page) = z2ui5_cl_xml_view_helper=>factory( )->shell(
)->page(
title = 'abap2UI5 - Scroll Container with Table and Toolbar'
navbuttonpress = client->_event( 'BACK' )

View File

@ -184,7 +184,7 @@ CLASS z2ui5_cl_app_demo_07 IMPLEMENTATION.
METHOD ui5_render_view_main.
DATA(page) = z2ui5_cl_xml_view_helper=>factory( )->page(
DATA(page) = z2ui5_cl_xml_view_helper=>factory( )->shell( )->page(
title = 'abap2UI5 - File Upload/Download'
navbuttonpress = client->_event( 'BACK' )
shownavbutton = abap_true

View File

@ -52,7 +52,7 @@ CLASS Z2UI5_CL_APP_DEMO_08 IMPLEMENTATION.
ENDCASE.
DATA(page) = z2ui5_cl_xml_view_helper=>factory(
DATA(page) = z2ui5_cl_xml_view_helper=>factory( )->shell(
)->page(
title = 'abap2UI5 - Messages'
navbuttonpress = client->_event( 'BACK' )

View File

@ -159,7 +159,7 @@ CLASS Z2UI5_CL_APP_DEMO_13 IMPLEMENTATION.
METHOD z2ui5_on_render_view_edit.
DATA(page) = z2ui5_cl_xml_view_helper=>factory(
DATA(page) = z2ui5_cl_xml_view_helper=>factory( )->shell(
)->page(
title = 'abap2ui5 - Table Maintenance'
navbuttonpress = client->_event( 'BACK' )
@ -247,7 +247,7 @@ CLASS Z2UI5_CL_APP_DEMO_13 IMPLEMENTATION.
METHOD z2ui5_on_render_view_export.
DATA(page) = z2ui5_cl_xml_view_helper=>factory(
DATA(page) = z2ui5_cl_xml_view_helper=>factory( )->shell(
)->page(
title = 'abap2ui5 - Table Maintenance'
navbuttonpress = client->_event( 'BACK' )
@ -311,7 +311,7 @@ CLASS Z2UI5_CL_APP_DEMO_13 IMPLEMENTATION.
METHOD z2ui5_on_render_view_import.
DATA(page) = z2ui5_cl_xml_view_helper=>factory(
DATA(page) = z2ui5_cl_xml_view_helper=>factory( )->shell(
)->page(
title = 'abap2UI5 - Table Maintenance'
navbuttonpress = client->_event( 'BACK' )

View File

@ -51,7 +51,7 @@ CLASS Z2UI5_CL_APP_DEMO_14 IMPLEMENTATION.
client->nav_app_leave( client->get_app( client->get( )-id_prev_app_stack ) ).
ENDCASE.
DATA(page) = z2ui5_cl_xml_view_helper=>factory( )->page(
DATA(page) = z2ui5_cl_xml_view_helper=>factory( )->shell( )->page(
title = 'abap2UI5 - MIME Editor'
navbuttonpress = client->_event( 'BACK' )
shownavbutton = abap_true

View File

@ -31,9 +31,10 @@ CLASS Z2UI5_CL_APP_DEMO_15 IMPLEMENTATION.
CASE client->get( )-event.
WHEN 'BACK'.
client->nav_app_leave( client->get_app( client->get( )-id_prev_app_stack ) ).
ENDCASE.
data(view) = z2ui5_cl_xml_view_helper=>factory(
data(view) = z2ui5_cl_xml_view_helper=>factory( )->shell(
)->page(
title = 'abap2UI5 - Formatted Text'
navbuttonpress = client->_event( 'BACK' )

View File

@ -364,7 +364,7 @@ CLASS Z2UI5_CL_APP_DEMO_16 IMPLEMENTATION.
ENDCASE.
DATA(container) = z2ui5_cl_xml_view_helper=>factory(
DATA(container) = z2ui5_cl_xml_view_helper=>factory( )->shell(
)->page(
title = 'abap2UI5 - Visualization'
navbuttonpress = client->_event( 'BACK' )

View File

@ -124,7 +124,7 @@ CLASS z2ui5_cl_app_demo_18 IMPLEMENTATION.
METHOD z2ui5_render_view_main.
result = z2ui5_cl_xml_view_helper=>factory(
result = z2ui5_cl_xml_view_helper=>factory( )->shell(
)->page(
title = 'abap2UI5 - Template'
navbuttonpress = client->_event( 'BACK' )

View File

@ -4,17 +4,21 @@ CLASS z2ui5_cl_app_demo_28 DEFINITION PUBLIC.
INTERFACES z2ui5_if_app.
DATA product TYPE string.
DATA quantity TYPE i.
* DATA product TYPE string.
* DATA quantity TYPE i.
*
* DATA input21 TYPE string.
* DATA input22 TYPE string.
* DATA input41 TYPE string.
DATA mt_draft TYPE REF TO data.
DATA mv_test TYPE REF TO data.
DATA input21 TYPE string.
DATA input22 TYPE string.
DATA input41 TYPE string.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
DATA:
BEGIN OF app,
client TYPE REF TO z2ui5_if_client,
check_initialized TYPE abap_bool,
view_main TYPE string,
view_popup TYPE string,
@ -31,12 +35,12 @@ ENDCLASS.
CLASS Z2UI5_CL_APP_DEMO_28 IMPLEMENTATION.
CLASS z2ui5_cl_app_demo_28 IMPLEMENTATION.
METHOD z2ui5_if_app~controller.
app-client = client.
me->client = client.
app-s_get = client->get( ).
app-view_popup = ``.
@ -63,19 +67,19 @@ CLASS Z2UI5_CL_APP_DEMO_28 IMPLEMENTATION.
CASE app-s_get-event.
WHEN 'BUTTON_POST'.
app-client->popup_message_toast( |{ product } { quantity } - send to the server| ).
* client->popup_message_toast( |{ product } { quantity } - send to the server| ).
app-view_popup = 'POPUP_CONFIRM'.
WHEN 'BUTTON_CONFIRM'.
app-client->popup_message_toast( |confirm| ).
client->popup_message_toast( |confirm| ).
app-view_popup = ''.
WHEN 'BUTTON_CANCEL'.
app-client->popup_message_toast( |cancel| ).
client->popup_message_toast( |cancel| ).
app-view_popup = ''.
WHEN 'BACK'.
app-client->nav_app_leave( app-client->get_app( app-s_get-id_prev_app_stack ) ).
client->nav_app_leave( client->get_app( app-s_get-id_prev_app_stack ) ).
ENDCASE.
@ -84,53 +88,75 @@ CLASS Z2UI5_CL_APP_DEMO_28 IMPLEMENTATION.
METHOD z2ui5_on_init.
product = 'tomato'.
quantity = '500'.
* product = 'tomato'.
* quantity = '500'.
app-view_main = 'VIEW_MAIN'.
input41 = 'faasdfdfsaVIp'.
* input41 = 'faasdfdfsaVIp'.
*
* input21 = '40'.
* input22 = '40'.
input21 = '40'.
input22 = '40'.
CREATE DATA mv_test TYPE string.
mv_test->* = 'test'.
CREATE DATA mt_draft TYPE STANDARD TABLE OF z2ui5_t_draft.
SELECT FROM z2ui5_t_draft
FIELDS uuid, uuid_prev
order by uuid
INTO TABLE @DATA(lt_data)
UP TO 10 ROWS
.
mt_draft->* = CORRESPONDING #( lt_data ).
ENDMETHOD.
METHOD z2ui5_on_render.
*
* app-s_next-xml_main = z2ui5_cl_xml_view_helper=>factory(
* )->page(
* title = 'abap2UI5 - Binding Syntax'
* navbuttonpress = app-client->_event( 'BACK' )
* shownavbutton = abap_true
* )->header_content(
* )->link(
* text = 'Source_Code'
* href = app-client->get( )-url_source_code
* )->get_parent(
* )->simple_form( title = 'Binding Syntax' editable = abap_true
* )->content( 'form'
* )->title( 'Templating'
* )->label( 'Documentation'
* )->link(
* text = 'Templating'
* href = 'https://sapui5.hana.ondemand.com/#/entity/sap.ui.core.mvc.XMLView'
* )->label( 'when both values are equal second form is displayed'
* )->input( app-client->_bind( input21 )
* )->input( app-client->_bind( input22 )
*
* )->get_parent( )->get_parent(
* " )->template_if( test = '{= $' && app-client->_bind( input21 ) && ` === $` && app-client->_bind( input22 ) && ` } `
* )->template_if( test = '{= ${meta>/oUpdate/INPUT21} === ${meta>/oUpdate/INPUT22} } '
* )->simple_form( title = 'Binding Syntax' editable = abap_true
* )->content( 'form'
* )->title( 'Expression Binding'
* )->label( 'templating'
* )->input( app-client->_bind( input21 )
* )->input( app-client->_bind( input22 )
*
* )->get_root( )->xml_get( ).
DATA(lo_view) = z2ui5_cl_xml_view_helper=>factory( )->shell( )->page(
title = 'abap2UI5 - First Example'
navbuttonpress = client->_event( 'BACK' )
shownavbutton = abap_true
)->header_content(
)->link(
text = 'Source_Code'
href = z2ui5_cl_xml_view_helper=>hlp_get_source_code_url( app = me get = client->get( ) )
)->get_parent(
)->simple_form( title = 'Form Title' editable = abap_true
)->content( 'form'
)->title( 'Input'
)->label( 'quantity' ).
lo_view->input( client->_bind( val = mv_test->* check_gen_data = abap_true ) ).
lo_view->button(
text = 'post'
press = client->_event( 'BUTTON_POST' )
).
data(tab) = lo_view->get_parent( )->get_parent( )->simple_form( title = 'Table' editable = abap_true
)->content( 'form' )->table(
items = client->_bind( val = mt_draft->* check_gen_data = abap_true )
).
tab->columns(
)->column(
)->text( 'UUID' )->get_parent(
)->column(
)->text( 'UUID_PREV' ).
tab->items( )->column_list_item(
)->cells(
)->input( '{UUID}'
)->input( '{UUID_PREV}'
).
app-s_next-xml_main = lo_view->get_root( )->xml_get( ).
ENDMETHOD.
ENDCLASS.

View File

@ -5,7 +5,7 @@
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_APP_DEMO_28</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>templ - ...</DESCRIPT>
<DESCRIPT>demo - table maintenance 2</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>

View File

@ -70,16 +70,8 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION.
METHOD main_index_html.
client-t_param = VALUE #( LET tab = client-t_param IN FOR row IN tab
( name = to_upper( row-name ) value = to_upper( row-value ) ) ).
DATA(lv_url) = client-t_header[ name = '~path' ]-value.
TRY.
DATA(lv_app) = client-t_param[ name = 'APP' ]-value.
CATCH cx_root.
ENDTRY.
DATA(lv_url) = _=>get_header_val( '~path' ).
DATA(lv_app) = _=>get_param_val( 'app' ).
z2ui5_lcl_db=>cleanup( ).
r_result = `<html>` && |\n| &&
@ -103,8 +95,6 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION.
`</body>` && |\n| &&
`</html>` && |\n|.
r_result = r_result && `<script id="z2ui5">` && |\n| &&
` sap.ui.getCore().attachInit(function () {` && |\n| &&
` "use strict";` && |\n| &&
@ -245,7 +235,6 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION.
` definition: sap.z2ui5.oResponse.vView,` && |\n| &&
` }).then(oView => {` && |\n| &&
` oView.setModel(oModel);` && |\n| &&
` debugger;` && |\n| &&
` oView.placeAt("content");` && |\n| &&
` this.oView = oView;` && |\n| &&
` sap.z2ui5.oView = oView;` && |\n| &&
@ -270,7 +259,6 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION.
` var xml = '<mvc:View controllerName="z2ui5_controller" xmlns:mvc="sap.ui.core.mvc" />';` && |\n| &&
` if (xml == '') { xml = '&lt;mvc:View controllerName="z2ui5_controller" xmlns:mvc="sap.ui.core.mvc" />' };` && |\n| &&
|\n| &&
` debugger;` && |\n| &&
` jQuery.sap.require("sap.ui.core.Fragment");` && |\n| &&
` jQuery.sap.require("sap.m.MessageToast");` && |\n| &&
` jQuery.sap.require("sap.m.MessageBox");` && |\n| &&
@ -282,4 +270,5 @@ CLASS z2ui5_cl_http_handler IMPLEMENTATION.
`</html>`.
ENDMETHOD.
ENDCLASS.

View File

@ -8,6 +8,9 @@ CLASS z2ui5_lcl_utility DEFINITION INHERITING FROM cx_no_check.
type_kind TYPE string,
bind_type TYPE string,
data_stringify TYPE string,
gen_type_kind TYPE string,
gen_type TYPE string,
gen_kind TYPE string,
END OF ty_attri.
TYPES ty_T_attri TYPE STANDARD TABLE OF ty_attri WITH EMPTY KEY.
@ -43,6 +46,18 @@ CLASS z2ui5_lcl_utility DEFINITION INHERITING FROM cx_no_check.
RETURNING
VALUE(result) TYPE string.
CLASS-METHODS get_header_val
IMPORTING
v TYPE clike
RETURNING
VALUE(result) TYPE z2ui5_if_client=>ty_s_name_value-value.
CLASS-METHODS get_param_val
IMPORTING
v TYPE clike
RETURNING
VALUE(result) TYPE z2ui5_if_client=>ty_s_name_value-value.
CLASS-METHODS get_uuid
RETURNING
VALUE(result) TYPE string.
@ -322,6 +337,7 @@ CLASS z2ui5_lcl_utility IMPLEMENTATION.
ENDTRY.
ENDMETHOD.
METHOD get_uuid_session.
mv_counter = mv_counter + 1.
@ -329,6 +345,25 @@ CLASS z2ui5_lcl_utility IMPLEMENTATION.
ENDMETHOD.
METHOD get_header_val.
result = z2ui5_cl_http_handler=>client-t_header[ name = v ]-value.
ENDMETHOD.
METHOD get_param_val.
DATA(lt_param) = VALUE z2ui5_if_client=>ty_t_name_value( LET tab = z2ui5_cl_http_handler=>client-t_param IN FOR row IN tab
( name = to_upper( row-name ) value = to_upper( row-value ) ) ).
TRY.
result = lt_param[ name = get_trim_upper( v ) ]-value.
CATCH cx_root.
ENDTRY.
ENDMETHOD.
METHOD get_attri_name_by_ref.
CONSTANTS c_prefix TYPE string VALUE `IO_APP->`.
@ -453,17 +488,16 @@ CLASS z2ui5_lcl_utility IMPLEMENTATION.
ASSIGN ir_tab_from->* TO <lt_from>.
raise( when = xsdbool( sy-subrc <> 0 ) ).
READ TABLE ct_to INDEX 1 ASSIGNING FIELD-SYMBOL(<back>).
IF sy-subrc <> 0.
RETURN.
ENDIF.
DATA(lt_components) = CAST cl_abap_structdescr( cl_abap_structdescr=>describe_by_data( <back> ) )->get_components( ).
CLEAR ct_to.
DATA(lo_tab) = CAST cl_abap_tabledescr( cl_abap_datadescr=>describe_by_data( ct_to ) ).
DATA(lo_struc) = CAST cl_abap_structdescr( lo_tab->get_table_line_type( ) ).
DATA(lt_components) = lo_struc->get_components( ).
LOOP AT <lt_from> INTO DATA(lr_from).
ASSIGN ct_to[ sy-tabix ] TO <back>.
raise( when = xsdbool( sy-subrc <> 0 ) ).
DATA lr_row TYPE REF TO data.
CREATE DATA lr_row TYPE HANDLE lo_struc.
ASSIGN lr_row->* TO FIELD-SYMBOL(<back>).
ASSIGN lr_from->* TO FIELD-SYMBOL(<row_ui5>).
raise( when = xsdbool( sy-subrc <> 0 ) ).
@ -488,6 +522,7 @@ CLASS z2ui5_lcl_utility IMPLEMENTATION.
ENDIF.
ENDLOOP.
INSERT lr_row->* INTO TABLE ct_to.
ENDLOOP.
ENDMETHOD.
@ -918,10 +953,11 @@ CLASS z2ui5_lcl_system_runtime DEFINITION.
METHODS _create_binding
IMPORTING
value TYPE data
type TYPE string DEFAULT cs_bind_type-two_way
value TYPE data
type TYPE string DEFAULT cs_bind_type-two_way
check_gen_data TYPE abap_bool OPTIONAL
RETURNING
VALUE(result) TYPE string.
VALUE(result) TYPE string.
CLASS-METHODS set_app_start
RETURNING
@ -1280,7 +1316,17 @@ CLASS z2ui5_lcl_db IMPLEMENTATION.
METHOD create.
" CAST z2ui5_if_app( db-o_app )->id = id.
DATA(lo_app) = CAST object( db-o_app ) ##NEEDED.
LOOP AT db-t_attri REFERENCE INTO DATA(lr_attri) WHERE gen_type IS NOT INITIAL.
FIELD-SYMBOLS <attribute> TYPE any.
DATA(lv_name) = 'LO_APP->' && to_upper( lr_attri->name ).
ASSIGN (lv_name) TO <attribute>.
DATA(lr_ref2) = REF #( <attribute> ).
CLEAR lr_ref2->*.
ENDLOOP.
DATA(ls_db) = VALUE z2ui5_t_draft(
uuid = id
@ -1457,6 +1503,30 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
EXPORTING ir_tab_from = lo_model->get_attribute( lr_attri->name )->mr_actual
CHANGING ct_to = <attribute> ).
WHEN OTHERS.
CASE lr_attri->gen_kind.
WHEN cl_abap_datadescr=>kind_elem.
CREATE DATA <attribute> TYPE (lr_attri->gen_type).
lv_value = lo_model->get_attribute( lr_attri->name )->get_val( ).
assign <attribute>->* to FIELD-SYMBOL(<attribute2>).
<attribute2> = lv_value.
WHEN cl_abap_datadescr=>kind_table.
DATA(lo_struc) = cl_abap_structdescr=>describe_by_name( lr_attri->gen_type ).
DATA(lo_tab) = cl_abap_tabledescr=>create(
p_line_type = CAST #( lo_struc )
p_table_kind = cl_abap_tabledescr=>tablekind_std
p_unique = abap_false
).
CREATE DATA <attribute> TYPE HANDLE lo_tab.
assign <attribute>->* to <attribute2>.
_=>trans_ref_tab_2_tab(
EXPORTING ir_tab_from = lo_model->get_attribute( lr_attri->name )->mr_actual
CHANGING ct_to = <attribute2> ).
"(lr_attri->gen_type).
ENDCASE.
ENDCASE.
ENDLOOP.
@ -1475,7 +1545,7 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
result->ms_db-id = _=>get_uuid( ).
TRY.
DATA(lv_classname) = to_upper( z2ui5_cl_http_handler=>client-t_param[ name = `app` ]-value ).
DATA(lv_classname) = _=>get_trim_upper( z2ui5_cl_http_handler=>client-t_param[ name = `app` ]-value ).
_=>raise( when = xsdbool( lv_classname = `` ) ).
CATCH cx_root.
result = result->set_app_system( ).
@ -1559,7 +1629,32 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
ASSIGN (lv_name) TO <attribute>.
_=>raise( when = xsdbool( sy-subrc <> 0 ) v = `Attribute in App with name ` && lv_name && ` not found` ).
DATA(lr_ref) = REF #( <attribute> ).
DATA(lr_ref2) = REF #( <attribute> ).
IF check_gen_data = abap_true.
TRY.
" DATA(lo_refdescr) = CAST cl_abap_refdescr( cl_abap_datadescr=>describe_by_data( lr_ref2->* ) ).
" DATA lr_ref TYPE REF TO data.
data(lr_ref) = cast data( lr_ref2->* ).
IF lr_attri->gen_type IS INITIAL.
DATA(lo_datadescr) = cl_abap_datadescr=>describe_by_data( lr_ref->* ).
lr_attri->gen_type_kind = lo_datadescr->type_kind.
lr_attri->gen_kind = lo_datadescr->kind.
CASE lo_datadescr->kind.
WHEN lo_datadescr->kind_elem.
SPLIT lo_datadescr->absolute_name AT '=' INTO DATA(lv_dummy) lr_attri->gen_type.
WHEN lo_datadescr->kind_table.
DATA(lo_tab) = CAST cl_abap_tabledescr( lo_datadescr ).
DATA(lo_struc) = lo_tab->get_table_line_type( ).
SPLIT lo_struc->absolute_name AT '=' INTO lv_dummy lr_attri->gen_type.
ENDCASE.
ENDIF.
CATCH cx_root.
CONTINUE.
ENDTRY.
ELSE.
lr_ref = lr_ref2.
ENDIF.
IF lr_in = lr_ref.
IF lr_attri->bind_type IS NOT INITIAL AND lr_attri->bind_type <> type.
@ -1665,6 +1760,20 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
v = _=>trans_any_2_json( <attribute> )
apos_active = abap_false ).
WHEN OTHERS.
CASE lr_attri->gen_kind.
WHEN cl_abap_datadescr=>kind_elem.
lo_actual->add_attribute( n = lr_attri->name
v = _=>get_abap_2_json( <attribute>->* )
apos_active = abap_false ).
WHEN cl_abap_datadescr=>kind_table.
lo_actual->add_attribute( n = lr_attri->name
v = _=>trans_any_2_json( <attribute>->* )
apos_active = abap_false ).
ENDCASE.
ENDCASE.
ENDLOOP.
@ -1747,7 +1856,11 @@ CLASS z2ui5_lcl_if_client IMPLEMENTATION.
METHOD z2ui5_if_client~_bind.
result = mo_runtime->_create_binding( value = val type = z2ui5_lcl_system_runtime=>cs_bind_type-two_way ).
result = mo_runtime->_create_binding(
value = val
type = z2ui5_lcl_system_runtime=>cs_bind_type-two_way
check_gen_data = check_gen_data
).
IF path = abap_false.
result = `{` && result && `}`.
ENDIF.

View File

@ -70,8 +70,9 @@ INTERFACE z2ui5_if_client
METHODS _bind
IMPORTING
val TYPE data
path TYPE abap_boolean DEFAULT abap_false
val TYPE data
path TYPE abap_boolean DEFAULT abap_false
check_gen_data type abap_bool OPTIONAL
RETURNING
VALUE(result) TYPE string.