Application Development 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: 

BKPF amd BSEG?

Former Member
0 Kudos

Hi,

I want to join two tables BKPF and BSEG, shall i join these two tables using joins or for all entries, remember BSEG is a cluster table and BKPF is a transparent? Please give me a solution.

Regards,

MD

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

Join doesnt work on cluster table use FOR ALL ENTRIES for that

refer below code:

SELECT bukrs
zuonr
gjahr
belnr
budat
bldat
blart
shkzg
dmbtr
xref3
FROM bsis
INTO CORRESPONDING FIELDS OF TABLE it_bsis
WHERE bukrs EQ p_bukrs
AND hkont EQ p_hkont
AND blart IN s_blart
AND budat IN s_budat.

IF NOT it_bsis[] IS INITIAL.

SELECT belnr
gjahr
awkey
FROM bkpf
INTO TABLE it_bkpf
FOR ALL ENTRIES IN it_bsis
WHERE bukrs EQ it_bsis-bukrs
AND belnr EQ it_bsis-belnr
AND gjahr EQ it_bsis-gjahr.

IF sy-subrc EQ 0.
SORT it_bkpf BY belnr gjahr.
ENDIF.

ENDIF.

Regards,

VIshwa.

4 REPLIES 4

Former Member
0 Kudos

Hi,

I think there has been a lot of discussion regarding this very topic in the forum previously too

you can search for the same and you will get a lot of answers.

Regards,

Pramod

Former Member
0 Kudos

Hi

Join doesnt work on cluster table use FOR ALL ENTRIES for that

refer below code:

SELECT bukrs
zuonr
gjahr
belnr
budat
bldat
blart
shkzg
dmbtr
xref3
FROM bsis
INTO CORRESPONDING FIELDS OF TABLE it_bsis
WHERE bukrs EQ p_bukrs
AND hkont EQ p_hkont
AND blart IN s_blart
AND budat IN s_budat.

IF NOT it_bsis[] IS INITIAL.

SELECT belnr
gjahr
awkey
FROM bkpf
INTO TABLE it_bkpf
FOR ALL ENTRIES IN it_bsis
WHERE bukrs EQ it_bsis-bukrs
AND belnr EQ it_bsis-belnr
AND gjahr EQ it_bsis-gjahr.

IF sy-subrc EQ 0.
SORT it_bkpf BY belnr gjahr.
ENDIF.

ENDIF.

Regards,

VIshwa.

Former Member
0 Kudos

You cannot use JOIN on cluster table.

Try other alternative of BSEG.

BSID Accounting: Secondary Index for Customers(Open Items)

BSIK Accounting: Secondary Index for Vendors

BSIM Secondary Index, Documents for Material

BSIS Accounting: Secondary Index for G/L Accounts

BSAD Accounting: Secondary Index for Customers(Cleared Items)

BSAK Accounting: Secondary Index for Vendors(Cleared Items)

BSAS Accounting: Secondary Index for G/L Accounts(Cleared Items)

Edited by: Swastik Bharati on Oct 15, 2008 1:13 PM

Former Member
0 Kudos

hi..

check this thread..

it has all the view names u have asked for...!

[Thread|]

regards,

Padma