cancel
Showing results for 
Search instead for 
Did you mean: 

need idoc no &error message to send in mail using workflow

Former Member
0 Kudos

Hi all.

I have build a workflow to trigger a mail when inbound idoc is in error status. I need to pass the idoc number & error message in mail.Can you pls let me know the how to get this information (idoc no & error message) in workflow builder. Thanks in advance.

Cheers,

sami.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

In the FM where the validation or any processing going in error you make to variable after concatenation of all the useful information

Header: E-TR001-[Interface Name]-Short Description

E- Error or Information

TR001-Exception Code

Interface Name-MATMAS,CFR5 etc

BODY: You can make the same multiline and pass all the relevant information.In the FM you will have

IDOC number and from there itself you can pass the Relevant information also.

Then call the FM SAP_WAPI_START_WORKFLOW and give input as

CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'

EXPORTING

task = lv_task_id

IMPORTING

workitem_id = lv_wiid

TABLES

input_container = lit_cont

agents = lit_agent.

Pass the task id to the FM .Header and BODY will be passed in container. You can pass the agent id as well like Position or User ID where exactly the mail should go.

I am presuming that the mail should go to SAP inbox.

If it should go as E mail in that case you will have to change the Function module.

If this is helpful and you need the detail approach I can give that as well.

Former Member
0 Kudos

Hi,

I think you are triggering the workflow by doing some setting's in process code(we42) inbound. I suggest you to remove these settings and directly call the FM 'SAP_WAPI_Create_event' in the FM which is assigned to the process code.

So, when a workflow fails youare going to change the status of the IDOC and you will be triggering the workflow.

By using the FM SAP_wapi_create_event you can pass the container data to the worlfow. In your case the Po number, etc....

In the workflow you can establish the biniding between event container and wf container. Now the data is present in the workflow container. So, the same data can be used to send a mail.

Hope i am clear with the logic.

Reply to this thread if this logic is not clear.

Thanks and regards,

Vijay.

Answers (2)

Answers (2)

imthiaz_ahmed
Active Contributor
0 Kudos

It should be present in the BO itself. for e.g. if you are using IDOCORDERS, the IDoc no should be there and error message too.

Regards, IA

former_member185167
Active Contributor
0 Kudos

Hello,

I think you should check if any events are generated already by an inbound idoc in error (check SWEL).

You could use this same event to trigger the workflow, and the object key it passes should allow you to access the error message.

regards

Rick Bakker

Hanabi Technology