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

file transfer form one application server to another application server

Former Member
0 Likes
750

Hi

my requirement is download the Report output into different Application Servers.

How to download into another Application Server. using dataset concept i was downloaded into application Server. but how to transfer this file to another application server. plz send it any sample code for this ( i think using RFC its possible).

Hi

my requirement is download the Report output into different Application Servers.

How to download into another Application Server. using dataset concept i was downloaded into application Server. but how to transfer this file to another application server. plz send it any sample code for this ( i think using RFC its possible).

3 REPLIES 3
Read only

Former Member
0 Likes
557

hi,

in the recieving sytem. write a function module which is remote enabled. pass the data tables(internal tables) to the function module by creating a RFC destination in sm59 transaction in the sending sytem.

take hints from here

report zsk_ravi_app.

&----


  • type declarations

&----


types: begin of ty_input,

bukrs type bukrs,

blart type blart,

end of ty_input.

&----


  • data declarations

&----


data: g_filename type string,

g_msg type string,

w_input type ty_input,

t_input type standard table of ty_input.

&----


  • Selection-screen

&----


selection-screen begin of block b1 with frame.

parameters: p_chk as checkbox user-command ucomm,

p_file type ibipparms-path default text-002 modif id 123, " here text-002 is 'sapin/ready/AFT.GENFIP.0000.' as text element

p_time type t.

selection-screen end of block b1.

&----


  • at selection-screen on value-request for p_file.

&----


at selection-screen on value-request for p_file.

call function 'F4_FILENAME'

  • EXPORTING

  • PROGRAM_NAME = SYST-CPROG

  • DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

importing

file_name = p_file

.

g_filename = p_file.

&----


  • at selection-screen output.

&----


at selection-screen output.

perform sub_screen_lgc.

&----


  • start-of-selection

&----


start-of-selection.

perform sub_read_file.

perform sub_conv_to_t9aff.

&----


  • end-of-selection

&----


end-of-selection.

perform sub_download.

&----


*& Form sub_screen_lgc

&----


form sub_screen_lgc .

concatenate text-002 p_time into p_file.

loop at screen.

if screen-group1 = '123'.

if p_chk = 'X'.

screen-input = 1.

modify screen.

else.

screen-input = 0.

modify screen.

endif.

endif.

endloop.

endform. " sub_screen_lgc

&----


*& Form sub_read_file

&----


form sub_read_file .

open dataset p_file in text mode for input encoding default.

if sy-subrc = 0.

do.

read dataset p_file into w_input.

if sy-subrc = 0.

append w_input to t_input.

else.

exit.

endif.

enddo.

close dataset p_file.

else.

call function 'FORMAT_MESSAGE'

exporting

id = sy-msgid

lang = 'E'

no = sy-msgno

v1 = sy-msgv1

v2 = sy-msgv2

v3 = sy-msgv3

v4 = sy-msgv4

importing

msg = g_msg

exceptions

not_found = 1

others = 2.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

open dataset 'SAPIN/READY/ERRORLOG' in text mode for output encoding default.

if sy-subrc = 0.

transfer g_msg to 'SAPIN/READY/ERRORLOG'.

close dataset 'SAPIN/READY/ERRORLOG'.

endif.

endif.

endform. " sub_read_file

&----


*& Form sub_conv_to_t9aff

&----


form sub_conv_to_t9aff .

endform. " sub_conv_to_t9aff

&----


*& Form sub_download

&----


form sub_download .

loop at t_input into w_input.

perform sub_build_filename using w_input-bukrs w_input-blart.

open dataset p_file in text mode for appending encoding default.

if sy-subrc = 0.

transfer w_input to p_file.

close dataset p_file.

endif.

endloop.

endform. " sub_download

&----


*& Form sub_build_filename

&----


  • text

----


  • -->P_W_INPUT_BUKRS text

*

----


form sub_build_filename using p_w_input_bukrs p_w_input_blart.

clear p_file.

concatenate 'SAPIN/READY/AFT.GENFIP.'

p_w_input_bukrs

'.'

p_w_input_blart

'.'

p_time

into p_file.

santhosh

Message was edited by:

Kaluvala Santhosh

Read only

Former Member
0 Likes
557

Hi Rai

After downloading the file to application server, use FM's FTP_CONNECT, FTP_COMMAND & FTP_DISCONNECT to copy the files to destination server(s).

Kind Regards

Eswar

Read only

Former Member
0 Likes
557

Hi Rai,

Check the sample program RSFTP004.

If you want to transfer file between different SAP servers then you can use the function module EPS_FTP_PUT. You need to have a RFC destination (with sufficient authorizations for the RFC user).

Other related function modules offered by SAP are:

- EPS_FTP_GET

- EPS_FTP_MPUT

- EPS_FTP_MGET

If you have to transfer one file from one application server to another server then you have to use this function module

sxpg_command_execute

Hope it would be useful for you.

Regards,

Susmitha

Message was edited by:

Susmitha Thomas