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

IDoc trigger IN UPDATE TASK Z_Function_Module

rammididoddi
Explorer
0 Likes
1,382
Hello Experts,
I am using Z_FM to update order status and to send status into an IDoc. So, here i'm doing creating entry in NAST table and using submit RSNAST00 for generating IDoc to send order status to IDoc.
Doing like CALL FUNCTION 'Z_FUNCTION_MODULE' IN UPDATE TASK
after this FM, creating message entry in NAST and submitting RSNAST00
SUBMIT rsnast00 WITH s_kappl = ls_nast-kappl "#EC CI_SUBMIT
WITH s_objky = ls_nast-objky
WITH s_kschl = ls_nast-kschl
WITH s_nacha = ls_nast-nacha
TO SAP-SPOOL
SPOOL PARAMETERS lv_print_parameters WITHOUT SPOOL DYNPRO VIA JOB v_jobname NUMBER lv_jobnumber AND RETURN.
Note: these code not writing in IN UPDATE FM, If we use this inside FM, getting errors.
If i use COMMIT WORK, then only IDoc getting success else it's getting failed.
But, we cannot use the COMMIT WORK in BAdi(LE_SHP_DELIVERY_PROC).
Please help on this How to Commit without using COMMIT WORK.
Kind Regards,
Ram Mididoddi
2 REPLIES 2
Read only

Jeansy
Active Contributor
1,066

Hi Ram,

I had such cases also several times. I implemented a new function module that is RFC-enabled which is called inside the update task function module using STARTING NEW TASK. This creates a new session inside the update task which allows also to use the (normally) forbidden commands (in update task) like COMMIT, SUBMIT and so on.

Refer to this documentation for more details:
https://help.sap.com/doc/abapdocu_751_index_htm/7.51/de-DE/abapcall_function_starting.htm

Kind regards
Jens

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,066

Format of your question is wrong, everything is in "Code" format. You can mix Code and Non-Code as you can see below.

----------------------------------------------

Hello Experts,

I am using Z_FM to update order status and to send status into an IDoc. So, here i'm doing creating entry in NAST table and using submit RSNAST00 for generating IDoc to send order status to IDoc.

Doing like CALL FUNCTION 'Z_FUNCTION_MODULE' IN UPDATE TASK

after this FM, creating message entry in NAST and submitting RSNAST00

 SUBMIT rsnast00 WITH s_kappl = ls_nast-kappl "#EC CI_SUBMIT
                 WITH s_objky = ls_nast-objky
                 WITH s_kschl = ls_nast-kschl
                 WITH s_nacha = ls_nast-nacha
                 TO SAP-SPOOL
                 SPOOL PARAMETERS lv_print_parameters
                 WITHOUT SPOOL DYNPRO
                 VIA JOB v_jobname NUMBER lv_jobnumber
                 AND RETURN. 

Note: these code not writing in IN UPDATE FM, If we use this inside FM, getting errors.

If i use COMMIT WORK, then only IDoc getting success else it's getting failed.

But, we cannot use the COMMIT WORK in BAdi(LE_SHP_DELIVERY_PROC).

Please help on this How to Commit without using COMMIT WORK.