11CLASS 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 .
1415ENDCLASS .
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+
88120ENDCLASS .
0 commit comments