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: 

Import parameter to method does not default when executed

0 Kudos

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

rahul_mb
Active Participant
0 Kudos

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

0 Kudos

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

Thanks

0 Kudos

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

0 Kudos

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

0 Kudos

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

Thanks.

Any suggestions.

0 Kudos

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

SuhaSaha
Advisor
Advisor
0 Kudos

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

0 Kudos

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

Thanks

0 Kudos

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

0 Kudos

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

0 Kudos

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

0 Kudos

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.