Application Development 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: 

data transfer from SAP to other servers

Former Member
0 Kudos

Hi Experts,

could you please answer of my problem.

1. i need transfer of SAP date to another server(not SAP).

how i can transfer from this server to another server(some folder).

Thanks

Jaya

2 REPLIES 2

Former Member
0 Kudos

hi,

i think u need to use BAPI, but not sure.

glio_ad
Active Participant
0 Kudos

Hi.

If you mean that you want to copy a file from one path to another (either on the same sever, but different folder or to somewhere else on the network) you can try the following:

assume you want to move the file a.txt from e:\temp to g:\temp, then:

1) in SM60 create a new external operating system command (for example, ZMOVE) and define the operating system in which it will be executed and in the operating system command field write: cmd /c move

2) try the following program:

REPORT zmove.

PARAMETERS: p_from LIKE rlgrap-filename OBLIGATORY,

p_to LIKE rlgrap-filename OBLIGATORY.

DATA: BEGIN OF i_btcxpm OCCURS 10.

INCLUDE STRUCTURE btcxpm.

DATA: END OF i_btcxpm.

DATA: orig_file LIKE sxpgcolist-parameters,

new_file LIKE sxpgcolist-parameters,

param LIKE sxpgcolist-parameters,

w_ind LIKE sy-subrc,

wl_msg LIKE message-msgtx,

rsexc LIKE rsexc OCCURS 0 WITH HEADER LINE,

rsexp LIKE rsexp OCCURS 0 WITH HEADER LINE,

rsimp LIKE rsimp OCCURS 0 WITH HEADER LINE,

rstbl LIKE rstbl OCCURS 0 WITH HEADER LINE.

REFRESH i_btcxpm.

CLEAR i_btcxpm.

  • From path and filename

MOVE p_from TO orig_file.

  • To path and filename

MOVE p_to TO new_file.

  • CREATE PARAMETER TO BE PASSED TO FUNCTION MODULE

  • THIS IS THE ACTUAL PARAMETER OF THE 'MOVE' DOS-PROMPT COMMAND

CONCATENATE orig_file new_file INTO param SEPARATED BY space.

CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

EXPORTING

commandname = 'ZMOVE'

additional_parameters = param

operatingsystem = sy-opsys

TABLES

exec_protocol = i_btcxpm

EXCEPTIONS

no_permission = 1

command_not_found = 2

parameters_too_long = 3

security_risk = 4

wrong_check_call_interface = 5

program_start_error = 6

program_termination_error = 7

x_error = 8

parameter_expected = 9

too_many_parameters = 10

illegal_command = 11

wrong_asynchronous_parameters = 12

cant_enq_tbtco_entry = 13

jobcount_generation_error = 14

OTHERS = 15.

IF sy-subrc <> 0.

w_ind = sy-subrc.

CALL FUNCTION 'FUNCTION_IMPORT_INTERFACE'

EXPORTING

funcname = 'SXPG_COMMAND_EXECUTE'

TABLES

exception_list = rsexc

export_parameter = rsexp

import_parameter = rsimp

tables_parameter = rstbl.

IF sy-subrc <> 0.

CONCATENATE 'ZMOVE:' p_from INTO wl_msg SEPARATED BY space.

WRITE wl_msg.

EXIT.

ENDIF.

READ TABLE rsexc INDEX w_ind.

CONCATENATE 'ZMOVE:' rsexc-exception INTO wl_msg

SEPARATED BY space.

WRITE:/ wl_msg.

EXIT.

ELSE.

  • OK !!

ENDIF.

Note, that the SAP user that will execute this program must have authorization to execute OS commands (authorization object: S_LOG_COM)

If this helped, please reward.

Regards,

George