$(function () { pageContext.i18n.modTalk = 'moderation talk'; pageContext.i18n.replyToComment = 'Reply'; pageContext.i18n.modTalkEmpty = 'moderation talk is empty'; pageContext.url.getModTalk = "/comments/%25ID%25/listModTalk.json"; pageContext.url.possibleCommentRecipients = "/comments/%ID%/possibleRecipients.json"; pageContext.url.commentEdit = '/comments/%25ID%25/edit.html'; pageContext.url.commentView = '/comments/%ID%/view.html'; pageContext.i18n.commentVisibility = { 'full': 'Viewable by all users', 'op': 'Viewable by the original poster', 'mod': 'Viewable by moderators', 'opAndMod': 'Viewable by moderators and the original poster', 'other': 'Advanced visibility', 'dialogTitle': 'Comment visibility', 'selectGroups': 'Visible to groups', 'selectOther': 'Other recipients', 'selectOriginalPoster': 'Original poster', 'selectModerators': 'Moderators', 'selectAssignees': 'Asked to answer users' }; pageContext.i18n.commentMenuLabels = { 'comment-edit': 'comments.menu.edit', 'comment-delete': 'comments.menu.delete', 'comment-convert': 'comments.menu.convert' };pageContext.i18n.answer= { bestAnswer: 'Best Answer', controlBar : { accept: 'Accept', unaccept: 'Unaccept', acceptCommand: 'Accept this answer as correct', cancelAcceptedCommand: 'Remove this answers accepted status' } }; window.croles = { u: false, op: false, m: false, og: false, as: false, ag: false, dc: false, doc: false, eo: false, ea: false }; tools.init({ q: { e: false, ew: false, eo: false, r: false, ro: false, d: false, dow: false, fv: false, c: false, co: false, p: false, tm: false , ms: false, mos: false }, n: { f: false, vf: false, vfo: false, vr: false, vro: false, c: false, co: false, vu: false, vd: false, w: false, wo: false, l: false }, c: { e: false, eo: false, d: false, dow: false, ta: false, tao: false, l: false }, a: { e: false, ew: false, eo: false, d: false, dow: false, a: false, aoq: false, ao: false, tc: false, tco: false, p: false, tm: false }, pc: croles }, { tc: true, nsc: true }); commandUtils.initializeLabels(); }); Skip to Content

BAPI extension for sales order creation

Oct 31, 2016 at 10:38 AM


avatar image

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 |10000 characters needed characters left characters exceeded

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.


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).

* Please Login or Register to Answer, Follow or Comment.

3 Answers

Raymond Giuseppi
Oct 31, 2016 at 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)


10 |10000 characters needed characters left characters exceeded
Ashok Mohan Oct 31, 2016 at 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.

Show 6 Share
10 |10000 characters needed characters left characters exceeded

ZBAPI, seriously?


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.


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.


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.


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.


"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.


Jelena Perfiljeva
Nov 02, 2016 at 04: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.

10 |10000 characters needed characters left characters exceeded