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 Subroutine

Former Member
0 Likes
686

Hi Experts...

A Subroutine can be called using

PERFORM Sub-Name using...

  • Is there any other way that a subroutine (- i.e., the code for subroutine written in between FORM ... ENDFORM) can be triggered?

Rewardable...

Santo

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
660

Hi,

U cannot call a subroutine in any other way except by using Perform.

Calling Subroutines

You call subroutines using the statement

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

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

Subroutines can call other subroutines (nested calls) and may also call themselves (recursive calls). Once a subroutine has finished running, the calling program carries on processing after the PERFORM statement. You can use the USING and CHANGING additions to supply values to the parameter interface of the subroutine.

Defining Subroutines

A subroutine is a block of code introduced by FORM and concluded by ENDFORM.

FORM <subr> [USING ... [VALUE(]<pi>[)] [TYPE <t>|LIKE <f>]... ]

[CHANGING... [VALUE(]<pi>[)] [TYPE <t>|LIKE <f>]... ].

...

ENDFORM.

<subr> is the name of the subroutine. The optional additions USING and CHANGING define the parameter interface. Like any other processing block, subroutines cannot be nested. You should therefore place your subroutine definitions at the end of the program, especially for executable programs (type 1). In this way, you eliminate the risk of accidentally ending an event block in the wrong place by inserting a FORM...ENDFORM block.

4 REPLIES 4
Read only

Former Member
0 Likes
661

Hi,

U cannot call a subroutine in any other way except by using Perform.

Calling Subroutines

You call subroutines using the statement

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

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

Subroutines can call other subroutines (nested calls) and may also call themselves (recursive calls). Once a subroutine has finished running, the calling program carries on processing after the PERFORM statement. You can use the USING and CHANGING additions to supply values to the parameter interface of the subroutine.

Defining Subroutines

A subroutine is a block of code introduced by FORM and concluded by ENDFORM.

FORM <subr> [USING ... [VALUE(]<pi>[)] [TYPE <t>|LIKE <f>]... ]

[CHANGING... [VALUE(]<pi>[)] [TYPE <t>|LIKE <f>]... ].

...

ENDFORM.

<subr> is the name of the subroutine. The optional additions USING and CHANGING define the parameter interface. Like any other processing block, subroutines cannot be nested. You should therefore place your subroutine definitions at the end of the program, especially for executable programs (type 1). In this way, you eliminate the risk of accidentally ending an event block in the wrong place by inserting a FORM...ENDFORM block.

Read only

Former Member
0 Likes
660

Hi,

Using Perform we r passing actual parameters.

USing FORM statement formal parameters r used.

With in form and endform statements code is written .

Regards,

Narasimha

Read only

Former Member
0 Likes
660

Hi,

1.YES,for external subroutines ,

Perform form_name in program program name

using ....

2.2 ways to call external forms..

1. PERFORM (RNAME) IN PROGRAM ZYX_STAT

Here RNAME canbe variable...

2. PERFORM RNAME IN PROGRAM ZYX_STAT

Here RNAME is Form name..

Refer:

Regards,

Kumar

Read only

prasanth_kasturi
Active Contributor
0 Likes
660

hi,

there is no way to trigger form... endform without using perform

if u dont use subroutiens.

try writing that code in a function module and call that functuion module.

reagrds

prasanth