‎2006 Dec 07 9:02 AM
hi friends,
can we write iner join on tables MSEG and BSEG tables
regards,
malleswari.
‎2006 Dec 07 9:04 AM
Hi
MSEG you can write Inner Join but BSEG you can not as it is Cluster table in Newer Version.
Regards
Nimesh Patel.
‎2006 Dec 07 9:05 AM
Hi malleswari,
1. BSEG - Not (bcos its a cluster table)
2. MSEG - Yes (bcos its a normal transparent table)
3. For BSEG,
if we want to use inner join concept,
then instead we should use FOR ALL ENTRIES.
eg. First we gather main data from BKPF,
then we gather data from BSEG in ANOTHER INTERNAL TABLE,
and there we use FOR ALL ENTRIES concept.
regards,
amit m.
‎2006 Dec 07 9:05 AM
Hi,
No, i dont think so,
MSEG is a transparent table
whereas BSEG is a cluster table.
Regards,
pankaj singh
‎2006 Dec 07 9:07 AM
fetch the data from the VBRK and VBRP tables
select vbrk~vbeln
vbrp~posnr
vbrk~fkart
vbrk~ktgrd
vbrp~oipbl
vbrp~matkl
vbrp~volum
vbrp~netwr
vbrp~voleh
vbrk~waerk
into table it_bill1
from vbrk
inner join vbrp
on vbrkvbeln = vbrpvbeln
where vbrk~fkart in s_fkart and
vbrk~vkorg in s_vkorg and
vbrk~spart in s_spart and
vbrk~fkdat in s_fkdat and
vbrp~matkl in s_matkl and
vbrp~oipbl in s_oipbl.
*----
OR
select a~vbeln
b~posnr
a~fkart
a~ktgrd
a~oipbl
b~matkl
b~volum
b~netwr
b~voleh
a~waerk
into table it_bill1
from vbrk as a
inner join vbrp as b
on avbeln = bvbeln
where a~fkart in s_fkart and
a~vkorg in s_vkorg and
a~spart in s_spart and
a~fkdat in s_fkdat and
b~matkl in s_matkl. " and
b~oipbl in s_oipbl.
‎2006 Dec 07 9:07 AM
You cannot write join for cluster tables like BSEG..Instead you can use FOR ALL ENTRIES options..
EX..
DATA: T_BKPF TYPE STANDARD TABLE OF BKPF,
T_BSEG TYPE STANDARD TABLE OF BSEG.
SELECT * FROM BKPF
INTO TABLE T_BKPF
WHERE....
IF NOT T_BKPF IS INITIAL.
SELECT * FROM BSEG
INTO TABLE T_BSEG
FOR ALL ENTRIES IN T_BKPF
WHERE BUKRS = T_BKPF-BUKRS
AND BELNR = T_BKPF-BELNR
AND GJAHR = T_BKPF-GJAHR..
ENDIF.