Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem in Select Query

Former Member
0 Likes
1,589

Hi All ,

Can anybody tell me what is wrong in below query ?

Im getting performance issue in the below Query ....

When im trying to execute the code program is going to dump

>>>>>       Select PARTNER

  356        RLTYP

  357       FROM BUT100 INTO TABLE IT_BUT100

  358       for all entries in t_but020

  359       WHERE partner eq t_but020-partner

  360       and RLTYP = ''

  361       OR RLTYP = 'BUP001' .

Error in Dump : You attempted to extend an internal table, but the required space was not available.

Thanks in advance

Smitha

1 ACCEPTED SOLUTION
Read only

arivazhagan_sivasamy
Active Contributor
0 Likes
1,517

Hi Sumitha,

Please use like below.

Select PARTNER

  356        RLTYP

  357       FROM BUT100 INTO TABLE IT_BUT100

  358       for all entries in t_but020

  359       WHERE partner eq t_but020-partner

  360       and RLTYP IN ('', 'BUP001' ).

Arivazhagan S

12 REPLIES 12
Read only

arivazhagan_sivasamy
Active Contributor
0 Likes
1,518

Hi Sumitha,

Please use like below.

Select PARTNER

  356        RLTYP

  357       FROM BUT100 INTO TABLE IT_BUT100

  358       for all entries in t_but020

  359       WHERE partner eq t_but020-partner

  360       and RLTYP IN ('', 'BUP001' ).

Arivazhagan S

Read only

0 Likes
1,517

Use the addition into corresponding fields of

Select PARTNER

  356        RLTYP

  357       FROM BUT100 INTO CORRESPONDING FIELDS OF TABLE IT_BUT100

  358       for all entries in t_but020

  359       WHERE partner eq t_but020-partner

  360       and RLTYP = ''

  361       OR RLTYP = 'BUP001' .

Read only

Arun_Prabhu_K
Active Contributor
0 Likes
1,517

Hello Smitha KB.

     You have to put the OR condition within brackets.

     Like,   

          and ( RLTYP = ' ' OR RLTYP = 'BUP001' ).


     Your current code will fetch all data which satisfies

     EITHER

          partner = t_but020-partner and RLTYP = ' '

     OR

          RLTYP = 'BUP001'.  

     This is the reason for error.

Regards

Read only

Former Member
0 Likes
1,517

Check your internal table declaration..

create a structure with required fields (PARTNER, RLTYP) & after that create an internal table of that structure type.

Read only

former_member226419
Contributor
0 Likes
1,517

Can you tell me how many records you are getting for this condition? Seems that no of records are too much..

Read only

0 Likes
1,517

Hi Sumeet ,

Thanks for the reply .....

Yes number of records are more in the internal table im trying to extract records around 2 Lacks ....

Can you please let me know how to improve the performance for this issue ?

Read only

former_member188282
Active Participant
0 Likes
1,517

Hi Smitha,

Can you please check how you declared your internal table IT_BUT100.


Regards,

Rajesh.B

Read only

0 Likes
1,517

My internal table declaration

data: begin of it_but100 occurs 0,

PARTNER like BUT100-PARTNER,

RLTYP like BUT100-RLTYP,

end of it_but100.

Read only

0 Likes
1,517

Do not use occurs 0...

Create a structure & internal table.

TYPES: BEGIN OF ty_struct,

         partner TYPE bu_partner,

          rltyp TYPE bu_partnerrole,

        END OF ty_struct.

DATA : it_but100 TYPE STANDARD TABLE OF ty_struct.

Read only

0 Likes
1,517

Hi-

check the NOT t_but020[] IS INITIAL

Please check the below code, it should not give you dump.

   DATA: BEGIN OF t_but020 OCCURS 0,

partner LIKE but100-partner,

END OF t_but020.

DATA: BEGIN OF it_but100 OCCURS 0,

partner LIKE but100-partner,

rltyp LIKE but100-rltyp,

END OF it_but100.

IF NOT t_but020[] IS INITIAL.

  SELECT partner
          rltyp

        FROM but100 INTO TABLE it_but100

         FOR ALL ENTRIES IN t_but020

        WHERE partner EQ t_but020-partner

        AND  ( rltyp = ' ' OR rltyp = 'BUP001' ).

  IF sy-subrc = 0.

  ENDIF.

ENDIF.

Let us know, in case it helps.

Regards,

Atul Mohanty

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,517

Your program reached the maximal memory allowed in your system. Try to remove unnecessary fields in the internal table, or contact system administrators. (20527 - Runtime error TSV_TNEW_PAGE_ALLOC_FAILED and similar notes for more information)

Also, never forget to check that t_but020[] is not initial, as if the internal table used in FOR ALL ENTRIES condition is empty, the whole WHERE clause is ignored, so you try to load the whole database table in memory.

Regards,

Raymond

Read only

Former Member
0 Likes
1,517

Hi smitha,

Are you checking the table entries before using for all entries.

i.e, if t_but020[] is not initial .

Select PARTNER

  356        RLTYP

  357       FROM BUT100 INTO TABLE IT_BUT100

  358       for all entries in t_but020

  359       WHERE partner eq t_but020-partner

  360       and RLTYP = ''

  361       OR RLTYP = 'BUP001' .

      endif.

Regards,

Mahesh Somanath.