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, end case statement

Former Member
0 Likes
534

Hi all,

name of my internal table is my_tab.i need to calculate the discounts depending upon the condition types(KSCHL) FROM KONV TABLE.

WHEN KSCHL = ZDO1 calulation procedure is in percentage

KSCHL= ZD02 calculation procedure is in fixed amount.

and so on.....

my_tab has fields

my_tab-total

my_tab-discount

if kschl = ZD01, discount = my_tab-total - my_tab-discount

if kschl = ZD02, discount = my_tab-total * my_tab-discount/100.

i wanted to know how to use this in CASE AND END CASE statement.

regards

akmal

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
493

Hi akmal,

loop at my_tab.

Case my_tab-kschl.

when 'Zd01'.

discount = my_tab-total - my_tab-discount.

when 'ZD02'.

discount = my_tab-total * my_tab-discount/100.

endcase.

endloop.

hope it helps u,

keerthi

2 REPLIES 2
Read only

Former Member
0 Likes
494

Hi akmal,

loop at my_tab.

Case my_tab-kschl.

when 'Zd01'.

discount = my_tab-total - my_tab-discount.

when 'ZD02'.

discount = my_tab-total * my_tab-discount/100.

endcase.

endloop.

hope it helps u,

keerthi

Read only

Former Member
0 Likes
493

Hi akmal,

chek out this code.

Case kshcl.

when 'ZD01'.

discount = my_tab-total - my_tab-discount.

when 'ZD02'.

if kschl = ZD02, discount = my_tab-total * my_tab-discount/100.

end case.

if you ar looping through the internal table sthen you can do the same af ter the when statements.

regards,

sateesh.