SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Progress Indicator (Also Stops report timeout)



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dialog Programming
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sun Oct 14, 2007 6:42 pm    Post subject: Progress Indicator (Also Stops report timeout) Reply with quote

"% complete" Progress indicator
The progress indicator adds a small timer in the lower left corner of the SAP screen. It not only provides the user with an indication of percentage completeness but also stops reports timing out. It does this by reseting the timeout timer whenever it is called.

Code:

*&**********************************************************************
*& DESCRIPTION: Demonstrate Progress indicator                         *
*&**********************************************************************
REPORT  zprogind.

TYPES: BEGIN OF t_mara,
         matnr LIKE mara-matnr,
       END OF t_mara.
DATA: it_mara TYPE STANDARD TABLE OF t_mara INITIAL SIZE 0,
      wa_mara TYPE t_mara.
DATA: mara_lines TYPE i,
      gd_percent TYPE i.


************************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.

  SELECT matnr
    INTO TABLE it_mara
    FROM mara.

  CHECK sy-subrc EQ 0.
  mara_lines = sy-dbcnt.
  clear: gd_percent.

  LOOP AT it_mara INTO wa_mara.
    PERFORM progress_bar USING 'Retrieving data...'(001)
                               sy-tabix
                               mara_lines.
*    WAIT UP TO 2 SECONDS.
  ENDLOOP.

  WRITE: /20 'Report is "Complete" OK'.


*&---------------------------------------------------------------------*
*&      Form  PROGRESS_BAR
*&---------------------------------------------------------------------*
FORM progress_bar USING    p_value
                           p_tabix
                           p_nlines.

  DATA: w_text(40),
        w_percentage TYPE p,
        w_percent_char(3).

  w_percentage = ( p_tabix / p_nlines ) * 100.
  w_percent_char = w_percentage.
  SHIFT w_percent_char LEFT DELETING LEADING ' '.
  CONCATENATE p_value w_percent_char '% Complete'(002) INTO w_text.

* This check needs to be in otherwise when looping around big tables 
* SAP will re-display indicator too many times causing report to run
* very slow. (No need to re-display same percentage anyway)
  if w_percentage gt gd_percent or p_tabix eq 1.
    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
        EXPORTING
           percentage = w_percentage
           text       = w_text.
   gd_percent = w_percentage.
  endif.
endform.                    " PROGRESS_BAR


Record Count progress indicator
The progress indicator adds a small timer in the lower left corner of the SAP screen. It not only provides the user with the number of records processed but also stops reports timing out. It does this by reseting the timeout timer whenever it is called.

Code:

*&**********************************************************************
*& DESCRIPTION: Demonstrate Progress indicator                         *
*&**********************************************************************
REPORT  zprogind.

TYPES: BEGIN OF t_mara,
         matnr LIKE mara-matnr,
       END OF t_mara.
DATA: it_mara TYPE STANDARD TABLE OF t_mara INITIAL SIZE 0,
      wa_mara TYPE t_mara.
DATA: gd_count(6)    TYPE n,
      gd_outtext(70) type c.


************************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.

  SELECT matnr
   UP TO 500 ROWS
    INTO TABLE it_mara
    FROM mara.

  CHECK sy-subrc EQ 0.
 
  LOOP AT it_mara INTO wa_mara.
  add 1 to gd_count.
  concatenate 'Processing personnel data'(m10) gd_count into gd_outtext
            separated by ' '.

* Display indicator for employee count
  perform progress_indicator using gd_outtext.
  ENDLOOP.

  WRITE: /20 'Report is "Complete" OK'.


*&---------------------------------------------------------------------*
*&      Form  PROGRESS_INDICATOR
*&---------------------------------------------------------------------*
*       Displays progress indicator on SAP screen
*----------------------------------------------------------------------*
form progress_indicator using p_text.
  call function 'SAPGUI_PROGRESS_INDICATOR'
      exporting
*         PERCENTAGE = 0
           text       = p_text.
endform.                    " PROGRESS_INDICATOR
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dialog Programming All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.