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

sub routine

Former Member
0 Likes
902

Can we call a sub-routine from one program to another program

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
875

Hi!

Yes, if the called program is an include type one, and it is included within the caller program, using the INCLUDE keyword.

Or you can use it like this:

PERFORM form(ZMYOTHERPROGRAM).

Or you can call the other program, using the SUBMIT keyword, but this will start the whole program.

Regards

Tamá

7 REPLIES 7
Read only

prasanth_kasturi
Active Contributor
0 Likes
875

Hi,

yes you can call

these are called external subroutienes

syntax:

perform <form name>(Prog name).

regards

prasanth

Read only

Former Member
0 Likes
876

Hi!

Yes, if the called program is an include type one, and it is included within the caller program, using the INCLUDE keyword.

Or you can use it like this:

PERFORM form(ZMYOTHERPROGRAM).

Or you can call the other program, using the SUBMIT keyword, but this will start the whole program.

Regards

Tamá

Read only

Former Member
0 Likes
875

ofcourse u can

thy almost same as function module,..

Read only

pavel_parshenkov2
Participant
0 Likes
875

Hi,

PERFORM subroutne IN PROGRAM prg_name IF FOUND.

or

PERFORM subroutne(prg_name).

Read only

Former Member
0 Likes
875

Yes.

use the below syntax

PERFORM <subr>(<prog>) [USING ... <pi>... ]

[CHANGING... <pi>... ] [IF FOUND].

Refer the below link.

[http://help.sap.com/saphelp_nw04/helpdata/en/9f/db978335c111d1829f0000e829fbfe/content.htm|http://help.sap.com/saphelp_nw04/helpdata/en/9f/db978335c111d1829f0000e829fbfe/content.htm]

Reward if found helpful

Regards,

Boobalan Suburaj

Read only

Former Member
0 Likes
875

Yes u can do in this way.

PERFORM form IN PROGRAM prog.

Example

DATA: RNAME(30) VALUE 'WRITE_STATISTIC', "Form and program

"names must

PNAME(8) VALUE 'ZYX_STAT'. "be written in

"upper case

PERFORM (RNAME) IN PROGRAM ZYX_STAT.

PERFORM WRITE_STATISTIC IN PROGRAM (PNAME).

PERFORM (RNAME) IN PROGRAM (PNAME).

All three PERFORM statements have the same effect, that is, they call the subroutine 'WRITE_STATISTIC', which is defined in the program 'ZYX_STAT'.

rwrd points if useful

Bhupal

Read only

Former Member
0 Likes
875

Use this:

PERFORM name_form IN PROGRAM name_report

USING ...

CHANGING ....