2008 Mar 23 10:10 AM
hi,
is this coding correct?
loop at gt_bkpf into wa_bkpf.
read table gt_bseg into wa_bseg with key bukrs = wa_bkpf-bukrs .
if sy-subrc = 0.
MOVE : wa_bkpf-bukrs TO wa_item-bukrs,
wa_bkpf-belnr TO wa_item-belnr,
wa_bkpf-budat TO wa_item-budat,
wa_bseg-wrbtr to wa_item-wrbtr.
append wa_item to gt_item.
endif.
endloop.
loop at gt_item into wa_item.
write:/ wa_item-bukrs , wa_item-belnr, wa_item-wrbtr .
endloop.
2008 Mar 23 10:22 AM
HI
loop at gt_bkpf into wa_bkpf.
MOVE : wa_bkpf-bukrs TO wa_item-bukrs,
wa_bkpf-belnr TO wa_item-belnr,
wa_bkpf-budat TO wa_item-budat.
read table gt_bseg into wa_bseg with key bukrs = wa_bkpf-bukrs .
if sy-subrc = 0.
move wa_bseg-wrbtr to wa_item-wrbtr.
endif.
append wa_item to gt_item.
endloop.
If you write like this then even though the read fails the data comes into gt_item. and also one thing. for reading bseg you have to take all the common fields of bseg and bkpf.
Reward.
2008 Mar 23 10:22 AM
HI
loop at gt_bkpf into wa_bkpf.
MOVE : wa_bkpf-bukrs TO wa_item-bukrs,
wa_bkpf-belnr TO wa_item-belnr,
wa_bkpf-budat TO wa_item-budat.
read table gt_bseg into wa_bseg with key bukrs = wa_bkpf-bukrs .
if sy-subrc = 0.
move wa_bseg-wrbtr to wa_item-wrbtr.
endif.
append wa_item to gt_item.
endloop.
If you write like this then even though the read fails the data comes into gt_item. and also one thing. for reading bseg you have to take all the common fields of bseg and bkpf.
Reward.
2008 Mar 23 10:24 AM
Hello Santosini,
your coding seems correct
instead of Move statement,
MOVE : wa_bkpf-bukrs TO wa_item-bukrs,
wa_bkpf-belnr TO wa_item-belnr,
wa_bkpf-budat TO wa_item-budat,
wa_bseg-wrbtr to wa_item-wrbtr.
use like this
wa_item-bukrs = wa_bkpf-bukrs,
wa_item-belnr = wa_bkpf-belnr,
....
Thanks
2008 Mar 23 10:32 AM
Ur coding is extremely correct and there is no issues regarding this.
So go ahead.
Small Note for u -
Don't forgot to clear the workareas before end of loop
Edited by: Angi Reddy Somala on Mar 23, 2008 11:32 AM