F4-help, formatted text, selection modes (#110)

* F4-help, formatted text, selection modes

* Update abaplint.jsonc

* abaplint findings
This commit is contained in:
oblomov 2023-03-19 11:41:23 +01:00
parent 0fa83262f8
commit a4f89a1b00
11 changed files with 870 additions and 251 deletions

View File

@ -184,7 +184,7 @@
"omit_receiving": true, "omit_receiving": true,
"parser_702_chaining": true, "parser_702_chaining": true,
"parser_error": true, "parser_error": true,
"parser_missing_space": true, "parser_missing_space": false,
"pragma_style": true, "pragma_style": true,
"prefer_corresponding": true, "prefer_corresponding": true,
"prefer_inline": { "prefer_inline": {

View File

@ -21,54 +21,12 @@ CLASS z2ui5_cl_app_demo_00 IMPLEMENTATION.
CASE client->get( )-event. CASE client->get( )-event.
WHEN '0101'.
client->nav_app_call( NEW z2ui5_cl_app_demo_01( ) ).
WHEN '0102'.
client->nav_app_call( NEW z2ui5_cl_app_demo_04( ) ).
WHEN '0103'.
client->nav_app_call( NEW z2ui5_cl_app_demo_08( ) ).
WHEN '0104'.
client->nav_app_call( NEW z2ui5_cl_app_demo_10( ) ).
WHEN '0201'.
client->nav_app_call( NEW z2ui5_cl_app_demo_02( ) ).
WHEN '0202'.
client->nav_app_call( NEW z2ui5_cl_app_demo_05( ) ).
WHEN '0301'.
client->nav_app_call( NEW z2ui5_cl_app_demo_03( ) ).
WHEN '0302'.
client->nav_app_call( NEW z2ui5_cl_app_demo_19( ) ).
WHEN '0303'.
client->nav_app_call( NEW z2ui5_cl_app_demo_06( ) ).
WHEN '0304'.
client->nav_app_call( NEW z2ui5_cl_app_demo_11( ) ).
WHEN '0100'.
client->nav_app_call( NEW z2ui5_cl_app_demo_22( ) ).
WHEN '2400'.
client->nav_app_call( NEW z2ui5_cl_app_demo_24( ) ).
WHEN 'MIME_EDITOR'.
client->nav_app_call( NEW z2ui5_cl_app_demo_14( ) ).
WHEN 'TABLE_MAINTENANCE'.
client->nav_app_call( NEW z2ui5_cl_app_demo_13( ) ).
WHEN 'BACK'. WHEN 'BACK'.
client->nav_app_leave( client->get( )-id_prev_app_stack ). client->nav_app_leave( client->get( )-id_prev_app_stack ).
WHEN OTHERS. WHEN OTHERS.
try. try.
DATA(lv_classname) = client->get( )-event. DATA(lv_classname) = to_upper( client->get( )-event ).
IF lv_classname(5) <> 'Z2UI5'. IF lv_classname(5) <> 'Z2UI5'.
RETURN. RETURN.
ENDIF. ENDIF.
@ -97,30 +55,30 @@ CLASS z2ui5_cl_app_demo_00 IMPLEMENTATION.
DATA(grid) = page->grid( default_span = 'L3 M6 S12' )->content( 'l' ). DATA(grid) = page->grid( default_span = 'L3 M6 S12' )->content( 'l' ).
grid->simple_form( 'HowTo - General' )->content( 'f' grid->simple_form( 'HowTo - General' )->content( 'f'
)->button( text = 'Communication & Data Binding' press = view->_event( '0101' ) )->button( text = 'Communication & Data Binding' press = view->_event( 'z2ui5_cl_app_demo_01' )
)->button( text = 'Events, Error & Change View' press = view->_event( '0102' ) )->button( text = 'Events, Error & Change View' press = view->_event( 'z2ui5_cl_app_demo_04' )
)->button( text = 'Flow Logic' press = view->_event( '2400' ) )->button( text = 'Flow Logic' press = view->_event( 'z2ui5_cl_app_demo_24' )
)->button( text = 'Messages (Toast, Box, Strip)' press = view->_event( '0103' ) )->button( text = 'Messages (Toast, Box, Strip)' press = view->_event( 'z2ui5_cl_app_demo_08' )
). ).
grid->simple_form( 'HowTo - General II' )->content( 'f' grid->simple_form( 'HowTo - General II' )->content( 'f'
)->button( text = 'Layout (Header, Footer, Grid)' press = view->_event( '0104' ) )->button( text = 'Layout (Header, Footer, Grid)' press = view->_event( 'z2ui5_cl_app_demo_10' )
)->button( text = 'Scrolling & Focus' press = view->_event( '0100' ) )->button( text = 'Scrolling & Focus' press = view->_event( 'z2ui5_cl_app_demo_22' )
)->button( text = 'Popups' press = view->_event( 'Z2UI5_CL_APP_DEMO_21' ) )->button( text = 'Popups' press = view->_event( 'Z2UI5_CL_APP_DEMO_21' )
" )->button( text = 'Popups II (F4 Help)' press = view->_event( '0101' ) " )->button( text = 'Popups II (F4 Help)' press = view->_event( '0101' )
). ).
grid->simple_form( 'HowTo - Selection-Screen' )->content( 'f' grid->simple_form( 'HowTo - Selection-Screen' )->content( 'f'
)->button( text = 'Basic' press = view->_event( '0201' ) )->button( text = 'Basic' press = view->_event( 'z2ui5_cl_app_demo_02' )
)->button( text = 'More Controls' press = view->_event( '0202' ) ). )->button( text = 'More Controls' press = view->_event( 'z2ui5_cl_app_demo_05' )
)->button( text = 'Formatted Text' press = view->_event( 'Z2UI5_CL_APP_DEMO_15' )
)->button( text = 'F4-Value-Help' press = view->_event( 'Z2UI5_CL_APP_DEMO_09' ) ).
grid->simple_form( 'HowTo - Tables' )->content( 'f' grid->simple_form( 'HowTo - Tables' )->content( 'f'
)->button( text = 'List' press = view->_event( '0301' ) )->button( text = 'List' press = view->_event( 'z2ui5_cl_app_demo_03' )
)->button( text = 'Toolbar, Scroll Container' press = view->_event( '0303' ) )->button( text = 'Toolbar, Scroll Container' press = view->_event( 'z2ui5_cl_app_demo_06' )
" )->button( text = 'Selection Modes' press = view->_event( '0302' ) " )->button( text = 'Selection Modes' press = view->_event( 'z2ui5_cl_app_demo_19' )
)->button( text = 'Editable' press = view->_event( '0304' ) )->button( text = 'Editable' press = view->_event( 'z2ui5_cl_app_demo_11' )
" )->button( text = 'Cell changes' press = view->_event( '0304' )
). ).
grid = page->grid( default_span = 'XL9 L9 M12 S12' )->content( 'l' ). grid = page->grid( default_span = 'XL9 L9 M12 S12' )->content( 'l' ).

View File

@ -0,0 +1,329 @@
CLASS z2ui5_cl_app_demo_09 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
DATA:
BEGIN OF screen,
color_01 TYPE string,
color_02 TYPE string,
color_03 TYPE string,
city TYPE string,
name TYPE string,
lastname TYPE string,
quantity TYPE string,
unit TYPE string,
END OF screen.
TYPES:
BEGIN OF s_suggestion_items,
selkz TYPE abap_bool,
value TYPE string,
descr TYPE string,
END OF s_suggestion_items.
DATA mt_suggestion TYPE STANDARD TABLE OF s_suggestion_items WITH EMPTY KEY.
DATA mt_suggestion_sel TYPE STANDARD TABLE OF s_suggestion_items WITH EMPTY KEY.
TYPES:
BEGIN OF s_suggestion_items_city,
value TYPE string,
descr TYPE string,
END OF s_suggestion_items_city.
DATA mt_suggestion_city TYPE STANDARD TABLE OF s_suggestion_items_city WITH EMPTY KEY.
TYPES:
BEGIN OF s_employee,
selkz TYPE abap_bool,
city TYPE string,
nr TYPE string,
name TYPE string,
lastname TYPE string,
END OF s_employee.
DATA mt_employees_sel TYPE STANDARD TABLE OF s_employee WITH EMPTY KEY.
DATA mt_employees TYPE STANDARD TABLE OF s_employee WITH EMPTY KEY.
PROTECTED SECTION.
METHODS z2ui5_on_rendering
IMPORTING
client TYPE REF TO z2ui5_if_client.
METHODS z2ui5_on_event
IMPORTING
client TYPE REF TO z2ui5_if_client.
METHODS z2ui5_on_init.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_app_demo_09 IMPLEMENTATION.
METHOD z2ui5_if_app~controller.
CASE client->get( )-lifecycle_method.
WHEN client->cs-lifecycle_method-on_init.
z2ui5_on_init( ).
WHEN client->cs-lifecycle_method-on_event.
z2ui5_on_event( client ).
WHEN client->cs-lifecycle_method-on_rendering.
z2ui5_on_rendering( client ).
ENDCASE.
ENDMETHOD.
METHOD z2ui5_on_rendering.
DATA(view) = client->factory_view( 'MAIN' ).
DATA(page) = view->page( title = 'abap2UI5 - Value Help Examples' navbuttontap = view->_event( 'BACK' ) ).
page->header_content( )->link( text = 'Go to Source Code' href = client->get( )-s_request-url_source_code ).
DATA(grid) = page->grid( 'XL12 L12 M12 S12' )->content( 'l' ).
DATA(form) = grid->simple_form( 'Input with Value Help' )->content( 'f' ).
form->label( 'Input with sugestion items'
)->input(
value = view->_bind( screen-color_01 )
placeholder = 'fill in your favorite colour'
suggestionitems = view->_bind_one_way( mt_suggestion )
showsuggestion = abap_true )->get(
)->suggestion_items( )->get(
)->list_item( text = '{VALUE}' additionalText = '{DESCR}' ).
form->label( 'Input only numbers allowed'
)->input(
value = view->_bind( screen-quantity )
type = 'Number'
placeholder = 'quantity' ).
form->label( 'Input with F4'
)->input(
value = view->_bind( screen-color_02 )
placeholder = 'fill in your favorite colour'
showvaluehelp = abap_true
valuehelprequest = view->_event( 'POPUP_TABLE_F4' ) ).
form->label( 'Custom F4 Popup'
)->input(
value = view->_bind( screen-name )
placeholder = 'name'
showvaluehelp = abap_true
valuehelprequest = view->_event( 'POPUP_TABLE_F4_CUSTOM' )
)->input(
value = view->_bind( screen-lastname )
placeholder = 'lastname'
showvaluehelp = abap_true
valuehelprequest = view->_event( 'POPUP_TABLE_F4_CUSTOM' ) ).
page->footer( )->overflow_toolbar(
)->toolbar_spacer(
)->button(
text = 'Clear'
press = view->_event( 'BUTTON_CLEAR' )
type = 'Reject'
enabled = abap_false
icon = 'sap-icon://delete'
)->button(
text = 'Send to Server'
press = view->_event( 'BUTTON_SEND' )
enabled = abap_false
type = 'Success' ).
view = client->factory_view( 'POPUP_TABLE_F4' ).
DATA(popup) = view->dialog( title = 'abap2UI5 - F4 Value Help' ).
DATA(tab) = popup->table(
mode = 'SingleSelectLeft'
items = view->_bind( mt_suggestion_sel ) ).
tab->columns(
)->column( width = '20rem' )->text( 'Color' )->get_parent(
)->column( )->text( 'Description' ).
tab->items( )->column_list_item( selected = '{SELKZ}' )->cells(
)->text( '{VALUE}'
)->text( '{DESCR}' ).
popup->footer( )->overflow_toolbar(
)->toolbar_spacer(
)->button(
text = 'continue'
press = view->_event( 'POPUP_TABLE_F4_CONTINUE' )
type = 'Emphasized' ).
view = client->factory_view( 'POPUP_TABLE_F4_CUSTOM' ).
popup = view->dialog( title = 'abap2UI5 - F4 Value Help' ).
popup->simple_form(
)->label( 'Location'
)->input(
value = view->_bind( screen-city )
suggestionitems = view->_bind_one_way( mt_suggestion_city )
showsuggestion = abap_true
)->get(
)->suggestion_items( )->get(
)->list_item( text = '{VALUE}' additionalText = '{DESCR}'
)->get_parent( )->get_parent(
)->button( text = 'search...' press = view->_event( 'SEARCH' )
).
tab = popup->table(
headertext = 'Employees'
mode = 'SingleSelectLeft'
items = view->_bind( mt_employees_sel ) ).
tab->columns(
)->column( width = '10rem' )->text( 'City' )->get_parent(
)->column( width = '10rem' )->text( 'Nr' )->get_parent(
)->column( width = '15rem' )->text( 'Name' )->get_parent(
)->column( width = '30rem' )->text( 'Lastname' )->get_parent( ).
tab->items( )->column_list_item( selected = '{SELKZ}' )->cells(
)->text( '{CITY}'
)->text( '{NR}'
)->text( '{NAME}'
)->text( '{LASTNAME}' ).
popup->footer( )->overflow_toolbar(
)->toolbar_spacer(
)->button(
text = 'continue'
press = view->_event( 'POPUP_TABLE_F4_CUSTOM_CONTINUE' )
type = 'Emphasized' ).
ENDMETHOD.
METHOD z2ui5_on_event.
CASE client->get( )-event.
WHEN 'POPUP_TABLE_F4'.
mt_suggestion_sel = mt_suggestion.
client->view_popup( 'POPUP_TABLE_F4' ).
WHEN 'POPUP_TABLE_F4_CUSTOM'.
mt_employees_sel = VALUE #( ).
mt_employees_sel = VALUE #( ).
client->view_popup( 'POPUP_TABLE_F4_CUSTOM' ).
WHEN 'SEARCH'.
mt_employees_sel = mt_employees.
IF screen-city IS NOT INITIAL.
DELETE mt_employees_sel WHERE city <> screen-city.
ENDIF.
client->view_popup( 'POPUP_TABLE_F4_CUSTOM' ).
WHEN 'POPUP_TABLE_F4_CUSTOM_CONTINUE'.
DELETE mt_employees_sel WHERE selkz = abap_false.
IF lines( mt_employees_sel ) = 1.
screen-name = mt_employees_sel[ 1 ]-name.
screen-lastname = mt_employees_sel[ 1 ]-lastname.
client->popup_message_toast( 'f4 value selected' ).
ENDIF.
WHEN 'POPUP_TABLE_F4_CONTINUE'.
DELETE mt_suggestion_sel WHERE selkz = abap_false.
IF lines( mt_suggestion_sel ) = 1.
screen-color_02 = mt_suggestion_sel[ 1 ]-value.
client->popup_message_toast( 'f4 value selected' ).
ENDIF.
WHEN 'BUTTON_SEND'.
client->popup_message_box( 'success - values send to the server' ).
WHEN 'BUTTON_CLEAR'.
CLEAR screen.
client->popup_message_toast( 'View initialized' ).
WHEN 'BACK'.
client->nav_app_leave( client->get( )-id_prev_app_stack ).
ENDCASE.
client->view_show( 'MAIN' ).
ENDMETHOD.
METHOD z2ui5_on_init.
mt_suggestion = VALUE #(
( descr = 'this is the color Green' value = 'GREEN' )
( descr = 'this is the color Blue' value = 'BLUE' )
( descr = 'this is the color Black' value = 'BLACK' )
( descr = 'this is the color Grey' value = 'GREY' )
( descr = 'this is the color Blue2' value = 'BLUE2' )
( descr = 'this is the color Blue3' value = 'BLUE3' ) ).
mt_suggestion_city = VALUE #(
( value = 'London' descr = 'London' )
( value = 'Paris' descr = 'Paris' )
( value = 'Rome' descr = 'Rome' ) ).
mt_employees = VALUE #(
( city = 'London' name = 'Tom' lastname = 'lastname1' nr = '00001' )
( city = 'London' name = 'Tom2' lastname = 'lastname2' nr = '00002' )
( city = 'London' name = 'Tom3' lastname = 'lastname3' nr = '00003' )
( city = 'London' name = 'Tom4' lastname = 'lastname4' nr = '00004' )
( city = 'Rome' name = 'Michaela1' lastname = 'lastname5' nr = '00005' )
( city = 'Rome' name = 'Michaela2' lastname = 'lastname6' nr = '00006' )
( city = 'Rome' name = 'Michaela3' lastname = 'lastname7' nr = '00007' )
( city = 'Rome' name = 'Michaela4' lastname = 'lastname8' nr = '00008' )
( city = 'Paris' name = 'Hermine1' lastname = 'lastname9' nr = '00009' )
( city = 'Paris' name = 'Hermine2' lastname = 'lastname10' nr = '00010' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' )
( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) ).
ENDMETHOD.
ENDCLASS.

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_APP_DEMO_09</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>selscreen - f4 help</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -0,0 +1,54 @@
CLASS z2ui5_cl_app_demo_15 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
DATA mv_html_text TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_app_demo_15 IMPLEMENTATION.
METHOD z2ui5_if_app~controller.
CASE client->get( )-lifecycle_method.
WHEN client->cs-lifecycle_method-on_init.
mv_html_text = `<h3>subheader</h3><p>link: <a href="https://www.sap.com" style="color:green; font-weight:600;">link to sap.com</a> - links open in ` &&
`a new window.</p><p>paragraph: <strong>strong</strong> and <em>emphasized</em>.</p><p>list:</p><ul` &&
`><li>list item 1</li><li>list item 2<ul><li>sub item 1</li><li>sub item 2</li></ul></li></ul><p>pre:</p><pre>abc def ghi</pre><p>code: <code>var el = document.getElementById("myId");</code></p><p>cite: <cite>a reference to a source</cite></p>` &&
`<dl><dt>definition:</dt><dd>definition list of terms and descriptions</dd>`.
WHEN client->cs-lifecycle_method-on_event.
CASE client->get( )-event.
WHEN 'BACK'.
client->nav_app_leave( client->get( )-id_prev_app_stack ).
ENDCASE.
WHEN client->cs-lifecycle_method-on_rendering.
DATA(view) = client->factory_view( 'VIEW_INPUT' ).
view->page( title = 'abap2UI5 - Formatted Text' navbuttontap = view->_event( 'BACK' )
)->header_content(
)->toolbar_spacer(
)->link( text = 'Source_Code' href = client->get( )-s_request-url_source_code
)->get_parent(
)->vbox( 'sapUiSmallMargin'
)->link( text = 'Control Documentation - SAP UI5 Formatted Text' href = 'https://sapui5.hana.ondemand.com/#/entity/sap.m.FormattedText/sample/sap.m.sample.FormattedText'
)->get_parent(
)->vbox( 'sapUiSmallMargin'
)->formatted_text( htmltext = mv_html_text ).
ENDCASE.
ENDMETHOD.
ENDCLASS.

View File

@ -0,0 +1,194 @@
CLASS lcl_mime_api DEFINITION FINAL.
PUBLIC SECTION.
CLASS-METHODS read_abap
RETURNING
VALUE(r_result) TYPE string.
CLASS-METHODS read_json
RETURNING
VALUE(r_result) TYPE string.
CLASS-METHODS read_js
RETURNING
VALUE(r_result) TYPE string.
CLASS-METHODS read_yaml
RETURNING
VALUE(r_result) TYPE string.
CLASS-METHODS read_text
RETURNING
VALUE(r_result) TYPE string.
TYPES:
BEGIN OF ty_S_suggest,
name TYPE string,
value TYPE string,
END OF ty_s_suggest.
TYPES ty_T_suggest TYPE STANDARD TABLE OF ty_s_suggest WITH EMPTY KEY.
CLASS-METHODS get_editor_type
RETURNING
VALUE(r_result) TYPE ty_t_suggest.
CLASS-METHODS save_data
IMPORTING
i_mv_editor TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS lcl_mime_api IMPLEMENTATION.
METHOD read_abap.
r_result = `METHOD SELECT_FILES.` && |\n| &&
|\n| &&
` DATA: LV_RET_CODE TYPE I,` && |\n| &&
` LV_USR_AXN TYPE I.` && |\n| &&
|\n| &&
` CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG(` && |\n| &&
` EXPORTING` && |\n| &&
` WINDOW_TITLE = 'Select file'` && |\n| &&
` MULTISELECTION = 'X'` && |\n| &&
` CHANGING` && |\n| &&
` FILE_TABLE = ME->PT_FILETAB` && |\n| &&
` RC = LV_RET_CODE` && |\n| &&
` USER_ACTION = LV_USR_AXN` && |\n| &&
` EXCEPTIONS` && |\n| &&
` FILE_OPEN_DIALOG_FAILED = 1` && |\n| &&
` CNTL_ERROR = 2` && |\n| &&
` ERROR_NO_GUI = 3` && |\n| &&
` NOT_SUPPORTED_BY_GUI = 4` && |\n| &&
` OTHERS = 5` && |\n| &&
` ).` && |\n| &&
` IF SY-SUBRC <> 0 OR` && |\n| &&
` LV_USR_AXN = CL_GUI_FRONTEND_SERVICES=>ACTION_CANCEL.` && |\n| &&
` RAISE EX_FILE_SEL_ERR.` && |\n| &&
` ENDIF.` && |\n| &&
|\n| &&
` ENDMETHOD. `.
ENDMETHOD.
METHOD read_json.
r_result = `{` && |\n| &&
` "quiz": {` && |\n| &&
` "sport": {` && |\n| &&
` "q1": {` && |\n| &&
` "test" : false,` && |\n| &&
` "question": "Which one is correct team name in NBA?",` && |\n| &&
` "options": [` && |\n| &&
` "New York Bulls",` && |\n| &&
` "Los Angeles Kings",` && |\n| &&
` "Golden State Warriros",` && |\n| &&
` "Huston Rocket"` && |\n| &&
` ],` && |\n| &&
` "answer": "Huston Rocket"` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` "maths": {` && |\n| &&
` "q1": {` && |\n| &&
` "question": "5 + 7 = ?",` && |\n| &&
` "options": [` && |\n| &&
` "10",` && |\n| &&
` "11",` && |\n| &&
` "12",` && |\n| &&
` "13"` && |\n| &&
` ],` && |\n| &&
` "answer": "12"` && |\n| &&
` },` && |\n| &&
` "q2": {` && |\n| &&
` "question": true,` && |\n| &&
` "options": [` && |\n| &&
` "1",` && |\n| &&
` "2",` && |\n| &&
` "3",` && |\n| &&
` "4"` && |\n| &&
` ],` && |\n| &&
` "answer": 487829` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
`}`.
ENDMETHOD.
METHOD read_js.
r_result = `function showAlert() {` && |\n| &&
` alert("Alert from JS file");` && |\n| &&
`}` && |\n| &&
|\n| &&
`function updateHeading() {` && |\n| &&
` document.getElementById('heading').innerHTML = 'Heading changed with JS';` && |\n| &&
`}`.
ENDMETHOD.
METHOD read_yaml.
r_result = `# Employee records` && |\n| &&
`- martin:` && |\n| &&
` name: Martin Developer` && |\n| &&
` job: Developer` && |\n| &&
` skills:` && |\n| &&
` - python` && |\n| &&
` - perl` && |\n| &&
` - pascal` && |\n| &&
`- tabitha:` && |\n| &&
` name: Tabitha Bitumen` && |\n| &&
` job: Developer` && |\n| &&
` skills:` && |\n| &&
` - lisp` && |\n| &&
` - fortran` && |\n| &&
` - erlang`.
ENDMETHOD.
METHOD read_text.
r_result = `TXT test file` && |\n| &&
`Purpose: Provide example of this file type` && |\n| &&
`Document file type: TXT` && |\n| &&
`Version: 1.0` && |\n| &&
`Remark:` && |\n| &&
|\n| &&
`Example content:` && |\n| &&
`The names "John Doe" for males, "Jane Doe" or "Jane Roe" for females, or "Jonnie Doe" and "Janie Doe" for children, or just "Doe" non-gender-specifically are used as placeholder names for a party whose true identity is unknown or mus` &&
`t be withheld in a legal action, case, or discussion. The names are also used to refer to acorpse or hospital patient whose identity is unknown. This practice is widely used in the United States and Canada, but is rarely used in other English-speak` &&
`ing countries including the United Kingdom itself, from where the use of "John Doe" in a legal context originates. The names Joe Bloggs or John Smith are used in the UK instead, as well as in Australia and New Zealand.` && |\n| &&
|\n| &&
`John Doe is sometimes used to refer to a typical male in other contexts as well, in a similar manner to John Q. Public, known in Great Britain as Joe Public, John Smith or Joe Bloggs. For example, the first name listed on a form is o` &&
`ften John Doe, along with a fictional address or other fictional information to provide an example of how to fill in the form. The name is also used frequently in popular culture, for example in the Frank Capra film Meet John Doe. John Doe was also` &&
` the name of a 2002 American television series.`.
ENDMETHOD.
METHOD get_editor_type.
DATA(lv_types) = `abap, abc, actionscript, ada, apache_conf, applescript, asciidoc, assembly_x86, autohotkey, batchfile, bro, c9search, c_cpp, cirru, clojure, cobol, coffee, coldfusion, csharp, css, curly, d, dart, diff, django, dockerfile, ` &&
`dot, drools, eiffel, yaml, ejs, elixir, elm, erlang, forth, fortran, ftl, gcode, gherkin, gitignore, glsl, gobstones, golang, groovy, haml, handlebars, haskell, haskell_cabal, haxe, hjson, html, html_elixir, html_ruby, ini, io, jack, jade, java, ja` &&
`vascri` &&
`pt, json, jsoniq, jsp, jsx, julia, kotlin, latex, lean, less, liquid, lisp, live_script, livescript, logiql, lsl, lua, luapage, lucene, makefile, markdown, mask, matlab, mavens_mate_log, maze, mel, mips_assembler, mipsassembler, mushcode, mysql, ni` &&
`x, nsis, objectivec, ocaml, pascal, perl, pgsql, php, plain_text, powershell, praat, prolog, properties, protobuf, python, r, razor, rdoc, rhtml, rst, ruby, rust, sass, scad, scala, scheme, scss, sh, sjs, smarty, snippets, soy_template, space, sql,` &&
` sqlserver, stylus, svg, swift, swig, tcl, tex, text, textile, toml, tsx, twig, typescript, vala, vbscript, velocity, verilog, vhdl, wollok, xml, xquery, terraform, slim, redshift, red, puppet, php_laravel_blade, mixal, jssm, fsharp, edifact,` &&
` csp, cssound_score, cssound_orchestra, cssound_document`.
SPLIT lv_types AT ',' INTO TABLE DATA(lt_types).
r_result = VALUE #( FOR row IN lt_types ( name = shift_right( shift_left( row ) ) value = shift_right( shift_left( row ) ) ) ).
ENDMETHOD.
METHOD save_data.
"save data here
ENDMETHOD.
ENDCLASS.

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_APP_DEMO_15</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>selscreen - formatted text (html)</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -12,7 +12,7 @@ ENDCLASS.
CLASS Z2UI5_CL_APP_DEMO_18 IMPLEMENTATION. CLASS z2ui5_cl_app_demo_18 IMPLEMENTATION.
METHOD z2ui5_if_app~controller. METHOD z2ui5_if_app~controller.
@ -58,6 +58,12 @@ CLASS Z2UI5_CL_APP_DEMO_18 IMPLEMENTATION.
DATA(page) = view->page( title = 'abap2UI5 - Upload/Download Files' navbuttontap = view->_event( 'BACK' ) ). DATA(page) = view->page( title = 'abap2UI5 - Upload/Download Files' navbuttontap = view->_event( 'BACK' ) ).
" DATA(grid) = page->grid( 'L12 M12 S12' )->content( 'l' ). " DATA(grid) = page->grid( 'L12 M12 S12' )->content( 'l' ).
DATA(lv_html_text) = `<h3>subheader</h3><p>link: <a href="//www.sap.com" style="color:green; font-weight:600;">link to sap.com</a> - links open in a new window.</p><p>paragraph: <strong>strong</strong> and <em>emphasized</em>.</p><p>list:</p><ul` &&
`><li>list item 1</li><li>list item 2<ul><li>sub item 1</li><li>sub item 2</li></ul></li></ul><p>pre:</p><pre>abc def ghi</pre><p>code: <code>var el = document.getElementById("myId");</code></p><p>cite: <cite>a reference to a source</cite></p>` &&
`<dl><dt>definition:</dt><dd>definition list of terms and descriptions</dd>`.
page->vbox( 'sapUiSmallMargin' )->formatted_text( htmltext = lv_html_text ).
page->zz_file_uploader( page->zz_file_uploader(
value = view->_bind( mv_value ) value = view->_bind( mv_value )
path = view->_bind( mv_path ) path = view->_bind( mv_path )

View File

@ -101,21 +101,21 @@ CLASS z2ui5_cl_app_demo_21 IMPLEMENTATION.
client->view_popup( 'POPUP_TO_TEXTAREA_SIZE' ). client->view_popup( 'POPUP_TO_TEXTAREA_SIZE' ).
WHEN 'BUTTON_TEXTAREA_CONFIRM'. WHEN 'BUTTON_TEXTAREA_CONFIRM'.
" client->popup_message_box( mv_textarea ). " client->popup_message_box( mv_textarea ).
WHEN 'BUTTON_TEXTAREA_CANCEL'. WHEN 'BUTTON_TEXTAREA_CANCEL'.
client->popup_message_toast( 'textarea deleted' ). client->popup_message_toast( 'textarea deleted' ).
CLEAR mv_textarea. CLEAR mv_textarea.
WHEN 'POPUP_TO_INPUT'. WHEN 'POPUP_TO_INPUT'.
ms_popup_input-value1 = 'value1'. ms_popup_input-value1 = 'value1'.
client->view_popup( 'POPUP_TO_INPUT' ). client->view_popup( 'POPUP_TO_INPUT' ).
WHEN 'POPUP_BAL'. WHEN 'POPUP_BAL'.
client->view_popup( 'POPUP_BAL' ). client->view_popup( 'POPUP_BAL' ).
WHEN 'POPUP_TABLE'. WHEN 'POPUP_TABLE'.
clear t_tab. CLEAR t_tab.
DO 10 TIMES. DO 10 TIMES.
DATA(ls_row) = VALUE ty_row( title = 'entry_' && sy-index value = 'red' info = 'completed' descr = 'this is a description' ). DATA(ls_row) = VALUE ty_row( title = 'entry_' && sy-index value = 'red' info = 'completed' descr = 'this is a description' ).
INSERT ls_row INTO TABLE t_tab. INSERT ls_row INTO TABLE t_tab.
@ -123,14 +123,16 @@ CLASS z2ui5_cl_app_demo_21 IMPLEMENTATION.
client->view_popup( 'POPUP_TABLE' ). client->view_popup( 'POPUP_TABLE' ).
WHEN 'POPUP_TABLE_CONTINUE'. WHEN 'POPUP_TABLE_CONTINUE'.
delete t_tab where selkz = abap_false. DELETE t_tab WHERE selkz = abap_false.
client->popup_message_toast( `Entry selected: ` && t_tab[ 1 ]-title ). client->popup_message_toast( `Entry selected: ` && t_tab[ 1 ]-title ).
WHEN 'BACK'. WHEN 'BACK'.
client->nav_app_leave( client->get( )-id_prev_app_stack ). client->nav_app_leave( client->get( )-id_prev_app_stack ).
ENDCASE. ENDCASE.
client->view_show( 'MAIN' ).
WHEN client->cs-lifecycle_method-on_rendering. WHEN client->cs-lifecycle_method-on_rendering.
@ -148,7 +150,10 @@ CLASS z2ui5_cl_app_demo_21 IMPLEMENTATION.
DATA(view) = i_client->factory_view( 'MAIN' ). DATA(view) = i_client->factory_view( 'MAIN' ).
DATA(page) = view->page( title = 'abap2UI5 - Popups' navbuttontap = view->_event( 'BACK' ) ). DATA(page) = view->page( title = 'abap2UI5 - Popups' navbuttontap = view->_event( 'BACK' ) ).
page->header_content( )->link( text = 'Go to Source Code' href = i_client->get( )-s_request-url_source_code ). page->header_content(
)->link( text = 'Demo' href = 'https://twitter.com/OblomovDev/status/1637163852264624139'
)->link( text = 'Source_Code' href = i_client->get( )-s_request-url_source_code
).
DATA(grid) = page->grid( 'XL8 L8 M12 S12' )->content( 'l' ). DATA(grid) = page->grid( 'XL8 L8 M12 S12' )->content( 'l' ).
@ -181,9 +186,7 @@ CLASS z2ui5_cl_app_demo_21 IMPLEMENTATION.
METHOD view_popup_decide. METHOD view_popup_decide.
DATA(view) = i_client->factory_view( 'POPUP_TO_DECIDE' ). DATA(view) = i_client->factory_view( 'POPUP_TO_DECIDE' ).
DATA(popup) = view->dialog( DATA(popup) = view->dialog( title = 'Title' icon = 'sap-icon://question-mark' ).
title = 'Title'
icon = 'sap-icon://question-mark' ).
popup->content( )->vbox( class = 'sapUiMediumMargin' popup->content( )->vbox( class = 'sapUiMediumMargin'
)->text( text = 'This is a question, you have to make a decision now, cancel or confirm?' ). )->text( text = 'This is a question, you have to make a decision now, cancel or confirm?' ).
@ -203,14 +206,8 @@ CLASS z2ui5_cl_app_demo_21 IMPLEMENTATION.
METHOD view_popup_textarea. METHOD view_popup_textarea.
DATA view TYPE REF TO z2ui5_if_view. DATA(view) = i_client->factory_view( 'POPUP_TO_TEXTAREA' ).
DATA popup TYPE REF TO z2ui5_if_view. DATA(popup) = view->dialog( stretch = mv_stretch_active title = 'Title' icon = 'sap-icon://edit' ).
view = i_client->factory_view( 'POPUP_TO_TEXTAREA' ).
popup = view->dialog(
stretch = mv_stretch_active
title = 'Title'
icon = 'sap-icon://edit' ).
popup->content( popup->content(
)->text_area( )->text_area(
@ -234,7 +231,7 @@ CLASS z2ui5_cl_app_demo_21 IMPLEMENTATION.
contentheight = '100px' contentheight = '100px'
contentwidth = '1200px' contentwidth = '1200px'
title = 'Title' title = 'Title'
icon = 'sap-icon://edit' ). icon = 'sap-icon://edit' ).
popup->content( popup->content(
)->text_area( )->text_area(
@ -257,13 +254,8 @@ CLASS z2ui5_cl_app_demo_21 IMPLEMENTATION.
METHOD view_popup_input. METHOD view_popup_input.
DATA(view) = i_client->factory_view( 'POPUP_TO_INPUT' ).
DATA(popup) = view->dialog(
DATA popup TYPE REF TO z2ui5_if_view.
DATA view TYPE REF TO z2ui5_if_view.
view = i_client->factory_view( 'POPUP_TO_INPUT' ).
popup = view->dialog(
contentheight = '500px' contentheight = '500px'
contentwidth = '500px' contentwidth = '500px'
title = 'Title' ). title = 'Title' ).
@ -271,9 +263,9 @@ CLASS z2ui5_cl_app_demo_21 IMPLEMENTATION.
popup->content( popup->content(
)->simple_form( )->simple_form(
)->label( 'Input1' )->label( 'Input1'
)->input( view->_bind( ms_popup_input-value1 ) )->input( view->_bind( ms_popup_input-value1 )
)->label( 'Input2' )->label( 'Input2'
)->input( view->_bind( ms_popup_input-value2 ) )->input( view->_bind( ms_popup_input-value2 )
)->label( 'Checkbox' )->label( 'Checkbox'
)->checkbox( )->checkbox(
selected = view->_bind( ms_popup_input-check_is_active ) selected = view->_bind( ms_popup_input-check_is_active )
@ -296,13 +288,13 @@ CLASS z2ui5_cl_app_demo_21 IMPLEMENTATION.
METHOD view_popup_table. METHOD view_popup_table.
DATA(view) = i_client->factory_view( 'POPUP_BAL' ). DATA(view) = i_client->factory_view( 'POPUP_BAL' ).
DATA(popup) = view->dialog( title = 'abap2ui5 - Popup Message Log:' ). DATA(popup) = view->dialog( title = 'abap2ui5 - Popup Message Log' ).
DATA(tab) = popup->table( view->_bind( t_bapiret ) ). DATA(tab) = popup->table( view->_bind( t_bapiret ) ).
tab->columns( tab->columns(
)->column( width = '5rem' )->text( 'Type' )->get_parent( )->column( width = '5rem' )->text( 'Type' )->get_parent(
)->column( width = '5rem' )->text( 'Number' )->get_parent( )->column( width = '5rem' )->text( 'Number' )->get_parent(
)->column( width = '5rem' )->text( 'ID' )->get_parent( )->column( width = '5rem' )->text( 'ID' )->get_parent(
)->column( )->text( 'Message' )->get_parent( ). )->column( )->text( 'Message' )->get_parent( ).
tab->items( )->column_list_item( )->cells( tab->items( )->column_list_item( )->cells(

View File

@ -69,25 +69,25 @@ CLASS z2ui5_lcl_utility DEFINITION INHERITING FROM cx_no_check.
IMPORTING IMPORTING
in TYPE REF TO object in TYPE REF TO object
RETURNING RETURNING
VALUE(r_result) TYPE string. VALUE(result) TYPE string.
CLASS-METHODS get_uuid CLASS-METHODS get_uuid
RETURNING RETURNING
VALUE(r_result) TYPE string VALUE(result) TYPE string
RAISING RAISING
cx_uuid_error. cx_uuid_error.
CLASS-METHODS get_uuid_session CLASS-METHODS get_uuid_session
RETURNING RETURNING
VALUE(r_result) TYPE string. VALUE(result) TYPE string.
CLASS-METHODS get_user_tech CLASS-METHODS get_user_tech
RETURNING RETURNING
VALUE(r_result) TYPE string. VALUE(result) TYPE string.
CLASS-METHODS get_timestampl CLASS-METHODS get_timestampl
RETURNING RETURNING
VALUE(r_result) TYPE timestampl. VALUE(result) TYPE timestampl.
CLASS-METHODS trans_json_2_data CLASS-METHODS trans_json_2_data
IMPORTING IMPORTING
@ -113,13 +113,13 @@ CLASS z2ui5_lcl_utility DEFINITION INHERITING FROM cx_no_check.
io_app TYPE REF TO object io_app TYPE REF TO object
t_attri TYPE ty-t-attri t_attri TYPE ty-t-attri
RETURNING RETURNING
VALUE(r_result) TYPE string ##NEEDED. VALUE(result) TYPE string ##NEEDED.
CLASS-METHODS get_t_attri_by_ref CLASS-METHODS get_t_attri_by_ref
IMPORTING IMPORTING
io_app TYPE REF TO object io_app TYPE REF TO object
RETURNING RETURNING
VALUE(r_result) TYPE ty-t-attri ##NEEDED. VALUE(result) TYPE ty-t-attri ##NEEDED.
CLASS-METHODS trans_object_2_xml CLASS-METHODS trans_object_2_xml
IMPORTING IMPORTING
@ -132,13 +132,13 @@ CLASS z2ui5_lcl_utility DEFINITION INHERITING FROM cx_no_check.
url TYPE string url TYPE string
name TYPE string name TYPE string
RETURNING RETURNING
VALUE(r_result) TYPE string. VALUE(result) TYPE string.
CLASS-METHODS get_prev_when_no_handler CLASS-METHODS get_prev_when_no_handler
IMPORTING IMPORTING
val TYPE REF TO cx_root val TYPE REF TO cx_root
RETURNING RETURNING
VALUE(r_result) TYPE REF TO cx_root. VALUE(result) TYPE REF TO cx_root.
CLASS-METHODS get_ref_data CLASS-METHODS get_ref_data
IMPORTING IMPORTING
@ -151,13 +151,19 @@ CLASS z2ui5_lcl_utility DEFINITION INHERITING FROM cx_no_check.
IMPORTING IMPORTING
val TYPE any val TYPE any
RETURNING RETURNING
VALUE(r_result) TYPE string. VALUE(result) TYPE string.
CLASS-METHODS check_is_boolean
IMPORTING
val TYPE any
RETURNING
VALUE(result) TYPE abap_bool.
CLASS-METHODS get_json_boolean CLASS-METHODS get_json_boolean
IMPORTING IMPORTING
val TYPE any val TYPE any
RETURNING RETURNING
VALUE(r_result) TYPE string. VALUE(result) TYPE string.
CLASS-METHODS trans_ref_tab_2_tab CLASS-METHODS trans_ref_tab_2_tab
IMPORTING ir_tab_from TYPE REF TO data IMPORTING ir_tab_from TYPE REF TO data
@ -167,7 +173,7 @@ CLASS z2ui5_lcl_utility DEFINITION INHERITING FROM cx_no_check.
IMPORTING IMPORTING
val TYPE clike val TYPE clike
RETURNING RETURNING
VALUE(r_result) TYPE string. VALUE(result) TYPE string.
PROTECTED SECTION. PROTECTED SECTION.
@ -178,7 +184,7 @@ CLASS z2ui5_lcl_utility DEFINITION INHERITING FROM cx_no_check.
io_app TYPE REF TO object io_app TYPE REF TO object
iv_attri TYPE csequence iv_attri TYPE csequence
RETURNING RETURNING
VALUE(r_result) TYPE abap_attrdescr_tab. VALUE(result) TYPE abap_attrdescr_tab.
PRIVATE SECTION. PRIVATE SECTION.
@ -188,8 +194,8 @@ ENDCLASS.
CLASS z2ui5_lcl_utility IMPLEMENTATION. CLASS z2ui5_lcl_utility IMPLEMENTATION.
METHOD get_trim_upper. METHOD get_trim_upper.
r_result = val. result = val.
r_result = to_upper( shift_left( shift_right( r_result ) ) ). result = to_upper( shift_left( shift_right( result ) ) ).
ENDMETHOD. ENDMETHOD.
@ -214,34 +220,59 @@ CLASS z2ui5_lcl_utility IMPLEMENTATION.
METHOD get_abap_2_json. METHOD get_abap_2_json.
DATA lo_ele TYPE REF TO cl_abap_elemdescr. * DATA lo_ele TYPE REF TO cl_abap_elemdescr.
lo_ele ?= cl_abap_elemdescr=>describe_by_data( val ). * lo_ele ?= cl_abap_elemdescr=>describe_by_data( val ).
CASE lo_ele->get_relative_name( ). * CASE lo_ele->get_relative_name( ).
WHEN 'ABAP_BOOL' OR 'ABAP_BOOLEAN'. * WHEN 'ABAP_BOOL' OR 'ABAP_BOOLEAN' OR 'XSDBOOLEAN'.
r_result = COND #( WHEN val = abap_true THEN 'true' ELSE 'false' ). * result = COND #( WHEN val = abap_true THEN 'true' ELSE 'false' ).
WHEN OTHERS. * WHEN OTHERS.
r_result = |"{ escape( val = val format = cl_abap_format=>e_json_string ) }"|. * result = |"{ escape( val = val format = cl_abap_format=>e_json_string ) }"|.
ENDCASE. * ENDCASE.
IF check_is_boolean( val ).
result = COND #( WHEN val = abap_true THEN 'true' ELSE 'false' ).
ELSE.
result = |"{ escape( val = val format = cl_abap_format=>e_json_string ) }"|.
ENDIF.
ENDMETHOD.
METHOD check_is_boolean.
TRY.
DATA(lo_ele) = CAST cl_abap_elemdescr( cl_abap_elemdescr=>describe_by_data( val ) ).
CASE lo_ele->get_relative_name( ).
WHEN 'ABAP_BOOL' OR 'ABAP_BOOLEAN' OR 'XSDBOOLEAN'.
result = abap_true.
ENDCASE.
CATCH cx_root.
ENDTRY.
ENDMETHOD. ENDMETHOD.
METHOD get_json_boolean. METHOD get_json_boolean.
DATA lo_ele TYPE REF TO cl_abap_elemdescr. * DATA lo_ele TYPE REF TO cl_abap_elemdescr.
lo_ele ?= cl_abap_elemdescr=>describe_by_data( val ). * lo_ele ?= cl_abap_elemdescr=>describe_by_data( val ).
CASE lo_ele->get_relative_name( ). * CASE lo_ele->get_relative_name( ).
WHEN 'ABAP_BOOL' OR 'ABAP_BOOLEAN'. * WHEN 'ABAP_BOOL' OR 'ABAP_BOOLEAN' OR 'XSDBOOLEAN'.
r_result = COND #( WHEN val = abap_true THEN 'true' ELSE 'false' ). * result = COND #( WHEN val = abap_true THEN 'true' ELSE 'false' ).
WHEN OTHERS. * WHEN OTHERS.
r_result = val. * result = val.
ENDCASE. * ENDCASE.
IF check_is_boolean( val ).
result = COND #( WHEN val = abap_true THEN 'true' ELSE 'false' ).
ELSE.
result = val.
ENDIF.
ENDMETHOD. ENDMETHOD.
METHOD get_classname_by_ref. METHOD get_classname_by_ref.
DATA(lv_classname) = cl_abap_classdescr=>get_class_name( in ). DATA(lv_classname) = cl_abap_classdescr=>get_class_name( in ).
r_result = substring_after( val = lv_classname sub = '\CLASS=' ). result = substring_after( val = lv_classname sub = '\CLASS=' ).
ENDMETHOD. ENDMETHOD.
@ -262,7 +293,7 @@ CLASS z2ui5_lcl_utility IMPLEMENTATION.
v = lv_value ) INTO TABLE lt_url_params. v = lv_value ) INTO TABLE lt_url_params.
ENDLOOP. ENDLOOP.
r_result = lt_url_params[ n = get_trim_upper( name ) ]-v. result = lt_url_params[ n = get_trim_upper( name ) ]-v.
ENDMETHOD. ENDMETHOD.
@ -270,12 +301,12 @@ CLASS z2ui5_lcl_utility IMPLEMENTATION.
METHOD get_prev_when_no_handler. METHOD get_prev_when_no_handler.
TRY. TRY.
r_result = CAST cx_sy_no_handler( val )->previous. result = CAST cx_sy_no_handler( val )->previous.
CATCH cx_root. CATCH cx_root.
ENDTRY. ENDTRY.
IF r_result IS NOT BOUND. IF result IS NOT BOUND.
r_result = val. result = val.
ENDIF. ENDIF.
ENDMETHOD. ENDMETHOD.
@ -295,14 +326,14 @@ CLASS z2ui5_lcl_utility IMPLEMENTATION.
METHOD get_timestampl. METHOD get_timestampl.
GET TIME STAMP FIELD r_result. GET TIME STAMP FIELD result.
ENDMETHOD. ENDMETHOD.
METHOD get_user_tech. METHOD get_user_tech.
r_result = sy-uname. result = sy-uname.
ENDMETHOD. ENDMETHOD.
@ -325,14 +356,14 @@ CLASS z2ui5_lcl_utility IMPLEMENTATION.
ENDTRY. ENDTRY.
r_result = uuid. result = uuid.
ENDMETHOD. ENDMETHOD.
METHOD get_uuid_session. METHOD get_uuid_session.
mv_counter = mv_counter + 1. mv_counter = mv_counter + 1.
r_result = shift_left( shift_right( CONV string( mv_counter ) ) ). result = shift_left( shift_right( CONV string( mv_counter ) ) ).
ENDMETHOD. ENDMETHOD.
@ -354,7 +385,7 @@ CLASS z2ui5_lcl_utility IMPLEMENTATION.
GET REFERENCE OF <attribute> INTO lr_ref. GET REFERENCE OF <attribute> INTO lr_ref.
IF lr_in = lr_ref. IF lr_in = lr_ref.
r_result = to_upper( lr_attri->name ). result = to_upper( lr_attri->name ).
EXIT. EXIT.
ENDIF. ENDIF.
@ -384,7 +415,7 @@ CLASS z2ui5_lcl_utility IMPLEMENTATION.
ENDLOOP. ENDLOOP.
r_result = CORRESPONDING #( lt_attri ). result = CORRESPONDING #( lt_attri ).
ENDMETHOD. ENDMETHOD.
@ -406,11 +437,11 @@ CLASS z2ui5_lcl_utility IMPLEMENTATION.
IF lr_comp->as_include = abap_true. IF lr_comp->as_include = abap_true.
INSERT LINES OF _get_t_attri( io_app = io_app INSERT LINES OF _get_t_attri( io_app = io_app
iv_attri = lv_element ) INTO TABLE r_result. iv_attri = lv_element ) INTO TABLE result.
ELSE. ELSE.
INSERT VALUE #( name = lv_element INSERT VALUE #( name = lv_element
type_kind = lr_comp->type->type_kind ) INTO TABLE r_result. type_kind = lr_comp->type->type_kind ) INTO TABLE result.
ENDIF. ENDIF.
ENDLOOP. ENDLOOP.
@ -566,39 +597,39 @@ CLASS z2ui5_lcl_utility_tree_json DEFINITION.
io_root TYPE REF TO z2ui5_lcl_utility_tree_json io_root TYPE REF TO z2ui5_lcl_utility_tree_json
iv_name TYPE simple iv_name TYPE simple
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_utility_tree_json. VALUE(result) TYPE REF TO z2ui5_lcl_utility_tree_json.
CLASS-METHODS factory CLASS-METHODS factory
IMPORTING IMPORTING
iv_json TYPE clike OPTIONAL iv_json TYPE clike OPTIONAL
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_utility_tree_json. VALUE(result) TYPE REF TO z2ui5_lcl_utility_tree_json.
METHODS constructor. METHODS constructor.
METHODS get_root METHODS get_root
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_utility_tree_json. VALUE(result) TYPE REF TO z2ui5_lcl_utility_tree_json.
METHODS get_attribute METHODS get_attribute
IMPORTING IMPORTING
name TYPE string name TYPE string
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_utility_tree_json. VALUE(result) TYPE REF TO z2ui5_lcl_utility_tree_json.
METHODS get_val METHODS get_val
RETURNING RETURNING
VALUE(r_result) TYPE string. VALUE(result) TYPE string.
METHODS get_parent METHODS get_parent
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_utility_tree_json. VALUE(result) TYPE REF TO z2ui5_lcl_utility_tree_json.
METHODS add_list_val METHODS add_list_val
IMPORTING IMPORTING
v TYPE string v TYPE string
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_utility_tree_json. VALUE(result) TYPE REF TO z2ui5_lcl_utility_tree_json.
METHODS add_attribute METHODS add_attribute
IMPORTING IMPORTING
@ -606,47 +637,47 @@ CLASS z2ui5_lcl_utility_tree_json DEFINITION.
v TYPE clike v TYPE clike
apos_active TYPE abap_bool DEFAULT abap_true apos_active TYPE abap_bool DEFAULT abap_true
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_utility_tree_json. VALUE(result) TYPE REF TO z2ui5_lcl_utility_tree_json.
METHODS add_attributes_name_value_tab METHODS add_attributes_name_value_tab
IMPORTING IMPORTING
it_name_value TYPE ty_T_name_value it_name_value TYPE ty_T_name_value
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_utility_tree_json. VALUE(result) TYPE REF TO z2ui5_lcl_utility_tree_json.
METHODS add_attribute_object METHODS add_attribute_object
IMPORTING IMPORTING
name TYPE clike name TYPE clike
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_utility_tree_json. VALUE(result) TYPE REF TO z2ui5_lcl_utility_tree_json.
METHODS add_list_object METHODS add_list_object
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_utility_tree_json. VALUE(result) TYPE REF TO z2ui5_lcl_utility_tree_json.
METHODS add_list_list METHODS add_list_list
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_utility_tree_json. VALUE(result) TYPE REF TO z2ui5_lcl_utility_tree_json.
METHODS add_attribute_list METHODS add_attribute_list
IMPORTING IMPORTING
name TYPE clike name TYPE clike
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_utility_tree_json. VALUE(result) TYPE REF TO z2ui5_lcl_utility_tree_json.
METHODS add_attribute_instance METHODS add_attribute_instance
IMPORTING IMPORTING
val TYPE REF TO z2ui5_lcl_utility_tree_json val TYPE REF TO z2ui5_lcl_utility_tree_json
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_utility_tree_json. VALUE(result) TYPE REF TO z2ui5_lcl_utility_tree_json.
METHODS write_result METHODS write_result
RETURNING RETURNING
VALUE(r_result) TYPE string. VALUE(result) TYPE string.
METHODS get_name METHODS get_name
RETURNING RETURNING
VALUE(r_result) TYPE string. VALUE(result) TYPE string.
PROTECTED SECTION. PROTECTED SECTION.
@ -654,14 +685,14 @@ CLASS z2ui5_lcl_utility_tree_json DEFINITION.
IMPORTING IMPORTING
iv_text TYPE string iv_text TYPE string
RETURNING RETURNING
VALUE(r_result) TYPE string. VALUE(result) TYPE string.
METHODS quote_json METHODS quote_json
IMPORTING IMPORTING
iv_text TYPE string iv_text TYPE string
iv_cond TYPE abap_bool iv_cond TYPE abap_bool
RETURNING RETURNING
VALUE(r_result) TYPE string. VALUE(result) TYPE string.
ENDCLASS. ENDCLASS.
@ -683,7 +714,7 @@ CLASS z2ui5_lcl_utility_tree_json IMPLEMENTATION.
lo_attri->mo_parent = me. lo_attri->mo_parent = me.
INSERT lo_attri INTO TABLE mt_values. INSERT lo_attri INTO TABLE mt_values.
r_result = me. result = me.
ENDMETHOD. ENDMETHOD.
@ -697,7 +728,7 @@ CLASS z2ui5_lcl_utility_tree_json IMPLEMENTATION.
apos_active = xsdbool( ls_value-no_apos = abap_false ) ). apos_active = xsdbool( ls_value-no_apos = abap_false ) ).
ENDLOOP. ENDLOOP.
r_result = me. result = me.
ENDMETHOD. ENDMETHOD.
@ -707,15 +738,15 @@ CLASS z2ui5_lcl_utility_tree_json IMPLEMENTATION.
val->mo_root = mo_root. val->mo_root = mo_root.
val->mo_parent = me. val->mo_parent = me.
INSERT val INTO TABLE mt_values. INSERT val INTO TABLE mt_values.
r_result = val. result = val.
ENDMETHOD. ENDMETHOD.
METHOD add_attribute_list. METHOD add_attribute_list.
r_result = add_attribute_object( name = name ). result = add_attribute_object( name = name ).
r_result->mv_check_list = abap_true. result->mv_check_list = abap_true.
ENDMETHOD. ENDMETHOD.
@ -725,21 +756,21 @@ CLASS z2ui5_lcl_utility_tree_json IMPLEMENTATION.
DATA(lo_attri) = new( io_root = mo_root iv_name = name ). DATA(lo_attri) = new( io_root = mo_root iv_name = name ).
mt_values = VALUE #( BASE mt_values ( lo_attri ) ). mt_values = VALUE #( BASE mt_values ( lo_attri ) ).
lo_attri->mo_parent = me. lo_attri->mo_parent = me.
r_result = lo_attri. result = lo_attri.
ENDMETHOD. ENDMETHOD.
METHOD add_list_list. METHOD add_list_list.
r_result = add_attribute_list( name = CONV string( lines( mt_values ) ) ). result = add_attribute_list( name = CONV string( lines( mt_values ) ) ).
ENDMETHOD. ENDMETHOD.
METHOD add_list_object. METHOD add_list_object.
r_result = add_attribute_object( name = CONV string( lines( mt_values ) ) ). result = add_attribute_object( name = CONV string( lines( mt_values ) ) ).
ENDMETHOD. ENDMETHOD.
@ -752,8 +783,8 @@ CLASS z2ui5_lcl_utility_tree_json IMPLEMENTATION.
mt_values = VALUE #( BASE mt_values ( lo_attri ) ). mt_values = VALUE #( BASE mt_values ( lo_attri ) ).
lo_attri->mo_parent = me. lo_attri->mo_parent = me.
r_result = lo_attri. result = lo_attri.
r_result = me. result = me.
ENDMETHOD. ENDMETHOD.
@ -767,24 +798,24 @@ CLASS z2ui5_lcl_utility_tree_json IMPLEMENTATION.
METHOD factory. METHOD factory.
r_result = NEW #( ). result = NEW #( ).
r_result->mo_root = r_result. result->mo_root = result.
/ui2/cl_json=>deserialize( /ui2/cl_json=>deserialize(
EXPORTING EXPORTING
json = CONV string( iv_json ) json = CONV string( iv_json )
assoc_arrays = abap_true assoc_arrays = abap_true
CHANGING CHANGING
data = r_result->mr_actual data = result->mr_actual
). ).
ENDMETHOD. ENDMETHOD.
METHOD new. METHOD new.
r_result = NEW #( ). result = NEW #( ).
r_result->mo_root = io_root. result->mo_root = io_root.
r_result->mv_name = CONV string( iv_name ). result->mv_name = CONV string( iv_name ).
ENDMETHOD. ENDMETHOD.
@ -807,7 +838,7 @@ CLASS z2ui5_lcl_utility_tree_json IMPLEMENTATION.
INSERT lo_attri INTO TABLE mt_values. INSERT lo_attri INTO TABLE mt_values.
r_result = lo_attri. result = lo_attri.
ENDMETHOD. ENDMETHOD.
@ -817,35 +848,35 @@ CLASS z2ui5_lcl_utility_tree_json IMPLEMENTATION.
ASSIGN mr_actual->* TO <attribute>. ASSIGN mr_actual->* TO <attribute>.
_=>raise( when = xsdbool( sy-subrc <> 0 ) v = `Value of Attribute in JSON not found` ). _=>raise( when = xsdbool( sy-subrc <> 0 ) v = `Value of Attribute in JSON not found` ).
r_result = <attribute>. result = <attribute>.
ENDMETHOD. ENDMETHOD.
METHOD get_name. METHOD get_name.
r_result = mv_name. result = mv_name.
ENDMETHOD. ENDMETHOD.
METHOD get_parent. METHOD get_parent.
r_result = COND #( WHEN mo_parent IS NOT BOUND THEN me ELSE mo_parent ). result = COND #( WHEN mo_parent IS NOT BOUND THEN me ELSE mo_parent ).
ENDMETHOD. ENDMETHOD.
METHOD get_root. METHOD get_root.
r_result = mo_root. result = mo_root.
ENDMETHOD. ENDMETHOD.
METHOD wrap_json. METHOD wrap_json.
" Wrap the input text string with the opening and closing characters " Wrap the input text string with the opening and closing characters
" and assign the result to r_result " and assign the result to result
r_result = iv_text. result = iv_text.
CASE mv_check_list. CASE mv_check_list.
WHEN abap_true. WHEN abap_true.
@ -857,13 +888,13 @@ CLASS z2ui5_lcl_utility_tree_json IMPLEMENTATION.
WHEN OTHERS. WHEN OTHERS.
RETURN. RETURN.
ENDCASE. ENDCASE.
r_result = open_char && r_result && close_char. result = open_char && result && close_char.
ENDMETHOD. ENDMETHOD.
METHOD quote_json. METHOD quote_json.
r_result = COND #( WHEN iv_cond = abap_true THEN `"` && iv_text && `"` ELSE iv_text ). result = COND #( WHEN iv_cond = abap_true THEN `"` && iv_text && `"` ELSE iv_text ).
ENDMETHOD. ENDMETHOD.
@ -872,28 +903,28 @@ CLASS z2ui5_lcl_utility_tree_json IMPLEMENTATION.
LOOP AT mt_values INTO DATA(lo_attri). LOOP AT mt_values INTO DATA(lo_attri).
IF sy-tabix > 1. IF sy-tabix > 1.
r_result = r_result && |,|. result = result && |,|.
ENDIF. ENDIF.
IF mv_check_list = abap_false. IF mv_check_list = abap_false.
r_result = r_result && |"{ lo_attri->mv_name }":|. result = result && |"{ lo_attri->mv_name }":|.
ENDIF. ENDIF.
IF lo_attri->mt_values IS NOT INITIAL. IF lo_attri->mt_values IS NOT INITIAL.
r_result = r_result && lo_attri->write_result( ). result = result && lo_attri->write_result( ).
ELSE. ELSE.
r_result = r_result && result = result &&
quote_json( iv_cond = xsdbool( lo_attri->mv_apost_active = abap_true OR lo_attri->mv_value IS INITIAL ) quote_json( iv_cond = xsdbool( lo_attri->mv_apost_active = abap_true OR lo_attri->mv_value IS INITIAL )
iv_text = lo_attri->mv_value ). iv_text = lo_attri->mv_value ).
ENDIF. ENDIF.
ENDLOOP. ENDLOOP.
r_result = wrap_json( r_result ). result = wrap_json( result ).
ENDMETHOD. ENDMETHOD.
ENDCLASS. ENDCLASS.
@ -951,7 +982,7 @@ CLASS z2ui5_lcl_if_view DEFINITION.
value TYPE data value TYPE data
type TYPE string DEFAULT cs-bind_type-two_way type TYPE string DEFAULT cs-bind_type-two_way
RETURNING RETURNING
VALUE(r_result) TYPE string. VALUE(result) TYPE string.
PROTECTED SECTION. PROTECTED SECTION.
@ -1038,7 +1069,7 @@ CLASS z2ui5_lcl_system_runtime DEFINITION.
CLASS-METHODS execute_init CLASS-METHODS execute_init
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_system_runtime. VALUE(result) TYPE REF TO z2ui5_lcl_system_runtime.
METHODS execute_before_app METHODS execute_before_app
IMPORTING IMPORTING
@ -1048,32 +1079,32 @@ CLASS z2ui5_lcl_system_runtime DEFINITION.
METHODS execute_finish METHODS execute_finish
RETURNING RETURNING
VALUE(r_result) TYPE string. VALUE(result) TYPE string.
CLASS-METHODS set_app_start CLASS-METHODS set_app_start
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_system_runtime. VALUE(result) TYPE REF TO z2ui5_lcl_system_runtime.
CLASS-METHODS set_app_client_update CLASS-METHODS set_app_client_update
IMPORTING IMPORTING
id_prev TYPE clike id_prev TYPE clike
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_system_runtime. VALUE(result) TYPE REF TO z2ui5_lcl_system_runtime.
METHODS set_app_leave_to_id METHODS set_app_leave_to_id
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_system_runtime. VALUE(result) TYPE REF TO z2ui5_lcl_system_runtime.
METHODS set_app_call_new METHODS set_app_call_new
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_system_runtime. VALUE(result) TYPE REF TO z2ui5_lcl_system_runtime.
METHODS set_app_system_error METHODS set_app_system_error
IMPORTING IMPORTING
kind TYPE string kind TYPE string
ix TYPE REF TO cx_root ix TYPE REF TO cx_root
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_system_runtime. VALUE(result) TYPE REF TO z2ui5_lcl_system_runtime.
PRIVATE SECTION. PRIVATE SECTION.
@ -1119,7 +1150,7 @@ CLASS z2ui5_lcl_if_view IMPLEMENTATION.
data_stringify = _=>trans_any_2_json( value ) data_stringify = _=>trans_any_2_json( value )
bind_type = type bind_type = type
) INTO TABLE m_root->mo_runtime->ms_db-t_attri. ) INTO TABLE m_root->mo_runtime->ms_db-t_attri.
r_result = '/' && lv_id && ''. result = '/' && lv_id && ''.
RETURN. RETURN.
ENDIF. ENDIF.
@ -1136,7 +1167,7 @@ CLASS z2ui5_lcl_if_view IMPLEMENTATION.
IF lr_in = lr_ref. IF lr_in = lr_ref.
lr_attri->bind_type = type. lr_attri->bind_type = type.
r_result = COND #( WHEN type = cs-bind_type-two_way THEN '/oUpdate/' ELSE '/' ) && lr_attri->name. result = COND #( WHEN type = cs-bind_type-two_way THEN '/oUpdate/' ELSE '/' ) && lr_attri->name.
RETURN. RETURN.
ENDIF. ENDIF.
@ -1149,7 +1180,7 @@ CLASS z2ui5_lcl_if_view IMPLEMENTATION.
data_stringify = _=>trans_any_2_json( value ) data_stringify = _=>trans_any_2_json( value )
bind_type = cs-bind_type-one_time bind_type = cs-bind_type-one_time
) INTO TABLE m_root->mo_runtime->ms_db-t_attri. ) INTO TABLE m_root->mo_runtime->ms_db-t_attri.
r_result = '/' && lv_id && ''. result = '/' && lv_id && ''.
ENDMETHOD. ENDMETHOD.
@ -1271,6 +1302,17 @@ CLASS z2ui5_lcl_if_view IMPLEMENTATION.
ENDMETHOD. ENDMETHOD.
METHOD z2ui5_if_view~formatted_text.
result = me.
_generic(
name = 'FormattedText'
t_prop = VALUE #(
( n = 'htmlText' v = htmlText )
) ).
ENDMETHOD.
METHOD z2ui5_if_view~badge_custom_data. METHOD z2ui5_if_view~badge_custom_data.
result = me. result = me.
@ -1407,6 +1449,7 @@ CLASS z2ui5_lcl_if_view IMPLEMENTATION.
( n = 'title' v = title ) ( n = 'title' v = title )
( n = 'showNavButton' v = COND #( WHEN navbuttontap = '' THEN 'false' ELSE 'true' ) ) ( n = 'showNavButton' v = COND #( WHEN navbuttontap = '' THEN 'false' ELSE 'true' ) )
( n = 'navButtonTap' v = navbuttontap ) ( n = 'navButtonTap' v = navbuttontap )
( n = 'class' v = class )
( n = 'id' v = id ) ( n = 'id' v = id )
) ). ) ).
@ -2320,7 +2363,7 @@ CLASS z2ui5_lcl_system_app DEFINITION.
app TYPE REF TO object OPTIONAL app TYPE REF TO object OPTIONAL
kind TYPE string OPTIONAL kind TYPE string OPTIONAL
RETURNING RETURNING
VALUE(r_result) TYPE REF TO z2ui5_lcl_system_app. VALUE(result) TYPE REF TO z2ui5_lcl_system_app.
PROTECTED SECTION. PROTECTED SECTION.
@ -2355,10 +2398,10 @@ CLASS z2ui5_lcl_system_app IMPLEMENTATION.
METHOD factory_error. METHOD factory_error.
r_result = NEW #( ). result = NEW #( ).
r_result->ms_error-x_error = error. result->ms_error-x_error = error.
r_result->ms_error-app ?= app. result->ms_error-app ?= app.
r_result->ms_error-kind = kind. result->ms_error-kind = kind.
ENDMETHOD. ENDMETHOD.
@ -2468,7 +2511,9 @@ CLASS z2ui5_lcl_system_app IMPLEMENTATION.
ENDIF. ENDIF.
view = client->factory_view( 'HOME' ). view = client->factory_view( 'HOME' ).
DATA(page) = view->page( 'abap2UI5 - Development of UI5 Apps in pure ABAP' ). DATA(page) = view->page(
class = 'sapUiContentPadding sapUiResponsivePadding--header sapUiResponsivePadding--subHeader sapUiResponsivePadding--content sapUiResponsivePadding--footer'
title = 'abap2UI5 - Development of UI5 Apps in pure ABAP' ).
page->header_content( page->header_content(
)->link( text = 'SCN' href = 'https://blogs.sap.com/tag/abap2ui5/' )->link( text = 'SCN' href = 'https://blogs.sap.com/tag/abap2ui5/'
)->link( text = 'Twitter' href = 'https://twitter.com/OblomovDev' )->link( text = 'Twitter' href = 'https://twitter.com/OblomovDev'
@ -2505,7 +2550,6 @@ CLASS z2ui5_lcl_system_app IMPLEMENTATION.
DATA(lv_link) = client->get( )-s_request-url_app_gen && ms_home-classname. DATA(lv_link) = client->get( )-s_request-url_app_gen && ms_home-classname.
form->link( text = 'Link to the Application' href = lv_link enabled = xsdbool( ms_home-class_editable = abap_false ) ). form->link( text = 'Link to the Application' href = lv_link enabled = xsdbool( ms_home-class_editable = abap_false ) ).
" grid = page->grid( default_span = 'L12 M12 S12' )->content( 'l'
grid->simple_form( 'Applications and Examples' )->content( 'f' grid->simple_form( 'Applications and Examples' )->content( 'f'
)->button( text = `Press to continue..` press = view->_event( 'DEMOS' ) ). )->button( text = `Press to continue..` press = view->_event( 'DEMOS' ) ).
@ -2604,11 +2648,11 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
TRY. TRY.
DATA(lv_id_prev) = ss_client-o_body->get_attribute( 'OSYSTEM' )->get_attribute( 'ID' )->get_val( ). DATA(lv_id_prev) = ss_client-o_body->get_attribute( 'OSYSTEM' )->get_attribute( 'ID' )->get_val( ).
CATCH cx_root. CATCH cx_root.
r_result = set_app_start( ). result = set_app_start( ).
RETURN. RETURN.
ENDTRY. ENDTRY.
r_result = set_app_client_update( lv_id_prev ). result = set_app_client_update( lv_id_prev ).
ENDMETHOD. ENDMETHOD.
@ -2629,6 +2673,7 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
ELSEIF ms_actual-view_active IS NOT INITIAL. ELSEIF ms_actual-view_active IS NOT INITIAL.
TRY. TRY.
lr_screen = REF #( ms_next-t_screen[ name = ms_actual-view_active ] ). lr_screen = REF #( ms_next-t_screen[ name = ms_actual-view_active ] ).
ms_next-view = ms_actual-view_active.
CATCH cx_root. CATCH cx_root.
_=>raise( `View with the name ` && ms_actual-view_active && ` not found - check the rendering` ). _=>raise( `View with the name ` && ms_actual-view_active && ` not found - check the rendering` ).
ENDTRY. ENDTRY.
@ -2701,11 +2746,11 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
IF ms_next-check_set_prev_view = abap_true. IF ms_next-check_set_prev_view = abap_true.
lo_ui5_model->add_attribute( n = 'SET_PREV_VIEW' v = 'true' apos_active = abap_false ). lo_ui5_model->add_attribute( n = 'SET_PREV_VIEW' v = 'true' apos_active = abap_false ).
ENDIF. ENDIF.
r_result = lo_ui5_model->get_root( )->write_result( ). result = lo_ui5_model->get_root( )->write_result( ).
z2ui5_lcl_db=>create( z2ui5_lcl_db=>create(
id = ms_db-id id = ms_db-id
response = r_result response = result
db = ms_db ). db = ms_db ).
ENDMETHOD. ENDMETHOD.
@ -2713,21 +2758,21 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
METHOD set_app_client_update. METHOD set_app_client_update.
CONSTANTS c_prefix TYPE string VALUE `R_RESULT->MS_DB-O_APP->`. CONSTANTS c_prefix TYPE string VALUE `result->MS_DB-O_APP->`.
r_result = NEW #( ). result = NEW #( ).
DATA(lv_id) = r_result->ms_db-id. DATA(lv_id) = result->ms_db-id.
r_result->ms_db = z2ui5_lcl_db=>load_app( id_prev ). result->ms_db = z2ui5_lcl_db=>load_app( id_prev ).
r_result->ms_db-id = lv_id. result->ms_db-id = lv_id.
r_result->ms_db-id_prev = id_prev. result->ms_db-id_prev = id_prev.
DATA(lo_system) = ss_client-o_body->get_attribute( 'OSYSTEM' ). DATA(lo_system) = ss_client-o_body->get_attribute( 'OSYSTEM' ).
TRY. TRY.
r_result->ms_next-view_popup = lo_system->get_attribute( 'VIEW_POPUP' )->get_val( ). result->ms_next-view_popup = lo_system->get_attribute( 'VIEW_POPUP' )->get_val( ).
DATA(lo_popup_model) = ss_client-o_body->get_attribute( 'OPOPUP' ). DATA(lo_popup_model) = ss_client-o_body->get_attribute( 'OPOPUP' ).
LOOP AT r_result->ms_db-t_attri REFERENCE INTO DATA(lr_attri) LOOP AT result->ms_db-t_attri REFERENCE INTO DATA(lr_attri)
WHERE bind_type = z2ui5_if_view=>cs-bind_type-two_way. WHERE bind_type = z2ui5_if_view=>cs-bind_type-two_way.
FIELD-SYMBOLS <attribute> TYPE any. FIELD-SYMBOLS <attribute> TYPE any.
@ -2751,7 +2796,7 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
CATCH cx_root. CATCH cx_root.
LOOP AT r_result->ms_db-t_attri REFERENCE INTO lr_attri LOOP AT result->ms_db-t_attri REFERENCE INTO lr_attri
WHERE bind_type = z2ui5_if_view=>cs-bind_type-two_way. WHERE bind_type = z2ui5_if_view=>cs-bind_type-two_way.
lv_name = c_prefix && to_upper( lr_attri->name ). lv_name = c_prefix && to_upper( lr_attri->name ).
@ -2777,73 +2822,75 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
TRY. TRY.
r_result->ms_next-event = ss_client-o_body->get_attribute( 'OEVENT' )->get_attribute( 'EVENT' )->get_val( ). result->ms_next-event = ss_client-o_body->get_attribute( 'OEVENT' )->get_attribute( 'EVENT' )->get_val( ).
CATCH cx_root. CATCH cx_root.
ENDTRY. ENDTRY.
* TRY. * TRY.
* r_result->ms_next-page_scroll_pos = ss_client-o_body->get_attribute( 'scrollPos' )->get_val( ). * result->ms_next-page_scroll_pos = ss_client-o_body->get_attribute( 'scrollPos' )->get_val( ).
* CATCH cx_root. * CATCH cx_root.
* ENDTRY. * ENDTRY.
TRY. TRY.
r_result->ms_next-view = lo_system->get_attribute( 'VIEW' )->get_val( ). result->ms_next-view = lo_system->get_attribute( 'VIEW' )->get_val( ).
CATCH cx_root. CATCH cx_root.
ENDTRY. ENDTRY.
TRY. TRY.
r_result->ms_next-view = lo_system->get_attribute( 'VIEW_NAME' )->get_val( ). result->ms_next-view = lo_system->get_attribute( 'VIEW_NAME' )->get_val( ).
CATCH cx_root. CATCH cx_root.
ENDTRY. ENDTRY.
* TRY. * TRY.
* r_result->ms_next-view = lo_system->get_attribute( 'VIEW_POPUP_NAME' )->get_val( ). * result->ms_next-view = lo_system->get_attribute( 'VIEW_POPUP_NAME' )->get_val( ).
* CATCH cx_root. * CATCH cx_root.
* ENDTRY. * ENDTRY.
r_result->ms_next-lifecycle_method = z2ui5_if_client=>cs-lifecycle_method-on_event. result->ms_next-lifecycle_method = z2ui5_if_client=>cs-lifecycle_method-on_event.
ENDMETHOD. ENDMETHOD.
METHOD set_app_start. METHOD set_app_start.
r_result = NEW #( ). result = NEW #( ).
DO. DO.
TRY. TRY.
r_result->ms_db-app_classname = to_upper( ss_client-t_param[ name = 'app' ]-value ). result->ms_db-app_classname = to_upper( ss_client-t_param[ name = 'app' ]-value ).
CATCH cx_root ##CATCH_ALL. CATCH cx_root ##CATCH_ALL.
r_result->ms_db-o_app = NEW z2ui5_lcl_system_app( ). result->ms_db-o_app = NEW z2ui5_lcl_system_app( ).
EXIT. EXIT.
ENDTRY. ENDTRY.
TRY. TRY.
CREATE OBJECT r_result->ms_db-o_app TYPE (r_result->ms_db-app_classname). CREATE OBJECT result->ms_db-o_app TYPE (result->ms_db-app_classname).
EXIT. EXIT.
CATCH cx_root ##CATCH_ALL. CATCH cx_root ##CATCH_ALL.
DATA(lo_error) = NEW z2ui5_lcl_system_app( ). DATA(lo_error) = NEW z2ui5_lcl_system_app( ).
lo_error->ms_error-x_error = NEW z2ui5_lcl_utility( lo_error->ms_error-x_error = NEW z2ui5_lcl_utility(
val = `class with name ` && r_result->ms_db-app_classname && ` not found, app call not possible` ). val = `class with name ` && result->ms_db-app_classname && ` not found, app call not possible` ).
r_result->ms_db-o_app = lo_error. result->ms_db-o_app = lo_error.
EXIT. EXIT.
ENDTRY. ENDTRY.
ENDDO. ENDDO.
r_result->ms_db-app_classname = _=>get_classname_by_ref( r_result->ms_db-o_app ). result->ms_db-app_classname = _=>get_classname_by_ref( result->ms_db-o_app ).
r_result->ms_db-t_attri = _=>get_t_attri_by_ref( r_result->ms_db-o_app ). result->ms_db-t_attri = _=>get_t_attri_by_ref( result->ms_db-o_app ).
r_result->ms_next-lifecycle_method = z2ui5_if_client=>cs-lifecycle_method-on_init. result->ms_next-lifecycle_method = z2ui5_if_client=>cs-lifecycle_method-on_init.
ENDMETHOD. ENDMETHOD.
METHOD set_app_leave_to_id. METHOD set_app_leave_to_id.
r_result = NEW #( ). result = NEW #( ).
r_result->ms_db = z2ui5_lcl_db=>load_app( ms_next-nav_app_leave_to_id ). result->ms_db = z2ui5_lcl_db=>load_app( ms_next-nav_app_leave_to_id ).
r_result->ms_next = ms_next. result->ms_next = ms_next.
r_result->ms_next-lifecycle_method = z2ui5_if_client=>cs-lifecycle_method-on_event. result->ms_next-view = ''.
result->ms_next-view_popup = ''.
result->ms_next-lifecycle_method = z2ui5_if_client=>cs-lifecycle_method-on_event.
CLEAR ms_next. CLEAR ms_next.
r_result->ms_db-id_prev_app = ms_db-id. result->ms_db-id_prev_app = ms_db-id.
r_result->ms_db-id_prev = ms_db-id. result->ms_db-id_prev = ms_db-id.
z2ui5_lcl_db=>create( id = ms_db-id db = ms_db ). z2ui5_lcl_db=>create( id = ms_db-id db = ms_db ).
@ -2853,38 +2900,38 @@ CLASS z2ui5_lcl_system_runtime IMPLEMENTATION.
z2ui5_lcl_db=>create( id = ms_db-id db = ms_db ). z2ui5_lcl_db=>create( id = ms_db-id db = ms_db ).
r_result = NEW #( ). result = NEW #( ).
r_result->ms_db-o_app = ms_next-s_nav_app_call_new-o_app. result->ms_db-o_app = ms_next-s_nav_app_call_new-o_app.
r_result->ms_db-app_classname = _=>get_classname_by_ref( r_result->ms_db-o_app ). result->ms_db-app_classname = _=>get_classname_by_ref( result->ms_db-o_app ).
r_result->ms_db-id_prev_app = ms_db-id. result->ms_db-id_prev_app = ms_db-id.
r_result->ms_db-id_prev_app_stack = ms_db-id. result->ms_db-id_prev_app_stack = ms_db-id.
r_result->ms_next-lifecycle_method = z2ui5_if_client=>cs-lifecycle_method-on_init. result->ms_next-lifecycle_method = z2ui5_if_client=>cs-lifecycle_method-on_init.
r_result->ms_next-t_after = ms_next-t_after. result->ms_next-t_after = ms_next-t_after.
r_result->ms_next-view = ms_next-view. result->ms_next-view = ms_next-view.
r_result->ms_next-event = ms_next-event. result->ms_next-event = ms_next-event.
r_result->ms_db-t_attri = _=>get_t_attri_by_ref( r_result->ms_db-o_app ). result->ms_db-t_attri = _=>get_t_attri_by_ref( result->ms_db-o_app ).
ENDMETHOD. ENDMETHOD.
METHOD set_app_system_error. METHOD set_app_system_error.
z2ui5_lcl_db=>create( id = ms_db-id db = ms_db ). z2ui5_lcl_db=>create( id = ms_db-id db = ms_db ).
r_result = NEW #( ). result = NEW #( ).
r_result->ms_db-o_app = z2ui5_lcl_system_app=>factory_error( error = ix app = ms_db-o_app kind = kind ). result->ms_db-o_app = z2ui5_lcl_system_app=>factory_error( error = ix app = ms_db-o_app kind = kind ).
r_result->ms_db-app_classname = _=>get_classname_by_ref( r_result->ms_db-o_app ). result->ms_db-app_classname = _=>get_classname_by_ref( result->ms_db-o_app ).
r_result->ms_db-id_prev_app = ms_db-id. result->ms_db-id_prev_app = ms_db-id.
r_result->ms_db-id_prev_app_stack = ms_db-id. result->ms_db-id_prev_app_stack = ms_db-id.
r_result->ms_next-lifecycle_method = z2ui5_if_client=>cs-lifecycle_method-on_init. result->ms_next-lifecycle_method = z2ui5_if_client=>cs-lifecycle_method-on_init.
r_result->ms_next-t_after = ms_next-t_after. result->ms_next-t_after = ms_next-t_after.
r_result->ms_db-t_attri = _=>get_t_attri_by_ref( r_result->ms_db-o_app ). result->ms_db-t_attri = _=>get_t_attri_by_ref( result->ms_db-o_app ).
r_result->ms_db-id_prev_app = ms_db-id. result->ms_db-id_prev_app = ms_db-id.
ms_actual-lifecycle_method = z2ui5_if_client=>cs-lifecycle_method-on_init. ms_actual-lifecycle_method = z2ui5_if_client=>cs-lifecycle_method-on_init.
ENDMETHOD. ENDMETHOD.

View File

@ -369,6 +369,7 @@ INTERFACE z2ui5_if_view
title TYPE clike OPTIONAL title TYPE clike OPTIONAL
navbuttontap TYPE clike OPTIONAL navbuttontap TYPE clike OPTIONAL
id TYPE clike OPTIONAL id TYPE clike OPTIONAL
class type clike optional
PREFERRED PARAMETER title PREFERRED PARAMETER title
RETURNING RETURNING
VALUE(result) TYPE REF TO z2ui5_if_view. VALUE(result) TYPE REF TO z2ui5_if_view.
@ -641,6 +642,12 @@ INTERFACE z2ui5_if_view
RETURNING RETURNING
VALUE(result) TYPE REF TO z2ui5_if_view. VALUE(result) TYPE REF TO z2ui5_if_view.
METHODS formatted_text
IMPORTING
htmlText TYPE clike optional
RETURNING
VALUE(result) TYPE REF TO z2ui5_if_view.
METHODS _generic METHODS _generic
IMPORTING IMPORTING
name TYPE clike name TYPE clike