|
1 | | -class Z2UI5_CL_DEMO_APP_S_04 definition |
2 | | - public |
3 | | - create public . |
| 1 | +CLASS z2ui5_cl_demo_app_s_04 DEFINITION PUBLIC CREATE PUBLIC. |
4 | 2 |
|
5 | | -public section. |
6 | | -protected section. |
7 | | -private section. |
| 3 | + PUBLIC SECTION. |
| 4 | + INTERFACES z2ui5_if_app. |
| 5 | + |
| 6 | + DATA unit TYPE meins. |
| 7 | + DATA numc TYPE z2ui5_numc12. |
| 8 | + DATA numc_out TYPE c LENGTH 12. |
| 9 | + |
| 10 | + |
| 11 | + PROTECTED SECTION. |
| 12 | + DATA client TYPE REF TO z2ui5_if_client. |
| 13 | + |
| 14 | + METHODS z2ui5_set_data. |
| 15 | + |
| 16 | + METHODS display_view |
| 17 | + IMPORTING |
| 18 | + !client TYPE REF TO z2ui5_if_client. |
| 19 | + |
| 20 | + METHODS on_event |
| 21 | + IMPORTING |
| 22 | + !client TYPE REF TO z2ui5_if_client. |
| 23 | + |
| 24 | + PRIVATE SECTION. |
8 | 25 | ENDCLASS. |
9 | 26 |
|
10 | 27 |
|
| 28 | +CLASS z2ui5_cl_demo_app_s_04 IMPLEMENTATION. |
| 29 | + |
| 30 | + METHOD z2ui5_if_app~main. |
| 31 | + |
| 32 | + me->client = client. |
| 33 | + |
| 34 | + IF client->check_on_init( ). |
| 35 | + display_view( client ). |
| 36 | + z2ui5_set_data( ). |
| 37 | + ENDIF. |
| 38 | + |
| 39 | + on_event( client ). |
| 40 | + |
| 41 | + ENDMETHOD. |
| 42 | + |
| 43 | + METHOD display_view. |
| 44 | + |
| 45 | + DATA(view) = z2ui5_cl_xml_view=>factory( ). |
| 46 | + |
| 47 | + client->view_display( val = view->shell( |
| 48 | + )->page( title = 'abap2UI5 - Conversion Exit' |
| 49 | + navbuttonpress = client->_event( 'BACK' ) |
| 50 | + shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) |
| 51 | + )->simple_form( title = 'Form Title' |
| 52 | + editable = abap_true |
| 53 | + )->content( 'form' |
| 54 | + )->title( 'Conversion' |
| 55 | + )->label( 'Numeric' |
| 56 | + )->input( value = client->_bind_edit( numc_out ) |
| 57 | + enabled = abap_false |
| 58 | + )->label( `Unit` |
| 59 | + )->input( value = client->_bind_edit( unit ) |
| 60 | + enabled = abap_false |
| 61 | + )->stringify( ) ). |
| 62 | + |
| 63 | + ENDMETHOD. |
| 64 | + |
| 65 | + METHOD on_event. |
| 66 | + |
| 67 | + CASE client->get( )-event. |
| 68 | + WHEN 'BACK'. |
| 69 | + client->nav_app_leave( ). |
| 70 | + ENDCASE. |
| 71 | + |
| 72 | + ENDMETHOD. |
| 73 | + |
| 74 | + METHOD z2ui5_set_data. |
| 75 | + |
| 76 | + unit = 'ST'. " internal ST -> external PC (if logged in in english) |
| 77 | + numc = 10. " internal 0000000010 -> external 10 |
| 78 | + |
| 79 | + TRY. |
| 80 | + CALL FUNCTION `CONVERSION_EXIT_CUNIT_OUTPUT` |
| 81 | + EXPORTING |
| 82 | + input = unit |
| 83 | + IMPORTING |
| 84 | + output = unit |
| 85 | + EXCEPTIONS |
| 86 | + OTHERS = 99. |
| 87 | + |
| 88 | +* numc = |{ numc ALPHA = OUT }|. |
| 89 | + CALL FUNCTION `CONVERSION_EXIT_ALPHA_OUTPUT` |
| 90 | + EXPORTING |
| 91 | + input = numc |
| 92 | + IMPORTING |
| 93 | + output = numc_out |
| 94 | + EXCEPTIONS |
| 95 | + OTHERS = 99. |
| 96 | + |
| 97 | + CATCH cx_root. |
| 98 | + ENDTRY. |
| 99 | + |
| 100 | + ENDMETHOD. |
11 | 101 |
|
12 | | -CLASS Z2UI5_CL_DEMO_APP_S_04 IMPLEMENTATION. |
13 | 102 | ENDCLASS. |
0 commit comments