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

GRIR report : Coding issue for CASE stmt .

0 Likes
662

Hi ,

Actually i've tried a case stmt to delete movement type from the internal table

its works well for lineitem 10 and 20 ...but when it loops for lineitem 30 with movementtype BWART(122 ,101 ,123 )

in case stmt  its not considering "WHEN 122" atall (the reason is there is 2 times 122 type for lineitem30 as highlighted below ) .

Finally it shud delete lineitem30 w.r.t mat.doc(5000000043 and 5000000044 ) .

So how to solve this issue ,kindly do the needful as it is urgent  .

Code :

LOOP AT  GT_EKBE1 INTO GS_EKBE1 WHERE SHKZG = 'H'.
    CHECK GS_EKBE1-BWART = '102' or GS_EKBE1-BWART = '122' or GS_EKBE1-BWART =  '161' .
  CASE GS_EKBE1-BWART.
             WHEN ' 122'.
                lv_bwart = '123' .
            WHEN '102' .
                lv_bwart = '101' .
            WHEN '161'.
               lv_bwart = '162' .
       ENDCASE.
        READ TABLE GT_EKBE1 INTO GS_EKBE3 WITH KEY   EBELN = GS_EKBE1-EBELN
                                                    EBELP = GS_EKBE1-EBELP
                                                    LFBNR = GS_EKBE1-LFBNR
                                                    MENGE = GS_EKBE1-MENGE
                                                    BWART = LV_BWART
                                                    SHKZG = 'S'     .


         IF GS_EKBE3 IS NOT INITIAL.
              DELETE TABLE GT_EKBE1 from GS_EKBE1.
              DELETE TABLE GT_EKBE1 from GS_EKBE3.
       ENDIF .
  CLEAR : GS_EKBE1 , GS_EKBE3 , LV_BWART  .
      ENDLOOP .


Regards ,

Wilson .

3 REPLIES 3
Read only

Former Member
0 Likes
630

Hi Lourd,

You have given WHEN ' 122' instead of WHEN '122'. Hence it is not called. remove the space and check.

Thanks,

Ajay Bose

Read only

0 Likes
630

Hi Ajay ,

Yes actually i dint notice that ,  i gott nw thx   .

Regards ,

Wilson .

Read only

Former Member
0 Likes
630

Hi Its Not due to the multiple entries in the table its the space character in your when statement..

WHEN ' 122'. - you may have remove the space and put when '122'.