on 12-05-2005 9:15 PM
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.
Hi Check the command in sm69
The command name identified COMMANDNAME and OPERATINGSYSTEM has not been defined in the maintenance function (Transaction SM69).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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
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.
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
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
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??
You should ask your basis team for it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try giving a ? in the Parameters for operating system command in the command, since u have to pass filenames.
Also check the commands in tables SXPGCOTABE, SXPGCOSTAB. In the FM they look for the command by passing command name and OS.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you using the FM in the following manner
data : w_name like SXPGCOLIST-NAME.
data : w_para like SXPGCOLIST-PARAMETERS.
data : it_result like BTCXPM occurs 0 with header line.
Where w_name is the command name and
w_para is the parameter in your case it should be the file name .
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
COMMANDNAME = w_name
ADDITIONAL_PARAMETERS = w_para
OPERATINGSYSTEM = sy-opsys
TABLES
EXEC_PROTOCOL = it_result
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi please reward for helpful answers..
regards
vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need Authorizations to run , because of that it gave no permission.
Command is not maintained in sm69, so it gave command not found..
regards
vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
for no permission this is the reason,.,.,
The AUTHORITY-CHECK of the user's authorization for the authorization obejct S_LOG_COM failed. The user is not authorized to execute the command with the specified arguments in thte target system.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
You need authorizaions on objects S_LOG_COM , S_RZL_ADM .
Also to be able to able to execute this FM you should have the OS commands defined in SM69.
Regards
Kalidas
Message was edited by: Kalidas Cheroolil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
4 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.