Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

assigning value inside a case statement

Hi friends

iam using the below code and can any one tell me why even after assigning the value in the case statement it coming out of it.

code

data :

p1(1) type n.

case p1.

when '0'.

write 'sunday'.

p1 = 1.

when '1'.

write 'monday'.

p1 = 2.

when others.

write 'invalid day'.

endcase.

output.

sunday

can any one tell me why it is coming out of the case statement even iam assigning p1 = 1

Tags:
replied

hi,

once one WHEN condition was found true, it will jump to ENDCASE, no other conditions will be checked.

you can do something like this:

WHILE condition.

CASE ... => your code from above

...

ENDCASE.

ENDWHILE.

hope this helps

ec

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question