2010 Oct 07 9:32 AM
Hi guys,
I need help on calculating vendor balances grouped by vendor no. (lifnr) and and company code (bukrs).
Please see my code bellow... Gt_output contains all the vendor numbers that are requested and t_bsik is a table type of bsik.
LOOP AT gt_output INTO gwa_output.
LOOP AT t_bsik INTO w_bsik
WHERE lifnr = gwa_output-lifnr
AND bukrs = gwa_output-bukrs.
IF sy-subrc = 0.
AT END OF lifnr.
AT END OF bukrs.
SUM.
gwa_output-balance = w_bsik-dmbtr.
MODIFY gt_output FROM gwa_output.
ENDAT.
ENDAT.
ENDIF.
ENDLOOP.
endloop.
this code adds all the balances onto one vendor only even when the vendor numbers and company codes are different.
Please help.
2010 Oct 07 11:40 AM
Hi guys,
I need help on calculating vendor balances grouped by vendor no. (lifnr) and and company code (bukrs).
Please see my code bellow... Gt_output contains all the vendor numbers that are requested and t_bsik is a table type of bsik.
LOOP AT gt_output INTO gwa_output.
LOOP AT t_bsik INTO w_bsik
WHERE lifnr = gwa_output-lifnr
AND bukrs = gwa_output-bukrs.
IF sy-subrc = 0.
AT END OF lifnr.
AT END OF bukrs.
SUM.
gwa_output-balance = w_bsik-dmbtr.
MODIFY gt_output FROM gwa_output.
ENDAT.
ENDAT.
ENDIF.
ENDLOOP.
endloop.
this code adds all the balances onto one vendor only even when the vendor numbers and company codes are different.
Please help.
2010 Oct 07 9:34 AM
2010 Oct 07 11:11 AM
Collect statement is giving me an error because collect works only for numbers, vendor number and company code are type c.
2010 Oct 07 11:40 AM
2010 Oct 15 11:14 AM
I have tried it, but it is displaying incorrect results,
Please check my code:
LOOP AT gt_output INTO gwa_output.
LOOP AT t_bsik INTO w_bsik.
IF sy-subrc = 0.
AT END OF lifnr.
AT new bukrs.
sum.
gwa_output-pre_dmbtr = w_bsik-dmbtr.
MODIFY gt_output FROM gwa_output.
ENDAT.
ENDAT.
ENDIF.
ENDLOOP.
endloop.
2010 Dec 29 7:11 AM