‎2006 Sep 13 8:13 PM
I have an internal table with vbelns from table vbak. Now I want to go to vbpa and calculate number of partners for these sales orders with partner functions 'ME', 'BU' or 'GS'. Can you provide a sample code for this ?
Thanks a lot.
‎2006 Sep 13 8:24 PM
Hi,
Please try this.
data: l_count type i.
loop at itab.
select count(*)
into l_count
from vbpa
where vbeln = itab-vbeln
and parvw in ('ME','BU',GS').
write: / itab-vbeln, 'total records:', l_count.
endloop.Hope this will help.
Regards,
Ferry Lianto
‎2006 Sep 13 8:16 PM
select count(*) into lcnt
from vbpa
where partner function in ('ME','BU','GS')
and vbeln = itab-vblen.
‎2006 Sep 13 8:20 PM
data: v_count type i.
if not it_vbak[] is initial.
Select count(*) into v_count
from vbpa
for all entries in it_vbak
where vbeln = it_vbak-vbeln and
parvw in ('ME','BU',GS').
endif.
‎2006 Sep 13 8:22 PM
Hi Krishen,
DATA IT_VBAK TYPE STANDARD TABLE OF VBAK OCCURS 0 WITH HEADER LINE.
DATA:
BEGIN OF IT_VBPA OCCURS 0,
VBELN TYPE VBPA-VBELN,
NO_PARTNERS TYPE I,
END OF IT_VBPA.
IF IT_VBAK[] IS NOT INITIAL.
SELECT VBELN COUNT( * )
FROM VBPA
INTO TABLE IT_VBPA
FOR ALL ENTRIES IN IT_VBAK
WHERE VBELN = IT_VBAK-VBELN
AND PARVW IN ( 'ME', 'BU', 'GS' )
GROUP BY VBELN.
ENDIF.
Thanks,
Vinay
‎2006 Sep 13 8:24 PM
Hi,
Please try this.
data: l_count type i.
loop at itab.
select count(*)
into l_count
from vbpa
where vbeln = itab-vbeln
and parvw in ('ME','BU',GS').
write: / itab-vbeln, 'total records:', l_count.
endloop.Hope this will help.
Regards,
Ferry Lianto
‎2006 Sep 13 8:30 PM
Hi,
tables : vbak, vbpa.
data : begin of it_vbak occurs 0,
vbeln like vbak-vbeln,
end of it_vbak.
data : begin of it_vbpa occurs 0,
vbeln like vbpa-vbeln,
parvw like vbpa-parvw,
end of it_vbpa.
select-options : s_vbeln for vbak-vbeln.
start-of-selection.
select vbeln
from vbak
into table it_vbak
where vbeln in s_vbeln.
select vbeln
parvw
from vbpa
into table it_vbpa
for all entries in it_vbak
where vbeln = it_vbak-vbeln and
parvw in ('ME', 'BU', 'GS') .
if sy-subrc = 0.
endif.
end-of-selection.
Regards,
Azaz.