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

Import parameter to method does not default when executed

0 Likes
3,243

Hi Everybody...i have a method with import parameter IV_DATE type SY-DATUM default SY-DATUM.

When i execute the method the system date does not default...the IV_DATE field is blank(Spaces). Is there anybody that can help. This is very strange.

Thanks in advance.

12 REPLIES 12
Read only

rahul_mb
Active Participant
0 Likes
2,919

How are you checking the value of the importing parameter? By debugging from SE24 directly OR by calling the method in another program?

Read only

0 Likes
2,919

Hi There....by executing TEST from se24.

Thanks

Read only

0 Likes
2,919

Hi Albert,

Default Value only works when you dont send the parameter, if you send the parameter with initial value you are sending a blank value, in this case '00000000', that happens too when you test the class from SE24, you are already sending the 00000000 while testing.

You can test this behavior in a Z program, sending lv_date with initial value(it will be 00000000 inside the class) and without sending the variable in the exporting parameters it will be the right date.

Regards

MC

Read only

Former Member
0 Likes
2,919

Hi,

I created  a custom class and used date as exporting parameter

I am able to get the date value. Please see screen shot for reference.

Regards,

Rafi

Read only

0 Likes
2,919

Hi Rafi..this  is exactly whet i have...but when test run it,,,the date field is blank....not even '00000000'.

Thanks.

Any suggestions.

Read only

Former Member
0 Likes
2,919

Hi,

Can you share the screen shot of the method and its parameters of the class you created.

Also can you try calling this class method in a program and see if the value for the date is populating.

Regards,

Rafi

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,919

the IV_DATE field is blank(Spaces)

The initial value for date is not blank but 00000000. Hence I think there is some mismatch in the definition of the formal param IV_DATE.

It would help everybody if you gave more information e.g., code snippet, screenshots etc.

- Suhas

Read only

0 Likes
2,919

Hi Suhas...see Rafi's screen shot...mine is exactly the same...but test run it,,,does not bring the date in.

Thanks

Read only

0 Likes
2,919

Hi Albert

Have you already tried testing the class in a program ?

i have already tested a class in the same way, when testing the parameter is blank and translates to 00000000, if you try it in a program and dont send the parameter it works well

Regards

MC

Read only

0 Likes
2,919

Hi MC...it Works perfectly in a program...it is when i am test running it...that it does not default the date.

Read only

0 Likes
2,919

Albert

as soon as you test the class(or even a FM) and you send in blank the testing class will initialize the value, the sy-datum initial value is 00000000, thats the initial value of that type

the difference is that in SE37 when you set a default value it will show the default value at the moment you test it, but if you clear the value it will take 00000000 as soon as you run the FM

its sad that the SE24 doesnt show a default value in testing mode, but thats how it works(for now)

the default value is applied when you dont send the parameter in a FM or CLASS and variables have initial values, maybe you should have a validation code in your program or class or fm that if the value is 00000000 then change it to sy-datum.

Regards

MC

Read only

0 Likes
2,919

Hi MC...sorry coming back now...of with Flu...we have establish that it works fine on another system...we have 2 DEV systems...how is this possible.

Thanks for your response.