Application Development and Automation 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: 
Read only

Pass hex command for signature printing through variable in SAP script

Former Member
0 Likes
1,621

Hi all,

I should print signatures stored in TROY printer through SAP script. I am passing the below code and it is working fine.

/:HEX TYPE PCL
/=1B28323031511B2873307032683732763073306232303154"escape sequence to choose image
/=1B2a7031353939783239353759616263646566"position command followed by font "abcdef"
/:ENDHEX

But in my scenario, a set of different font escape sequences are stored in a custom table. And I should pick from that table and pass it to the script from my print program. Hence, I passed my font escape sequence through a variable as below, whereas its not working. It just prints the font "abcdef" as it is.

/:HEX TYPE PCL
/=&GV_SIGN1&
/=1B2a7031353939783239353759616263646566
/:ENDHEX

From my analysis, the hard-coded second line is working fine (both positioning and font printing). Whereas the first line, which I have passed as a variable(image choosing) is not working. Can anyone with prior experience with this kind of scenario in signature printing help?

Regards,

Shanthi Priya

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,156

Hi ShanthiPriya,

Based on SAP Help on this issue which states "SAPscript does not interpret the data enclosed by the HEX and ENDHEX command pair, but inserts it unchanged into the output stream. ", thus my conclusion is that the variable is not replaced with its value but is sent to the printer as the variable name itself. Since the printer does not understand the variable name it leaves it, I guess.

Below is the link to SAP Help.

Hexadecimal Data: HEX, ENDHEX

Thus, I guess you will simply have to hardcode the value.

Hi all,

I should print signatures stored in TROY printer through SAP script. I am passing the below code and it is working fine.

/:HEX TYPE PCL
/=1B28323031511B2873307032683732763073306232303154"escape sequence to choose image
/=1B2a7031353939783239353759616263646566"position command followed by font "abcdef"
/:ENDHEX

But in my scenario, a set of different font escape sequences are stored in a custom table. And I should pick from that table and pass it to the script from my print program. Hence, I passed my font escape sequence through a variable as below, whereas its not working. It just prints the font "abcdef" as it is.

/:HEX TYPE PCL
/=&GV_SIGN1&
/=1B2a7031353939783239353759616263646566
/:ENDHEX

From my analysis, the hard-coded second line is working fine (both positioning and font printing). Whereas the first line, which I have passed as a variable(image choosing) is not working. Can anyone with prior experience with this kind of scenario in signature printing help?

Regards,

Shanthi Priya

3 REPLIES 3
Read only

Former Member
0 Likes
1,156

Hi ShanthiPriya,

What is the data type for GV_SIGN1? Assuming it is char type, in that case, it wouldn't work. Generally any string that you put into a char variable is interpreted along with the " ' ". We need to actually key in the hex value. Hmmm...interesting problem. Per my experience, direct feed of Hex values works. Never tried it with variables.

Another question, is this a TROY printer. If so then you should refer to the print command documentation at the following location:

http://www.troygroup.com/support/documents/ProgrammersReferenceGuide.pdf

Hopefully this should help.

Read only

Former Member
0 Likes
1,157

Hi ShanthiPriya,

Based on SAP Help on this issue which states "SAPscript does not interpret the data enclosed by the HEX and ENDHEX command pair, but inserts it unchanged into the output stream. ", thus my conclusion is that the variable is not replaced with its value but is sent to the printer as the variable name itself. Since the printer does not understand the variable name it leaves it, I guess.

Below is the link to SAP Help.

Hexadecimal Data: HEX, ENDHEX

Thus, I guess you will simply have to hardcode the value.

Read only

0 Likes
1,156

Hi Ujjval,

Thank you for the response. I replaced the variables with hard-coded values by using IF ELSE Command lines in SAP script. it is working fine now. Thank you