Skip to Content
author's profile photo Former Member
Former Member

IS REQUESTED and IS SUPPLIED??

Could anyone let me know what are IS REQUESTED and IS SUPPLIED?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2007 at 04:03 PM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2007 at 04:04 PM

    hi

    IS REQUESTED and IS SUPPLIED are the two special keywords supplied by SAP for use in function modules.

    IS REQUESTED:

    Consider the following code in a function module:

    If CARRNAME is requested.

    Select single CARRNAME from SCARR

    Where carrid eq I_carrid.

    Endif.

    The statement “If CARRNAME is requested” is true if the actual parameter was specified for the formal parameter CARRID, when the function module call was made. IS REQUESTED is allowed only in a function module and not even in a subroutine called by the function module. Suppose the call to the above function module in the program is as follows:

    CALL FUNCTION 'ZSURESH_TEST1'

    EXPORTING

    CARRID = 'AA'

    IMPORTING

    CONNID = connid

    • FLDATE =

    • CARRNAME = carrname .

    Since CARRNAME value is not requested in the program, the statement “If CARRNAME is requested” fails, thus avoiding unnecessary expensive database operation.

    IS SUPPLIED:

    This checks whether the parameter <p> was passed during runtime (IMPORTING). For this the parameter <p> should be optional, else the system raises an error. This statement can be used in function modules and methods.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2007 at 04:13 PM

    IS REQUESTED

    -


    Logical Expressions - Test for Existence of a Formal Parameter

    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).

    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.

    IS SUPPLIED

    -


    Logical Expressions - Check for Transfer of an Actual Parameter

    Basic form

    IF f IS SUPPLIED.

    Effect

    This variant checks to see whether or not the parameter f was passed at runtime ( IMPORTING) or is to be passed ( EXPORTING) In function modules and methods. The condition is true, if f contains a value, although the system checks only the actual value of the formal parameter, not the default value.

    If the parameter is not optional, the system returns a runtime error. If f is a structure, you can only query the parameter itself, not the structure components.

    Notes

    The logical expression IS SUPPLIED checks only the declaration of an actual parameter when a function module or method is called. If IS SUPPLIED is false for a formal parameter in a procedure, but is nonetheless passed to another procedure as an actual parameter, then IS SUPPLIED is true for the relevant formal parameter in this procedure. Thus, the IS SUPPLIED attribute is not passed on to nested function modules or methods.

    You cannot use IS SUPPLIED with update function modules, or asynchronous RFCs.

    IS SUPPLIED does not support data exchanges in RFCs unless the function module has the same release status - or higher - as the caller.

    Example

    A method meth contains the field op as an optional parameter. In the following example, the case condition (using the CASE statement) is true only if op has been passed a value by the calling program.

    CLASS test DEFINITION.

    PUBLIC SECTION.

    METHODS meth IMPORTING op TYPE i OPTIONAL

    EXCEPTIONS excp.

    ENDCLASS.

    CLASS test IMPLEMENTATION.

    METHOD meth.

    DATA: feld TYPE i.

    IF op IS SUPPLIED.

    CASE op.

    WHEN 1.

    feld = 100.

    WHEN 2.

    feld = 200.

    WHEN OTHERS.

    RAISE excp.

    ENDCASE.

    ENDIF.

    ENDMETHOD.

    ENDCLASS.

    Thanks,

    Santosh

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.