2005 Oct 10 3:56 PM
Hi,
I've written an abap program using the logical database PNP to select the employees record using the statement 'Get pernr'. I would like to know if there are ways to get the total number of records that can be selected.
Thanks,
Francis
2005 Oct 10 4:39 PM
Thats not passible. Imagine having a select statement, there is no way of getting the number of resulting rows ahead the statement. you have tp process the select statement twice, first to get the amount, and then to ge tthe rows. in the first step you can optimize the select with count(*), but nevertheless, it is executed twice. So you have to execute the logical database in advance, there are funcion modules to do that. For performance reasons, thats not a good choice.
On the other hand, when the get event is triggered and your program is getting the first rowm most work by the database is done and you're only fetching row by row.
2005 Oct 10 4:39 PM
Thats not passible. Imagine having a select statement, there is no way of getting the number of resulting rows ahead the statement. you have tp process the select statement twice, first to get the amount, and then to ge tthe rows. in the first step you can optimize the select with count(*), but nevertheless, it is executed twice. So you have to execute the logical database in advance, there are funcion modules to do that. For performance reasons, thats not a good choice.
On the other hand, when the get event is triggered and your program is getting the first rowm most work by the database is done and you're only fetching row by row.
2005 Oct 11 12:17 AM
Thanks. If executing the logical database in advance is not a good choice, then if I want to show the progress of the execution (i.e. xx % completed...) in the status bar, how can I do this?
Regards.
2005 Oct 11 6:30 AM
Just do an estimation counting the rows with a select count(*) in the start-of-selection event. The where condition might be a bit tricky. just use the standard selection screen-options and do a count over PA0001, for having a progress bar thats sufficient accuracy.
2005 Oct 12 3:30 PM
Another possible solution:
get the last employee id from the table that contains the sequence numbers (don't know the table out of the head)
If you are interested I can try to look this up...
This will not be completely correct but it might be a enough to make an estimation
Cheers,
Wim