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

Trigger IDOC using Custom FM/Program automatically

Former Member
0 Likes
4,517

Hello All,

Requesting your help on the below.

Our requirement is to trigger an IDOC automatically when a PO is created or changed. However, the catch is we need a custom FM to be triggered for creating idocs when PO is changed/created.

Custom FM is needed since there is an existing custom error logging tool which is used in this client. Any idoc triggering failures need to be logged in this tool ( by calling relevant custom FM 's for updating this tool). This cannot be done using standard existing FM.

How can i trigger our custom FM every time a PO is created or changed?

Other option would be to have a stand-alone report which will pick up all PO 's created and changed during the day and create IDOC 's. This way errors can easily be logged in the custom tool. However this does not seem a good approach.

1 ACCEPTED SOLUTION
Read only

MarekTurczynski
Contributor
2,541

What might suit you is output control in PO where you can call a custom message type that triggers a custom IDOC for ME21/22N.

Please have a look at this blog that gives exacly that info how to customize custom output type with custom IDOC for PO:

https://blogs.sap.com/2009/11/10/configure-edi-message-control-base-on-purchase-order-case/

If I were you I would rather go for output control than a custom program that reads POs and triggers IDOCs.

Cheers,

Marek

6 REPLIES 6
Read only

MarekTurczynski
Contributor
2,542

What might suit you is output control in PO where you can call a custom message type that triggers a custom IDOC for ME21/22N.

Please have a look at this blog that gives exacly that info how to customize custom output type with custom IDOC for PO:

https://blogs.sap.com/2009/11/10/configure-edi-message-control-base-on-purchase-order-case/

If I were you I would rather go for output control than a custom program that reads POs and triggers IDOCs.

Cheers,

Marek

Read only

0 Likes
2,541

Many thanks for your detailed response.

I will follow these steps and check if this solves my requirement.

Read only

0 Likes
2,541

Hi everyone ,

I also need to achieve a similar functionality but for PM/QM module- Notification.

To gain clarity on trigger point, Wanted to understand where is the trigger point in this case - before commit work or after ??

Read only

Jelena_Perfiljeva
Active Contributor
2,541

Why is there a custom error logging tool needed? If there was any problem with output and IDoc was not generated then this will be reflected in the output processing log and NAST table. If there was any problem with sending IDoc the it'll be in the IDoc status.

This functionality actually works quite well in SAP and if you want something bigger you can easily build up on it to add a workflow or email notification. To be honest, creating custom logging here seems like reinventing the bicycle and adding another point of failure at the same time. Just sayin'...

Read only

Former Member
0 Likes
2,541

Thank you all for the help. We will be going for the steps suggested by Marek.

Read only

kjyothiraditya
Participant
0 Likes
2,541

Hi ,

If we use workflow, does it trigger before commit work or after ? Also can we trigger an idoc from workflow. Does it pose any problem as for idoc to be sent, we need again commit work. I have tried to generate idoc from a badi without commit work as we cannot have it in BAdi. But idoc was in status 30 and all the data I need was not available in BAdi. Actually I have to read additional data again from db tables after commit and trigger immediately. Any pointers please on how to achieve the same ??