Skip to content

Commit 742bb4c

Browse files
abapsheepViktor Hoffmannoblomov-dev
authored
Samples Update (#492)
* Samples Update z2ui5_cl_demo_app_067 - added numeric Conversion z2ui5_cl_demo_app_326 - was not added to samples_000 this sample will dump! /SCWM/TANUM is a NUMC12 with an conversion exit ALPH0. NUMC12 in an external format (000000000099 -> 99) can not be serialized. * update * Changed Dataelement Created Dataelement Z2UI5_NUMC12 to showcase conversion of Numerics. Z2UI5_NUMC12: Data Type NUMC No. Characters 12 Decimal Places 0 Routine ALPH0 * Dataelement Z2UI5_NUMC12 * Update * Update ABAP_STANDARD.yaml --------- Co-authored-by: Viktor Hoffmann <Viktor.Hoffmann@swisskrono.com> Co-authored-by: oblomov-dev <102328295+oblomov-dev@users.noreply.github.com>
1 parent 9cee165 commit 742bb4c

File tree

6 files changed

+239
-58
lines changed

6 files changed

+239
-58
lines changed

.github/workflows/ABAP_STANDARD.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ name: ABAP_STANDARD
22

33
on:
44
push:
5-
branches: [standard]
6-
5+
76
permissions:
87
contents: read
98

Lines changed: 88 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
CLASS z2ui5_cl_demo_app_067 DEFINITION PUBLIC.
22

33
PUBLIC SECTION.
4-
54
INTERFACES z2ui5_if_app.
65

7-
DATA amount TYPE p LENGTH 14 DECIMALS 3.
8-
DATA currency TYPE string.
6+
DATA amount TYPE p LENGTH 14 DECIMALS 3.
7+
DATA currency TYPE string.
8+
DATA numeric TYPE Z2UI5_NUMC12.
99

1010
DATA check_initialized TYPE abap_bool.
1111

1212
PROTECTED SECTION.
13+
1314
PRIVATE SECTION.
1415
ENDCLASS.
1516

1617

17-
18-
CLASS Z2UI5_CL_DEMO_APP_067 IMPLEMENTATION.
19-
18+
CLASS z2ui5_cl_demo_app_067 IMPLEMENTATION.
2019

2120
METHOD z2ui5_if_app~main.
2221

2322
IF check_initialized = abap_false.
2423
check_initialized = abap_true.
2524

25+
numeric = '000000000012'.
2626
amount = '123456789.123'.
2727
currency = `USD`.
2828

@@ -33,56 +33,88 @@ CLASS Z2UI5_CL_DEMO_APP_067 IMPLEMENTATION.
3333
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
3434
ENDCASE.
3535

36-
client->view_display( z2ui5_cl_xml_view=>factory( )->shell(
37-
)->page(
38-
title = 'abap2UI5 - Currency Format'
39-
navbuttonpress = client->_event( 'BACK' )
40-
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL )
41-
)->simple_form( title = 'Currency'
42-
editable = abap_true
43-
)->content( 'form'
44-
)->title( 'Input'
45-
)->label( 'Documentation'
46-
)->link( text = 'https://sapui5.hana.ondemand.com/#/entity/sap.ui.model.type.Currency'
47-
href = 'https://sapui5.hana.ondemand.com/#/entity/sap.ui.model.type.Currency'
48-
)->label( 'One field'
49-
)->input( `{ parts: [ '` && client->_bind_edit( val = amount
50-
path = abap_true ) && `', '` && client->_bind_edit( val = currency
51-
path = abap_true ) && `'], type: 'sap.ui.model.type.Currency' }`
52-
)->label( 'Two field'
53-
)->input( `{ parts: [ '` && client->_bind_edit( val = amount
54-
path = abap_true ) && `', '` && client->_bind_edit( val = currency
55-
path = abap_true ) && `'], type: 'sap.ui.model.type.Currency' , formatOptions: {showMeasure: false} }`
56-
)->input( `{ parts: [ '` && client->_bind_edit( val = amount
57-
path = abap_true ) && `', '` && client->_bind_edit( val = currency
58-
path = abap_true ) && `'], type: 'sap.ui.model.type.Currency' , formatOptions: {showNumber: false} }`
59-
)->label( 'Default'
60-
)->text( `{ parts: [ '` && client->_bind_edit( val = amount
61-
path = abap_true ) && `', '` && client->_bind_edit( val = currency
62-
path = abap_true ) && `'], type: 'sap.ui.model.type.Currency' }`
63-
)->label( 'preserveDecimals:false'
64-
)->text( `{ parts: [ '` && client->_bind_edit( val = amount
65-
path = abap_true ) && `', '` && client->_bind_edit( val = currency
66-
path = abap_true ) &&
67-
`'], type: 'sap.ui.model.type.Currency' , formatOptions: { preserveDecimals : false } }`
68-
)->label( 'currencyCode:false'
69-
)->text( `{ parts: [ '` && client->_bind_edit( val = amount
70-
path = abap_true ) && `', '` && client->_bind_edit( val = currency
71-
path = abap_true ) &&
72-
`'], type: 'sap.ui.model.type.Currency' , formatOptions: { currencyCode : false } }`
73-
)->label( `style:'short'`
74-
)->text( `{ parts: [ '` && client->_bind_edit( val = amount
75-
path = abap_true ) && `', '` && client->_bind_edit( val = currency
76-
path = abap_true ) && `'], type: 'sap.ui.model.type.Currency' , formatOptions: { style : 'short' } }`
77-
)->label( `style:'long'`
78-
)->text( `{ parts: [ '` && client->_bind_edit( val = amount
79-
path = abap_true ) && `', '` && client->_bind_edit( val = currency
80-
path = abap_true ) && `'], type: 'sap.ui.model.type.Currency' , formatOptions: { style : 'long' } }`
81-
)->label( 'event'
82-
)->button( text = 'send'
83-
press = client->_event( 'BUTTON' )
84-
)->stringify( ) ).
85-
36+
DATA(page) = z2ui5_cl_xml_view=>factory( )->shell(
37+
)->page( title = 'abap2UI5 - Currency Format'
38+
navbuttonpress = client->_event( 'BACK' )
39+
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) ).
40+
41+
page->simple_form( title = 'Currency'
42+
editable = abap_true
43+
)->content( 'form'
44+
)->title( 'Input'
45+
)->label( 'Documentation'
46+
)->link( text = 'https://sapui5.hana.ondemand.com/#/entity/sap.ui.model.type.Currency'
47+
href = 'https://sapui5.hana.ondemand.com/#/entity/sap.ui.model.type.Currency'
48+
)->label( 'One field'
49+
)->input(
50+
|\{ parts: [ '{ client->_bind_edit( val = amount
51+
path = abap_true ) }', '{ client->_bind_edit(
52+
val = currency
53+
path = abap_true ) }'], type: 'sap.ui.model.type.Currency' \}|
54+
)->label( 'Two field'
55+
)->input(
56+
|\{ parts: [ '{ client->_bind_edit( val = amount
57+
path = abap_true ) }', '{ client->_bind_edit(
58+
val = currency
59+
path = abap_true ) }'], type: 'sap.ui.model.type.Currency' , formatOptions: \{showMeasure: false\} \}|
60+
)->input(
61+
|\{ parts: [ '{ client->_bind_edit( val = amount
62+
path = abap_true ) }', '{ client->_bind_edit(
63+
val = currency
64+
path = abap_true ) }'], type: 'sap.ui.model.type.Currency' , formatOptions: \{showNumber: false\} \}|
65+
)->label( 'Default'
66+
)->text(
67+
|\{ parts: [ '{ client->_bind_edit( val = amount
68+
path = abap_true ) }', '{ client->_bind_edit(
69+
val = currency
70+
path = abap_true ) }'], type: 'sap.ui.model.type.Currency' \}|
71+
)->label( 'preserveDecimals:false'
72+
)->text( |\{ parts: [ '{ client->_bind_edit( val = amount
73+
path = abap_true ) }', '| && client->_bind_edit(
74+
val = currency
75+
path = abap_true ) &&
76+
|'], type: 'sap.ui.model.type.Currency' , formatOptions: \{ preserveDecimals : false \} \}|
77+
)->label( 'currencyCode:false'
78+
)->text( |\{ parts: [ '{ client->_bind_edit( val = amount
79+
path = abap_true ) }', '| && client->_bind_edit(
80+
val = currency
81+
path = abap_true ) &&
82+
|'], type: 'sap.ui.model.type.Currency' , formatOptions: \{ currencyCode : false \} \}|
83+
)->label( `style:'short'`
84+
)->text(
85+
|\{ parts: [ '{ client->_bind_edit( val = amount
86+
path = abap_true ) }', '{ client->_bind_edit(
87+
val = currency
88+
path = abap_true ) }'], type: 'sap.ui.model.type.Currency' , formatOptions: \{ style : 'short' \} \}|
89+
)->label( `style:'long'`
90+
)->text(
91+
|\{ parts: [ '{ client->_bind_edit( val = amount
92+
path = abap_true ) }', '{ client->_bind_edit(
93+
val = currency
94+
path = abap_true ) }'], type: 'sap.ui.model.type.Currency' , formatOptions: \{ style : 'long' \} \}|
95+
)->label( 'event'
96+
)->button( text = 'send'
97+
press = client->_event( 'BUTTON' ) ).
98+
99+
page->simple_form( title = 'No Zeros'
100+
editable = abap_true
101+
)->content( 'form'
102+
)->title( 'Input'
103+
)->label( 'Documentation'
104+
)->link( text = 'https://sapui5.hana.ondemand.com/sdk/#/api/sap.ui.model.odata.type.String%23methods/formatValue'
105+
href = 'https://sapui5.hana.ondemand.com/sdk/#/api/sap.ui.model.odata.type.String%23methods/formatValue'
106+
)->label( 'Numeric'
107+
)->input( value = client->_bind_edit( val = numeric )
108+
109+
)->label( `Without leading Zeros`
110+
111+
)->text(
112+
text = |\{path : '{ client->_bind_edit(
113+
val = numeric
114+
path = abap_true ) }', type : 'sap.ui.model.odata.type.String', constraints : \{ isDigitSequence : true \} \}| ).
115+
116+
client->view_display( page->stringify( ) ).
86117

87118
ENDMETHOD.
119+
88120
ENDCLASS.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
CLASS z2ui5_cl_demo_app_326 DEFINITION PUBLIC CREATE PUBLIC.
2+
3+
PUBLIC SECTION.
4+
INTERFACES z2ui5_if_app.
5+
6+
DATA unit TYPE meins.
7+
DATA numc TYPE z2ui5_numc12.
8+
DATA check_initialized TYPE abap_bool.
9+
10+
PROTECTED SECTION.
11+
DATA client TYPE REF TO z2ui5_if_client.
12+
13+
METHODS z2ui5_set_data.
14+
15+
METHODS display_view
16+
IMPORTING
17+
!client TYPE REF TO z2ui5_if_client.
18+
19+
METHODS on_event
20+
IMPORTING
21+
!client TYPE REF TO z2ui5_if_client.
22+
23+
PRIVATE SECTION.
24+
ENDCLASS.
25+
26+
27+
CLASS z2ui5_cl_demo_app_326 IMPLEMENTATION.
28+
29+
METHOD z2ui5_if_app~main.
30+
31+
me->client = client.
32+
33+
IF check_initialized = abap_false.
34+
check_initialized = abap_true.
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 )
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 input = unit
82+
IMPORTING output = unit
83+
EXCEPTIONS OTHERS = 99.
84+
85+
CALL FUNCTION `CONVERSION_EXIT_ALPHA_OUTPUT`
86+
EXPORTING input = numc
87+
IMPORTING output = numc
88+
EXCEPTIONS OTHERS = 99.
89+
90+
CATCH cx_root.
91+
ENDTRY.
92+
93+
ENDMETHOD.
94+
95+
ENDCLASS.

src/z2ui5_cl_demo_app_326.clas.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
3+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
4+
<asx:values>
5+
<VSEOCLASS>
6+
<CLSNAME>Z2UI5_CL_DEMO_APP_326</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>
16+
</abapGit>

src/z2ui5_numc12.doma.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DOMA" serializer_version="v1.0.0">
3+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
4+
<asx:values>
5+
<DD01V>
6+
<DOMNAME>Z2UI5_NUMC12</DOMNAME>
7+
<DDLANGUAGE>E</DDLANGUAGE>
8+
<DATATYPE>NUMC</DATATYPE>
9+
<LENG>000012</LENG>
10+
<OUTPUTLEN>000012</OUTPUTLEN>
11+
<CONVEXIT>ALPHA</CONVEXIT>
12+
<DDTEXT>Numc12</DDTEXT>
13+
</DD01V>
14+
</asx:values>
15+
</asx:abap>
16+
</abapGit>

src/z2ui5_numc12.dtel.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DTEL" serializer_version="v1.0.0">
3+
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
4+
<asx:values>
5+
<DD04V>
6+
<ROLLNAME>Z2UI5_NUMC12</ROLLNAME>
7+
<DDLANGUAGE>E</DDLANGUAGE>
8+
<DOMNAME>Z2UI5_NUMC12</DOMNAME>
9+
<HEADLEN>07</HEADLEN>
10+
<SCRLEN1>07</SCRLEN1>
11+
<SCRLEN2>07</SCRLEN2>
12+
<SCRLEN3>07</SCRLEN3>
13+
<DDTEXT>Numeric 12</DDTEXT>
14+
<REPTEXT>Numc 12</REPTEXT>
15+
<SCRTEXT_S>Numc 12</SCRTEXT_S>
16+
<SCRTEXT_M>Numc 12</SCRTEXT_M>
17+
<SCRTEXT_L>Numc 12</SCRTEXT_L>
18+
<DTELMASTER>E</DTELMASTER>
19+
<REFKIND>D</REFKIND>
20+
</DD04V>
21+
</asx:values>
22+
</asx:abap>
23+
</abapGit>

0 commit comments

Comments
 (0)