cancel
Showing results for 
Search instead for 
Did you mean: 

Flie Upload/ File Download Sap Server

0 Kudos

Hi Experts,

I have a PDF document created in my PC, I need to put it into SAP Server .

Then I need that then, other external user be able to read this document.

Has anybody make something similar into A web dynpro abap???

Can you help me???

thanks anyway!

Accepted Solutions (0)

Answers (2)

Answers (2)

alespad
Contributor
0 Kudos

You can do an OPEN DATASET BINARY from application server

DATA: bin_cont TYPE TABLE OF orblk,
wa_bin TYPE orblk,
ln  LIKE sy-tabix,
ln_size TYPE i.


OPEN DATASET file_pdf FOR INPUT IN BINARY MODE.
IF sy-subrc = 0.


CLEAR: ln_size, bin_cont[],wa_bin.
DO.
CLEAR: ln, wa_info.
READ DATASET file_pdf INTO wa_bin LENGTH ln.


IF sy-subrc <> 0.
**from function C13Z_RAWDATA_READ
* Begin Correction 20.11.2005 899632 *******************
IF ln > 0.
* End Correction 20.11.2005 899632 *********************
ln_size = ln_size + ln.
APPEND wa_bin TO bin_cont.
ENDIF.
EXIT.
ENDIF.
ln_size = ln_size + ln.
APPEND wa_bin TO bin_cont.
ENDDO.
CLOSE DATASET file_pdf.
ENDIF.

then using the Function SCMS_BINARY_TO_XSTRING to convert binary in HEX

and calling the method CL_WD_RUNTIME_SERVICES=>ATTACH_FILE_TO_RESPONSE to send the file to the browser

0 Kudos

Thanks!!!!!!!!!!

former_member186491
Contributor
0 Kudos

Hi LydiaMM ,

Yes, you can easily do that. Actually, I've done in one of my project recently.

I would suggest you to follow the steps given in this link, as this is of great help --

[http://wiki.sdn.sap.com/wiki/display/WDABAP/UploadandDownloadfilesinWebdynproABAP]

This describes steps with screen-shots and would definitely be of good help.

Thanks.

Kumar Saurav.

0 Kudos

Thanks!!!!!!!!!!!!!!!!!!!!!!

It's very hepfull for me!

Thanks again!

Edited by: LydiaMM on Oct 22, 2010 11:58 AM

0 Kudos

Thanks again.

I think this is very usefull, and I am trying this code now but what I need is a bit different.

In this case you are saving the file into a ztable isn't it? I need to upload it to the server (what you can see throw AL11 tx)

do you Know what I mean?

can you help me?

Thanks!

Former Member
0 Kudos

Hi Saurav

Thanks for ur mail and I appreciate u

I have a requirement to upload the All files in folder in PS at a time

I tried to Do but its Upload the single file into Ztable

Do u have any idea about my Requirement?

Thanks and Regards

Suresh

vishesh_malik
Participant
0 Kudos

Hi Lydia,

I am facing a similar issue , if u have any pointers for it. Please reply back asap. I am able to upload the files but after downloading from server when trying to read the contents of file. I am getting proper view of txt and pdf file but unable to get proper data in case of other formats like .xls/.doc/.docx etc

Thanks in advance.

Regards,

vishesh