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: 

Reg: IDOC Purchase Order

Former Member
0 Kudos

Hi All,

I have a requirement to trigger a Purchase Order from Stock Transport Order (STO).

So whenever the STO is created, IDOC needs to be triggered & create a auto PO in the same client.

I tried with some examples from forum thread, but all goes in vain.

Could you please advice, what are all the steps needed to achieve this with in a same client. I have created a dummy logical system for Inbound processing with tRFC. Could you please advice this step is really needed.

Thanks & Regards,

Uswin

Edited by: Uswin B on Nov 21, 2011 11:40 AM

1 ACCEPTED SOLUTION

former_member186099
Contributor
0 Kudos

I am afraid whether there is any standard solution, but you can follow the below steps, where in it helps you to achieve with least coding and configs.

1) Use Message type PORDCR1

2) Create a output type with program BUS2012_ICH_R3 and subroutine SEND_PORDCR1.

3) Maintain distribution model and Partner profile for the same output type.

The above three steps triggers the outbound idoc

Now trick is to bring it back to the same system,

1) Create a ABAP port in WE21.

2) Create a Z function module using the standard signature (look for F1 of the field) and revert back the idoc to same system using FM APPLICATION_IDOC_POST_IMMEDIAT (check out, i hope this is correct FM)

3) Create partner profile with BAPI process code.

Cheers,

5 REPLIES 5

Former Member
0 Kudos

1. You need to setup output determination on the STO (transaction NACE, Application EF). You can create output type similar to NEU and assign it to o/p determination procedure linked to your STO document type. You can't use NEU though as it is configured to create ORDERS message type IDoc. To create PO you need message type PORDCR1.

2. You have to write your own function module to output IDoc of message type PORDCR1 and call MASTER_IDOC_DISTRIBUTE to trigger it. It is easy if you only map the minimum required fields so that the IDoc doesn't fail in syntax and take it from there. There are no standard functions that I know that created PORDCR1 message type IDoc (others chip in if you know). You need to create your own outbound process code with ALE processing as medium in the output type.

3. You can set the IDoc from the output type with direct 2 (as inbound) and set up partner profile in the output condition record to point to your inbound LS partner profile

4. You need to assign inbound message type:PORDCR1, IDOC type PORDCR101 and Process code: BAPI to your receiving LS partner profile

Those are the settings you need to do. I can't elaborate as there are many things specific to your implementation

0 Kudos

Hi Vishnu,

Thanks for your Reply.

I would like to confirm couple of things from you.

1. Do we need to set up both Outbound & Inbound parameters with Message type PORDCR1? If yes, sender would be Dummy LS & Receiver would be the Logical system of the client (Which is assigned to Client).

2. What is the process code that I need to use for Inbound.

Thanks & Regards,

Uswin

0 Kudos

You only need to create inbound partner profile parameter configured with BAPI process code and PORDCR1 message type. You will have to set the direction of the IDoc you create through STO output type to '2' and trick the system into taking it as an inbound IDoc type (we did similar things in our system before).

Outbound partner profile should not be created as you want the IDoc that you created through STO output be treated as an inbound IDoc by tricking the system, by manipulating the control record on it.

If I were to do this, I would first create a PORDCR1 IDoc in WE19 transaction manually and try to post a PO against an exist SO using the inbound LS partner profile configured with BAPI process code and PORDCR1 mess type and I will then take it from there.

Basically you need to set the control record on the PRODCR1 IDoc you create from the STO output, so that it will search for the inbound LS partner profile parameter you configured.

0 Kudos

Hi Vishnu,

I understand. Can I go ahead with tRFC port or do i need to set up ABAP port for this?

Regards,

Uswin

former_member186099
Contributor
0 Kudos

I am afraid whether there is any standard solution, but you can follow the below steps, where in it helps you to achieve with least coding and configs.

1) Use Message type PORDCR1

2) Create a output type with program BUS2012_ICH_R3 and subroutine SEND_PORDCR1.

3) Maintain distribution model and Partner profile for the same output type.

The above three steps triggers the outbound idoc

Now trick is to bring it back to the same system,

1) Create a ABAP port in WE21.

2) Create a Z function module using the standard signature (look for F1 of the field) and revert back the idoc to same system using FM APPLICATION_IDOC_POST_IMMEDIAT (check out, i hope this is correct FM)

3) Create partner profile with BAPI process code.

Cheers,