cancel
Showing results for 
Search instead for 
Did you mean: 

OData Service with multiple entity set for Create SO:

former_member203894
Participant
0 Kudos

Hi Experts,

I want to create a OData service for create sales order, using BAPI_SALESORDER_CREATEFROMDAT2. For this I have created multiple entity/entity sets i.e. I need to pass Order Item, Order Partner and Partner Address as table fields to call above BAPI to Create Sales Order. Kindly suggest how to proceed further, because now I am little confused,  where (In Service Implementation) I should call the BAPI, because now I have three entity sets and of course there is no association in all of them. Probably I may be wrong in approaching "Create Sales Order" OData, Please advice. However, it is clear if I create a custom structure (Consist of mandatory fields from all the three above required entities) and fill all the fields in the single entity/entity set this is achievable, but I want to use the straight BAPI and use the table structures of the BAPI directly.

Thanks & Regards

Saurabh

Accepted Solutions (1)

Accepted Solutions (1)

EkanshCapgemini
Active Contributor
0 Kudos

Hi Saurabh,

There is association between your three entities: OrderHeader, OrderItem and OrderPartner. There may not be any referential constraint (no common key among all these) but still the association holds true.

You need to create association and navigation properties. Then you need to implement the create_deep_entity method in order to receive your payload and create a sales order. You can check this link on

Regards,

Ekansh

former_member203894
Participant
0 Kudos

Hi Ekansh,

Thanks for your reply, but still I am not aware of your point - "There may not be any referential constraint (no common key among all these) but still the association holds true." - How do I create this in OData service? it would be good if you share some example or screen shot.


Thanks & Regards

saurabh

EkanshCapgemini
Active Contributor
0 Kudos

Hi Saurabh,


"There may not be any referential constraint (no common key among all these) but still the association holds true."

I meant that there may not be any common property between Header entity and Item entity as I saw in the given BAPI table structures. But still you know that there is a association between these two. So you can go ahead and create a association but without providing referential constraints which is nothing but common properties. For example:

Since I am able to create associations, I went ahead and created navigation properties in header entity. Now I will pass my item level and partner level data to these nav. prop. in the payload and will receive all three in the deep_entity method(you have to implement the code).

Hope this makes the statement clear.

Regards,

Ekansh

HemendraS
Participant
0 Kudos

Hi Saurabh,

Ekansh is correct, "Where" to do this, please see below screen for your consideration. You will do while creating association wizard Step-2:

    

Thanks,

Warm Regards

Hemendra

Answers (1)

Answers (1)

former_member203894
Participant
0 Kudos

Thanks

Ekansh & Hemendra

If there is any issue I will get back to you guy's.