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

How to execute external command from SAP

Hi gurus,

i need to execute an external command from a Sap (rel ECC.5.0) to a server UNIX (no SAP); precisely i have to write a file into a directory in unix server.

I see transaction SM49 and Sm69 but i don't know how can i use these features.

Please coul'd you help me or give me a documentation.

Thank's in advance

Maurizio Ortolani

email. maurizio.ortolani@trilog.it

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Jan 10, 2007 at 10:26 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 10:24 AM

    Hi Maurizio,

    i do it in this way:

    CONSTANTS: CMD_LS(50) VALUE 'ls -al /transfer/sap'.

    *

    DATA: BEGIN OF ITAB_LS OCCURS 0,

    LINE(200),

    END OF ITAB_LS.

    *

    CALL 'SYSTEM'

    ID 'COMMAND' FIELD CMD_LS

    ID 'TAB' FIELD ITAB_LS-SYS.

    *

    How do you write the file, via an UNIX-COMMAND than try the above call

    with your command.

    Another way is to write the file via OPEN DATASET ..., TRANSFER ... TO ..., CLOSE DATASET.

    If you mean this i can give you an example.

    Hope it helps.

    Regards, Dieter

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 10:27 AM

    apart from open dataset.. transfer... close dataset.

    u can also use C3GY or C3GZ tcodes.

    also the function module SXPG_COMMAND_EXECUTE

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 10:38 AM

    Hi everyone,

    thank's a lot for your helpful answers.

    I try to do this and when i finished i give you a feedback.

    Best regards

    Maurizio Ortolani

    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.