cancel
Showing results for 
Search instead for 
Did you mean: 

How to upload PDF file using Webdynpro ABAP

Former Member
0 Kudos

Hi All,

Could you please tell me, how can i upload PDF file using Webdynpro abap, but i am aware of how to upload Excel file using webdynpro abap. 

Once we upload PDF using Webdynpro ABAP, after that , able to see PDF file in Webdynpro ABAP screen, can someone help me on this.

Thanks & Regards

BVSRR.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi BVS,

Follow the below path to get a thought on above issue

PDF File into a table :

http://scn.sap.com/thread/1485950

Regards,

Sushiptha

Former Member
0 Kudos

Hi Sushiptha/Steve,

@Sushiptha: Thanks for your url link.

@Steve: Thanks for your information.

I am able to upload Single pdf into table using below link.

http://wiki.sdn.sap.com/wiki/display/WDABAP/Upload+and+Download+files+in+Webdynpro+ABAP.

But still i have to solve, multiple pdfs at a time, sorting , merging pdfs.

Thanks

BVSRR.

Former Member
0 Kudos

Hi BVSRR,

  

    If you want to upload any PDF then u can't use it same as excel. I mean u can read a excel and get the entries in table but in case of PDF u can the details of the uploaded document in XSTRING format.

Use file upload ui element to get details of any uploaded file in xstring format.

If required you can save it in application server by using open dataset / close dataset statement.

You can display it later also.

Please specify your requirement in details.

regards,

Monishankar

Former Member
0 Kudos

Hi,

How u uploaded the excel file, same way u want to upload the pdf file also.

try to save that PDF file in business object or GOS or separate table. create separate table in your component with hyperlink.

By using the cl_wd_runtime_services=>attach_file_to_response you can open the clicked attachment.

Hope this will help you.

Thanks,

Hema.

Former Member
0 Kudos

Hi Monishankar/Hemachandran,

Thanks for your reply, Once i select file from local folder & click on attach , i want to see PDF file name in a table. can u please send me code for this requirement.

Thanks in advance.

Thanks & Regards

BVSRR.

Former Member
0 Kudos

Hi BVSRR,

   Certainly.

  Create one attribute in your context node of type string.

  Bind this attribute with file name properties of your 'File Upload' UI element.

Now you can get the file name of the uploaded file. But it come with location of your file in desktop

( like C:\Document & settings\...\File.pdf).

So u need split at '\'  in a table and the last entry will be you actual file name without path.

There is no action in File Upload Ui element so you can create a button to get this or else you can get the value in WDDOMODIFYVIEW fby using the view referrence.

in WDDOMODIFYVIEW:-

    data: file_upload type ref to cl_wd_file_upload,

            filename     type string.

        file_upload2 ?= view->get_element( 'ID of the File upload UI element' ).
        filename = file_upload2->get_file_name( ).

Regards,

Monishankar

Former Member
0 Kudos

Hi Monishankar,

  Thank you for your reply, with above code, is it possible to open file, once click on file name from table (Once we uploaded file into table, i wanted to sort those files, because here i am going to upload multiple files & once click on any file name, it should open PDF and able to  see data from PDF).

  can you please share the code for above requirement.

Thanks & Regards

BVSRR.

Former Member
0 Kudos

Hi BVS RR,

     Yes u can do that.

   In your table you must have two fields.

  1. File Name  [string type attribue ]

  2. Mime Type ( get this field same as file name, u will get this  properties in UI element )

  3. File Content [ Xstring type attribute ]

after uploading your file populate your table with file name,mime type & file content details and any other fields of ur requirement.

Create a action in the table row like link to action on any field or button. There u get the details of row the and its file content,file name & mime type.

You can again display the xstring data ( from file content) to pdf by using following code and passing the above parameter:-

call method cl_wd_runtime_services=>attach_file_to_response

  exporting

    i_filename      = filename

    i_content       = filecontent

    i_mime_type     = mimetype

*    i_in_new_window = ABAP_FALSE

*    i_inplace       = ABAP_FALSE

    .

I think I have answered your queries.

Regards,

Monishankar

Message was edited by: Monishankar Chatterjee

Former Member
0 Kudos

Hi Monishankar,

  Here i attached my requirement, could you please do the needful. Please let me know, if you need more information.

Thanks in advance.

Thanks & Regards

BVSRR.

soldner
Participant
0 Kudos

Perhaps you should contract with Monishankar to code this for you.

Former Member
0 Kudos
Former Member
0 Kudos

Dear Shambu,

  Thanks for your reply, instead of opening PDF file in browser window , i want to see PDF file name in a table, once i click on Attach button. can u please send me code for this requirement.

Thanks in advance.

Thanks & Regards

BVSRR.