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: 

BAPI extension for sales order creation

Former Member
0 Kudos

Hi Everyone,

We have a requirement to create sales order upload program.

Normally we can create using "BAPI_SALESORDER_CREATEFROMDAT2".

But we have a requirement to update below mentioned data when we create sales order.

1. Name of Requisitioner/Requester (EBAN - AFNAM)

2.Purchasing Group (EBAN - EKGRP)

3. Price in Purchase Requisition (EBAN - PREIS).

But we dont have feasibility to update this through BAPI, So we are thinking of BAPI extension.

Please help us how to proceed with this.

We also tried this with BDC but since table control is there its not working.

11 REPLIES 11

ashok_mohan
Participant
0 Kudos

Create a custom bapi ZBAPI. In that BAPI, call the standard bapi "BAPI_SALESORDER_CREATEFROMDAT2". If you get sales order number as output, then call the BAPI "BAPI_TRANSACTION_COMMIT". After commit bapi has been executed successfully, manually update the above mentioned tables.

Jelena
Active Contributor
0 Kudos

ZBAPI, seriously?

0 Kudos

If he is seriuosly in need to do additional updates along with sales order creation BAPI, then custom BAPI is needed according to my logic. Other logic is seriously appreciated.

"manually update" ?

We are discussing about creating a SO using a BAPI.Manually updation of the tables for PR details defies the basic concept of using a BAPI in the first place.

K.Kiran.

If you can't safely integrate something beneath the standard API shell - don't and simply stop there. Otherwise the "whole outside world" needing to interface with your system's business logic will need to know - the real business logic is accessible only via "ZBAPIs" anymore and not via the API it should have been under.

raghug
Active Contributor
0 Kudos

While you are at it - how about getting rid of the SAP Sales Order process and creating a custom one which manually does only the sales orders. That way you wouldn't have any problem creating them. You could even interface it to your calculator watch.

Jelena
Active Contributor
0 Kudos

OP clearly stated it's "upload program". This is likely just a standalone ABAP report. There is no indication anywhere in the post that any kind of interface (like RFC, web service and such) or any special functionality is needed.

From what I see, this does not even call for a special custom FM, much less a custom BAPI (surely you must understand the difference). What you are suggesting is a layer of complexity that is not necessary at all based on the OP.

raymond_giuseppi
Active Contributor

So you call BAPI_SALESORDER_CREATEFROMDAT2 and you want to change some values in the generated PR?

You could either call BAPI_PR_CHANGE on the generated PRs with, or use user exit USEREXIT_MOVE_FIELD_TO_ME_REQ of include MV45AFZB before PR creation to change the required fields value. (I'm afraid a BAdI like ME_PROCESS_REQ_CUST is not called outside of enjoy transactions and BAPI)

Regards,
Raymond

Jelena
Active Contributor

Of course you cannot update these fields because they are not part of the sales order. EBAN is the purchase requisition table. You might want to clarify what is it that you are trying to achieve exactly.

Former Member
0 Kudos

Actually we are trying to create third party sales order.

in this process when we give PLANT and hit enter then it will take us to to another screen where we have to give the above mentioned field values.

These three fields are mandatory and due to this even through "BAPI_SALESORDER_CREATEFROMDAT2", It is not getting successful(Sales order is not getting created).

Jelena
Active Contributor
0 Kudos

I suspect the items you've mentioned can be configured to be populated automatically (see this post). We use third-party orders but I don't recall such manual step in our process. We have a routine for price calculation.

Otherwise Google -> BAPI third party order site:scn.sap.com and you'll find some posts that suggest using EXTENSIONIN and mention some related SAP notes. You might want to search Notes as well since there might be newer ones. And there are many SCN posts on using doing BAPI extension in general, look it up.