Application Development and Automation 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: 
Read only

progress bar code

Former Member
0 Likes
837

Dear All

Can you please help me with code which shows the progress bar movement until the loop is finished.

Thank you in advance

Regards

William

6 REPLIES 6
Read only

Former Member
0 Likes
796

Hi,

You can do it using Function SAPGUI_PROGRESS_INDICATOR.

Try this, it will surely help you.

Read only

0 Likes
796

Thank you so much. it worked well.

William

Read only

Former Member
0 Likes
796

a little more detail


    IF sy-dbcnt = cyc_break.
      cyc_pct = cyc_pct + 10.
      cyc_break = cyc_break + cyc_const.
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
           EXPORTING
                percentage = cyc_pct
                text       = 'Building Prospect Information'.
    ENDIF.

I do a select COUNT .. to determine max db reads within the loop. then divide by 10 so that the indicator is updated only 10x. Doing it every time through the loop will give you unbelievable bad response time.

Read only

Pawan_Kesari
Active Contributor
0 Likes
796

I use something like this... assuming i_afpo is the table need to be processed


  DATA : lv_per     TYPE syst-tabix     ,
         lv_lst_p   TYPE syst-tabix     ,
         lv_total   TYPE syst-tabix     ,
         lv_char    TYPE string         .

  DESCRIBE TABLE i_afpo LINES lv_total .

  LOOP AT i_afpo ASSIGNING <fs_afpo> .

*   Progress Indicator
    lv_lst_p = ( sy-tabix  * 100  ) / lv_total .
*   There is no point in updating frontend if % remains same
    IF lv_lst_p NE lv_per .
      lv_per = lv_lst_p .
      lv_char = lv_per .

      CONCATENATE 'Processing'(002)
                  lv_char
                  '%'(003)
             INTO lv_char
        SEPARATED BY space .

      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
        EXPORTING
          percentage = lv_per
          text       = lv_char.
    ENDIF.
  ENDLOOP.

Read only

0 Likes
796

Dear Pawan Kesari.

Thank you so much it worked. many thanks to you.

William

Read only

0 Likes
796

Thank you so much it worked for me

William