Skip to Content
0
Jul 29, 2020 at 02:12 AM

How to use less or between as condition in read table clause ?

332 Views

I have two internal tables IT_ITAB and IT_ZAFS_FI_01. In IT_ZAFS_FI_01 there are two range fields ZFIRAFR and ZFIRATO. I want to find for each RACCT and RFAREA in IT_ITAB whether exist in IT_ZAFS_FI_01 with RACCT in the range and RFAREA equal ZFIFUAR. I have code like below. But it has error. So in READ TABLE itab less or between as condition is not allowed? I have to use loop instead? Thx.

  SELECT
    RACCT  
    RFAREA  
    HSLVT 
   INTO  TABLE IT_ITAB
   FROM FAGLFLEXT
   WHERE RYEAR  = P_YEAR
   AND RLDNR  = '0L'
   AND RRCTY  = '0'
   AND RBUKRS = P_BUKRS.
SORT it_itab BY racct rfarea.

  SELECT
           BUKRS
           ZFIITEM
           ZFISUIT
           ZFITEXT
           ZFISIGN
           ZFITYPE
           ZFIRAFR
           ZFIRATO
           ZFIFUAR
           ZFIITFR
           ZFIITTO
   FROM ZTFI03
   INTO CORRESPONDING FIELDS OF TABLE IT_ZAFS_FI_01
   WHERE BUKRS = P_BUKRS .
LOOP AT IT_ITAB INTO data(IT_ITAB_l) group by ( key1 = IT_ITAB_l-racct  key2 =  IT_ITAB_l-rfarea ) .
     READ TABLE IT_ZAFS_FI_01 with key ZFIFUAR = IT_ITAB_l-rfarea ZFIRAFR < IT_ITAB_l-racct  ZFIRATO > IT_IT  AB_l-racct  . 
ENDLOOP.