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

Selection query problem

Former Member
0 Likes
1,009

Hi Experts,

I have a select query, which yields huge amount of data. Due to its size, the internal table is not getting filled and raises some memory problem. Can I spilt that selection into multiple small selections and append it to the same internal table. If possible, how can it be done?

Thanks and regards,

Venkat...

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
982

Hi Venkat,

You can try this.

SELECT *

FROM XXXX

APPENDING TABLE ITAB PACKAGE SIZE 500.

ENDSELECT.

This query will fetch 500 records and time and add it to ITAB and proceed with fetching next 500 records.

Hope it helps.

Regards,

Komal

Edited by: Komal Lakhwani on Apr 22, 2009 10:20 AM

9 REPLIES 9
Read only

Former Member
0 Likes
982

Dear

You can do this by resticting the number of records

select *
from bseg 
where
........
...
up to 100 rows .

by this you can restrict number of rows .

rgds ankit

Read only

0 Likes
982

This will repeatedly selecting same 100 records. But the second selection should be 101-200.

Read only

0 Likes
982

Hi,

You can use this logic:

DATA: BEGIN OF ITAB OCCURS 0,
        VBELN LIKE VBAK-VBELN,
      END OF ITAB.

DATA: VAL TYPE STRING,
      N TYPE I.

SELECT VBELN FROM VBAK INTO TABLE ITAB UP TO 100 ROWS.

LOOP AT ITAB.                " First 100 records selected
  WRITE:/ ITAB-VBELN.
ENDLOOP.

DESCRIBE TABLE ITAB LINES N.

LOOP AT ITAB.              
  IF SY-TFILL = N.
    VAL = ITAB-VBELN.
  ENDIF.
ENDLOOP.

CLEAR ITAB.

*WRITE:/ VAL.

SELECT VBELN FROM VBAK INTO TABLE ITAB UP TO 100 ROWS
             WHERE VBELN GT VAL.
                                     " Next 100 records selected
LOOP AT ITAB.
  WRITE:/ ITAB-VBELN.
ENDLOOP.

thanks\

Mahesh

Read only

0 Likes
982

Hi Venkat,

You can try this.

SELECT *

FROM XXXX

APPENDING TABLE ITAB PACKAGE SIZE 500.

ENDSELECT.

This query will fetch 500 records and time and add it to ITAB and proceed with fetching next 500 records.

This should work.

Regards,

Komal

Read only

Former Member
0 Likes
982

Hi Venkat,

Can you be little more clear, from which tables are you picking the data how did you write the select statement ?

Regards

Kumar M

Edited by: Kumar M on Apr 22, 2009 6:47 AM

Read only

Former Member
0 Likes
983

Hi Venkat,

You can try this.

SELECT *

FROM XXXX

APPENDING TABLE ITAB PACKAGE SIZE 500.

ENDSELECT.

This query will fetch 500 records and time and add it to ITAB and proceed with fetching next 500 records.

Hope it helps.

Regards,

Komal

Edited by: Komal Lakhwani on Apr 22, 2009 10:20 AM

Read only

Former Member
0 Likes
982

hi,

use views it will solve u r problem it is very fast .

hope it will help u .

Read only

Former Member
0 Likes
982

create views with suitable inner joins

and after that use the view for picking the data with suitable select query.

it will increase your performance.

As for as possible try to use maximum no. of possible keys

with regards

s.janagar

Read only

digvijay_rai
Participant
0 Likes
982

HI ,

first try to search for any database view if its then use it and if not first make secondry keys of the tables you are using then make ur own custom database view .

use inner join and replace all the like sataments with the type

most important is to make the secondry keys of the table for which you are going to select .

Regards

Digvijay Rai