cancel
Showing results for 
Search instead for 
Did you mean: 

if end if inside the case end -case

vieet
Explorer
242

Hi Gurus, 

   Hope all are doing good. I have faced something weird in debugging which is what I have not expeccted. I am using IF ENDIF inside the CASE ENDCASE. However I can see the if condition inside the case endcase is not working.

here is the screenshot 

vieet_0-1721716658114.png

I am using in PBO of screen.

You can see from the above screenshot, when sy-ucomm = 'GET_G' , it has to check if condition ztwdate field value . If it is 0 or initial, it should skip the if clause. 

We can see in debugging that WA_DATA-ztwdate  is initial, but still it is going inside if loop .

Any idea why it is happening.  ?

vieet_0-1721720190487.png

I am using data type DATS.

Kindly please help me as I was already late in fixing the issue. 

Sandra_Rossi
Active Contributor
Weird title, it's not a problem of IF ENDIF - CASE ENDCASE, it's a problem of why a conditional expression is evaluated true (false expected). Be careful to use an adequate question title. It's not initial because the data type is not D or not N length 8. I guess you have defined it C length 8 because in that case IS INITIAL is equivalent to all characters are spaces.
vieet
Explorer

I am using DATS data type.(it will capture the sy-datum value in it as per logic)....(added new image ) .Is there any way I can write validation inside CASE ENDCASE. I have to check if the value is available or not .

Sandra_Rossi
Active Contributor
You're going in the wrong direction. You should not look at the table in SE11, but instead look at the variable type in the debugger.

Accepted Solutions (0)

Answers (1)

Answers (1)

AndreasMuno
Product and Topic Expert
Product and Topic Expert

Thank you for your questions, @vieet.

Sandra has answered them in the comments. 

If that solves your request please mark accordingly and please give Sandra Kudos. Thank you.