2011 Oct 27 10:03 AM
Hi,
Background
I have written a FM that sends email with cl_document_bcs and cl_gbt_multirelated_service. I plan to use that FM in many places so it must work both in normal mode and in an update process but my problem is that when running in an update process (example when sending email from order) the COMMIT WORK. creates a dump.
My question:
- How can the function module detect when it is running in an update process?
This is how I have solved it right now, but it really feels like a dirty fix...
IF sy-title NE 'Update control'.
COMMIT WORK.
ENDIF.I hope that you have a simple answer to this....
2011 Oct 27 10:20 AM
Use this:
IF CL_SYSTEM_TRANSACTION_STATE=>GET_IN_UPDATE_TASK( ) EQ 0 .
COMMIT WORK.
ENDIF.
Hi,
Background
I have written a FM that sends email with cl_document_bcs and cl_gbt_multirelated_service. I plan to use that FM in many places so it must work both in normal mode and in an update process but my problem is that when running in an update process (example when sending email from order) the COMMIT WORK. creates a dump.
My question:
- How can the function module detect when it is running in an update process?
This is how I have solved it right now, but it really feels like a dirty fix...
IF sy-title NE 'Update control'.
COMMIT WORK.
ENDIF.I hope that you have a simple answer to this....
2011 Oct 27 10:11 AM
Hi again,
I now have another dirty solution, a new imported parameter i_commit_work. I don't like it but I must perhaps have it like this...
Br Linus
2011 Oct 27 10:20 AM
Use this:
IF CL_SYSTEM_TRANSACTION_STATE=>GET_IN_UPDATE_TASK( ) EQ 0 .
COMMIT WORK.
ENDIF.
2011 Oct 27 11:13 AM
Thank you!
I used Arsens suggestion, it worked for me!
Br Linus
2011 Oct 27 10:31 AM
Have a look at the system field[SY-ONCOM|http://help.sap.com/saphelp_nw04/helpdata/en/7b/fb96c8882811d295a90000e8353423/content.htm]
You can also use the function module TH_IN_UPDATE_TASK for this .
Kesav
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |