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: 

How to move STRING to XSTRING when STRING is already RAW?

dirk_boller
Explorer

Hello,

I want to convert a SAP Standard Report to PDF and display it in an ABAP Webdynpro application.

With the function CONVERT_ABAPSPOOLJOB_2_PDF I receive the result of the report as PDF, but this PDF is stored in a field of type STRING. Unfortunatly, this STRING contains already the binary data of the PDF file.

So any function or class for convertion to move the STRING to the XSTRING field changes the content of the STRING, that is already an XSTRING.

The only way to move the data without changes, is to write the STRING to filesystem in binary mode and then open it again and read it in the XSTRING field in binary mode.

But the users of this application should not be access to filesystem granted.

How can I get the content of the STRING field to the XSTRING field without any conversion, because the STRING field is already a XSTRING?

Thanks in advance for any replies

4 REPLIES 4

dirk_boller
Explorer
0 Kudos

Hello,

I found the solution

DATA lv_buffer TYPE xstring.

DATA lv_string TYPE string.

DATA lv_xstring TYPE xstring.

EXPORT my_data = lv_string TO DATA BUFFER lv_buffer.

IMPORT my_data TO lv_xstring FROM DATA BUFFER lv_buffer IN CHAR-TO-HEX MODE.

In this case the C field is move to the X field without any convertion.

santosh_l
Explorer
0 Kudos

Hello Dirk,

Thank you for Answer , however my prob was not solved by this conversion.

Solution : Simply translate data to uppercase then we can copy from CHAR format to hex. With this I got desired results.

Like

Data hex type xstring,

Data char type string.

translate char in uppercase.

copy char into xstring.

Thank you Dirk for reply

0 Kudos

Could someone already do it?

I want to pass the data from a string variable to an xtring without converting it.

moshenaveh
Community Manager
Community Manager
0 Kudos
Hello, While we're happy that you've come to SAP Community to get an answer to your question, you posted your question as an answer in an old thread.
I've converted your answer to a comment, but even so -- posting in older threads is not the best way to get guidance.
If you're looking for help, you should ask a new question: https://answers.sap.com/questions/ask.html.
Here are some tips to help you craft an effective question for our community: https://community.sap.com/resources/questions-and-answers, https://developers.sap.com/tutorials/community-qa.html, https://groups.community.sap.com/t5/welcome-corner-discussions/advice-from-sap-champions-questions-a....
I encourage you to follow this guidance, as I'd really like to see you get a solution to your problem.
I hope you find this advice useful!