Using CASE with SELECT ABAP 7.4

Using CASE statement in ABAP OPEN SQL SELECT statements using ABAP 7.4 Syntax

A+ A-

In NetWeaver 7.4, you can use CASE statement in SELECT statements to do some operations, below is the example of using CASE with SELECT open sql statements.

In the below example we are passing material type text LV_FERT, LV_HALB or LV_OTHER into a local structure variable MATERIAL_TYPE

Example using CASE in OPEN SQL SELECT ABAP 7.4

DATA: lv_fert TYPE TEXT30 VALUE 'Finished Products',
      lv_halb TYPE TEXT30 VALUE 'Semifinished Products',
      lv_other TYPE TEXT30 VALUE 'Other Material Type'.

    WHEN mtart = 'FERT' THEN @lv_fert
    WHEN mtart = 'HALB' THEN @lv_halb
    ELSE @lv_other
  END AS material_type
  INTO @DATA(wa_mara)
  WHERE matnr = '000001-002'.

  WRITE:/ 'Material Type :', wa_mara-material_type.

Using CASE in Select ABAP 7.4

Learner Questions

No Questions by learners, be first one to ask ..!!

    Please Sign in to ask a question

    Was this lesson helpful to you? Yes No 1 People out of 1 think this lesson helpful

    Lesson Navigation

    ←Previous Chapter
    Next Chapter →