10-15-2008 12:08 PM
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
10-15-2008 12:12 PM
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.
10-15-2008 12:10 PM
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
10-15-2008 12:12 PM
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.
10-15-2008 12:13 PM
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
10-15-2008 12:20 PM