2005 May 06 2:31 PM
Hi All
I want to upload a file which is of *.doc file from local disk and want to store it on a location remotely.
After I store this at the remote location. I have to store the link to that document in the Database Table.
Could anyone help in this. I have tried using GUI_UPLOAD but I am sure I am not doing it right. Please help.
2005 May 06 3:28 PM
Hi,
For storing on a application server you should use 'Open dataset' and 'Transfer' statements. For presentation server, use GUI_UPLOAD and GUI_DOWNLOAD.
2005 May 06 4:18 PM
Hi Shivani,
You can make use of the Business Doc Service (BDS) to store docs (e.g Word or Excel files) using tcode OAER.
A good example for retrieving the stored file via program: SAPRDEMOVIEWING.
enjoy.
Regards,
Kelvin Dela Rosa
2005 May 09 7:07 AM
Hi Kshitij,
Thanks for the reply, I am very new to ABAP. right now i am undergoing a training for the same.
My first question is Is it possible for a flat file to be selected from my local system and save it on a remote server hard disk?
Could you also guide me to an example code for the same. I am stuck with this problem and am not making any headway.
Regards
Shivani
2005 May 09 9:52 AM
Hi Shivani
here's a sample:
REPORT ztrans01 .
*Parameters(files)
PARAMETERS: ux_dir TYPE epsf-epsdirnam OBLIGATORY,
filename TYPE epsf-epsfilnam OBLIGATORY,
pc_dir TYPE rlgrap-filename OBLIGATORY.
*DATA(Strings)
DATA itab TYPE TABLE OF string.
DATA wa TYPE string.
DATA file TYPE string.
DATA size TYPE epsf-epsfilsiz.
DATA ux_file TYPE epsf-epspath.
DATA mode TYPE epsf-epstxtmod.
*start-of-selection
START-OF-SELECTION.
*1)upload
CONCATENATE pc_dir '' filename INTO file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file
TABLES
data_tab = itab.
*2) transfer
CONCATENATE ux_dir '/' filename INTO ux_file.
OPEN DATASET ux_file FOR OUTPUT IN TEXT MODE.
IF sy-subrc <> 0.
MESSAGE i502(me) WITH ux_file.
ENDIF.
LOOP AT itab INTO wa.
TRANSFER wa TO ux_file.
ENDLOOP.
CLOSE DATASET ux_file.
regards Andreas
2005 May 09 11:24 AM
Hi Shivani,
I think you are trying to copy/move the file to a remote file server (not the application server) yes?
If so, then use Andreas's code for the upload, but use the GUI_DOWNLOAD to write the file to a remote file server (assuming your PC has a connection to this file server). It would look something like:
* SNIP
*1)upload
CONCATENATE pc_dir '' filename INTO file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file
TABLES
data_tab = itab.
*2)download remote_dir = '\serverdirectory'
CLEAR: file.
CONCATENATE remote_dir '' filename INTO file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = file
TABLES
data_tab = itab.
* SNIP
Hope that helps.
If you are not happy with this approach then you could create a batch script on your PC and execute it using WS_EXECUTE (although you then need a batch file on every PC that will run the program ).
Brad
2005 May 09 2:34 PM
thanks for the replies. i will try and let u know what i have. i think what andreas and brad have put to-gether i will be having a good solution up by trw. thanks again
2005 May 09 2:48 PM
Hi Shivani,
that's fine that we could help you
So please say
'Thanks the SDN way'. Click on the yellow star, and award suitable points.
Check out this weblog:
/people/mark.finnern/blog/2004/08/10/spread-the-love
regards Andreas