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: 

SXPG_COMMAND_EXECUTE FUNCTION

Former Member
0 Kudos

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.

6 REPLIES 6

Former Member
0 Kudos

Can you have a look at what the command name Z_HR_FILE_TRANSFER stand for in UNIX by checking in SM69?

May be it is not simply "cp" as your code is trying to use it as ?

Also what error / exception is it returning back to you?

0 Kudos

Hi,

The ZHR_FILE_TRANSFERT execute unix script copyoutbound file.

The statut code is blank .

0 Kudos

Can you access the shell script? I can have a look at it and tell you what might be the issue..

You may use AL11 to view the script, if that path where the script is, is already configured there.

Or else download the script from its directory using CG3Y and paste it here.

0 Kudos

Script qui copie un fichier en utilisant le protocole ssh

#

  1. Parametres Obligatoire:

  2. $INTERFACE => Interface

  3. $SOURCESID => SID d'origine

  4. $TARGETSID => SID de destination

  5. $AREA => Area

  6. $LOCAL_AREA => Nom de repertoire qui doit figurer dans le path de source entre "interfaces" et "outbound".

  7. $FILENAME => Filename (Could contain a wild card)

  8. $LOCATION => Nom de repertoire qui doit figurer dans le path de destination entre "$TARGETSID" et "common"

  9. $DIRECTION => inbound/outbound

#

Former Member
0 Kudos

Hi,

This is how you can troubleshoot this problem :

1. Check the command in Sm69

2. See the sy-subrc value after the function call.

3. Check the entries in the table exec_"protocol = tabl" after the function call.

You will get the root casue from the above steps.

You might get the solution as well . Or else reply back once you find the root cause.

regards,

Advait

Former Member
0 Kudos

I found the solution, i used a perl unix script.