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

case statement

Former Member
0 Likes
712

i need to check the condition in case can i do it, but the statement below is failing

IF v_quantity NE '0'.

CASE l_sy_ucomm.

WHEN l_sy_ucomm.

PERFORM f_pop_up.

ENDCASE.

ELSE.

PERFORM f_delete_hu.

ENDIF.

any alterntive to this.

7 REPLIES 7
Read only

Former Member
0 Likes
691

yes because of if statement it is not going inside to execute case statement. so if you dont want that just comment if endif.

regards

shiba dutta

Read only

Former Member
0 Likes
691

Try this..

IF v_quantity NE '0'. " check in debug mode whether v_quantity is 0 or not

<b>CASE sy-ucomm.</b>

WHEN l_sy_ucomm.

PERFORM f_pop_up.

ENDCASE.

ELSE.

PERFORM f_delete_hu.

ENDIF.

Read only

Former Member
0 Likes
691

another thing u can try is write the if endiff statements inside the case according to ur requirement

hopen it helps

navjot

reward accordingly

Read only

Former Member
0 Likes
691

Hi

try like this.

IF v_quantity NE '0' and l_sy_ucomm = l_sy_ucomm.

PERFORM f_pop_up.

elseif v_quantity eq '0' .

PERFORM f_delete_hu.

endif.

regards,

bharat.

Read only

Former Member
0 Likes
691

Gupta,

What is "l_sy_ucomm". Is it sy-ucomm value? if so have you moved the value to l_sy_ucomm.

l_sy_ucomm = sy-ucomm.

Put the break point here and check the l_sy_ucomm.

-


This is wrong.Every time case statement will get true.

CASE l_sy_ucomm.

WHEN l_sy_ucomm.

-


Pls. reward if useful

Read only

Former Member
0 Likes
691

Hi..,

Generally we use the case statement as ..

<b>CASE w_field

when 1. ** gets executed when w_field = 1.

do

when 2. ** gets executed when w_field = 2.

do

when 3. ** gets executed when w_field = 3.

do

endcase.</b>

but u are checking here as..

<b>CASE l_sy_ucomm.

WHEN l_sy_ucomm. <u>** here it should contain the value of the l_sy_ucomm. for ex : 'DISP' - the function code..</u>

PERFORM f_pop_up.

ENDCASE.</b>

reward if it helps u..

sai ramesh

Read only

aris_hidalgo
Contributor
0 Likes
691

Hi,

What you can do is to put a breakpoint in your IF statement to see the value of v_quantity if its 0 or not. If its not, then now check your l_sy_ucomm to see if it will perform your routine or not. Hope this helps...

P.S. Please award points if found useful...