2009 Nov 26 8:43 AM - last edited on 2024 Feb 04 3:36 AM by postmig_api_4
hi guriji,
i have writeen one query .
loop at itab.
read table itab2 with key kostl = itab-fictr
hkont = itab-acc_code .
kostl1 = itab2-kostl+6(4).
hkont1 = itab2-hkont+4(6).
if kostl1 = itab-fictr and hkont1 = itab-acc_code.
itab-dmbtr = itab2-dmbtr.
modify itab transporting dmbtr .
clear itab-fictr.
clear itab-acc_code.
clear itab2-dmbtr.
clear itab-dmbtr.
clear kostl1.
clear hkont1.
endif.
when the read statement execute it reads only 2nd line value of itab2. but according to read statement reads whole internal table value.
plz tell me .
thanks.
2009 Nov 26 8:48 AM
>
> loop at itab. "" dont use header line table,,use work area..
> read table itab2 with key kostl = itab-fictr
> hkont = itab-acc_code .
>check sy-subrc eq 0. ""<< add this
> kostl1 = itab2-kostl+6(4).
> hkont1 = itab2-hkont+4(6).
> if kostl1 = itab-fictr and hkont1 = itab-acc_code.
> itab-dmbtr = itab2-dmbtr.
> modify itab transporting dmbtr .
> clear itab-fictr.
> clear itab-acc_code.
> clear itab2-dmbtr.
> clear itab-dmbtr.
> clear kostl1.
> clear hkont1.
> endif.
> thanks.
hi guriji,
i have writeen one query .
loop at itab.
read table itab2 with key kostl = itab-fictr
hkont = itab-acc_code .
kostl1 = itab2-kostl+6(4).
hkont1 = itab2-hkont+4(6).
if kostl1 = itab-fictr and hkont1 = itab-acc_code.
itab-dmbtr = itab2-dmbtr.
modify itab transporting dmbtr .
clear itab-fictr.
clear itab-acc_code.
clear itab2-dmbtr.
clear itab-dmbtr.
clear kostl1.
clear hkont1.
endif.
when the read statement execute it reads only 2nd line value of itab2. but according to read statement reads whole internal table value.
plz tell me .
thanks.
2009 Nov 26 8:46 AM
Debugging the code will answer your question.
pk
2009 Nov 26 8:47 AM
Hi Sachin,
The READ statement reads based on whatever you have given in the KEY statement.
It means it reads only thos records which satisfies the values of ITAB-FICTR.
Dont know what your requirement is.
Regards
Abhii
2009 Nov 26 8:48 AM
>
> loop at itab. "" dont use header line table,,use work area..
> read table itab2 with key kostl = itab-fictr
> hkont = itab-acc_code .
>check sy-subrc eq 0. ""<< add this
> kostl1 = itab2-kostl+6(4).
> hkont1 = itab2-hkont+4(6).
> if kostl1 = itab-fictr and hkont1 = itab-acc_code.
> itab-dmbtr = itab2-dmbtr.
> modify itab transporting dmbtr .
> clear itab-fictr.
> clear itab-acc_code.
> clear itab2-dmbtr.
> clear itab-dmbtr.
> clear kostl1.
> clear hkont1.
> endif.
> thanks.
2009 Nov 26 8:52 AM
Hello Sachin,
When in doubt use the philanthropic F1 key. It offers a much faster & more reliable answers than us mortals on SDN.
Cheers,
Suhas
2009 Nov 26 9:23 AM
Hi,
From F1 help of read statement:
If the row to be read is not uniquely specified, the first suitable row is read. In the case of index tables, this row has the lowest table index of all matching rows.
Regards,
Swarna Munukoti
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |