cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SXPG_COMMAND_EXECUTE

Former Member
0 Likes
6,345

Hi,

I am trying to run SXPG_COMMAND_EXECUTE FM. but in one client it raises the exception "No Permission". and in the other client it raises "Command not found". Can you please guide me how do I rectify both of these exceptions.

Thank You,

SB.

View Entire Topic
Former Member
0 Likes

Hi Check the command in sm69

The command name identified COMMANDNAME and OPERATINGSYSTEM has not been defined in the maintenance function (Transaction SM69).

Former Member
0 Likes

Hi Vijay,

In SM69 my

command name is :- Z_MY_COMMAND

Operating system is AIX

Type is Customer

Operating system command is mv

Parameters for OS is blank

Additonal parameters allowed checkbox is checked.

This info is avaliable for me in both of the clients... I checked this by going to Tcode SM49 in both clients...

In my second client (where is throws exception "No Permission"... If I do not have authorization for S_LOG_COM , S_RZL_ADM... then how do I get that??....

For the first client where it says "Command not found" how should I rectify this??

Please help.

Thank You.

Former Member
0 Likes

Hi for the Authorizations you need to contact Basis team .

<b>case2</b>

<b>for testing check the sy-subrc it might be 12, so change it to 0 and try to see the results...

after that check the command also....

But i think in this case also you should get command not found.</b>

case1;

you have authorizations, but command faield...

i think passing may be wrong, or command not maintained fully...

check them also using sy-subrc

regards

vijay

Former Member
0 Likes

can you give the code how you are passing it to FM..

regards

vijay

Former Member
0 Likes

Hi

Are you still facing some problem with that ..

please let me know..

regards

vijay

Former Member
0 Likes

REPORT ZREPORT.

DATA: FILENAME(100) VALUE 'C:\Testfiles\AP-INT-001 TEST FILE.txt',

FILENAME1(100) VALUE '/holdarchlogs/outbound/testfile.txt',

FILENAME1_ARCH_DIR(100) VALUE '/tmp/testfile.txt',

Z_MY_COMMAND TYPE SXPGCOLIST-NAME,

FINAL_ARCHIVE_DIR TYPE SXPGCOLIST-PARAMETERS,

MSGS(256),

G_FILE TYPE STRING.

DATA: BEGIN OF T_DATATAB OCCURS 0,

LINE(1000),

END OF T_DATATAB.

DATA: T_MOVETODIR LIKE BTCXPM OCCURS 0 WITH HEADER LINE.

G_FILE = FILENAME.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = G_FILE

FILETYPE = 'ASC'

  • HAS_FIELD_SEPARATOR = ' '

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = T_DATATAB

  • EXCEPTIONS

  • FILE_OPEN_ERROR = 1

  • FILE_READ_ERROR = 2

  • NO_BATCH = 3

  • GUI_REFUSE_FILETRANSFER = 4

  • INVALID_TYPE = 5

  • NO_AUTHORITY = 6

  • UNKNOWN_ERROR = 7

  • BAD_DATA_FORMAT = 8

  • HEADER_NOT_ALLOWED = 9

  • SEPARATOR_NOT_ALLOWED = 10

  • HEADER_TOO_LONG = 11

  • UNKNOWN_DP_ERROR = 12

  • ACCESS_DENIED = 13

  • DP_OUT_OF_MEMORY = 14

  • DISK_FULL = 15

  • DP_TIMEOUT = 16

  • OTHERS = 17

.

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 file

OPEN DATASET FILENAME1 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT

MESSAGE MSGS.

IF SY-SUBRC <> 0.

WRITE: 'File could not be opened', MSGS.

ENDIF.

  • transfering data.

LOOP AT T_DATATAB.

TRANSFER T_DATATAB TO FILENAME1.

ENDLOOP.

  • Close file.

CLOSE DATASET FILENAME1.

  • command = 'mv /holdarchlogs/outbound/seema1.txt /tmp/seema1.txt'.

    • command = 'mv /holdarchlogs/outbound/seema.txt /tmp/seema1.txt

  • CALL 'SYSTEM' ID 'COMMAND' FIELD COMMAND ID 'TAB' FIELD TABL-SYS.

  • Achieving the above functionality by using FM

CONCATENATE FILENAME1 FILENAME1_ARCH_DIR INTO

FINAL_ARCHIVE_DIR SEPARATED BY SPACE.

CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

EXPORTING

COMMANDNAME = Z_MY_COMMAND

ADDITIONAL_PARAMETERS = FINAL_ARCHIVE_DIR

OPERATINGSYSTEM = SY-OPSYS

  • TARGETSYSTEM = SY-HOST

  • DESTINATION =

  • STDOUT = 'X'

  • STDERR = 'X'

  • TERMINATIONWAIT = 'X'

  • TRACE =

  • IMPORTING

  • STATUS =

  • EXITCODE =

TABLES

EXEC_PROTOCOL = T_MOVETODIR

  • 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.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

WRITE: 'SUCCESS'.

ENDIF.

Former Member
0 Likes

Your path to the command may be wrong on the system where it is giving you the "command not found" message. After that, if the command is found, it then determined that you don't have the necessary <b>operating system</b> level authorizations for the command.

Are these really two clients or two systems? Can you go to the corresponding AIX box and run the MV command?

Srinivas

Former Member
0 Likes

try to uncomment the exceptions while calling FM.

and Keep a Break point in the FM where it is raising No permission, and Command not found...

what happened to other way..

CALL 'SYSTEM' ID 'COMMAND' FIELD COMMAND ID 'TAB' FIELD TABL-SYS.

is it working..

please let me know...

regards

vijay

Former Member
0 Likes

Well that command was not accepted by the other team and they said that it was a bad way of programming... ... So only I am trying to find an alternative.

Former Member
0 Likes

Try to check the Parameters once which you are passing to Fm.

regards

vijay

Former Member
0 Likes

Try to check it once, Tomorrow i will find out..from

your posts

Former Member
0 Likes

DO u know How do I get authorization for object s_log_com & s_rzl_adm ??

Former Member
0 Likes

COntact BASIS team ....

what happend, if your Problem solves then please close the thread and reward for helpful answers

vijay

Former Member
0 Likes

hi,

Can you tell me what is additional parameter and what should be passed to it??

-SB

Former Member
0 Likes

Check whether you have Maintained properly or not

to test that call this fm and find out your command is in the command list...

    CALL FUNCTION 'SXPG_COMMAND_LIST_GET'
         EXPORTING
              COMMANDNAME     = COMMANDNAME
              OPERATINGSYSTEM = '*'
         TABLES
              COMMAND_LIST    = COMMAND_LIST
         EXCEPTIONS
              OTHERS          = 1.

    IF SY-SUBRC <> 0 .
       RAISE X_ERROR .
    ENDIF

Former Member
0 Likes

Hi,

I am able to run this in the first client (where it was saying command not found)...

Regarding the second client where no_permission error was thrown I may get the permission from someone in the authorizing team ...

Thank a lot for all your help .....

Former Member
0 Likes

Please reward and close the thread.

Thanks,

Srinivas

Former Member
0 Likes

please close the thread and reward points for helpful answers..

vijay

Former Member
0 Likes

Last time... I was able to move this file with the help of this FM.. but if I am writing this FM in the same program then immediately the files are getting moved to the destination folders... What I want is that after the files get processed by the other (opposite) application system ... then the files should move to the destination folder .... Does it means that I have to write this FM in a seperate program and schedule it in background??

Former Member
0 Likes

Yeah do it separately,, then code according to your logic..

regards

vijay

Former Member
0 Likes

ok thank you....