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

calling a subroutine

Former Member
0 Likes
1,095

Hello,

Can anyone help me out giving this answer. How can we call a subroutine of one report from an other report.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,075

Hi,

You can use

PERFORM <subr> [USING ... <pi>... ]

[CHANGING... <pi>... ].

OR

PERFORM (<fsubr>)[IN PROGRAM (<fprog>)][USING ... <pi>... ]

[CHANGING... <pi>... ]

[IF FOUND].

OR

SUBMIT

Calls an executable program of type 1.

Syntax

SUBMIT <rep> [AND RETURN] [VIA SELECTION-SCREEN]

[USING SELECTION-SET <var>]

[WITH <sel> <criterion>]

[WITH FREE SELECTIONS <freesel>]

[WITH SELECTION-TABLE <rspar>]

[LINE-SIZE <width>]

[LINE-COUNT <length>].

Calls the program <rep>. If you omit the AND RETURN addition, the current program is terminated. Otherwise, the data from the current program is retained, and processing returns to the calling program when <rep> has finished running. The other additions control the selection screen and set attributes of the default list in the called program.

Regards,

Bhaskar

8 REPLIES 8
Read only

kostas_tsioubris
Contributor
0 Likes
1,075

Hi,

you can use this statement

perform routine(external_program_name).

Kostas

Read only

suresh_datti
Active Contributor
0 Likes
1,075

PERFORM form IN PROGRAM prog.

do an F1 on Perofrm in your ABAP editor & you will get a help on all the options..

~Suresh

Read only

Former Member
0 Likes
1,075

Hi,

You can simply write the prog name in () bracket and execute the perform.

e.g.

PERFORM buildt_fieldcat(Z5GJK_BILLING_BLOCK_DETAILS) CHANGING t_fieldcat

Hope this solves your purpose.

Award points if it helps.

-Gaurang

Read only

Former Member
0 Likes
1,075

Hi,

Subroutine Name (Program in which Subroutine present).

Regards,

Ranjit Thakur.

<b>Please Mark The Helpful Answer.</b>

Read only

ferry_lianto
Active Contributor
0 Likes
1,075

Hi Satish,

Welcome to SDN.

Please check this link for detail information and sample codes.

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

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
1,075

Hi,

Calling External Subroutines

1 report ztx1811.

2 tables ztxlfa1.

3 data f1(3) value 'AAA'.

4

5 ztxlfa1-lifnr = '1000'.

6 perform s1(ztx1812).

7 write: / 'f1 =', f1,

8 / 'lifnr =', ztxlfa1-lifnr.

-


-


Listing 18.12 Subroutine Called from the Program in Listing 18.11

1 report ztx1812.

2 tables ztxlfa1.

3 data f1(3).

4

5 form s1.

6 f1 = 'ZZZ'.

7 ztxlfa1-lifnr = '9999'.

8 endform.

-


The code in Listing 18.11 produces the following output:

f1 = AAA

lifnr = 9999

Hope this helps.

Reward if helpful.

Regards,

Sipra

Read only

Former Member
0 Likes
1,075

Thank you all. For helping me out.

Read only

Former Member
0 Likes
1,076

Hi,

You can use

PERFORM <subr> [USING ... <pi>... ]

[CHANGING... <pi>... ].

OR

PERFORM (<fsubr>)[IN PROGRAM (<fprog>)][USING ... <pi>... ]

[CHANGING... <pi>... ]

[IF FOUND].

OR

SUBMIT

Calls an executable program of type 1.

Syntax

SUBMIT <rep> [AND RETURN] [VIA SELECTION-SCREEN]

[USING SELECTION-SET <var>]

[WITH <sel> <criterion>]

[WITH FREE SELECTIONS <freesel>]

[WITH SELECTION-TABLE <rspar>]

[LINE-SIZE <width>]

[LINE-COUNT <length>].

Calls the program <rep>. If you omit the AND RETURN addition, the current program is terminated. Otherwise, the data from the current program is retained, and processing returns to the calling program when <rep> has finished running. The other additions control the selection screen and set attributes of the default list in the called program.

Regards,

Bhaskar