Application Development 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: 

IF... IS REQUESTED?

former_member1330001
Participant
0 Kudos

Hi Friends,

I came across an IF statement in a standard SAP program which i am not familiar with. Can anybody explain the use of such a statement that goes something like this?

IF <var> IS REQUESTED.

...

ENDIF.

Thanks in advance.

Regards,

Tamilarasan.

5 REPLIES 5

Former Member
0 Kudos

Hi,

Below is the detailed explanation for the Statement

IF .... REQUESTED...

This is what I could gather from SAP Help documentation. I actually have not used this statement any time.

Hope it is of some help to you.

<b>Logical Expressions - Test for Existence of a Formal Parameter</b>

The expression f IS [NOT] REQUESTED is true if an actual parameter was specified for the formal parameter f when the call was made.

Here, f must be the parameter of a function module, not a pure import parameter ("IMPORTING"). If you are dealing with a structured parameter, it must refer only to the parameter itself, not to a component. Moreover, this is allowed only in the function module itself (not in a subroutine called by the function module).

Note

The function of the logical expression IS REQUESTED is covered by the logical expression IS SUPPLIED. Instead of IS REQUESTED you should use IS SUPPLIED.

Example

In a function module, the next test establishes whether the result parameter TEXT was specified when the module was called. The expensive database read operation is executed only if the result is positive.

...

IF TEXT IS REQUESTED.

SELECT SINGLE * FROM ...

TEXT = ...

ENDIF.

Note

Although this test can result in a considerable improvement in performance, it should still be used with caution. In particular, the behavior of a function module (visible from outside) should depend only on the values and not on the existence of actual parameters.

Regards,

Vara

athavanraja
Active Contributor
0 Kudos

removing the content, as it was eactly the same as Vara's

Regards

Raja

Message was edited by: Durairaj Athavan Raja

Former Member
0 Kudos

Hi,

Got this info from the F1 help

<u>Logical Expressions - Test for Existence of a Formal Parameter</u>

The expression f IS REQUESTED is true if an actual parameter was specified for the formal parameter f when the call was made.

Here, f must be the parameter of a function module, not a pure import parameter ("IMPORTING"). If you are dealing with a structured parameter, it must refer only to the parameter itself, not to a component. Moreover, this is allowed only in the function module itself (not in a subroutine called by the function module).

<u>Example</u>

In a function module, the next test establishes whether the result parameter TEXT was specified when the module was called. The expensive database read operation is executed only if the result is positive.

...

IF TEXT <b>IS REQUESTED.</b>

SELECT SINGLE * FROM ...

TEXT = ...

ENDIF.

<b>Note</b>

Although this test can result in a considerable improvement in performance, it should still be used with caution. In particular, the behavior of a function module (visible from outside) should depend only on the values and not on the existence of actual parameters.

Hope this helps.

Thanks & Regards,

Judith.

The same content ........!!!!!!!!!!!!oops

Message was edited by: Judith Jessie Selvi

Vinod_Chandran
Active Contributor
0 Kudos

Hi,

This can be used when your function module have optional parameters and some statements are executed based on the availability of this. For example you can eliminate the execution of expensive select statements when an optional parameter is not used in a function module call.

Thanks

Vinod

0 Kudos

To add to what Vinod had said, it is especially true in case the interface parameter is a ranges table which is used in the SELECT statement. If the table is initial, you do not want to consider all the values for that field.

Also, in case your select statement uses FOR ALL ENTRIES, you might want to trigger it only if the table has got some entries in it.

Regards,

Anand Mandalika.