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: 

Printing an XSTRING in ABAP

Former Member
0 Kudos
1,537

Moderator message: please do not post the same question in two forums. Duplicate deleted

In my ABAP program I have an XSTRING that contains a PDF document. This XSTRING was returned by a web service. In the debugger, if I download the contents of the XSTRING and save it as a PDF I can open it and print it. However, I need to be able to send the XSTRING to a printer in my ABAP program. Is this possible? Do I need to convert the XSTRING to some other format first?

Thank you,

Edited by: Matt on Dec 22, 2008 7:40 AM

6 REPLIES 6

MarcinPciak
Active Contributor
0 Kudos
444

Hmm, not sure if this will help but you may try. Convert xtring to string with fm HR_KR_XSTRING_TO_STRING and try to sent it to your printer.


DATA: xstr TYPE xstring.  "your xstring
          str TYPE string.
          
          CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
            EXPORTING
              in_xstring = xstr
            IMPORTING
              out_string = str.
 
"now try sending it to the printer

I am myself curious if this works so please let me know the result.

Thanks

Marcin

0 Kudos
444

How do I print it to the printer? I was thinking about using this

print-control function 'XXXX'.

write: mystring.

print-control function 'XXXX'.

However, what print control ('XXXX') should I use?

thank you

0 Kudos
444

I was able to make it print. However, it just print the exact string (Not in PDF format).

0 Kudos
444

That's good. Frankly I have never used it. Try with converting string to pdf or print spool to pdf.

Here is one of thread decribing how to achieve this:

[Convert report spool to pdf|;

I also found some topic about direct convertion from xtring to pdf:

[Converting xstring to pdf|;

Hope they can help you

Marcin

0 Kudos
444

I think I just need to find the write print control to use for a PDF document. I'm having the same problem with printing ZPL code to a ZEBRA printer. Both the ZPL code and the PDF are returned in a string parameter from a web service. You would think that you could just send the string to the printer. Anyone have a clue?

0 Kudos
444

I was able to to solve my problem with printing ZPL code. The fix was to use a smartform and pass the zpl code to the smart form and print it. However, I still can't print a PDF. I tried using the smartform in the same way as the ZPL, but it didn't work. What format does the data have to be in when it is passed to the smartform? Binary, PDF, OTF?

Binary Data:

255044462D312E320D0A352030206F626A0D0A3C3C0D0A2F54797065202F584F626A6563740D0A2F53756274797065202F496D6167650D0A2F4E616D65202F536E6F77626F756E64300D0A2F576964746820313730300D0A2F48656967687420323230300D0A2F42697473506572436F6D706F6E656E7420310D0A2F436F6C6............

PDF Data:

%PDF-1.2

5 0 obj

<<

/Type /XObject

/Subtype /Image

/Name /Snowbound0

/Width 1700

/Height 2200

/BitsPerComponent 1

/ColorSpace /DeviceGray

/Filter /CCITTFaxDecode

/DecodeParms <<

/K -1

/Columns 1700 /Rows 2200

/EndOfBlock false

/EndOfLine false

/EncodedByteAlign false

>>

/Length 6 0 R

>>

stream..................

Edited by: Tony Raimo on Jan 6, 2009 2:51 AM