Application Development 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: 

Case statement

suryakumar1223
Explorer
0 Kudos
297

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

Sandra_Rossi
Active Contributor
217

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.

jack_graus2
Active Contributor
217
flag_mail = SWITCH #( lv_tcode WHEN 'ZDRT' OR 'ZDPT' THEN abap_true ).

raymond_giuseppi
Active Contributor
0 Kudos
217

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;

matt
Active Contributor
0 Kudos
217

This wasn't working

and

This was also not working

are not recognisable error messages.