Skip to Content

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

Vbrk and Vbrp tables performance problem

Hi all,

The below query is taking lot of time in QAS i need to decrease the time without affecting the logic.....

SELECT vbrk~kunag

vbkd~bstkd

vbkd~bstdk

INTO TABLE c_tab_po FROM vbrp

INNER JOIN vbrk ON vbrkmandt = vbrpmandt AND vbrk~vbeln =

vbrp~vbeln

INNER JOIN vbkd ON vbkdmandt = vbrpmandt AND vbkd~vbeln =

vbrp~aubel

AND vbkd~posnr = con_zposnr

WHERE vbrp~vbeln EQ nast-objky.

DELETE ADJACENT DUPLICATES FROM c_tab_po COMPARING ALL FIELDS.

*Getting the other Invoices based on the customer PO number

IF c_tab_po[] IS NOT INITIAL.

SELECT

vbrk~kunag

vbkd~bstkd

vbkd~bstdk

vbkdposex_e vbrkvkorg

vbrpvbeln vbrpposnr vbrp~erdat

vbpakunnr vbrpaubel vbrpaupos vbakerdat

vbrpmatnr vbrkmwsbk vbrp~netwr

vbrkvaldt vbrkzterm vbrk~vbtyp

INTO TABLE g_tab_invoice FROM vbrp

INNER JOIN vbrk ON vbrkmandt = vbrpmandt AND vbrk~vbeln =

vbrp~vbeln

INNER JOIN vbkd ON vbkdmandt = vbrpmandt AND vbkd~vbeln =

vbrp~aubel

AND vbkd~posnr = con_zposnr

INNER JOIN vbpa ON vbpamandt = vbrpmandt AND vbpa~vbeln =

vbrp~aubel

AND vbpaposnr = con_zposnr AND vbpaparvw =

con_parvw

INNER JOIN vbak ON vbakmandt = vbakmandt AND vbak~vbeln =

vbrp~aubel

FOR ALL entries IN c_tab_po

WHERE vbrk~kunag EQ c_tab_po-kunag AND

vbkd~bstkd EQ c_tab_po-bstkd AND

vbkd~bstdk EQ c_tab_po-bstdk.

ENDIF.

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