‎2007 Apr 05 5:25 AM
Hi all,
can any one tell the code for joining vbap and vbpa.
i want item details from vbap based on vbpa-lifnr (broker for the sales order)
common field is vbeln. In one sale order there are no of lifnr (broker) for individual items.
i want all d items corresponding to lifnr(broker) in a sales order.
please help the same.
sure reward points sure.
Regards
Deepa
‎2007 Apr 05 5:35 AM
Hi Deepa ,
The code would look some think like this
select VBPA~LIFNR
VBAPvbeln VBAPposnr vbap~matnr <add other feilds you want.
INTO TABLE <IT>
FROM VBPA INNER JOIN VBAP
ON VBPAVBELN = VBAPVBELN
VBPAPOSNR = VBAPPOSNR
WHERE
VBPA~VBELN = <SO Number> and
VBPA~LIFNR = <Vendor>.
Regards
Arun
‎2007 Apr 05 5:35 AM
Hi Deepa ,
The code would look some think like this
select VBPA~LIFNR
VBAPvbeln VBAPposnr vbap~matnr <add other feilds you want.
INTO TABLE <IT>
FROM VBPA INNER JOIN VBAP
ON VBPAVBELN = VBAPVBELN
VBPAPOSNR = VBAPPOSNR
WHERE
VBPA~VBELN = <SO Number> and
VBPA~LIFNR = <Vendor>.
Regards
Arun
‎2007 Apr 05 5:41 AM
‎2007 Apr 05 5:39 AM
select A~field1 ... B~field2 ...
into table itab
from vbap as A inner join
vbpa as B on
A~vbeln = B~vbeln and
A~lifnr = B~lifnr
where ...<>.
‎2007 Apr 05 5:41 AM
Hi,
VBPA contains all the partners for the sales document.
select VBPA~LIFNR
VBAPvbeln VBAPposnr vbap~matnr .
INTO TABLE ITAB
FROM VBPA as a INNER JOIN VBAP as b
ON aVBELN = bVBELN
a~POSNR = '000000' (don't join POSNR's of both simply check whether the POSNR in VBPA is maintained or not , because most of the times the POSNR in VBPA is 000000)
WHERE
a~VBELN = <SO Number> and
a~LIFNR = <Vendor>.
reward if useful
regards,
Anji
‎2007 Apr 05 5:45 AM
Hi Deepa,
Here is the code....
select-options:s_lifnr for vbpa-lifnr.
data: begin of itab occurs 0,
................,
................,
end of itab.
select a~.........
a~.........
b~.........
b~.........
into corresponding fields of table itab
from vbpa as a inner join vbap as b
on alifnr = blifnr
where a~lifnr in s_lifnr.
Reward points if helpful.
Regards,
Ramana
‎2007 Apr 05 5:47 AM
Hi deepa,
Innerjoin:
select VBPA~LIFNR
VBAPvbeln VBAPposnr vbap~matnr <add other feilds you want.
INTO TABLE ><IT>
FROM VBPA INNER JOIN VBAP
ON VBPAVBELN = VBAPVBELN
VBPAPOSNR = VBAPPOSNR
WHERE
VBPA~VBELN = <SO Number> and
VBPA~LIFNR = <Vendor>.
Outer join means for all entries.
select vbeln posnr from vbap into table itab where
vbeln = p_vbeln.
if not itab[] is initial.
select lifnr from vbpa into itab1
for allentries in itab
where vbeln = itab-vbeln.
Hope this helps you, reply for queries, Shall post you the updates.
Regards.
Kumar
‎2007 Apr 05 5:49 AM
Hi Deepa
please try this.
select <items> from vbap
into corresponding fields of itab
where vbpa-vbeln = vbap-vbeln and
vbap~lifnr = <vendor>
hope this will work for u.
please reward if helpful.
regards
ravish
‎2007 Apr 06 10:32 AM
‎2007 Apr 06 10:35 AM