08-17-2005 11:02 AM
Hi!
is there any possibility to check whether an optional tables parameter has actually been passed to a function?
e.g.
function xxx
TABLES tab1 OPTIONAL
how do I know within the function code if the parameter tab1 has been specified when calling the function?
thanks for help.
AP
Message was edited by: Angelika Pokorny
Message was edited by: Angelika Pokorny
08-17-2005 11:15 AM
Welcome to SDN,
yes you can do it, IS SUPPLIED is the key word.
if tab1 <b>IS SUPPLIED</b>.
do something
endif .
docuementation from ABAP key word documenataion.
log_exp - IS SUPPLIED
Syntax
... p IS [NOT] SUPPLIED ...
Effect
The logical expression checks whether a formal parameter p of a procedure is filled or requested. The expression is true if at the call an actual parameter was assigned to the formal parameter.
This logical expression is possible only in function modules and methods. For p, you can specify all optional formal parameters.
With addition NOT, the expression is true if at the call no actual parameter was assigned to the formal parameter.
Note
The logical expression with IS SUPPLIED cannot be used in function modules that are called with
CALL FUNCTION ... IN UPDATE TASK ...
CALL FUNCTION ... STARTING NEW TASK ...
For function modules called with Remote Function Call, the application servers of calling and called program must have at least release 4.6.
Hope this helps.
If your question is answered, kindly mark the thread as answered and reward the points for helpful answers.
Regards
Raja
08-17-2005 11:18 AM
Hi,
When you pass an internal table to your FM and if it has some entries in that table then inside FM code you can check for if that parameter is initial. If it is initial then it means nothing is passed to optional table parameter.
08-17-2005 11:31 AM
i guess the poster has asked whether a particular optional parameter is passed or not
NOT
the parameter holds a value or not
Regards
Raja
08-17-2005 11:36 AM
you're right
thanks for your hint
I'm just trying the "is supplied" keyword.
but it looks good
regards
Angelika
08-17-2005 11:50 AM
Hi Angelika,
You can also use the code as follows.
IF ITAB[] IS NOT INITIAL.
**DO SOMETHING
ELSE.
**DO SOMETHING
ENDIF.
Cheers,
Sam
08-17-2005 12:28 PM
suddenly the post is not marked as question any more. did you remove the check box mark as question. set it back
if your intention is to mark it as answered, click on the radio button solved.
Regards
Raja
Message was edited by: Durairaj Athavan Raja