Skip to Content
avatar image
Former Member

Calling one program from other Program - and External Subroutine

Hi Friends,

Could u pls explain how to call one program from the other program

and wht is SUBMIT , SUBMIT and RETURN. how to use these.

wht is external subroutine.

pls reply soon. its bit urgent.

jai.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

8 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 25, 2007 at 11:16 AM

    Hi,

    SUBMIT command is used to call one program from other program. Here if you use RETURN then the control will return to 1st calling program after the execution of the 2nd program.

    External Subroutine:

    Subroutine that exists in some other program or include which is not related to the current program.

    You can call the external subroutine from your program as shown here:

    PERFORM abc(XYZ) USING C D CHANGING E. "Here XYZ is the program or include name.
    **abc is the subroutine name
    

    Thanks and Regards,

    Kunjal Patel

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 25, 2007 at 11:34 AM

    Hi,

    To add

    for Non-executable programs u have to use call transaction statement.

    http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9da935c111d1829f0000e829fbfe/frameset.htm

    the above link explais how to use it..

    Regards,

    Aparna

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 25, 2007 at 11:17 AM

    Hi,

    Check the link...

    http://www.sap-img.com/abap/how-to-call-one-report-to-another.htm

    I hope this link will be helpful for you to understand the in and out of SUBMIT statement used to call executable programs from another programs.

    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9dd035c111d1829f0000e829fbfe/frameset.htm

    REPORT ZREP1.

    parameter : paramet(18) type c.

    write : paramet.

    -


    REPORT ZREP2 NO STANDARD PAGE HEADING.

    tables: qals.

    RANGES seltab for qals-prueflos.

    WRITE: 'Select a Selection!',

    / '----


    '.

    SKIP.

    FORMAT HOTSPOT COLOR 5 INVERSE ON.

    WRITE: 'Selection 1',

    / 'Selection 2'.

    AT LINE-SELECTION.

    CASE SY-LILLI.

    WHEN 4.

    SUBMIT zrep1 VIA SELECTION-SCREEN

    WITH PARAMET EQ 'Selection 1'

    WITH SELECTO IN SELTAB

    WITH SELECTO NE 3

    AND RETURN.

    WHEN 5.

    SUBMIT zrep1 VIA SELECTION-SCREEN

    WITH PARAMET EQ 'Selection 1'

    AND RETURN.

    ENDCASE.

    Reward points if it is helpful..

    Regards,

    Omkar.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 25, 2007 at 11:18 AM

    Hi Guru,

    Submit is used for call one program from another Program. You can see the second

    Ex :

    Create 1 pgm in se38 (zsample) and call another pgm like,

    submit zexample. -


    > here u can see the output of zexample .

    Submit and Return :

    Ex :

    submit zexample and return.

    write : ' something'.

    here u can see the output of zexample and zsample output also.

    Thanks.

    reward If Helpful.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 25, 2007 at 11:20 AM

    hi

    good

    You can call executable programs from other ABAP programs using the following statement:

    SUBMIT prog|(field) [AND RETURN] [options].

    You can either specify the name of the program you want to call statically by entering the program name in the code of the calling program, or dynamically by specifying the name of a field (in parentheses) containing the name of the program. If the system cannot find the specified executable program when trying to execute the SUBMIT statement, a runtime error occurs.

    go through this link to know further detail

    http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dba51a35c111d1829f0000e829fbfe/content.htm

    thanks

    mrutyun^

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 25, 2007 at 11:20 AM

    YOu can give a call to the external program using submin prog.

    Eg: In your Z program, you give a call to SAP standard program and get some results back.

    SUBMIT <External Prog> and return.

    The addition AND RETURN starts the executable program in a new internal session. The session for the calling program is retained. Once program access is completed, program execution for the calling program continues after the SUBMIT statement.

    pelase reward if useful.

    regards

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 25, 2007 at 11:22 AM

    HI.

    Refer this code.

    DATA: P_JOBCNT LIKE TBTCJOB-JOBCOUNT,

    L_RELEASE(1) TYPE c.

    CALL FUNCTION 'JOB_OPEN'

    EXPORTING

    JOBNAME = 'ZTST1'

    IMPORTING

    JOBCOUNT = P_JOBCNT

    EXCEPTIONS

    CANT_CREATE_JOB = 1

    INVALID_JOB_DATA = 2

    JOBNAME_MISSING = 3

    OTHERS = 4.

    IF SY-SUBRC <> 0.

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

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

    ENDIF.

    SUBMIT ZNTEST VIA JOB 'ZTST1' NUMBER P_JOBCNT

    USER 'ELIGETV'

    TO SAP-SPOOL WITHOUT SPOOL DYNPRO

    • WITH DESTINATION = 'HPMISPRT'

    WITH IMMEDIATELY = SPACE

    WITH KEEP_IN_SPOOL = 'X' AND RETURN.

    CALL FUNCTION 'JOB_CLOSE'

    EXPORTING

    JOBCOUNT = P_JOBCNT

    JOBNAME = 'ZTST1'

    STRTIMMED = 'X'

    PRDMINS = 15

    IMPORTING

    JOB_WAS_RELEASED = L_RELEASE

    EXCEPTIONS

    CANT_START_IMMEDIATE = 1

    INVALID_STARTDATE = 2

    JOBNAME_MISSING = 3

    JOB_CLOSE_FAILED = 4

    JOB_NOSTEPS = 5

    JOB_NOTEX = 6

    LOCK_FAILED = 7

    INVALID_TARGET = 8

    OTHERS = 9.

    IF SY-SUBRC <> 0.

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

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

    ENDIF.

    Check the link...

    http://www.sap-img.com/abap/how-to-call-one-report-to-another.htm

    I hope this link will be helpful for you to understand the in and out of SUBMIT statement used to call executable programs from another programs.

    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9dd035c111d1829f0000e829fbfe/frameset.htm

    Rewards if it helpfull

    Regards.

    Jay

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 25, 2007 at 11:31 AM

    Hi,

    There are different types of programs:

    Executible programs are called from another program using

    Submit <reportname> [and return]

    If you omit the AND RETURN addition, all data and list levels of the calling program (the entire internal session) are deleted. After the called executable program has finished, control returns to the level from which you started the calling program.

    that is after displaying the results of ur submitted list the system does not execute the calling program anymore..

    If you use AND RETURN, the system stores the data of the calling executable program and returns to the calling after processing the called program. The system resumes executing the calling program at the statement following the call.

    that is after the list of the submitted report is generated when u press back it takes u to the list display of ur primari program

    report try.

    submit new." and return.

    write 'hi'.

    report new.

    write 'bye'.

    try the above to understand better

    Regards,

    Aparna

    Add comment
    10|10000 characters needed characters exceeded