Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

What is the Difference?

Hello All,

I had a select statement like this.

OPTION 1:

SELECT

vbak~kunnr

vbak~vbeln

vbak~ernam

vbak~autlf

vbak~lifsk

vbap~posnr AS posnv

vbap~posnr AS posnn

vbap~matnr

vbap~pstyv

vbap~prodh

vbap~werks

vbap~abgru

vbap~fixmg

vbap~kwmeng

vbuk~gbstk

INTO TABLE g_t_nso_sales

FROM vbak

INNER JOIN vbap

ON vbakvbeln = vbapvbeln "AND

INNER JOIN vbuk

ON vbakvbeln = vbukvbeln

WHERE vbak~kunnr IN s_kunnr AND

vbak~vbeln IN s_vbeln AND

vbak~auart = v_auart AND

vbak~vkorg = v_vkorg AND

vbak~ernam IN r_uname AND

vbak~audat IN s_audat AND

vbap~vbeln in s_vbeln AND

vbap~pstyv IN s_pstyv AND

vbap~werks IN s_werks AND

vbuk~vbeln in s_vbeln and

vbuk~gbstk IN r_gbstk.

we had issues with this select in terms of performance.

it was changed to following.

SELECT vbak~kunnr

vbak~vbeln

vbak~ernam

vbakautlf vbaklifsk vbap~posnr AS posnv

vbap~posnr AS posnn

vbap~matnr

vbap~pstyv

vbap~prodh

vbap~werks

vbap~abgru

vbap~fixmg

vbap~kwmeng

vbuk~gbstk

vbak~bstnk

INTO TABLE g_t_nso_sales

FROM vbak

INNER JOIN vbap

ON vbakvbeln = vbapvbeln "AND

INNER JOIN vbuk

ON vbakvbeln = vbukvbeln

WHERE vbak~kunnr IN s_kunnr AND

vbak~vbeln IN s_vbeln AND

vbak~auart = v_auart AND

vbak~vkorg = v_vkorg AND

vbak~ernam IN r_uname AND

vbak~audat IN s_audat AND

vbak~bstnk IN s_bstkd AND

vbap~pstyv IN s_pstyv AND

vbuk~gbstk IN r_gbstk.

As you can see the only difference is removing ,

vbuk~vbeln in s_vbeln

vbap~vbeln in s_vbeln from where conditions.

It has improved performance, but at the cost of not fectghing few records.

Query 1 fetched 5K records, where later picked only 3,500

records.

I count really understand the difference in queries.

am sure am missing something ova here, can some pl help me to understand this.

Rgds,

รถ

Tags:
Not what you were looking for? View more on this topic or Ask a question