Skip to content

Commit

Permalink
Sample for F4-Help (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
abapsheep authored Jun 12, 2024
1 parent 9a4d289 commit 178cd44
Show file tree
Hide file tree
Showing 2 changed files with 153 additions and 0 deletions.
137 changes: 137 additions & 0 deletions src/z2ui5_cl_demo_app_204.clas.abap
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
CLASS z2ui5_cl_demo_app_204 DEFINITION
PUBLIC
CREATE PUBLIC.

PUBLIC SECTION.
INTERFACES z2ui5_if_app.

DATA ms_t004 TYPE z2ui5_t004.

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

DATA mv_active_f4 TYPE string.

METHODS on_init.
METHODS on_event.
METHODS render_main.
METHODS call_f4.

PRIVATE SECTION.
METHODS on_after_f4.

ENDCLASS.


CLASS z2ui5_cl_demo_app_204 IMPLEMENTATION.

METHOD on_event.

CASE client->get( )-event.

WHEN 'BACK'.
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).

WHEN `CALL_POPUP_F4`.

call_f4( ).

WHEN OTHERS.

ENDCASE.

ENDMETHOD.

METHOD on_init.

render_main( ).

ENDMETHOD.

METHOD render_main.

DATA(view) = z2ui5_cl_xml_view=>factory( ). "->shell( ).

DATA(page) = view->page( title = 'Layout'
navbuttonpress = client->_event( 'BACK' )
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL )
class = 'sapUiContentPadding' ).

page->simple_form( title = 'F4-Help'
editable = abap_true
)->content( 'form'
)->text(
`Table Z2UI5_T004 field GUID is linked to table Z2UI5 field GUID via a foreign key link.`
)->label( `GUID`
)->input( value = client->_bind_edit( ms_t004-guid )
showvaluehelp = abap_true
valuehelprequest = client->_event( val = 'CALL_POPUP_F4'
t_arg = VALUE #( ( `GUID` ) ) ) ).

client->view_display( view->stringify( ) ).

ENDMETHOD.

METHOD z2ui5_if_app~main.
me->client = client.

IF check_initialized = abap_false.
check_initialized = abap_true.
on_init( ).
ENDIF.

on_event( ).

on_after_f4( ).

ENDMETHOD.

METHOD call_f4.

DATA(lt_arg) = client->get( )-t_event_arg.

mv_active_f4 = VALUE string( lt_arg[ 1 ] ).

CASE mv_active_f4.
WHEN `GUID`.

client->nav_app_call( z2ui5_cl_pop_f4_help=>factory( i_table = 'Z2UI5_T004'
i_fname = 'GUID'
i_value = CONV #( ms_t004-guid ) ) ).
WHEN OTHERS.

ENDCASE.

ENDMETHOD.

METHOD on_after_f4.

IF client->get( )-check_on_navigated = abap_false.
RETURN.
ENDIF.

TRY.
DATA(app) = CAST z2ui5_cl_pop_f4_help( client->get_app( client->get( )-s_draft-id_prev_app ) ).

IF app->mv_return_value IS NOT INITIAL.

CASE mv_active_f4.
WHEN `GUID`.

ms_t004-guid = CONV #( app->mv_return_value ).

WHEN OTHERS.

ENDCASE.

client->view_model_update( ).

ENDIF.

CATCH cx_root.
ENDTRY.

ENDMETHOD.

ENDCLASS.
16 changes: 16 additions & 0 deletions src/z2ui5_cl_demo_app_204.clas.xml
Original file line number Diff line number Diff line change
@@ -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_DEMO_APP_204</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>Table Layout</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

0 comments on commit 178cd44

Please sign in to comment.