cancel
Showing results for 
Search instead for 
Did you mean: 

Performance issue

Former Member
0 Kudos

hi all Performance issue

SELECT VBRP~VBELN

VBRP~POSNR

VBRP~AUBEL

VBRP~AUPOS

VBRP~FKIMG " VBRP

VBRK~FKDAT " VBRK

INTO TABLE T_VBRK

FROM VBRP

INNER JOIN VBRK ON VBRKVBELN = VBRPVBELN

WHERE VBRK~VBELN IN S_VBELN AND -


> this is always BLANK

VBRK~FKART NOT IN R_FKART AND

VBRK~FKDAT IN S_FKDAT AND

VBRK~SPART IN S_SPART AND

VBRP~AUBEL IN S_KDAUF. -


> this is always BLANK

Due to the ABAOVE the below statement is taking many hours to execute

SELECT BUKRS

BELNR

GJAHR

AWKEY

INTO TABLE T_SVBKPF

FROM BKPF

FOR ALL ENTRIES IN T_VBRK

WHERE BUKRS IN S_BUKRS AND

BUDAT = T_VBRK-FKDAT AND

AWKEY = T_VBRK-AWKEY.

-


1) Is S_VBELN needed as we can vet vbeln based on VBRK~FKDAT.

Regards

babu

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello

Modify following query:

SELECT BUKRS

BELNR

GJAHR

AWKEY

INTO TABLE T_SVBKPF

FROM BKPF

FOR ALL ENTRIES IN T_VBRK

WHERE BUKRS IN S_BUKRS AND

BUDAT = T_VBRK-FKDAT AND

AWKEY = T_VBRK-AWKEY.

To

SELECT BUKRS

BELNR

GJAHR

AWKEY

INTO TABLE T_SVBKPF

FROM BKPF

FOR ALL ENTRIES IN T_VBRK

WHERE AWTYP IN GR_AWTYP AND

AWKEY = T_VBRK-AWKEY AND

AWSYS IN GR_AWSYS AND

BUKRS IN S_BUKRS AND

BUDAT = T_VBRK-FKDAT.

Here AWTYP, AWKEY, AWSYS will use the Index which will make query to run faster.

Thanks

Amol Lohade

Former Member
0 Kudos

Hi Babu,

You are facing this issue because in table VBRK the only key field is VBELN and in your selection query s_vbeln is always blank. If you want to have better performance then I think you need to create an index on table VBRK. You can include FKART and FKDAT in your index.

Regards,

Sanjay

valter_oliveira
Active Contributor
0 Kudos

To access BKPF you should use one of it's secondary indexes. Since you are using budat and awkey, some fields are missing here:

1 - AWTYP for index 4: AWTYP - AWKEY - AWSYS OR

2 - BSTAT for index 2: BUKRS - BSTAT - BUDAT.

If s_vbeln is always blank, you can remove it from select. But, why is it always blank?

Regards,

Valter Oliveira.