Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Using Barcode Scanner to read maintenance order number

Former Member
0 Kudos

Hi experts!

I have a question regarding Barcode Scanner and integration of it into a Z-Report. I have found a lot of threads but none of them is really helpful to me due to the fact that I am totally new in this field of application.

The requirement is as follows:

Our customer wants to start SAP in production hall/garage or whatever. In there, the employee scans the barcode of a maintenance order which he has to process. Simplest scenario to proceed:

--> The Maintenance order number should be stored in a ZTable with the time stamp, when the order was scanned by the reader. My questions now are:

1.) How can I use the information read by the barcode reader?

     1.1) Is it possible to trigger an event when the barcode is read or is it better to solve this with a Z-Report/Z-Transaction?

2.) Are there any configurations which have to be done in order to use this functionality?

3.) Which Interface (Classes or FM) are provided by SAP to handle this kind of requirements?

4.) Do you have any sample programs or step by step examples to read barcode and use it in report?

Any helpful answer will be rewarded. Thanks in advance,

Best Regards,

Patrick

1 ACCEPTED SOLUTION

0 Kudos

Hi Patrick,

In case you still haven't solved the issue, it is quite simple: a scanner is just a regular keyboard, another tool to input values.

Bellow an example using a selection-screen report. There are 2 important things to keep in mind:

1-      make sure the cursor sets on the right input field you want the scanner to capture the order number to. This is handy because the users won’t have to  do that themselves by dragging and clicking the mouse.

2-      if you want the report to fire right away after scanning, program the scanner in a way that it sends the Enter keystroke automatically after inputting the value.

Programming the scanner is also quite simple: google on your scanner name how to add Enter and you will get a documentation where you need to scan a specific barcode and voila!

Please take a look on the link bellow, in my case it is motorola scanner. you can even add prefixes and suffixes to your scanner. Alter sound and tone 😉

http://www.thebarcodewarehouse.co.uk/Assets/Documents/Motorola/Manuals/Motorola-LS1203-Quick-Start-G...


REPORT zscan_order.

PARAMETERS p_field      TYPE char10.    "this field added to show the use of the SET CURSOR FIELD

PARAMETERS p_aufnr      TYPE aufnr.

*Here you make sure that your cursor sets on the input field you want at start

INITIALIZATION.

  SET CURSOR FIELD 'P_AUFNR'.

*This screen-event is triggered by the validation (pressing of the Enter) of the input in order number field

AT SELECTION-SCREEN ON p_aufnr.

  lcl_scan_order=>do_something_with_order( IMPORTING i_order_number = p_aufnr ).

* OR

  PERFORM do_something_with_order USING p_aufnr.

Regards,

Kamal.

7 REPLIES 7

former_member182550
Active Contributor
0 Kudos

The easiest way would be to use a wedge scanner which plugs directly into the keyboard.  The user then just places the cursor in the appropriate field on the screen and scans the barcode.

For what you are  proposing I wouldn't consider anything more complicated.

Rich

0 Kudos

Hi Richard,

Ok thats fine for me. As I said, I have no experience with barcode reading.

So the best way would be to make e.g. a Dynpro with only one Field (Type Mainenance order). But how does the wedge scanner works? Do I simply place the cursor at that field when starting the Report / Transaction? and the rest is done by SAP itself?

Regards

Patrick

0 Kudos

Hi,

The wedge scanner injects keycodes into the keyboard buffer.  Unless the barcode contains something like an enter key the user would have to click online.

However,  it might be more productive to write the interface in something that is really event driven (for example VB) so that you can catch an 'On Change' event from the field,  call a custom written BAPI to do your work and then clear the field again.  That way the user does not have to keep clicking the ONLI button.

Rich

0 Kudos

Hi, Patrick.

Have you ever worked it out? I wonder whether it is the latest version of the Barcode reader you were using? I am also looking for a fine barcode scanner whose way of processing is simple and fast to help me scan aztec barcode. It will be better if it offers free trials for users to check. Any suggestion will be appreciated. Thanks in advance.

Best regards,

Pan

0 Kudos

Hi Pan!

I haven't figured it out yet but I will let you know ASAP i have found a solution for this task.

0 Kudos

Hi Patrick,

In case you still haven't solved the issue, it is quite simple: a scanner is just a regular keyboard, another tool to input values.

Bellow an example using a selection-screen report. There are 2 important things to keep in mind:

1-      make sure the cursor sets on the right input field you want the scanner to capture the order number to. This is handy because the users won’t have to  do that themselves by dragging and clicking the mouse.

2-      if you want the report to fire right away after scanning, program the scanner in a way that it sends the Enter keystroke automatically after inputting the value.

Programming the scanner is also quite simple: google on your scanner name how to add Enter and you will get a documentation where you need to scan a specific barcode and voila!

Please take a look on the link bellow, in my case it is motorola scanner. you can even add prefixes and suffixes to your scanner. Alter sound and tone 😉

http://www.thebarcodewarehouse.co.uk/Assets/Documents/Motorola/Manuals/Motorola-LS1203-Quick-Start-G...


REPORT zscan_order.

PARAMETERS p_field      TYPE char10.    "this field added to show the use of the SET CURSOR FIELD

PARAMETERS p_aufnr      TYPE aufnr.

*Here you make sure that your cursor sets on the input field you want at start

INITIALIZATION.

  SET CURSOR FIELD 'P_AUFNR'.

*This screen-event is triggered by the validation (pressing of the Enter) of the input in order number field

AT SELECTION-SCREEN ON p_aufnr.

  lcl_scan_order=>do_something_with_order( IMPORTING i_order_number = p_aufnr ).

* OR

  PERFORM do_something_with_order USING p_aufnr.

Regards,

Kamal.

0 Kudos

Hi Kamal,

I haven't implemented this topic yet. But thanks for the detailed description, sounds very good to me. I will let you know as soon as I have implemented the topic on our customers system.

Regards,

Patrick