Application Development 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: 

Get Pernr

Francis417
Participant
0 Kudos
307

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

1 ACCEPTED SOLUTION

rainer_hbenthal
Active Contributor
0 Kudos
130

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.

4 REPLIES 4

rainer_hbenthal
Active Contributor
0 Kudos
131

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.

0 Kudos
130

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.

0 Kudos
130

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.

0 Kudos
130

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