‎2008 Jan 16 1:02 PM
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.
‎2008 Jan 16 1:04 PM
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.
‎2008 Jan 16 1:05 PM
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
‎2008 Jan 16 1:09 PM
‎2008 Jan 16 1:58 PM
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.
‎2008 Jan 16 2:25 PM
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
‎2008 Jan 16 2:38 PM
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.
‎2008 Jan 16 2:52 PM
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
‎2008 Jan 16 3:02 PM
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.
‎2008 Jan 16 3:07 PM
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.
‎2008 Jan 17 7:17 AM
Good morning all,
Martin I did not understand your answer.
Please clarify what you meant.
Thanks.