Skip to Content
0
Former Member
Jan 29, 2009 at 05:36 PM

SXPG_COMMAND_EXECUTE FUNCTION

163 Views

Hi Everyone,

I have a problem to use this function :

The unix commande is copyoutbound .

I want to copy a file automatically using reflection from a unix path to other unix path.

But it doesn`t work in this test code.

Can someone help me .

Thanks a lot

Soufiene

REPORT ZTEST_SOU.

DATA: params LIKE sxpgcolist-parameters.

DATA: return_code LIKE btcxp3-exitstat.

DATA: unix_command LIKE sxpgcolist-name.

DATA: dest LIKE rfcdes-rfcdest.

DATA: FILENAME1(128) TYPE C,

FILENAME2(128) TYPE C.

DATA: single_quote(1) TYPE c VALUE '"'.

DATA: quoted_subject(32) TYPE c.

DATA: convert_flag(1) TYPE c.

DATA: BEGIN OF tabl OCCURS 0.

INCLUDE STRUCTURE btcxpm. "Structure for Logging message from

DATA: END OF tabl. "external program to calling program

DATA: ICN LIKE ICON-ID,

I_NEXT_DATE LIKE SY-DATUM,

I_COMP_DATE LIKE SY-DATUM,

T_EXEC LIKE SY-DATUM.

UNIX_COMMAND = 'Z_HR_FILE_TRANSFER'.

FILENAME1 = '/US/hrit-sdck/trsf0019.toc'.

FILENAME2 = '/test/esc/inbound/done'.

DEST = 'cib10'.

CONCATENATE FILENAME1 FILENAME2 INTO PARAMS SEPARATED BY SPACE.

CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

EXPORTING

commandname = unix_command

destination = dest

additional_parameters = params

IMPORTING

status = return_code

TABLES

exec_protocol = tabl

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.

IF return_code NE 'O'.

WRITE:/ 'UNIX status UNSUCCESSFUL TRANSFER RETURN CODE = ',return_code.

ENDIF.