Para incluir dicha barra de progreso debemos escribir el siguiente código en nuestro programa:
DESCRIBE TABLE it_data LINES ld_lines.
LOOP AT it_data.
PERFORM progress_bar
USING 'Procesando...'(001)
sy-tabix
ld_lines.
...
ENDLOOP.
El código de la rutina 'progress_bar' es el siguiente:
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
INTO w_text SEPARATED BY space.
* 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.