cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger an outbound Idoc when a PR is created.

masna_7
Participant
0 Kudos
141

Hi Peers,

 

I have a requirement to trigger an outbound Idoc whenever a PR (Purchase Requisition) is created. 

Idoc types : Create : PREQCR104, Change : PREQCHANGE04.

 

I have found out that this can be achieved through a FM ALE_PR_CREATE. But, I am not sure how to achieve this. Any pseudo code or other possible ways is greatly appreciated.

 

Thanks and Regards

raymond_giuseppi
Active Contributor
0 Kudos

(removed)

View Entire Topic
raymond_giuseppi
Active Contributor
0 Kudos

You can call this FM and generate an IDOC thru a BAdI such as ME_PROCESS_REQ_CUST or (better) ME_REQ_POSTED but not thru NACE (AFAIK only PO not PR - A Purchase Requistion is an internal document that is not meant to be sent externally)

You could also consider using FM MASTER_IDOC_DISTRIBUTE and not ALE_PR_CREATE or CHANGE (more threads available)

masna_7
Participant
0 Kudos

Hi Raymond, If I understood correctly, you are asking me to use FM ALE_PR_CREATE in BADI ME_REQ_POSTED ? and when all the PR details are entered in ME51N and after clicking on Save button, this FM will trigger an outbound Idoc with the details passed on to it ?

raymond_giuseppi
Active Contributor
0 Kudos
Personally, I would have called the FM MASTER_IDOC_DISTRIBUTE in the POSTED method of the BAdI ME_REQ_POSTED, but that's the general idea.
masna_7
Participant
0 Kudos

thanks for the suggestion, The Idoc has to triggered in two cases here

1. Create : trigger an Idoc when PR is Created

2. Change : Create an Idoc when PR is Changes

 

The Idea is to use FM : MASTER_IDOC_DISTRIBUTE in IF_EX_ME_REQ_POSTED~POSTED of BADI ME_REQ_POSTED. 

 

I will try to trigger an Idoc as per your suggestion and let you know the results

 

Regards,

raymond_giuseppi
Active Contributor
0 Kudos

You may also consider PR deletion (another IDOC)

Look also at FM such as

  • OWN_LOGICAL_SYSTEM_GET
  • EDI_AGREE_OUT_MESSTYPE_READ

to initialize some technical data

 

masna_7
Participant
0 Kudos
Hi Raymond, the same BAPi can be used for PR Create and PR Change ?
raymond_giuseppi
Active Contributor
0 Kudos
Yes you can use this single FM for many IDOC types (fill the field IDOCTP of parameter MASTER_IDOC_CONTROL)