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

UPDATE TASK Function Module - Informational Message

Former Member
0 Likes
2,901

Hello All,

We are triggering an ALE output at the shipment level through a scheduled job. We are getting a ROLLBACK in the system because of an informational message issued inside of a standard SAP function module that is being called in UPDATE TASK.

Before opening a note with SAP I wanted to verify that you can not issue an informational message inside of a function module called in UPDATE TASK. Is this correct?

Thanks!

1 ACCEPTED SOLUTION
Read only

MariaJooRocha
Contributor
0 Likes
1,833

Hi,

Here is the help for the receive instruction:

"Receives the results returned by a function module called asynchronously ( CALL FUNCTION func STARTING NEW TASK taskname). This ABAP statement is used within a FORM routine. The form routine must have a place holder for passing the task name (for example, USING taskname - see example), and it can only be used to receive and execute simple ABAP statements. It cannot contain any statements that interrupt the program execution (such as CALL SCREEN, CALL DIALOG, CALL TRANSACTION, SUBMIT, COMMIT WORK, WAIT, Remote Function CAlls, CPIC calls),

or any warning or information messages that use the MESSAGE statement

.

Hope this helps,

Regards,

Maria João Rocha

11 REPLIES 11
Read only

christian_wohlfahrt
Active Contributor
0 Likes
1,833

Hi Ryan,

that's correct, because a message needs a GUI - which is not available in update.

But before you look for OSS: it is not possible to book a whole function in update task. You can make same database changes, but at no circumstances you should invoke a second commit work.

So no call transaction or other FM, which might include explicit or implicit commits.

Regards,

Christian

Read only

Former Member
0 Likes
1,833

Hi Ryan,

I paste here a note in the SAP help on calling function modules in update task:

During updating processes of function modules, you may not make any calls using the language statements SUBMIT, CALL DIALOG, CALL SCREEN, CALL TRANSACTION, COMMIT WORK or ROLLBACK WORK . All other language elements that trigger a database Commit <b>(for example, a screen change using the MESSAGE statement)</b> also lead to a runtime error during updating.

I hope that helps.

Brad

Message was edited by: Brad Williams

Read only

Former Member
0 Likes
1,833

Hi Ryan,

I don't think that is correct. I think you can have an Information Message in your UPDATE TASK. Are you sure it is not an ABEND Message ?

By the way, which Function Module are you referring to ?

Regards,

Anand Mandalika.

Read only

0 Likes
1,833

Hi Anand,

work processes of type dialog have a GUI connection, others like update or background will crash at the attempt of a popup creation.

(Message behaves different in different contexts, unfortunately I don't have access to keyword help at the moment.)

Regards,

Christian

Read only

0 Likes
1,833

Hi Anand,

You are correct that the informational message is being interpreted as an ABEND message, however, I also get a rollback in the system.

The function module that is being called is 'SD_SHIPMENTS_SAVE_ACTIVITY_2'. Subroutine MESSAGES_PROCCESS inside of INCLUDE LV70AF01 has the informational message that is only issued when in batch mode.

IF SY-BATCH EQ TRUE.

L_PARTNER-PARVW = NAST-PARVW.

L_PARTNER-PARNR = NAST-PARNR.

MESSAGE I035(VN) WITH NAST-OBJKY NAST-KSCHL L_PARTNER.

ENDIF.

Regards,

Ryan

Read only

0 Likes
1,833

Hi Christian,

I'm sorry, I thought that an information message would do no harm.

But if you take the case of a background process, the information message will simply be ignored. This is what the documentation says -

<i>You can catch messages from function modules that are not sent using the RAISING addition in the MESSAGE statement by including the implicit exception ERROR_MESSAGE in the EXCEPTIONS list of the CALL FUNCTION statement. The following conditions apply:

Type S, I, and W messages are ignored (but logged during background processing)

Type E and A messages trigger the exception ERROR_MESSAGE

Type X messages trigger the usual runtime error and short dump.</i>

Even in case of a background process, e.g., a batch job, there will be no access to the GUI. But the information message does not cause the job to fail. It is merely logged in the job log and the program processing continues. So I had applied similar reasoning to the Update Task. Apparently, that is not correct.

I imagine that the information message will be some sort of a screen, which will trigger an implicit commit work. I will however verify the concept again.

Another line of thinking was, if it is an SAP Delivered Function Module, why would an information message be used instead of an Abend Message? I will check that out too.

Regards,

Anand Mandalika.

Read only

0 Likes
1,833

Hi Anand,

I forgot the job log - but it's quit common to raise a info message to get some info into the job log. I guess, that is the purpose in this context, too: if sy-batch = 'X'. message ... endif. <- programmer expected background processing.

But here we are in update task, and message is handled 'according to the context' - a situatin, which might not be defined explicit up to now. So default popup action might be used and your trail with implicit commit work will come true.

I didn't fetch the exact calling structure, so I'm not sure, if the problem is to be searched inside this function or in the design of the calling.

Regards,

Christian

Read only

0 Likes
1,833

All,

Thank you very much for all of you input, it has been very valuable. It is becoming clear that it might be worth talking with SAP.

Just some additional information if it interests you, here is a dump of the SAP code that calls the function module in question:

  • when there are any activities after saving, carry them

  • out on commit and in update task to ensure that all

  • data are already on the database

IF NOT g_activity_list[] IS INITIAL.

PERFORM act_after_saving_on_commit ON COMMIT LEVEL 1000.

ENDIF.

It is then inside of subroutine 'ACT_AFTER_SAVING_ON_COMMIT', that they call function module 'SD_SHIPMENTS_SAVE_ACTIVITY_2' in UPDATE TASK.

Regards,

Ryan

Read only

Former Member
0 Likes
1,833

Hello Ryan,

are you seeing the log using SM13? It should give the details regarding exact problem..

Regards,

Samir.

Read only

Former Member
0 Likes
1,833

have seen these Oss notes: 196768 and 335483

Read only

MariaJooRocha
Contributor
0 Likes
1,834

Hi,

Here is the help for the receive instruction:

"Receives the results returned by a function module called asynchronously ( CALL FUNCTION func STARTING NEW TASK taskname). This ABAP statement is used within a FORM routine. The form routine must have a place holder for passing the task name (for example, USING taskname - see example), and it can only be used to receive and execute simple ABAP statements. It cannot contain any statements that interrupt the program execution (such as CALL SCREEN, CALL DIALOG, CALL TRANSACTION, SUBMIT, COMMIT WORK, WAIT, Remote Function CAlls, CPIC calls),

or any warning or information messages that use the MESSAGE statement

.

Hope this helps,

Regards,

Maria João Rocha