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

Transfer file from presentation server to application server

Former Member
0 Likes
1,354

Dear Gurus,

My requirement is transfer the text file my local pc to sap application server.

For that i tried following functional module. In that i need to provide the file name .

i want to browse the file from local pc and dont want to browse the file in application server.

can any one provide the solution .

report zrr_test.

start-of-selection.

CALL FUNCTION 'ARCHIVFILE_CLIENT_TO_SERVER'

EXPORTING

PATH = 'd:\rr\rrtest2.txt'

TARGETPATH = 'e:\usr\sap\D02\DVEBMGS00\work\rrtest3'.

  • EXCEPTIONS

  • ERROR_FILE = 1

  • OTHERS = 2

.

write : / sy-subrc.

IF SY-SUBRC <> 0.

write : / sy-subrc.

ENDIF.

Thanks in advance

Rajendran R

Dear Gurus,

My requirement is transfer the text file my local pc to sap application server.

For that i tried following functional module. In that i need to provide the file name .

i want to browse the file from local pc and dont want to browse the file in application server.

can any one provide the solution .

report zrr_test.

start-of-selection.

CALL FUNCTION 'ARCHIVFILE_CLIENT_TO_SERVER'

EXPORTING

PATH = 'd:\rr\rrtest2.txt'

TARGETPATH = 'e:\usr\sap\D02\DVEBMGS00\work\rrtest3'.

  • EXCEPTIONS

  • ERROR_FILE = 1

  • OTHERS = 2

.

write : / sy-subrc.

IF SY-SUBRC <> 0.

write : / sy-subrc.

ENDIF.

Thanks in advance

Rajendran R

5 REPLIES 5
Read only

Former Member
0 Likes
998

Hi Rajendra ,

please try this code snippet , here we call a selection screen that allows us to browse the file name .

.

PARAMETER : p_file TYPE localfile OBLIGATORY .

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file .

data: user_action type i, filename type filetable, result type i,

fn type file_table.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG

EXPORTING

WINDOW_TITLE = 'SELECT FILE'

  • DEFAULT_EXTENSION =

  • DEFAULT_FILENAME =

  • FILE_FILTER =

  • INITIAL_DIRECTORY =

  • MULTISELECTION =

CHANGING

FILE_TABLE = filename

RC = result

USER_ACTION = user_action

EXCEPTIONS

FILE_OPEN_DIALOG_FAILED = 1

CNTL_ERROR = 2

ERROR_NO_GUI = 3

NOT_SUPPORTED_BY_GUI = 4

others = 5

.

if user_action = cl_gui_frontend_services=>action_ok.

clear p_file.

loop at filename into fn.

p_file = fn-filename.

endloop.

endif.

Hopefully it helps

Read only

Former Member
0 Likes
998

Hi,

use method CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG to get filename on pesentation server. After that you can use C13Z_FILE_UPLOAD_ASSCI or C13Z_FILE_UPLOAD_BINARY. Or you can try to call direct C13Z_FRONT_END_TO_APPL if it fulfill your requirement. This FM provides user with a possibility to browse for file on a presentation server.

Regards,

Adrian

Read only

Former Member
0 Likes
998

This message was moderated.

Read only

JL23
Active Contributor
0 Likes
998

I will just give you a different idea, which makes it much easier than going thru a program.

The application server has a file system like you have one in your PC.

We have a directory for data exchange in the application server. I can add this directory as a drive in my MS Explorer.

So I can just use Explorer functionality like drag&drop, copy&paste to move a file from local PC to application server.

I guess your basis admin can do this too..

Read only

Former Member
0 Likes
998

Hi,

get the data into a internal table using gui_upload function module

then loop the internal table data and transfer to application server

DATA:lv_string TYPE string,

p_er_a type string,

lv_msg type string.

p_er_a = '/tmp/file_name.txt'.

if p_er_a is not initial.

if comout[] is not initial.

open dataset p_er_a FOR OUTPUT IN TEXT MODE ENCODING UTF-8.

LOOP AT comout.

*concatenate the internal table fields & it_comut is that internal table

CONCATENATE comout-doc comout-msg comout-sordr comout-outdel comout-acnt comout-customer

INTO lv_string

SEPARATED BY cl_abap_char_utilities=>horizontal_tab.

transfer lv_string to p_er_a .

CLEAR:lv_String,comout.

ENDLOOP.

close dataset p_er_a.

concatenate 'Refer the File Path: ' p_er_a into lv_msg.

message lv_msg type 'I'.

endif.

endif.

Regards,

Manesh.R