Skip to Content

How to move a specific field from one internal table to another internal table and compare the result?

Hi All

My requirement is to  Compare Countries coming from Bex Query through variable-DT_COUNTRY3  with table  /BI0/PCOMP_CODE 

Now Get COMP_CODE , CHRT_ACCTS from table /BI0/PCOMP_CODE   which has  specific chart of accounts.

Now Compare these specific chart of accounts of table /BI0/PCOMP_CODE   with   chart of accounts of  table /BIC/ADTRANGES00

then i need to specify few conditions in select statement of table  /BIC/ADTRANGES00   and get the GL Accounts.

Here i am trying to compare chart of accounts from Tbale /BI0/PCOMP_CODE  and /BIC/ADTRANGES00   which has different length of char .

i am trying to creat one more internal table and change the length to chart of accounts of table /BIC/ADTRANGES00 and compare.

i am not successful in comparing chart of accounts. Please help me in comparing chart of accounts, internal table or workarea creation issue in LT_RANGE

DATA: L_S_RANGE       TYPE RSR_S_RANGESID,

        L_S_VAR_RANGE  TYPE RRRANGEEXIT,

        LVRSPL_LOW     TYPE  /BIC/ADTRANGES00-RSPL_LOW.

   IF I_STEP = 2.

     READ TABLE I_T_VAR_RANGE INTO L_S_VAR_RANGE

                             WITH KEY VNAM = 'DT_COUNTRY3'.

DATA: L_T_CHART TYPE TABLE OF /BI0/PCOMP_CODE,

       L_S_CHART  TYPE /BI0/PCOMP_CODE,

       L_T_GLACNT TYPE TABLE OF /BIC/ADTRANGES00,

       L_S_GLACNT TYPE /BIC/ADTRANGES00.

DATA: BEGIN of S_RANGE,

       CHRACT   TYPE /BIC/ADTRANGES00-/BIC/DTSELKEY,

       END oF S_RANGE.

DATA: LT_RANGE TYPE TABLE OF S_RANGE,

       LS_RANGE TYPE LT_RANGE.

Select   COUNTRY COMP_CODE CHRT_ACCTS   from  /BI0/PCOMP_CODE

   INTO TABLE L_T_CHART

                     WHERE    COUNTRY  = 'VNAM'

                     AND  ( CHRT_ACCTS = 'ARCA'   OR

                            CHRT_ACCTS = 'CACO'   OR

                            CHRT_ACCTS = 'CAPY'   OR

                            CHRT_ACCTS = 'CRCA'   OR

                            CHRT_ACCTS = 'ECCA'   OR

                            CHRT_ACCTS = 'GTCA'   OR

                            CHRT_ACCTS = 'PACA'   OR

                            CHRT_ACCTS = 'PECA'   OR

                            CHRT_ACCTS = 'PYCA'   OR

                            CHRT_ACCTS = 'UYCA'   OR

                            CHRT_ACCTS = 'VECA ').

LOOP AT LT_RANGE INTO LS_RANGE  .

L_S_CHART-CHRT_ACCTS = LS_RANGE-CHRACT .

append L_T_CHART.

endloop.

       SELECT  RSPL_LOW

        INTO TABLE  L_T_GLACNT

        FROM /BIC/ADTRANGES00

        FOR ALL ENTRIES IN LT_RANGE

        WHERE /BIC/DTSELKEY = DTGLACNT

         AND  ( /BIC/DTFLD1 =    'WIP_EXPENSES' OR /BIC/DTFLD1 =  'WIP_TIME'  )   AND

        /BIC/DTOBJNAME =  'HKONT'   .

       IF SY-SUBRC = 0.

         L_S_RANGE-SIGN = 'I'.

         L_S_RANGE-OPT  = 'EQ'.

         L_S_RANGE-LOW  = LVRSPL_LOW .

         APPEND L_S_RANGE TO E_T_RANGE.

       ENDIF.

     ENDIF.

   ENDIF.



Thanks all

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Oct 23, 2015 at 12:23 PM

    Hi Naiduz,

    Try,

    LOOP AT LT_RANGE INTO LS_RANGE  .

           SELECT  RSPL_LOW

            INTO       L_S_GLACNT

            FROM /BIC/ADTRANGES00

            WHERE /BIC/DTSELKEY = DTGLACNT

             AND  ( /BIC/DTFLD1 =    'WIP_EXPENSES' OR /BIC/DTFLD1 =  'WIP_TIME'  )   AND

            /BIC/DTOBJNAME =  'HKONT'   .

            APPEND L_S_GLACNT to L_T_GLACNT.

           ENDSELECT.

    endloop.

    Hope it helpful,

    Regards,

    Venkat.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Naidu,

      Try,

      loop at first_table into wa.

      select fieldnames from  tablename into  wa2 where  char20   = wa-char4

      append wa2 to second_table.

      endselect.

      endloop.

      Hope it helpful,

      Regards,

      Venkat.