sap.ndc - BarcodeScannerButton
sap.ndc.BarcodeScannerButton expressed in abap2UI5 - a SAPUI5-only control, so the demo kit original is outside OpenUI5 and this is orientation rather than a 1:1 port.
Z2UI5_CL_SMPC_SAPUI5_011
Controls
sap.ndc
UI5 1.71
needs SAPUI5
needs SAPUI5. This sample is listed here because a sample somebody cannot find is worse than one they cannot run: sap.ndc. The ABAP is below; installed on a system that has what it needs, it runs there.
The facts
- Repository
- abap2UI5/samples-controls
- Class
Z2UI5_CL_SMPC_SAPUI5_011- Source file
z2ui5_cl_smpc_sapui5_011.clas.abap↗- Library
- sap.ndc
- Minimum UI5
- 1.71 — the floor abap2UI5 holds its samples to
- In the playground
- needs SAPUI5 — it opens for reading instead
Keywords: barcodescannerbutton, shell, simpleform, label, input
Controls it builds
- sap.m.Input
- sap.m.Label
- sap.m.Page
- sap.m.Shell
- sap.ndc.BarcodeScannerButton
- sap.ui.core.mvc.View
- sap.ui.layout.form.SimpleForm
Read out of the builder chain by the abap2UI5 linter, not from the category this sample is filed under — which is what makes “which samples build one of these” a question the catalogue can answer at all.
Libraries
The ABAP
z2ui5_cl_smpc_sapui5_011.clas.abap — 78 lines
Click a number to link to a line — shift-click for a range.
Read it on GitHub ↗
" @keywords barcodescannerbutton shell simpleform label input
" @summary sap.ndc.BarcodeScannerButton expressed in abap2UI5 - a SAPUI5-only control, so the demo kit original is outside OpenUI5 and this is orientation rather than a 1:1 port.
"! <p class="shorttext">sap.ndc - BarcodeScannerButton</p>
"!
"! SAPUI5-only control: it ships with SAPUI5, not with OpenUI5, so there is no
"! demo kit original in this repo's sample universe and no 1:1 port (AGENTS section 3).
"! Collected here as orientation - how the control is expressed in abap2UI5.
"!
"! SAPUI5 demo kit: https://ui5.sap.com/#/entity/sap.ndc.BarcodeScannerButton
CLASS z2ui5_cl_smpc_sapui5_011 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
DATA mv_scan_input TYPE string.
DATA mv_scan_type TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_smpc_sapui5_011 IMPLEMENTATION.
METHOD z2ui5_if_app~main.
IF client->get_event( ) = `ON_SCAN_SUCCESS`.
client->message_box_display( `Scan finished!` ).
DATA(lt_arg) = client->get( )-t_event_arg.
mv_scan_input = lt_arg[ 1 ].
mv_scan_type = lt_arg[ 2 ].
"implement further processing here...
"...
RETURN.
ENDIF.
DATA(view) = z2ui5_cl_ui5_view_builder=>factory( ).
view->ele( n = `View` ns = `mvc`
)->a( n = `displayBlock` v = `true`
)->a( n = `height` v = `100%`
)->a( n = `xmlns` v = `sap.m`
)->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
)->a( n = `xmlns:form` v = `sap.ui.layout.form`
)->a( n = `xmlns:ndc` v = `sap.ndc`
)->ele( `Shell`
)->ele( `Page`
)->a( n = `title` v = `abap2UI5`
)->a( n = `navButtonPress` v = client->_event_nav_app_leave( )
)->a( n = `showNavButton` b = client->check_app_prev_stack( )
)->a( n = `showHeader` b = xsdbool( client->get( )-check_launchpad_active = abap_false )
)->ele( n = `SimpleForm` ns = `form`
)->a( n = `title` v = `Information`
)->a( n = `editable` b = abap_true
)->ele( n = `content` ns = `form`
)->tag( `Label`
)->a( n = `text` v = `mv_scan_input`
)->tag( `Input`
)->a( n = `value` v = client->_bind( mv_scan_input )
)->tag( `Label`
)->a( n = `text` v = `mv_scan_type`
)->tag( `Input`
)->a( n = `value` v = client->_bind( mv_scan_type )
)->tag( `Label`
)->a( n = `text` v = `scanner`
)->tag( n = `BarcodeScannerButton` ns = `ndc`
)->a( n = `dialogTitle` v = `Barcode Scanner`
)->a( n = `scanSuccess` v = client->_event( val = `ON_SCAN_SUCCESS`
t_arg = VALUE #( ( `${$parameters>/text}` )
( `${$parameters>/format}` ) ) ) ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
ENDCLASS.
On this page