10-23-2015 1:07 PM
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
10-23-2015 1: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.
10-23-2015 2:16 PM
CHRT_ACCTS IN TABLE /BI0/PCOMP_CODE IS CHAR 4 AND
CHART OF ACCOUNTS (/BIC/DTSELKEY) IN TABLE /BIC/ADTRANGES00 IS CHAR 20.
What i want to do is Creat new field for chart of accounts in a structure in below way
DATA: BEGIN of S_RANGE,
CHRACT TYPE /BIC/ADTRANGES00-/BIC/DTSELKEY,
END oF S_RANGE.
delcare internaltable and workarea
DATA: LT_RANGE TYPE TABLE OF S_RANGE,
LS_RANGE TYPE S_RANGE.
now i wan to move CHRT_ACCTS of internal table( L_T_CHART) to CHRACT of internaltable (LT_RANGE ) and then compare with L_T_GLACNT
Please let me know if confusing. i will eloberate again
10-23-2015 2:32 PM
Hi Naiduz,
Try,
Without creating new field pass the actual field to the select query (select endselect).
Hope it helpful,
Regards,
Venkat.
10-26-2015 7:18 AM
the lengths are different to compare. first internal table has char 4 and second internal table has char 20
10-26-2015 12:07 PM
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.