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

Custom Function Module: Check if parameter specified by calling program

Former Member
0 Likes
1,241

Hi everyone,

I'm developing a custom function module that is going to be used by various different programs. For some programs the logic processed in the FM will be the same, but for some cases additional logic is required. I only want to run through this logic if it is required by the calling program. I 'm thinking i can determine whether or not logic should be processed based on whether or not an export parameter for the FM has been specified in the calling program. But I'm not sure what way to do this.

For example.

CALL FUNCTION 'Z_Function'

EXPORTING

pernr = peras-pernr

begda = l_begda

endda = l_endda

IMPORTING

param_a = l_param_a

param_b = l_param_b

EXCEPTIONS

DATA_MISSING = 1

OTHERS = 2 .

If both parameters above are specified then that's fine. However if only l_param_a or l_param_b is specified then i only want to process the logic to relevant to determing the value of that export parameter. The reason for this is that this function module will could run thousands of times (per employee basis) and i dont want to slow performance by retrieving data that is not required in some programs.

So within the function module - is there a straightforward way i can check whether param_a or param_b has been speficied by the calling program ? Having to separate function modules is not an option for us.

Thanks alot for your time

DK

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
1,041

Check out option IF ... IS SUPPLIED in ABAP help.

http://help.sap.com/abapdocu_70/en/ABENLOGEXP_SUPPLIED.htm

Thomas

2 REPLIES 2
Read only

ThomasZloch
Active Contributor
0 Likes
1,042

Check out option IF ... IS SUPPLIED in ABAP help.

http://help.sap.com/abapdocu_70/en/ABENLOGEXP_SUPPLIED.htm

Thomas

Read only

0 Likes
1,041

Thomas,

Excellent, exactly what I need - I had not unearthed this is my search. Thanks alot - I appreciate your time and help.

Best Regards

Damien