Technical Articles
The progress indicator in ABAP reports
I’m sure most of you have been asked to develop a report displaying a progress indicator during the execution of the report. I just developed a migration report which needs several minutes to execute, so I decided to put in a progress indicator.
When running the ATC check with abapOpenChecks for the report I’ve developed, I got an error telling me that function module SAPGUI_PROGRESS_INDICATOR
should not be used. Even though this is documented in the documentation of check 53 for abapOpenChecks, an SAP Knowledge Base Search for information on what should be used instead of function module SAPGUI_PROGRESS_INDICATOR
didn’t give me any results. The documentation at abapOpenChecks states that class CL_PROGRESS_INDICATOR
should be used instead of the function module. I decided to write this short blog post to share this information with the community as well as to provide a tiny code example.
Instead of using the function module like this:
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' EXPORTING percentage = progress_percent text = progress_text.
You can use the class like this:
cl_progress_indicator=>progress_indicate( i_text = |Processing: { current_record }/{ total_records }| i_output_immediately = abap_true ).
The result isn’t exactly the same since the function module only works with percentages. This could easily be achieved with the class as well, but in this case, I was more interested in seeing how many of the total records had been processed.
Happy coding!
This blog post first appeared on the Developer Voyage blog at https://www.developervoyage.com/2019/11/11/the-progress-indicator-in-abap-reports.html
For the matter of fact, method cl_progress_indicator=>progress_indicate has a few advantages over FM SAPGUI_PROGRESS_INDICATOR:
You must set I_TEXT or I_MSGID/I_MSGNO with 3 message placeholders (&1, &2, &3) so it will work as expected.
Thanks for a great comment!
Regarding point 3, I made two examples and added them to the abapOpenChecks documentation.
Excellent blog. One of those little things that I could easily miss. 🙂
Its configurable in abapOpenChecks if usage of SAPGUI_PROGRESS_INDICATOR should report errors, but by default abapOpenChecks is quite picky 🙂
Nice blog - knowing these little twists makes the difference between a good and a great developer!
First of all thanks a lot for mentioning this class. Nice Blog.
On a lighter note, i very happily went to my system, SE24, displayed the class. checked the class documentation and this is the GEM i found
I just checked the documentation of FM PROGRESS_INDICATOR 🙂
Hi,
Don't have experience with the class version but I was always trying to stay away from the progress bar when my programs was making updates on the DB or at least being very careful. If I remember correctly it is triggering an implicit commit at each GUI update.
Regards,
David.
Hi,
Nice!
The method also offers automatic text replacement:
There is even a fourth placeholder: