Application Development and Automation 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: 
Read only

External Command in SM69

Former Member
0 Likes
10,540

Hi guys,

i have created command zcmd in SM69 to run a .BAT file for encryption.

How to set the "operating system command" and "Parameters for operating system command" ?

Any example will be appreciated greatly.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,653

Hi,

i usualy use FM 'SXPG_COMMAND_EXECUTE' to execute sm69 comands.

Here is and example for 'rm' comand (delete):

I had created a external comand in sm69 , named Z_DELETE with operating system HP-UX, type customer and Operating System command 'rm'.

Then in my report, i executed FM this way:

data: PARAM LIKE SXPGCOLIST-PARAMETERS.

param = '//dir1/dir2/file.txt'.

CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

EXPORTING

COMMANDNAME = 'Z_DELETE'

  • OPERATINGSYSTEM = SY-OPSYS

  • TARGETSYSTEM = SY-HOST

  • STDOUT = 'X'

  • STDERR = 'X'

  • TERMINATIONWAIT = 'X'

  • TRACE = ' '

ADDITIONAL_PARAMETERS = PARAM

IMPORTING

STATUS = STATUS

TABLES

EXEC_PROTOCOL = RESULTADO

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.

Hope this help's,

Regards,

Hi guys,

i have created command zcmd in SM69 to run a .BAT file for encryption.

How to set the "operating system command" and "Parameters for operating system command" ?

Any example will be appreciated greatly.

6 REPLIES 6
Read only

Former Member
0 Likes
3,654

Hi,

i usualy use FM 'SXPG_COMMAND_EXECUTE' to execute sm69 comands.

Here is and example for 'rm' comand (delete):

I had created a external comand in sm69 , named Z_DELETE with operating system HP-UX, type customer and Operating System command 'rm'.

Then in my report, i executed FM this way:

data: PARAM LIKE SXPGCOLIST-PARAMETERS.

param = '//dir1/dir2/file.txt'.

CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

EXPORTING

COMMANDNAME = 'Z_DELETE'

  • OPERATINGSYSTEM = SY-OPSYS

  • TARGETSYSTEM = SY-HOST

  • STDOUT = 'X'

  • STDERR = 'X'

  • TERMINATIONWAIT = 'X'

  • TRACE = ' '

ADDITIONAL_PARAMETERS = PARAM

IMPORTING

STATUS = STATUS

TABLES

EXEC_PROTOCOL = RESULTADO

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.

Hope this help's,

Regards,

Read only

Former Member
Read only

Former Member
0 Likes
3,653

Hi Rosa,

Good days!

Thanks for your reply.

Btw, my OS is Window NT... so I can't test the example that u give me.

Do u have any others examples or documentation related to SM69?

Regards,

Hikaruno

Read only

0 Likes
3,653

Hi,

sorry but all the external commands i have done are for HP-UX systems. So all the examples are related to that !

http://help.sap.com/saphelp_nw2004s/helpdata/en/c4/3a7f2c505211d189550000e829fbbd/content.htm

regards,

Read only

0 Likes
3,653

Hi,

Can we execute shell script .sh through external command. If yes than pls share some examples it would be great help.

Thanks a lot in advace,

Regards,

Read only

0 Likes
3,653

Hi Ritesh,

Yes you can execute shell script through external command defined in SM69.

First create test1.sh file under /home directory and then create a external command in SM69 with following details:

Command name : ZT (your choice)

Op System : Linux

External program : sh

parameters of external program : /home/test1.sh

Alpa