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

upload file into application server

Former Member
0 Likes
2,023

Hi ,

I created path in application server to upload data.

but path is not creating.

parameters: filename(128) default '/usr/tmp/testfile.dat'

lower case.

open dataset filename for output in text mode encoding default.

if sy-subrc ne 0.

write: 'File cannot be opened. '.

exit.

endif.

loop at gstring into wastr.

transfer wastr-fstring to filename.

endloop.

close dataset filename. " Closing the file

Thanks,

Asha

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
859

What i understood from your question is...your open dataset returns sy-subrc as 4. If yes, declare parameters as below and try:

PARAMETERS: FILENAME TYPE PATHEXTERN

default '/usr/tmp/testfile.dat'

Thanks,

SKJ

5 REPLIES 5
Read only

Former Member
0 Likes
859

Dear Asha,

To upload data/ down load data application server use below transactions.

CG3Y

CG3Z

Regards

Read only

Former Member
0 Likes
859

Asha

Try to upload a file using Transaction CG3Z with the same file path on Application Server... By doing so you may find the cause...

Thanks

Amol Lohade

Read only

former_member585060
Active Contributor
0 Likes
859

Try this code

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS : p_asfile TYPE rlgrap-filename DEFAULT '/usr/tmp/testfile.dat'.

.

SELECTION-SCREEN END OF BLOCK b1.

OPEN DATASET p_asfile FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

IF sy-subrc <> 0.

EXIT.

ENDIF.

LOOP AT it_emp INTO wa_emp.

TRANSFER wa_emp TO p_asfile.

ENDLOOP.

CLOSE DATASET p_asfile.

Read only

Former Member
0 Likes
859

To set up the path permanently ..basis help is needed..

Also check if there are proper authorization to save the file in application server and to open the dataset

Read only

Former Member
0 Likes
860

What i understood from your question is...your open dataset returns sy-subrc as 4. If yes, declare parameters as below and try:

PARAMETERS: FILENAME TYPE PATHEXTERN

default '/usr/tmp/testfile.dat'

Thanks,

SKJ