10-31-2016 10:38 AM
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.
10-31-2016 11:01 AM
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.
10-31-2016 3:27 PM
11-01-2016 5:20 AM
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.
11-01-2016 6:16 AM
"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.
11-01-2016 6:40 AM
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.
11-01-2016 8:56 AM
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.
11-02-2016 3:57 PM
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.
10-31-2016 12:26 PM
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
10-31-2016 3:25 PM
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.
11-01-2016 4:57 AM
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).
11-02-2016 4:07 PM
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.