cancel
Showing results for 
Search instead for 
Did you mean: 

Passing content to method cl_wd_runtime_services=>attach_file_to_response

former_member196438
Participant
0 Kudos

Hi all,

My requirement is that when a particular row on a table is clicked, it should open the relevant document. The document is stored in BDS. So Iam using the method cl_wd_runtime_services=>attach_file_to_response to display the document. But this method needs the content to be passed. Please let me know how to retrieve the content details from BDS, in order to convert it to xstring and then pass to this method. The document can be of any format in BDS.

My table is of format ROS_BP_ATTACHMENTS_S, where clicking on the COMP_ID should open the attachment.

Please suggest.

Accepted Solutions (1)

Accepted Solutions (1)

ChandraMahajan
Active Contributor
0 Kudos

Hi,

you need to use FM BDS_BUSINESSDOCUMENT_GET_TAB for your requirment. Look at method DPCOMMON_BDS_OUTPUT of the class /SAPDII/CL_DP_COMMON. this will give you hints on how to use this method to open the attachmments which are stored as BDS documents.

Thanks,

Chandra

former_member196438
Participant
0 Kudos

Hi Chadra,

Thanks for your reply. But I have 2 difficulties in this solution:

1. Only if i give the DOC_ID, it returns me the exact contents. Could you please let me know how to get the doc_id for the selected document?

2. I get the contents in RAW. I try to convert it to XSTRING using the following code. But the document still does not open correctly, and gives the error that incorrect data stored in it.

DATA: xstring type xstring.

LOOP AT i_content into w_content.

CONCATENATE xstring i_content-line INTO xstring IN BYTE MODE.

ENDLOOP.

Please suggest.

Answers (0)