Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

re: file upload

Former Member
0 Likes
1,142

Hi,

Im uploading text file from one server to sap by using ws_upload function module. In the foreground it is getting upload. But in the background it cannot upload if we use partiular gui. Iam using one server IP and trying to upload in the background. But i could not. How to upload this file in the background.

rgds

p.kp

Hi,

Im uploading text file from one server to sap by using ws_upload function module. In the foreground it is getting upload. But in the background it cannot upload if we use partiular gui. Iam using one server IP and trying to upload in the background. But i could not. How to upload this file in the background.

rgds

p.kp

10 REPLIES 10
Read only

Former Member
0 Likes
1,113

Hi,

WS_UPLOAD CAN NOT be used in background mode.

You will have to use OPEN DATASET statement to upload the data from file in background mode.

Hope it helps.

Regards,

Shashank

Read only

0 Likes
1,113

WS_UPLOAD can n't be used for upload file in back ground processing.

Read only

0 Likes
1,113

Hi,

I know i have to upload this file by using open dataset. But my requirement is they run that program in the back ground and i have to download the file from another IP which is located at another server. They everday upload that file periodically . They don't want the user intervention. If we use datasets, again we have to upload that file by user interaction. so what can i do.

rgds

p.kp

Read only

0 Likes
1,113

Will it be possible for you to try with the Function Modules <b>FTP_CONNECT, FTP_COMMAND, and FTP_DISCONNECT</b>, if it is a different IP address?

I could see more explanations in these links.

/people/thomas.jung3/blog/2004/11/15/performing-ftp-commands-from-abap

rgds

TM.

Read only

0 Likes
1,113

Hi paluri,

1. I have to download the file from another IP

In that case one approach is to use

this convention


computername\folder\filename

or


ipaddress\folder\filename

2. this u can also test using your own computer first,

from START-->RUN

regards,

amit m.

Read only

Former Member
0 Likes
1,113

reading file from Presentation server will NOT be allowed in background. if you are running a report with this type of reading file, you have to place it in the APPLICATION server & then Use OPEN DATASET, READ DATASET statements to read the contents of the file into your program

regards

srikanth

Read only

Former Member
0 Likes
1,113

Hi Paluri,

1.Use the transaction code 'CG3Z' to upload the file from presentation server to application server.

2.Use the command OPEN DATASET,READ DATASET and CLOSE DATASET for processing the file in the background.

Regards,

Mukesh Kumar

Message was edited by: mukesh kumar

Read only

Former Member
0 Likes
1,113

Try using this:

OPEN DATASET fname FOR OUTPUT IN BINARY MODE.
TRANSFER file_content TO FNAME.
CLOSE DATASET FNAME.

file_content TYPE XSTRING

fname type string

fname contains the path in the app server and file_content is the content of the file.

Regards,

Ravikiran.

Read only

Former Member
0 Likes
1,113

Hai Krishna Prasad

Go through the following Code

REPORT ZFILE_UPLOAD_APPL message-id ztraining .

----


  • types

----


**-- types for data to be downloaded

types: begin of tp_kna1,

KUNNR type kna1-kunnr, " customer number

LAND1 type kna1-land1, " Country Key

NAME1 type kna1-name1, " customer name

ORT01 type kna1-ort01, " city

PSTLZ type kna1-pstlz, " postal code

REGIO type kna1-regio, " region

end of tp_kna1.

----


  • I n t e r n a l T a b l e s

----


**-- Internal table for data to be downloaded

data: it_kna1 type standard table of tp_kna1 with header line.

----


  • S e l e c t i o n S c r e e n

----


selection-screen begin of block b1 with frame title text-001.

parameters: p_afile type rlgrap-filename

default 'customer.txt'.

selection-screen end of block b1.

----


----


  • S t a r t o f s e l e c t i o n

----


start-of-selection.

*-- Upload the data from Sales Deal file

perform upload_app_file.

end-of-selection.

perform write_data.

*&----


*& Form upload_app_file

*&----


  • Upload the application server file data

*----


form upload_app_file.

data: l_msg(100). " error message

open dataset p_afile for input in text mode encoding default message

l_msg.

if sy-subrc <> 0.

message i004 with l_msg.

else.

do.

read dataset p_afile into it_kna1.

if sy-subrc = 0.

append it_kna1.

clear it_kna1.

else.

exit.

endif.

enddo.

close dataset p_afile.

endif.

endform. " upload_app_file

&----


*& Form write_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM write_data .

loop at it_kna1.

write:/ it_kna1-kunnr,

it_kna1-land1,

it_kna1-name1,

it_kna1-ort01,

it_kna1-pstlz,

it_kna1-regio.

endloop.

ENDFORM. " write_data

Thanks & regards

Sreenivasulu P

Read only

Former Member
0 Likes
1,113

Hi Krishna prasad,

Check this Document this helps you a lot.it is a code sample By one of my Colleague.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/9831750a-0801...

Regards

vijay