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: 

Issue with hidden ASCII characters for 2D barcode

Former Member
0 Kudos

Hi,

I have created 2D barcode using PDF417. Below is code which generates data to be displayed as barcode.

* Logic for 2D barcode.

DATA: lv_hex_rs       TYPE x LENGTH 4 VALUE '001E',

           lv_hex_gs      TYPE x LENGTH 4 VALUE '001D',

           lv_hex_eot     TYPE x LENGTH 4 VALUE '0004'.

DATA:  lv_rs   TYPE c,

            lv_gs  TYPE c,

            lv_eot TYPE c.

FIELD-SYMBOLS: <fs_rs>,

                             <fs_gs>,

                             <fs_eot>.

* Get non-Printing character set.

ASSIGN lv_hex_rs   TO <fs_rs> CASTING TYPE c.

ASSIGN lv_hex_gs  TO <fs_gs> CASTING TYPE c.

ASSIGN lv_hex_eot TO <fs_eot> CASTING TYPE c.

IF <fs_rs> IS ASSIGNED .

   lv_rs = <fs_rs>.

ENDIF.

IF <fs_gs> IS ASSIGNED.

   lv_gs = <fs_gs>.

ENDIF.

IF <fs_eot> IS ASSIGNED.

   lv_eot = <fs_eot>.

ENDIF.

CLEAR gv_2d.

CONCATENATE '[)>'      lv_rs

                         '06'      lv_gs

                         'P'       TEST      lv_gs

                         'Q'       500         lv_gs

                         'V'       009421  lv_gs

                         '1T'      150909  lv_gs

                         '3S'      w_zlabels-charg lv_rs lv_eot

           INTO gv_2d.

Now when this barcode is printed and scanned, it is scanned like below.

[)>#06#PTEST#Q500#V009421#1T150909#3SVB000089##.

But business requirement is that it should be scanned like below.

[)><RS>06<GS>PTEST<GS>Q500<GS>V009421<GS>1T150909<GS>3SVB000089<RS><EOT>.

Now I am not able to understand does it mean they want hard coded <GS>, <RS> and <EOT>?

How to get correct content for 2D barcode with non-printable ASCII characters.

                        


4 REPLIES 4

roberto_vacca2
Active Contributor
0 Kudos

Hi.

As you can see through documentation:

Then if you do something like this in ABAP:

types:

   char01        type c length 1.

data:

   s             type string,

   hex           type x length 4,

   char          type char01.

FIELD-SYMBOLS:

   <pc>.

hex = '09'.

assign hex to <pc> casting type char01.

char = <pc>.

WRITE:/ char.


You'll have a # hash as output char, but if you copy and paste it in notepad, for example, you'll have the specular converted ASCII value as seen in document before.


Hope to help

Bye

alexander_bolloni
Contributor
0 Kudos

Hi,

no, do not enter the non -printing data literally (as equivalent binary data) into your CHAR field that you pass in your form to the barcode. This will certainly  fail. Especially in a Unicode system.

The PDF417 implementation in SAP has special invocation codes for representing binary data. Check out SAP note 645158. You can represent for example binary character GS (hex 1D) by

\0x1D

in the PDF417 barcode data.

Regards,

  Alex

0 Kudos

Hi Alex,

but how to write code. How to generate string that needs to be converted into 2D barcode.

0 Kudos

the \0x1D or \u0006 works in formcalc. in fact, i only use \u0006 in formcalc and it works because of the label printer programming. if you are working with creating 2d barcodes for a pdf, you need to do what the programming above and you will get very strange characters but they should work for scanning.