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

Default parameter in FM

Former Member
0 Likes
1,981

Hi,

i'm creating a Function module in SE37 and i would like to have a default value for my IMPORT parameter (import tab) which is a date that should be set to the actual date - 3 days.

I can't specify sy-datum - 3 and it does not recognize any variable i declare in the source tab.

Is there a way to do this ?

1 ACCEPTED SOLUTION
Read only

dev_parbutteea
Active Contributor
0 Likes
1,396

Hi,

in your FM , check if your parameter is empty, if it is assign actual date - 3 in in before processing!

Regards,

Sooness.

6 REPLIES 6
Read only

dev_parbutteea
Active Contributor
0 Likes
1,397

Hi,

in your FM , check if your parameter is empty, if it is assign actual date - 3 in in before processing!

Regards,

Sooness.

Read only

Former Member
0 Likes
1,396

Hi Tomislav,

Instead of trying to do it in IMPORT tab why don't you set the imported DATE field in the SOURCE CODE of function module. There it will recognise sy-datum and you can very well write.

date = sy-datum - 3.

Award points if found useful.

Regards

Indrajit.

Read only

Former Member
0 Likes
1,396

Hi,

You can check for the field, if its is blank then assign the default date in source code before processing.

Thanks

Sandeep

Reward if helpful

Read only

Former Member
0 Likes
1,396

Thanks for your answers.

I'm not sure it answers my question : i want the default value to be visible when i test it (i'm going to use this fm with a web service from another app so the fact that the default value is visible is important so it can be changed if not corresmonding to the user needs) and if i just affect a value in my source code, it changes the value of the parameter but this is not visible at selection screen

Read only

0 Likes
1,396

Hello,

Did you try calculating the value of your parameter before calling the FM (ie date - 3 if the value is empty) and displaying it directly before the call so the user can still change it?

Read only

0 Likes
1,396

Hello Walter,

i'm not sure i can do this because i'm going to create a web service with this function module so if i set my value in a program before i assume it won't be set (and as far as i know, i can't generate a webservice from a program but only from a FM...).

Anyway, i'm going to try your way, thanks a lot