sap. ndc. Barcodescannerbutton: button control used to start the barcode scanning process (display barcode icon). If the local scanning function is not available or the camera function is not granted, the button is either hidden or provides backup by opening a dialog box with input fields, in which the barcode can be entered manually. After codescanner is loaded, it is executed
// * Feature vector (sap.Settings.isFeatureEnabled) is available // * Barcode scanner is enabled by the Feature Vector // * Barcode scanner Cordova plug-in (cordova.plugins.barcodeScanner) or zxing-js (ZXing.BrowserMultiFormatReader) is available
The available attribute defaults to true:
native device capabilities should be by default enabled if there is no feature vector available to restrict the capability.
Cordova API not detected in browser:
Then try to get
ZXingAPIThis is an asynchronous process.
After clicking the barcode button, execute the code in line 129 below
If the barcode scanning function is not available, start the barcode scanning process, display the real-time input from the camera or display the dialog box to enter the value directly.
Barcode scanning is done asynchronously. When it is triggered, the function returns without waiting for the scan process to complete. The application must provide callback functions to respond to successful scans, errors during scans, and real-time input events on dialog boxes.
Fnsuccess passes an object with text, formatting, and cancellation properties. Text is the text representation of barcode data, format is the detected barcode type, and cancel is whether the user cancels scanning. Fnerror gives the error, and fnliveupdate is passed the new value entered in the input field of the dialog box.
Only when cordovascanner API is available, the following branch of line 584 is entered:
Otherwise, enter line 618 and a dialog box will pop up.
SAP Fiori client is the native mobile application runtime container of SAP Fiori application. SAP Fiori client allows users to access their SAP Fiori applications online. Later, I will introduce how to solve the problem of unavailable Cordova plug-in in Fiori client.