2006 Nov 29 3:16 PM
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).
2006 Nov 29 3:39 PM
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
2006 Nov 30 2:50 AM
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
2006 Nov 30 4:45 AM
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
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |