Skip to content

Commit e1f66c0

Browse files
restore conversion-exit sample (#562)
1 parent 23cc84a commit e1f66c0

File tree

2 files changed

+109
-8
lines changed

2 files changed

+109
-8
lines changed
Lines changed: 96 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,102 @@
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.
42

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.
825
ENDCLASS.
926

1027

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.
11101

12-
CLASS Z2UI5_CL_DEMO_APP_S_04 IMPLEMENTATION.
13102
ENDCLASS.
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
3-
<asx:abap version="1.0" xmlns:asx="http://www.sap.com/abapxml"/>
3+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
4+
<asx:values>
5+
<VSEOCLASS>
6+
<CLSNAME>Z2UI5_CL_DEMO_APP_S_04</CLSNAME>
7+
<LANGU>E</LANGU>
8+
<DESCRIPT>Conversion Exits</DESCRIPT>
9+
<STATE>1</STATE>
10+
<CLSCCINCL>X</CLSCCINCL>
11+
<FIXPT>X</FIXPT>
12+
<UNICODE>X</UNICODE>
13+
</VSEOCLASS>
14+
</asx:values>
15+
</asx:abap>
416
</abapGit>

0 commit comments

Comments
 (0)