2007 Jun 20 8:31 AM
Hi All,
With all the control stuff around like cl_dd_document I was wondering if there is a way to give a user a report which shows the progress of a very long running program?
i.e. If I have a 20 step process and each step takes 1 minute, the following is what I would like to occur:
Output a status line in a report format, run step, repeat until all steps are finished.
This is similar to the status bar, but with a history of what is happening. Obviously scrolling needs to be considered also. Ideally it would behave like sapinst would but in a reporting format.
Obviously this has to bypass the PBO/PAI approach, hence why I believe UI Controls must be the answer.
Any ideas anyone?
Regards,
Matt
2007 Jun 21 5:08 AM
Hi Matt,
If this is a foreground Job, the FM PROGRESS_INDICATOR' can be used with appropriate text supplied to it.
If you are running the program as a background job, you could fetch the output from the spool ( which will contain the logic stated above) and display it to the User.
Hope this solves your issue.
Regards,
Shruthi R
2007 Jun 20 8:41 AM
Hi Matt ,
there is one FM like SAPGUI* which will tells u the status of the report on the status bar ?
<b>SAPGUI_PROGRESS_INDICATOR</b>
u can use this FM .
Regards
Peram
2007 Jun 20 8:56 AM
Hi Matt,
I have not done this before but i gues, the logic could be:
1. Submit step one of the program as a background job. After it finishes, you will get a joblog..
Put information messages in the program which will appear in the joblog.
2. Read using job log read FMs, the joblog and display it. Meanwhile, submit second step for asynchronous processing.
3. This approach will work even in PBO/PAI type design.
Regs,
Sameer
2007 Jun 21 5:08 AM
Hi Matt,
If this is a foreground Job, the FM PROGRESS_INDICATOR' can be used with appropriate text supplied to it.
If you are running the program as a background job, you could fetch the output from the spool ( which will contain the logic stated above) and display it to the User.
Hope this solves your issue.
Regards,
Shruthi R
2007 Jun 21 5:45 AM
Thanks All (especiall Shruthi). I knew about the Progress_Indicator, and can also point you at EPS_PROGRESS_POPUP which is especially cool (check out the package SGRP for some cool demo programs also); but really I was after providing the user detailed logs while running a foreground job. Looks like it may not be possible.
Another strange requirement would be the need to give the user a popup occasionally during the execution (which would rule out EPS_PROGRESS_POPUP I believe).
Regards,
Matt
2007 Jun 22 6:36 AM
Without using a control, you could try the old report refresh trick using set user-command and an action triggered after an RFC in a new task ... see basic demo below:
report zlocal_auto_refresh no standard page heading.
data:
begin of gs_step,
uzeit like sy-uzeit,
step like sy-tabix,
start_end(10) type c,
end of gs_step,
gt_step like gs_step occurs 10,
g_step_number like sy-tabix.
*=======================================================================
* Events
*=======================================================================
at user-command.
perform user_command.
*=======================================================================
* Mainline
*=======================================================================
start-of-selection.
perform start_of_report.
end-of-selection.
*&---------------------------------------------------------------------*
*& Form start_of_report
*&---------------------------------------------------------------------*
form start_of_report.
set pf-status '1000LIST'. "contains ZREFRESH ucomm
perform run_a_step.
endform. "start_of_report
*&---------------------------------------------------------------------*
*& Form run_a_step
*&---------------------------------------------------------------------*
form run_a_step.
* Demo with something that takes some time, like sleeping...
data:
ls_step like gs_step.
add 1 to g_step_number.
if g_step_number > 9.
stop.
endif.
get time.
clear: ls_step.
ls_step-step = g_step_number.
ls_step-uzeit = sy-uzeit.
ls_step-start_end = 'Starting'.
append ls_step to gt_step.
* generate a delay for demo
call function 'ENQUE_SLEEP'
exporting
seconds = 1
exceptions
others = 0.
get time.
clear: ls_step.
ls_step-step = g_step_number.
ls_step-uzeit = sy-uzeit.
ls_step-start_end = 'Ended'.
append ls_step to gt_step.
format reset.
format color col_normal.
loop at gt_step into ls_step.
write: /
ls_step-uzeit,
ls_step-start_end,
ls_step-step,
at sy-linsz space.
endloop.
uline.
call function 'RFC_PING'
starting new task 'NEWTASK'
performing when_back on end of task.
endform. "run_a_step
*&---------------------------------------------------------------------*
*& Form when_back
*&---------------------------------------------------------------------*
form when_back
using
i_taskname type any.
receive results from function 'RFC_PING'.
set user-command 'ZREFRESH'. "act like user pressed something
endform. "when_back
*&---------------------------------------------------------------------*
*& Form user_command
*&---------------------------------------------------------------------*
form user_command.
case sy-ucomm.
when 'ZREFRESH'.
perform run_a_step.
sy-lsind = sy-lsind - 1.
endcase.
endform. "user_commandcheers
jc
2007 Jun 22 6:42 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |