Application Development and Automation 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: 
Read only

inner join

Former Member
0 Likes
548

hi friends,

can we write iner join on tables MSEG and BSEG tables

regards,

malleswari.

5 REPLIES 5
Read only

Former Member
0 Likes
513

Hi

MSEG you can write Inner Join but BSEG you can not as it is Cluster table in Newer Version.

Regards

Nimesh Patel.

Read only

Former Member
0 Likes
513

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.

Read only

Former Member
0 Likes
513

Hi,

No, i dont think so,

MSEG is a transparent table

whereas BSEG is a cluster table.

Regards,

pankaj singh

Read only

Former Member
0 Likes
513

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.

Read only

Former Member
0 Likes
513
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.