SAP: Dynamic Sapgui Progress Indicator

It is very easy to apply a progress indicator on your abap programs. This will enable the

user to determine how much long will he wait until the program finish its processing.

This is done by simply calling the function module SAPGUI_PROGRESS_INDICATOR.

 
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
  EXPORTING
    VALUE(PERCENTAGE) DEFAULT 0
    VALUE(TEXT) DEFAULT SPACE

PERCENTAGE is where you indicate the percentage of processing time and the TEXT is

where you indicate the text to be displayed on the status bar. This parameters can be

set with static values. But if you want, you could also add a few line of codes to make your

progress indicator dynamic and based on the actual number of records being process. This tip

is applicable when you are querying and processing a record from a database.

First you have to declare three decimal variables, see example below.

 
DATA:   v_percent    TYPE p DECIMALS 4,	"holds the actual percentage of process time
        v_increment  TYPE p DECIMALS 4, "holds the increment value per single loop
        v_mod        TYPE p DECIMALS 4. "used as indicator

Now refer to the lines below for the rest of the codes.

 
****Your select statement goes here******
 
* this will determine the increment value based on the result of the select statement
  v_increment = 100 / sy-dbcnt.
 
  LOOP AT it INTO wa.
*calculate the progress percentage on every single loop
    v_percent = v_percent + v_increment.
 
*this codes indicates that I want to update my progress indicator every 5% increase
*in percentage. you can change this anytime you want.
    v_mod = v_percent MOD 5.
    IF  v_mod  < 1.
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
        EXPORTING
          percentage = v_percent
          text       = 'Processing, please wait.'.
    ENDIF.

Creative Commons License

0 Responses to “SAP: Dynamic Sapgui Progress Indicator”


  1. No Comments

Leave a Reply