Skip to Content
author's profile photo
Former Member

performance issue table vbrp

Hi experts

I have writen a select query in z program but i am getting the prformance issue. The program is taking more than 40 min when execute the below select query. could anyone please give me the idea how to resolve this performance issue. can i replace with view.

select  vbrp~vbeln
            vbrp~posnr
           vbrk~fkdat
           vbrk~fksto
           vbrk~vbtyp
           vbrk~rfbsk
            vbrp~matnr
           vbrp~fkimg
           vbrp~werks
            vbrp~shkzg
     into table it_billcom
     from vbrk inner join vbrp "wb2_v_vbrk_vbrp2
      on vbrk~vbeln eq vbrp~vbeln
      for all entries in it_alv_output
        where vbrp~vbeln eq vbrk~vbeln

with regards

chandan_vigi

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    author's profile photo
    Former Member
    Posted on May 06, 2011 at 05:45 AM

    Hi Chandan,

    I see that the ON CLAUSE and the WHERE CLAUSE are the same, since you are using FOR ALL ENTRIES against IT_ALV_OUTPUT, i presume that your SELECT WHERE CLAUSE must be more like VBRK~VBELN EQ IT_ALV_OUTPUT-VBELN?

    Also, it is better to have a check if IT_ALV_OUTPUT is not initial before the WHERE CLAUSE.

    Regards,

    Chen

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Chandan,

      >

      > I see that the ON CLAUSE and the WHERE CLAUSE are the same, since you are using FOR ALL ENTRIES against IT_ALV_OUTPUT, i presume that your SELECT WHERE CLAUSE must be more like VBRK~VBELN EQ IT_ALV_OUTPUT-VBELN?

      >

      > Also, it is better to have a check if IT_ALV_OUTPUT is not initial before the WHERE CLAUSE.

      >

      > Regards,

      > Chen

      Chen is absolutely right. I would just fix his last sentence:

      "it is necessary to have a check if IT_ALV_OUTPUT is not initial before the SELECT statement".

  • Posted on May 06, 2011 at 11:00 AM

    Hi,

    1. In you SQL Where clause has not written correctly or incomplete.

    2. Why are you using the join and for all entries togather ?

    first used the for all entries on table vbrk using internal table it_alv_output

    2nd used the for all entries on table vbrp using data read in table step 1.

    Don't forget to check driver table internal table is not initial while apply the for all entries

    Kind Rgds

    Ravi Lanjewar

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on May 06, 2011 at 12:18 PM

    Hi,

    1. correct your code as Chen KV suggested.

    2. Dont use join or use item table(VBRP) in left side. ref below statment

    select vbrp~vbeln

    vbrp~posnr

    vbrk~fkdat

    vbrk~fksto

    vbrk~vbtyp

    vbrk~rfbsk

    vbrp~matnr

    vbrp~fkimg

    vbrp~werks

    vbrp~shkzg

    into table it_billcom

    from vbrp inner join vbrk

    on vbrkvbeln eq vbrpvbeln

    Add comment
    10|10000 characters needed characters exceeded