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: 

Checking optional tables parameter in function

Former Member
0 Kudos

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

6 REPLIES 6

athavanraja
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

0 Kudos

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

0 Kudos

you're right

thanks for your hint

I'm just trying the "is supplied" keyword.

but it looks good

regards

Angelika

0 Kudos

Hi Angelika,

You can also use the code as follows.

IF ITAB[] IS NOT INITIAL.

**DO SOMETHING

ELSE.

**DO SOMETHING

ENDIF.

Cheers,

Sam

0 Kudos

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