Skip to Content
Author's profile photo Prabhu Rajesh

How to display GOS PDF document from Webdynpro

Dear All;

One of the way to display the GOS PDF document via Webdynpro; hope this will help; 

Step1: Select the list of attachments from the business document using function module BDS_ALL_CONNECTIONS_GET; for this you need the following inputs; Classname, Classtype and objkey.

Step2: Convert the file ID (loio_id from the above function module) to xstring using the method “attachment_get_detail” from the class “cl_hap_wd_document_ui” 

lv_aid  type bds_docid,    
lv_fcon  type string,    
lv_fchex type xstring,    
lv_mftyp type string,    
lv_ret  type bapiret2.

     attachment_id    = lv_aid        
     attachment_type  = ‘pdf’      
     file_content     = lv_fcon        
     file_content_hex = lv_fchex        
     mime_file_type   = lv_mftyp        
     s_return         = lv_ret ). 

Step3: Display the document in new browser; using the method attach_file_to_response from class cl_wd_runtime_services;

l_file    type string,    
l_mime    type string,    
pdf_data  type xstring.

l_mime = ‘application/pdf’ .
l_file = ‘title.pdf’ . 

call method
        i_filename  = l_file      
        i_content  = lv_fchex      
        i_mime_type = l_mime.

Assigned tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.