Application Development 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: 

SM37 - Job Logs - Updates while job is running

venkateswaran_k
Active Contributor
0 Kudos

Dear All

I have a program that is being executed every month end. It is not through SM37 Job, but in Executed manually in program using Execute in background.(option). (as shown below)

My question is as below:

The program process a large volume of data - so we are executing in background. To facilitate the user, I put messages inside the program of each stage.. as 'stage x of 7 ' completed. Once the program is executed as above in background, a job is activated in the sm37. I was expecting in SM37- If I click the job logs, I can see the current stage.

However, The Job log shows all my messages only after the job is completed.

Please guide me how to achieve this.

Regards,

Venkat

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor

In my system, I can see the messages appear in SM37 job log, one after the other, with the program below. I guess it depends how TemSe has been configured, of your kernel, and so on.

DO 60 TIMES.
  MESSAGE |Step #{ sy-index }| TYPE 'S'.
  WAIT UP TO 1 SECONDS.
ENDDO.

EDIT August 3rd: if it fixes your issue, then maybe the issue is that in your TemSe configuration, MESSAGE statement writes the message to a database table, and as WAIT UP TO x SECONDS triggers a database commit (due to roll-out/roll-in of the context) then the new message can be seen everywhere (or any other reason in the same direction). So, instead of WAIT UP TO x SECONDS, this will probably work too:

CALL FUNCTION 'DB_COMMIT'.

(or EXEC SQL. COMMIT WORK ENDEXEC)

5 REPLIES 5

abo
Active Contributor

If you're using WRITE to output the progress status, that is to be expected.

Try using application logs, instead: fm BAL_LOG_CREATE and so on, tx SLG0/SLG1

venkateswaran_k
Active Contributor
0 Kudos

I was using simple Message statement..

So instead you recommend to call this FM BAL_LOG_CREATE ?

abo
Active Contributor
0 Kudos

"message" will be seen by no one anyway 🙂

"Business Application Logs" (BAL) instead can be examined while the program is still running

Sandra_Rossi
Active Contributor

In my system, I can see the messages appear in SM37 job log, one after the other, with the program below. I guess it depends how TemSe has been configured, of your kernel, and so on.

DO 60 TIMES.
  MESSAGE |Step #{ sy-index }| TYPE 'S'.
  WAIT UP TO 1 SECONDS.
ENDDO.

EDIT August 3rd: if it fixes your issue, then maybe the issue is that in your TemSe configuration, MESSAGE statement writes the message to a database table, and as WAIT UP TO x SECONDS triggers a database commit (due to roll-out/roll-in of the context) then the new message can be seen everywhere (or any other reason in the same direction). So, instead of WAIT UP TO x SECONDS, this will probably work too:

CALL FUNCTION 'DB_COMMIT'.

(or EXEC SQL. COMMIT WORK ENDEXEC)

0 Kudos

Yes, It is showing now job logs. I really do not know the reason.!

What I did is, after each message statement I added - delay statement Wait up to 1 sec.

Then it started showing logs after each stage completed.

I did not further research,, as it started working 7 seconds delay in background job is not big 🙂 as of now..

Closing the thread,

Thanks Andrea and Sandra.