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

sales order creation using BAPI using IDoc

Former Member
0 Likes
3,132

Hi all,

I am getting an IDoc from PI server. I need to process that IDoc in SAP for which I have created a function module.

I need to read that IDoc in the FM.

Please give me sample code / procedure of coding step by step to validate the data from Idoc structure and creating sales order from the IDoc data.

Also tell me which BAPI / FM should I use to create sales order.

Thanks,

~Sachin

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,572

Actually I have additional fields for sales order at header and item level.

So I have extended order type ORDERS05 to ZFRORDERS05 with additional fields.

I am creating new FM now. I see that FM IDOC_INPUT_ORDERS is using BDC but I need to go for some FM to create sales order.

Please give me sample code for this FM.

Thanks,

~Sachin

4 REPLIES 4
Read only

Former Member
0 Likes
1,572

Hi,

Use this FM IDOC_READ_COMPLETELY to read idoc data.

Use this BAPI SALESORDER_CREATEFROMDAT2 to create sales order.

Regards,

Shanmugavel Chandrasekaran

Read only

Former Member
0 Likes
1,572

why are you not using the standard IDOC_OUTPUT_ORDERS function module, and reading in the IDOCS by attaching the port/message type/process code combination to this function module ?

Then the orders will be created by standard SAP.

Read only

Former Member
0 Likes
1,573

Actually I have additional fields for sales order at header and item level.

So I have extended order type ORDERS05 to ZFRORDERS05 with additional fields.

I am creating new FM now. I see that FM IDOC_INPUT_ORDERS is using BDC but I need to go for some FM to create sales order.

Please give me sample code for this FM.

Thanks,

~Sachin

Read only

0 Likes
1,572

Hi Sachin

Extended order type ORDERS05 to ZFRORDERS05 with additional fields is goodu2026

But you can write user exits to populate the additional field to sale order fieldsu2026.

And FM IDOC_INPUT_ORDERS will post the data and create the SALES ORDERu2026

This is standard function every industry will followu2026. And this is recommended.

If you want to create custom FM then call (BAPI_SALESORDER_CREATEFROMDAT2 Sales order: Create Sales Order) in you custom FM.

Thanks

Ramesh