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

suryakumar1223
Explorer
0 Likes
1,005

Hello,

For the case statement i need two true cases.

Ex:

CASE lv_tcode.

When 'VF31'

FLAG_MAIL = ' '

WHEN 'VF02'

FLAG_MAIL = ' '

WHEN 'ZDRT'

FLAG_MAIL = 'X'

FOR ZDPT ALSO I NEED FLAG MAIL AS 'X'.SO I WROTE AS

WHEN 'ZDPT'

FLAG_MAIL = 'X'.

This wasn't working.

Also I tried, WHEN 'ZDRT' OR 'ZDPT'

FLAG_MAIL = 'X'.

This was also not working ..pls help me on this

4 REPLIES 4
Read only

Sandra_Rossi
Active Contributor
925

CASE is as simple as IF.

You can find yourself the reason why "it doesn't work" (no idea what you mean), by using the debugger.

Read only

JackGraus
Active Contributor
925
flag_mail = SWITCH #( lv_tcode WHEN 'ZDRT' OR 'ZDPT' THEN abap_true ).
Read only

RaymondGiuseppi
Active Contributor
0 Likes
925

Could you elaborate on 'This wasn't working.'

  • Also read CASE statement
  • Check carefully for lowercase/uppercase or any typo in code
  • How waw the 'local tcode' variable filled, did you use cl_dynpro=>get_current_transaction( ) which is required for variant/parameter transactions;
Read only

matt
Active Contributor
0 Likes
925

This wasn't working

and

This was also not working

are not recognisable error messages.