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

Performance issue

Former Member
0 Likes
979

Hi all,

As you know, when we want to display a table data >> go to se16 and enter table name, at the bottom of the selection criteria screen, there is a box of which text says: Maximum no. of hits...

What I want is like this, max number of hits but for my own reports.

How can I restrict the number of selected entries, by number criterion as well as selection criterion, that is just user says me that he wants to display just 200 of records according to a criteria even if there are many records.

Is this possible? I will use it to decrease the response time.

Thanks.

10 REPLIES 10
Read only

Former Member
0 Likes
954

use package size addition in select to restrict no. of records

This option can be use to Restrict the Number of rows fetched from database in a Single access especially while fetching large number of records into internal table.

this can improve the performance.

SELECT * FROM <DBTABLE> APPENDING TABLE <ITAB> PACKAGE SIZE 1000.

SELECT * INTO TABLE itab PACKAGE SIZE 20 FROM scarr.

LOOP AT itab ASSIGNING <FS>.

WRITE: / <FS>-carrid, <FS>-carrname.

ENDLOOP.

ENDSELECT.

Read only

JozsefSzikszai
Active Contributor
0 Likes
955

hi Deniz,

you can use:

SELECT ... UP TO n ROWS ...

not more than n records will be selected this way. You can place n as PARAMETER on the selection screen.

hope this helps

ec

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
955

You might want to try using the UP TO <number> ROWS extension of the SELECT statement.



data: lv_records type i value '200'.

Select * into table itab up to lv_records rows.

Regards,

Rich Heilman

Read only

0 Likes
955

Thanks Rich and all,

I got my answer, however there is another need that when the data is displayed at a number specified by user, can I say that this is not the all data, there is also n number of the rest of data.

And is this possible to display the rest of the records by clicking a button set on application toolbar.

That is, at first selection, n number of records displayed and the rest (whatever the rest) is displayed when a button is displayed.

I will reward answers.

Thanks.

Read only

0 Likes
955

Try:

REPORT ztest LINE-SIZE 80 MESSAGE-ID 00.

TABLES bkpf.

PARAMETERS: p_bukrs LIKE bkpf-bukrs,
            p_count TYPE i DEFAULT 500.
DATA:       count_rec TYPE i.

SELECT COUNT( * )
  FROM bkpf
  INTO count_rec
  WHERE bukrs = p_bukrs.

SELECT *
  FROM bkpf
  UP TO p_count ROWS
  WHERE bukrs = p_bukrs.

  WRITE: /001 bkpf-belnr.

ENDSELECT.

SKIP 1.

IF count_rec <= p_count.
  WRITE: /001 count_rec, 'of', count_rec, 'rows selected'.
ELSE.
  WRITE: /001 p_count, 'of', count_rec, 'rows selected'.
ENDIF.

Rob

Read only

0 Likes
955

Hi Rob Burbank,

This algorithm is good, thanks,

just last one thing I want is that:

How can I select the records from the last record selected at first, when p_count is 500, up to count_rec.

This range will be showed at a screen as the rest of data.

Is there anything something like following at select:

SELECT *

FROM bkpf

from rows n UP TO p_count ROWS

WHERE bukrs = p_bukrs.

Thanks.

Read only

0 Likes
955

Deniz - it would really help if you would give all your requirements up front rather than coming back with additions. In this case, the new requirement will affect how you you will approach the problem from the start.

I think someone else mentioned PACKAGE SIZE. You can probably use that to select your first set of rows and then the subsequent ones.

Rob

Read only

0 Likes
955

Thanks again,

What I want is that:

One of the reports at my company needs a long time to display the data, about 20 minutes, instead of waiting a long time, I want to display it partially. At first screen the user sets a number about how many of records to display at first screen.

When this first display is realized, another thing is to show the rest of the data that has not been displayed due to the number criterion. For joins it could not be possible to say retrieve records after (for instance) 500 records I think, but I hope that may be a solution.

Hope clear this time.

Thanks again.

Read only

0 Likes
955

I presume a trace has been placed on the program to see where the performance issues occur and been resolved. The reason it now takes 20 minutes to run it down to the sheer amount of data being processed.

Read only

0 Likes
955

Good morning all,

Martin I did not understand your answer.

Please clarify what you meant.

Thanks.