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: 

Insert Custom Status Message for Outbound IDoc

Former Member
0 Kudos

Hello All,

The Actual requirement is to Extend a Basic Type and add a segment and process a outbound Idoc. The data is retrieved from a custom table to fill the extended custom segment and to issue a custom message in status record of the outbound Idoc if the data does not exist in the custom table for the corresponding document.

Can you please let me know how do we insert a custom message in the status records of an Outbound Idoc ?.

Thanks and regards,

Mahesh

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Write the below code in user exit.

if return_code = 0.

workflow_result = '0'.

idoc_status-docnum = idoc_contrl-docnum.

idoc_status-status = '53'. <you can give the status number here>

idoc_status-uname = sy-uname.

idoc_status-repid = sy-repid.

idoc_status-msgty = sy-msgty.

idoc_status-msgid = 'XXXX'. <Your own message id>

idoc_status-msgno = p_msgno. <message number>

idoc_status-msgv1 = sy-msgv1.

idoc_status-msgv2 = sy-msgv2.

idoc_status-msgv3 = sy-msgv3.

idoc_status-msgv4 = sy-msgv4.

return_variables-wf_param = 'Processed_IDOCs'. <Your own message>

return_variables-doc_number = idoc_contrl-docnum.

APPEND return_variables.

APPEND idoc_status.

else. <to throw the error message>

workflow_result = '99999'.

call_transaction_done = ''.

idoc_status-docnum = idoc_contrl-docnum.

idoc_status-status = '51'.

idoc_status-uname = sy-uname.

idoc_status-repid = sy-repid.

idoc_status-msgty = 'E'.

idoc_status-msgid = 'XXXX'.

idoc_status-msgno = p_msgno.

  • idoc_status-msgv1 = itab-ebeln. <You can pass the number>

  • idoc_status-msgv2 = v_fmreserv_a-xblnr.

idoc_status-msgv3 = ''.

idoc_status-msgv4 = ''.

return_variables-wf_param = 'Error_IDOCs'.

return_variables-doc_number = idoc_contrl-docnum.

APPEND return_variables.

APPEND idoc_status.

endif.

Hope it helps.

Reward if it is useful.

Thanks,

Srinivas

6 REPLIES 6

Former Member
0 Kudos

Any Suggestions please, this has become priority to me.

Thanks and regards,

Mahesh

Former Member
0 Kudos

Hi,

If you want to add a segment to IDoc Basic type...that can be done by TCode WE30...First of all you need to Cancel Release from Edit menu and add a segment to your IDoc type.. Then again Set Release...

Thanks and regards,

Dharitree

0 Kudos

Also..Segment can be Created using Tcode WE31...

Former Member
0 Kudos

Write the below code in user exit.

if return_code = 0.

workflow_result = '0'.

idoc_status-docnum = idoc_contrl-docnum.

idoc_status-status = '53'. <you can give the status number here>

idoc_status-uname = sy-uname.

idoc_status-repid = sy-repid.

idoc_status-msgty = sy-msgty.

idoc_status-msgid = 'XXXX'. <Your own message id>

idoc_status-msgno = p_msgno. <message number>

idoc_status-msgv1 = sy-msgv1.

idoc_status-msgv2 = sy-msgv2.

idoc_status-msgv3 = sy-msgv3.

idoc_status-msgv4 = sy-msgv4.

return_variables-wf_param = 'Processed_IDOCs'. <Your own message>

return_variables-doc_number = idoc_contrl-docnum.

APPEND return_variables.

APPEND idoc_status.

else. <to throw the error message>

workflow_result = '99999'.

call_transaction_done = ''.

idoc_status-docnum = idoc_contrl-docnum.

idoc_status-status = '51'.

idoc_status-uname = sy-uname.

idoc_status-repid = sy-repid.

idoc_status-msgty = 'E'.

idoc_status-msgid = 'XXXX'.

idoc_status-msgno = p_msgno.

  • idoc_status-msgv1 = itab-ebeln. <You can pass the number>

  • idoc_status-msgv2 = v_fmreserv_a-xblnr.

idoc_status-msgv3 = ''.

idoc_status-msgv4 = ''.

return_variables-wf_param = 'Error_IDOCs'.

return_variables-doc_number = idoc_contrl-docnum.

APPEND return_variables.

APPEND idoc_status.

endif.

Hope it helps.

Reward if it is useful.

Thanks,

Srinivas

0 Kudos

Hello Srinivas,

After appending the message data to Internal table idoc_status, where should i provide this internal table to reflect in the Idoc status.

regards,

Mahesh

salah_zinet
Participant
0 Kudos

Hi All,

I know that this thread is old, but I want to add this link:

Modify IDOC Status by Program - ABAP Development - SCN Wiki

It can help visitors of this thread.

Regards.