Skip to Content
0

Improve selection for AVL report

Sep 06, 2017 at 04:14 PM

48

avatar image

I'm attempting to improve the performance of my data selection for a report. Any suggestions?

  SELECT  vbak~vbeln

          vbak~vkbur

          vbak~vkgrp

          vbak~kunnr

          vbak~kunnr

          vbak~bstnk

          vbak~kvgr3

          vbap~matnr

          vbap~arktx

          vbap~zmeng

          vbak~guebg

          vbak~gueen

          vbap~netwr

          vbak~angdt

          vbak~bnddt

          vbap~waerk

          vbap~posnr

          vbak~knumv

          knvv~ernam



    INTO CORRESPONDING FIELDS OF wa_data

    FROM vbak

      JOIN vbap ON vbak~vbeln EQ vbap~vbeln

      JOIN knvv  ON vbak~kunnr EQ knvv~kunnr

*    UP TO 500 ROWS

    WHERE vbak~vbeln IN s_vbeln AND

          vbak~vkbur IN s_vkbur AND

          vbak~vkgrp IN s_vkgrp AND

          knvv~ernam IN s_ernam AND

          vbak~erdat IN s_erdat AND

          vbak~bstnk IN s_bstnk AND

          vbak~kunnr IN s_soldto AND

          vbak~gueen IN s_gueen AND

          vbak~guebg IN s_guebg.



    SELECT SINGLE kbetr

      FROM konv

      INTO wa_data-kbetr_zb

      WHERE knumv = wa_data-knumv

        AND kschl = 'ZBID'

        AND kposn = wa_data-posnr.



    SELECT SINGLE kbetr

      FROM konv

      INTO wa_data-kbetr_pr

      WHERE knumv = wa_data-knumv

        AND kschl = 'PR00'

        AND kposn = wa_data-posnr.



    SELECT SINGLE bezei

      FROM tvkbt

      INTO wa_data-bezei_so

      WHERE vkbur = wa_data-vkbur.



    SELECT SINGLE bezei

      FROM tvgrt

      INTO wa_data-bezei_sg

      WHERE vkgrp = wa_data-vkgrp.



    SELECT SINGLE name1

      FROM kna1

      INTO wa_data-name1_st

      WHERE kunnr = wa_data-kunnr.



    SELECT SINGLE kunnr

      FROM vbpa

      INTO wa_data-kunnr_eu

      WHERE vbeln = wa_data-vbeln

        AND parvw = 'EN'.



    SELECT SINGLE name1

      FROM kna1

      INTO wa_data-name1_eu

      WHERE kunnr = wa_data-kunnr_eu.



    SELECT SINGLE bezei

      FROM tvv3t

      INTO wa_data-bezei_ps

      WHERE kvgr3 = wa_data-kvgr3.



    APPEND wa_data TO it_data.



  ENDSELECT.
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Nic Teunckens Sep 09, 2017 at 11:27 PM
0
  • Check Other VBAK / VBAP - Related Posts in the SAP Community in previous years, they are numerous and will present some Refactoring options ...
  • Do your Checks via Trx."SAT" (ABAP Trace) and "ST05" (SQL Trace)
  • Check the use of Indexes on the main Tables ...
  • Check if you can make use of DB-Views or SD IndexTables ...


There used to be an Accessible SAP-KBA 185530 on "Customer Developments in SD" (it is no longer reachable in SAP ONE Support?), but it is also mentioned on the web : link.

Share
10 |10000 characters needed characters left characters exceeded