Skip to Content
author's profile photo Former Member
Former Member

What's the Function Module name to execute OS command?

Hi Expert,

I remeber that there is a function module which can be used to execute OS command, but forget the FM name.

Does any expert know the FM name?

Thanks in advance,

Best Regards, Johnney.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Apr 07, 2009 at 09:41 AM

    Create the command name in SM49 defining the operating system name and other parameters. Then use the command in FM SXPG_COMMAND_EXECUTE to execute OS commands in ABAP.

    Add a comment
    10|10000 characters needed characters exceeded

    • Hello , I have the same problem I created a command in SM49 transaction with command name = ZCOPY, and S.O command = "scp". because I want to copy the files in unix (al11) to windows server.

      my problem is that I want to copy a lot of file in the same parameter but I only have 255 caracter. If I create a new fuction 'Z' then I have to change a lot of other function that are calling by the 'SXPG_COMMAND_EXECUTE'.

      In the parameters I have to repeat all the time the origin directory:'/usr/sap/DEV/RetencionesWeb/ if i don´t repeated it the file is not found

      The command is like this:

      SCP

      file 1 = '/usr/sap/DEV/RetencionesWeb/26000000012009.PDF'

      file 2 = '/usr/sap/DEV/RetencionesWeb/26000000012009.PDF'

      Destination windows server

      Do you know any way to don´t repeat the '/usr/sap/DEV/RetencionesWeb/?

      Thanks,

      Lucila

      Edited by: Lucila Isernia on Apr 25, 2011 4:31 PM

  • author's profile photo Former Member
    Former Member
    Posted on Apr 07, 2009 at 09:14 AM

    You use this FM 'SXPG_COMMAND_EXECUTE' to execute OS command.

    Regards,

    Joan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 07, 2009 at 09:04 AM

    in transaction SM69 create external command,

    call command using function, example:

    CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

    EXPORTING

    commandname = w_command

    ADDITIONAL_PARAMETERS = w_output

    IMPORTING

    STATUS = w_status

    TABLES

    EXEC_PROTOCOL = LOG.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 07, 2009 at 09:05 AM

    Hi,

    "SXPG_COMMAND_EXECUTE" is the FM which will Execute an External Command.

    regards,

    Naveen

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 07, 2009 at 09:07 AM

    Please Search SDN

    how-to-create-sap-directories-in-application-serve

    Edited by: Sap Fan on Apr 7, 2009 11:07 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 07, 2009 at 09:11 AM

    Hi ,

    The FM name is 'SXPG_COMMAND_EXECUTE'.

    You need to create the command in SM69.

    You can test the same command in SM49.

    Regards,

    Anuj

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.