cancel
Showing results for 
Search instead for 
Did you mean: 

PDF attachment

Former Member
0 Kudos

Dear All,

We want to attach a PDF file to a Purchase order. We are able to do this directly from the PO screen and it works. We are able to retrieve it as well.

Now we upload the file using a upload element in ABAP webdynpro and this is returns the data in XSTRING format. After this step we followed 2 paths but both of them have failed

1. We converted Xstring to a string and string to internal table

2. We converted Xtrsing to an internal table format

Now when call function SCMS_HTTP_CREATE to attach this internal table to PO, it gives no error. When go to PO, it shows this new attachment, but while opening it gives an error saying it is not a PDF format.

Thanks.

Regards

Naveen Agarwal

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You defintely don't want to convert the XSTRING to a STRING. This would corrupt the data. How are you converting the XSTRING to an internal table? What is the data type of the internal table? Hopefully it is type x (binary). You need to keep the PDF data in binary format to avoid corrupting the file.

prathamesh_gandhi
Participant
0 Kudos

Hi Thomas Jung,

I am also searching for the same. which function module should be use to convert the XSTRING to internal table??? i am using SCMS_XSTRING_TO_BINARY function module to convert, is it the correct one?? or is there any class to attach the file from webdynpro application???

Thanks in Advance

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

SCMS_XSTRING_TO_BINARY should work well. I used to use that function module before we had the BCS converter classes (cl_bcs_convert=>xstring_to_xtab). That should safely convert the data to binary table.

prathamesh_gandhi
Participant
0 Kudos

Hi Thomas Jung,

Really thanks for your valuable suggestion. its working fine now. I need more help from you for reading the file from webdynpro application. I have design my screen where i am showing the AR_DOC_ID as link, and on click of that link i want to display the attach document(pdf / image). so which UI element should i use in such cases to display both pdf or image.?? and what steps need to be follow??

Thanks

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>so which UI element should i use in such cases to display both pdf or image.??

Probably only the iFrame UI element would display both types. Even then you would have to generate a temporary URL to the content (by placing the content in the ICM cache). Probably better to just trigger the content to be downloaded and let the browser decide how to present or save the content via the file download dialog.

http://help.sap.com/saphelp_nw70ehp2/helpdata/en/13/a1764299d76255e10000000a155106/frameset.htm

Answers (0)