Skip to Content
Author's profile photo Andrei Vishnevsky

Nice (yet another) way to enable barcode scanner in C4C custom development

If the Reader followed my previous blogs about custom panes and custom controls in C4C and how to use them to utilize barcode scanner, for example, the one may have found it quite complicated and long to read.

Fortunately, SAP recently brought something nice to do the same thing. I personally found it only a few days ago in 1808.

I think (and hope) it came from the idea Automated barcode/number/text reading for an input field from camera of a device. However, it took almost a year to have it voted and implemented. Or I didn’t notice its arrival earlier but I doubt. Actually, the idea is still in “Review and Develop” phase (since April 2018). Nevertheless, the thing is it’s available now and let’s have a look at how it can be easily utilized.

The main point here:

Fields with display type as InputField (and some others types as well but it’s a different story) now have a new section in their properties in UI Designer called “Fiori Client Specific”.
There are few properties currently available:

  • Enable Barcode Scanner
  • Font Size
  • ForegroundColor
  • MachineLearningContext

I found only “Enable Barcode Scanner” working as of now. Maybe other entries are in preparation for next releases. Let’s see.

Getting back to the topic of this particular blog.
I took the same Embedded Component which I used in my previous blog.
Added new DataField “BarCodeResult” in Data Model and brought it on the screen.
Then set its property “Enable Barcode Scanner” to True.

That is really all. We good to go and test with C4C app.

The field in question now has tiny barcode icon when you’re in edit mode. Once this icon pressed, the barcode scanner is started.

When you scanned the barcode, its value populated straight back to the field.

   

That’s it! No video today, sorry.

 

Now we can proceed, assign our own event handler for OnValueChanged event for this field in Data Model and we’re good to go and format the scanning result as we already did previously or do any other cool things.

Hopefully, ForegroundColor and MachineLearningContext (honestly have no idea what this one is about) will work so easily as well.

Assigned Tags

      7 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Dedeepya Reddy
      Dedeepya Reddy

      Hi Andrei,

      I don't see "Font Size" on my UI Designer 🙂

      Would you know if it is enabled for a any specific types?

      Regards

      Dedeepya

       

      Author's profile photo Andrei Vishnevsky
      Andrei Vishnevsky
      Blog Post Author

      Hi Dedeepya Reddy ,

      It's just an input field. No specific type. Probably SDK version makes the difference. I have the latest available as of now: 1808 SP03 (file SOLSTUD1808SP03_0-70003547.MSI )

      Author's profile photo Dhruvin Mehta
      Dhruvin Mehta

      how can we enable barcode scan for a strandard field?

      Author's profile photo Andrei Vishnevsky
      Andrei Vishnevsky
      Blog Post Author

      Apparently, the answer from SAP Support would be: "It's a feature request, please raise an idea using Idea Place". Jokes aside, currently I can't see it's possible.

      Author's profile photo Dhruvin Mehta
      Dhruvin Mehta

      Thanks so appararently i have to create a lot of transient fields to hold data in EC and move them on Standard field incase if want to achieve this! X(

      Author's profile photo Andrei Vishnevsky
      Andrei Vishnevsky
      Blog Post Author

      Nah, you need custom SDK UI field (input field control) where you enable barcode property. But the UI field can be linked to the standard data model field directly. No transient field required.

      Author's profile photo Dhruvin Mehta
      Dhruvin Mehta

      Aah okay Gotcha!! 🙂 Thanks!!!