Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

append itab1 and itab2 into itab3

Former Member
0 Kudos
102

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
77

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.

3 REPLIES 3

Former Member
0 Kudos
78

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.

Former Member
0 Kudos
77

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

Former Member
0 Kudos
77

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