Skip to Content
0
Former Member
Mar 07, 2009 at 04:59 AM

List Report ( Join Query )

42 Views

I am developing list report and in that i have to use approximately 8-9 inner joins and according to SAP we can use only 2-3 joins so is there any alternative of fetching data from multiple table without effecting performance, i am listing my query below for proper understanding of the situation.

SELECT  vbrk~vbeln vbrk~kunag vbrk~vtweg vbrk~vkorg
          vbrp~fkimg vbrp~matnr vbrp~werks vbrp~vkbur
          j_1iexchdr~exnum j_1iexchdr~exdat
          kna1~stceg kna1~name1 kna1~regio
          t005u~bezei
          adrc~street adrc~str_suppl1 adrc~str_suppl2
          t023t~wgbez
          likp~traid
          zmm_deliv_badi~lr_number zmm_deliv_badi~lr_date zmm_deliv_badi~manual_no
          zmm_deliv_badi~curr_num zmm_deliv_badi~manual_no1 zmm_deliv_badi~curr_num1
          mara~spart
     FROM vbrk INNER JOIN vbrp       ON vbrp~vbeln = vbrk~vbeln
               INNER JOIN j_1iexchdr ON j_1iexchdr~rdoc = vbrk~vbeln
               INNER JOIN kna1       ON kna1~kunnr = vbrk~kunag
               INNER JOIN t005u      ON t005u~bland = kna1~regio
                                         AND t005u~spras = 'EN'
                                         AND t005u~land1 = 'IN'
               INNER JOIN adrc       ON adrc~addrnumber = kna1~adrnr
               INNER JOIN t023t      ON  t023t~matkl = vbrp~matkl
               INNER JOIN likp       ON  likp~vbeln =  vbrp~vgbel
               INNER JOIN zmm_deliv_badi ON zmm_deliv_badi~vbeln =  vbrp~vgbel
               INNER JOIN mara           ON mara~matnr =  vbrp~matnr
          INTO CORRESPONDING FIELDS OF TABLE lit_st
     WHERE vbrk~vtweg IN ('03','04','06')
       AND vbrk~fkdat IN so_date
       AND vbrp~werks IN p_werks
       AND j_1iexchdr~status = 'C'
       AND vbrk~vkorg IN p_vkorg
       AND vbrk~kunag NOT IN ('0000001130','0000001150','0000001220','0000001240').

What is the other alternative of apart from using joins , making views is not the solution as it will increase database objects and it is also not recommended and ranges and for all entries in will also decrease performance and for that we have to make lots of temporary objects

So , please advice.

Thanks .

Ankesh Jindal