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

Displaying program log during the program run

Former Member
0 Likes
1,284

Hi there dear ABAP'ers,

I've got a report, something like this:


SELECT ... INTO itab .  

LOOP AT itab INTO item .
  ... [processing item] ..
  WRITE item-sometext .
ENDLOOP .

* > cumulated LOG displayed *

The effect is that I receive a program log after program is finished.

Is it possible to display part of log each time item is processed? Something like this:


SELECT ... INTO itab .  

LOOP AT itab INTO item .
  ... [processing item] ..
  WRITE item-sometext .
* > line of the LOG appended and cumulated LOG displayed *
ENDLOOP .

Maybe instead of WRITE I could use an GRID object, and each time item is processed I append a line to GRID and refresh it display. But it would be blikning probably each refresh occurs ...

Is such solution worthy of efforts? Uset wants to see which step is currently program processing. I thought about using a Process Indicator in status bar (CLOCK), bot some of steps would change quickly and user would not be able to read the text.

I will be thankful for tips. Regards. P.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,245

I hope Write Statement with some messages would be better approach.

Using Process Indiactor each time will slow down the performance.

ManasM.

11 REPLIES 11
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,245

just a possibility

You can use the 'wait' statement and show the GUI progress indicator.

Read only

0 Likes
1,245

The statement WAIT causes a switch in the work process, which is linked to the rollout and rollin of all loaded programs. For this reason, the time given in sec must not be less than one second, to avoid burdening the system with too many work process switches.

Read only

Former Member
0 Likes
1,246

I hope Write Statement with some messages would be better approach.

Using Process Indiactor each time will slow down the performance.

ManasM.

Read only

0 Likes
1,245

Kumar Manas Mishra

But haw could I achieve this effect?


DATA: BEGIN OF itab OCCURS 0,
        item_1(50) ,
      END OF itab .
DATA: line LIKE LINE OF itab .

DATA: ctr_i TYPE i .
DATA: ctr_c(3) .

ctr_i = 1 .

DO 5 TIMES .
  ctr_c = ctr_i .
  CLEAR line .
  CONCATENATE 'This is a' ctr_c 'line of log.'
  INTO line SEPARATED BY SPACE .
  ctr_i = ctr_i + 1 .

  APPEND line TO itab .

ENDDO .

LOOP AT itab INTO line .
  WAIT UP TO 1 SECONDS.
  WRITE / line-item_1 .

ENDLOOP .

In example program above I have to wait 5 seconds to see the log. And the log is cumulated. Like this:

This is a 1 line of log.

This is a 2 line of log.

This is a 3 line of log.

This is a 4 line of log.

This is a 5 line of log.

whils I would like to see each line of log immediately when item is processed, so something like that:

<after 1st second> output:

This is a 1 line of log.

<after 2nd second> output:

This is a 1 line of log.

This is a 2 line of log.

<after 3rd second> output:

This is a 1 line of log.

This is a 2 line of log.

This is a 3 line of log.

... ... ...

Read only

0 Likes
1,245

Yeah true.

But im not sure whether the user can read the log within one second.

@piotr - if there is lot of records to be processed

then time taken should be considered.

Read only

0 Likes
1,245

Try This:-

DATA: BEGIN OF itab OCCURS 0,
        item_1(50) ,
      END OF itab .
DATA: line LIKE LINE OF itab .

DATA: ctr_i TYPE i .
DATA: ctr_c(3) .

ctr_i = 1 .

DO 5 TIMES .
  ctr_c = ctr_i .
  CLEAR line .
  CONCATENATE 'This is a' ctr_c 'line of log.'
  INTO line SEPARATED BY SPACE .
  ctr_i = ctr_i + 1 .

  APPEND line TO itab .

LOOP AT itab INTO line .
  WAIT UP TO 1 SECONDS.
WRITE / line-item_1 .

ENDLOOP .
ENDDO .

Read only

0 Likes
1,245

Kumar Manas Mishra

The result is that first I'm waiting few seconds and then such a log appears in one moment:

This is a 1 line of log.

This is a 1 line of log.

This is a 2 line of log.

This is a 1 line of log.

This is a 2 line of log.

This is a 3 line of log.

This is a 1 line of log.

This is a 2 line of log.

This is a 3 line of log.

This is a 4 line of log.

This is a 1 line of log.

This is a 2 line of log.

This is a 3 line of log.

This is a 4 line of log.

This is a 5 line of log.

Read only

0 Likes
1,245

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

percentage = v_percent

text = 'Processing, please wait.'.

Can we go this way?

Increase the wait time so that user can see all the logs.

Read only

0 Likes
1,245

Unfortunatelly,

client seems to want the log to be presented as a cumulated list.

Read only

0 Likes
1,245

[Here|; we have a WRITE-based solution.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,245

So this was a cross thread )))