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: 

Passing Variable Number of Parameters

z-mvg
Advisor
Advisor
0 Kudos

Hello All,

I need to pass variable number of parameters, either to a function module or a class method.

Can anyone tell me if at all this is possible and if yes how? It would be great if someone can suggest about this or some other way to solve this problem.

Thanks,

Mohit

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Keep the maximum number of parameters possible as importing in your function module and make the absolute necessary ones, mandatory and other as optional.

For eg.


Call FM1 with parameters A B C
Call FM1 with parameters A B F
Call FM1 with parameters A B G

So your function module should have import parameters as:


<u><b>FM1</b></u>
A  - Mandatory
B  - Mandatory
C  - Optional
F  - Optional
G  - Optional

Regards,

Subramanian V.

3 REPLIES 3

Former Member
0 Kudos

Keep the maximum number of parameters possible as importing in your function module and make the absolute necessary ones, mandatory and other as optional.

For eg.


Call FM1 with parameters A B C
Call FM1 with parameters A B F
Call FM1 with parameters A B G

So your function module should have import parameters as:


<u><b>FM1</b></u>
A  - Mandatory
B  - Mandatory
C  - Optional
F  - Optional
G  - Optional

Regards,

Subramanian V.

0 Kudos

or have a tables paramters where the structure is something like

1.parameter name

2. option

3. sign

4. low

5. high

and within your FM you can read this table and make selections accordingly.

(Note: there is a delivered structure available within the SAP system, i dont remember the structure name. which exactly has the same fields as i have mentioned ablve.)

Regards

Raja

z-mvg
Advisor
Advisor
0 Kudos

Raja's answer was helpful.

BTW the delivered structure he is talking about is RSPARAMS.

Edited by: Mohit V Gadkari on Sep 29, 2008 2:10 PM