07-06-2006 2:22 AM
Hello experts,
I am currently playing around with my report and I would like to know on how do I show the clock/timer when calling function module SAPGUI_PROGRESS_INDICATOR. Also, will this affect the performance of my report?
----
Start of selection *
----
START-OF-SELECTION.
PERFORM get_data.
CHECK NOT it_final[] IS INITIAL.
PERFORM combine_data.
FORM get_data.
DATA: lv_hkont LIKE bsik-hkont VALUE '190100'.
IF sy-batch = ''.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = 'Fetching data...'.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = '190100'
IMPORTING
output = lv_hkont.
get records from BSIK
SELECT bukrs lifnr hkont belnr gjahr shkzg dmbtr sgtxt buzei
FROM bsik
INTO TABLE it_final
WHERE bukrs = p_bukrs
AND budat < p_budat
AND hkont = lv_hkont.
ENDFORM.
----
FORM combine_data *
----
........ *
----
FORM combine_data.
DATA: lv_age_of_rec TYPE p.
IF sy-batch = ''.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = 'Combining data...'.
ENDIF.
LOOP AT it_final ASSIGNING <fs_final>.
get records from BKPF
SELECT SINGLE bukrs belnr gjahr budat bldat xblnr bktxt FROM bkpf
INTO (bkpf-bukrs, bkpf-belnr, bkpf-gjahr, <fs_final>-budat,
<fs_final>-bldat, <fs_final>-xblnr, <fs_final>-bktxt)
WHERE bukrs = <fs_final>-bukrs
AND belnr = <fs_final>-belnr
AND gjahr = <fs_final>-gjahr.
if <fs_final>-shkzg = 'H', multiply dmbtr(amount in local currency)
by negative 1
IF <fs_final>-shkzg = 'H'.
<fs_final>-dmbtr = <fs_final>-dmbtr * -1.
ENDIF.
combine needed data to get long text
CONCATENATE: <fs_final>-bukrs <fs_final>-belnr
<fs_final>-gjahr <fs_final>-buzei
INTO it_thead-tdname.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = '0001'
language = sy-langu
name = it_thead-tdname
object = 'DOC_ITEM'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
TABLES
lines = it_lines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
if successful, split long text into start and end date
IF sy-subrc = 0.
READ TABLE it_lines TRANSPORTING tdline.
IF sy-subrc = 0.
SPLIT it_lines-tdline AT '-' INTO
<fs_final>-s_dat <fs_final>-e_dat.
ENDIF.
ENDIF.
get vendor name
SELECT SINGLE name1 FROM lfa1
INTO <fs_final>-name1
WHERE lifnr = <fs_final>-lifnr.
lv_age_of_rec = p_budat - <fs_final>-budat.
condition for age of deposits
IF lv_age_of_rec < 30.
<fs_final>-amount1 = <fs_final>-dmbtr.
ELSEIF lv_age_of_rec > 30 AND lv_age_of_rec < 60.
<fs_final>-amount2 = <fs_final>-dmbtr.
ELSEIF lv_age_of_rec > 60 AND lv_age_of_rec < 90.
<fs_final>-amount3 = <fs_final>-dmbtr.
ELSEIF lv_age_of_rec > 90 AND lv_age_of_rec < 120.
<fs_final>-amount4 = <fs_final>-dmbtr.
ELSEIF lv_age_of_rec > 180.
<fs_final>-amount5 = <fs_final>-dmbtr.
ENDIF.
CLEAR: bkpf, it_lines-tdline.
ENDLOOP.
ENDFORM.
07-06-2006 2:31 AM
First, you need to pass a percentage value to the percentage parameter of the function module, this will show the clock. And yes, everytime you fire this function module it is making a round trip. So use it only when you need to. What I mean is if you are processing 5000 records, do not show the status for every record processed, like 1 or 5000 complete. This will make your program run a lot longer than it needs to. Instead give status maybe every 500 or so.
In your case, it looks like you are only giving information as to what step the program is doing. Not sure that the clock will help out in this case, maybe just for looks.
Regards,
Rich Heilman
07-06-2006 2:31 AM
First, you need to pass a percentage value to the percentage parameter of the function module, this will show the clock. And yes, everytime you fire this function module it is making a round trip. So use it only when you need to. What I mean is if you are processing 5000 records, do not show the status for every record processed, like 1 or 5000 complete. This will make your program run a lot longer than it needs to. Instead give status maybe every 500 or so.
In your case, it looks like you are only giving information as to what step the program is doing. Not sure that the clock will help out in this case, maybe just for looks.
Regards,
Rich Heilman