Adding item positions with reference to contract in sales order

Hi all,
I would be very grateful if some of you could help on this:
I have a requirement to add lines with reference to a contract while the user is creating or modificating it via VA01 or VA02. The logic flow will be as follows:
if the user enters a new item position with reference to a contract, and the qty entered exceeds the qty in the position selected of the contract, we have to skip the standard error message and try to spli the quantities in several positions with the same material in the contract.
As an example:
the contract 000000000001 has 5 lines:
line     material       qty
01       mat1           100
02       mat1           50
03       mat1           50
04       mat2           n/a
05       mat2           n/a
if the user picks up the line 02 of the contract to create a new line in the sales order, and enters 180 as qty, the sap standard will raise an error, saying the qty has exceeded the contract qty. Ok, we have to skip that error (maybe could we set it as a warning??) and 'split' the qty as follows:
in the sales orders, 3 lines will be created automatically
line    material     qty
     mat1         100
     mat1         50
     mat1         30
and of course, the released quantities in the contract must be updated: i.e the contract should be as follows:
line     material       available qty
01       mat1           0
02       mat1           0
03       mat1           20
Any ideas? : )
What i've done by the moment is to check is that 'split' is possible, in userexit_save_document. If not (e.g. if the user enters 220 for mat1 in the previous example), a custom error will appear. If it is possible, then the sales order will be created (only with the line the uswer entered) and I will trigger somehow a FM processed in background to modify the sales order.
my question now is: how can i add lines to the created sales order, making reference to some contract lines?
I've seen BAPI BAPI_SALESORDER_CREATEFROMDAT2 is used to create a document with reference, but can i use it to MODIFY an existing sales order?
any help would be greatly appreciated.
thanks a lot for your help.
regards.

Hello,
there's a function module called 'BAPI_SALESORDER_CHANGE', which could change a sales order. The problem could be,that these BAPI's enque the salesorder. So if you start them in background via an userexit, you have to be sure that the salesorder is updated and dequeued by posting.
An other way could be to use the exit 'userexit_check_vbap' in MV45AFZB. It's called after creating a new position or changing a position. All existing positions at that time in a internal table 'XVBAP', which you could change. (But be carefull, that you don't create an endless loop !).  
The check about the contract quantity is in a form routine called 'vbep-wmeng_pruefen_folgebeleg(sapfv45e)'.
Have a look into the form 'vbap_pruefen_ende' in FV45PFAP_VBAP_PRUEFEN_ENDE. There's the whole thing done including the call of the userexit.
Regards Wolfgang

Similar Messages

  • Creation of compliants with reference to r/3 sales order.

    dear friends
    Is it possible to create compliants in CRM with reference to r/3 sales order? if answer is yes please provide  the solution how to configure the same.
    regards
    naveen

    Hi Naveen
    I dont know why you want to create complaints with respect to the sales order.
    The usual process the companies follow is to create complaints wrt to the invoice number.
    But incase you wish to create complaints wrt to sales order, then you can use implementation of a BAdI CRM_COPY_BADI_EXT for the same in the CRM system which will allow you to create a complaint in CRM System wrt sales order in ECC.The path for the same in CRM system is IMG>CRM>Transactions> Settings for Complaints> Integration>Business Add-Ins for Document Referencing> Business Add-In: Create Complaints with Reference to External Document
    Secondly maintian the assignment between the Business Object type of referenced doc and Transaction type using path IMG>CRM>Transactions> Settings for Complaints> Integration>Business Add-Ins for Document Referencing> Assign Business Object Types to Transaction Types
    Now go to CRMD_ORDER and open the transaction type CRLP, you will get pop-up for creation of complaint where you can choose the transaction type and business object type and reference sales order number/ invoice number and create the complaint.
    Hope this will help
    Regards,
    Rekha Dadwal
    You gain a point for every point that you reward. So reward helpful answers generously

  • BAPI to create a billing document with reference to delivery or sales order

    Hi,
    Does anyone know any BAPI or function module that allows the creation of a billing document with reference to a sales order or to a delivery.
    Maybe the BAPI_BILLINGDOC_CREATEFROMDATA may be used to create a billing document with reference to a sales document, but i'm looking for a solution where I only need to indicate the number of the reference sales order or the reference delivery and maybe some few data more without the need of transfer all the items and conditions information.
    Thanks.
    Kind regards,
    Paulo Sousa

    Hello Paulo,
    To create a billing document based on a delivery use BAPI_BILLINGDOC_CREATEMULTIPLE. In table BILLINGDATAIN insert one line with the following data:
    REF_DOC = Delivery number
    REF_DOC_CA = 'J'
    If it runs fine, table SUCCESS will bring back useful data, like BILL_DOC (Billing document number).
    Regards,
    Joã

  • Error while copy with reference of quotation to Sales Order

    Dear All
    I am creating the sales order with reference to quotation . while , doing so , I get an error of
    Customer not maintained in Distribution channel - 'D1' .
    The Quotaion is having following structure
    Sales Organisation -- AAAA
    Distribution Channel - S7
    Division                     - D3
    But while copy the error erupts notifying to create the customer master for division 'D1' . If created of division D1 then the sales order is created with reference of quotation.
    Kindly guide.
    AVS

    Perhaps the configuration settings have been changed (to make D1 the reference division for D3 for master data ) since the quotation was originally created.

  • Want to procure material  with reference to WBS and sales order

    Dear all
    If i have assigned account assignment in PO means then while GR my material value is going to consumption. I dont want to book consumption at GR level i want to do consumption at delivery level. Also i want to procure material for particular WBS and Sales order.
    How to process the same. Kindly give some idea.

    Hi
    If you wanna toprocure the material wrt to WBS element or sales order the you have to make use of the Account assignment category P- projects ( That can be WBS elements /network ) And sales order C or any specific account assignment category created by you.
    Example :
    Sceneraio- When you are creating a slea order in SAP by T.code VA01 then at time of saving the SO the system is creation the WBS automatically ( that has to be mapped in SAP) .The Sales order number and the WBS element are  same .When you are cretating PO for  the Material wrt to  this WBS element then the system at time of the GR will be posting the consumption account which is booked to WBS element that in turn against the particular sales order.
    In SPRO - customizing i for the account assingment category P  in the Consumption Value is V
    Which is posted to consumption at time GR. Please  try create new account assignment category
    Consumption Value is E i.e accounting by sales order .
    Regards

  • PO with reference to contract nett price decimal place

    In a PO  with reference to contract when user ordered qty 0.046 and contract price = $100.00 with a 7 % tax rate, SAP takes (0.046 * 100) * 1.07 = 4.922
    However as PO is up to 2 decimal place, the nett price is cut off to 4.92
    Thus calculation of PO price (4.92 / 0.046) = 106.95652173u2026
    When rounded off to 2 decimal places, it becomes 106.96
    But in actual fact, it should 107.00
    Is there any way I can bypass this error?

    HI,
    The only solution I see is to create smaller unit of measure in a way that instead of ordering  0.046 you order 46, 0r 460.
    Best Regards,
    Arminda Jack

  • Problem in Sales Order Creation with reference to Contract

    Hi All,
    We had enhanced Contracts (VA41) by adding fields thru append structures in VBAP and the same is provided in the "Additional Data B" tab at the item level.
    The Z fields are populated with data and gets saved along with the contracts line items.
    But when a sale order is created with reference to a contract, the data in the Z fields (maintained in Append Structures) of the contract are not getting copied to the line item of Sales orders.
    Should a routine be necessarily written for copying Z fields from contract to Sales orders or Copy control must be set up for Z fields separately?
    Any info on this would help.
    Thanks,
    K.V.Venkatasubramanian

    Hi VJ,
    The copying from Contract to Orders worked. I copied the standard routine (151) in data transfers and added the code to transfer Z fields from work area CVBAP to work area VBAP and attached the same in the copy control. It works!!!
    Thanks for the help VJ.
    Cheers,
    Venkat

  • Error while posting a sales order created with reference from contract for

    Hi,
    I am posting a sales document( Type: WA)  created with reference from contract document(  type wk2) for delivery.  The item category in the sales order of the Item is WAN. On posting this document for delivery I am getting the error as "Item category WAN is not defined".  Please help me out how to resolve this issue.
    Thanks
    Jayant

    Hi Jayant,
    I think its value contract releated error,
    You suppose to check material item category group through T.code-MM02 into sales2 tab and maintain VCIT,
    and do item category assignment through T.code- VOV4.
    plz.maintain like that,
    WK2 -          -VCIT-         -           - WAN(contract item category),
    wk2  -          -        -VCTR-          - WAN((contract item category),
    you should also maintain same against your standard Sales Document type and for Standard Item category into VOV4,
    WA(standard docu.type) -VCIT-                             -                -TAN(your standard docu.type item category),
    WA(standard docu.type) -         -VCTR(item usage)-              -TAN(your standard docu.type item category),

  • Create a Sales Order with Reference to Contract using IDoc / LSMW  ( AFS )

    Hi Gurus,
    I need to crate a Sales Order with reference to a Contract. I need to upload Sales Orders with reference to contract via LSMW.
    So far, I've been able to create the Sales Order with ref to contract. But, the Sales Order Quantity is not getting deducted from the Original Qty in Referred Contract ( When try to create another Sales Order referring to the same Contract.) When a Sales Order is created manually, this is working fine.
    Please tell me if I've missed some parameter which stopping it create the link to exact schedule line ( Sizes level )
    The Details of the IDoc which is been created via LSMW are as follows;
    Message Type: ORDERS
    Basic Type     : /AFS/ORDERS05
    Process Code : ORDE / DELO
    ( Tried with both process codes.  But the Identification is the same for both: IDOC_INPUT_ORDERS )
    *_In Header;_
    Segment : E1EDK02  - IDoc: Document header reference data *
    Qualifier : '043' - Vendor Contract Number ( Tried with ' 005' - Customer Contract, but it's not working )
    Contract Order is mapped for field BELNR
    *_In Item;_
    Segment : E1EDP02  - IDoc: Document Item Reference Data *
    Qualifier : '043' - Vendor Contract Number ( Tried with ' 005' - Customer Contract, but it's not working )
    Contract Order is mapped to field BELNR
    Line Item of the Contract is mapped to field ZEILE
    I also tried passing the Schedule line of Contract in Segment :  E1J3P01 AFS IDoc: Doc.item general data
    to following fields;
    J_3AETENV
    J_3AVGETE
    /AFS/UETENR
    Still its not getting updated in the VBEP also..
    Please help me with regard to this. Points will be awarded for your valuable contribution.
    Thanks.

    Hi,
    This issue is been resolved.
    One of my friend helped me with resolving this issue..
    Once the below mentioned configurations were done on SPRO, the Sales Order was created with reference to Contract and the Qty was reflected when tried to create a new Order referring the same contract.;
    u2022     SPRO --> SD  -->Sales  --> Sales Documents  --> Sales Document Header  --> Define Sales Document Types  --> Field : Outline agreement message; from blank to u201CBu201D.
    u2022     SPRO  -->SD  -->Sales  --> Sales Documents  --> Sales Document Header  --> Maintain Sales Document Types for AFS  --> Field : Outline agreement message; from blank to u201CAu201D

  • Creation of Purchase requisition with reference to Contract documents

    Dear All
    I am not able to create the Purchase requisition with reference to Contract documents, in outline agreement field if I enter the contract document number which is already existing it is not copying the details, again I have to enter all the details like Plant, Material, document type, Qty etc.  Even after selecting the PR document type as RV for outline agreement also it is not coping. Kindly let me know that can we not able to give reference of Contract number in this outline agreement field to create Purchase requisition.
    regards
    Dhanu

    1.Logistics--Materials Management--Purchasing ---Purchase Requisition --Follow-on functions --- Assign and Process
    2.ME57
    3.Select the Assigned Purchase Requisitions checkbox if you also want to see requisitions already assigned, and choose Execute.
    4.On the Assign and Process Purchase Requisitions screen, select the requisition lines for your material.
    5.Choose Assign Manually if the info record already exists.
    6.On the pop-up Assign Source of Supply Manually dialog box, make the following entries:
    Agreement     46XXXXX            Agmt item     10          
    7.Choose Assign Source of Supply.
    For assign the source of supply, you can also choose Assign Automatically (only if not already assigned by MRP due to existing source list). If more than one source exists, select the contract in the Source Overview for Purchase Requisition 100XXXXX window and confirm with Enter.
    When assigning a source, make sure to select the contract.
    8.Choose Save.
    9.Select the line item, and then choose Assignments Overview (SHIFT+F5).
    10.On the Assign and Process Requisitions: Overview of Assignments screen, select the line below Vendor (you can only select one at a time), then choose Process Assignment.
    11.On the Process Assignment: Create PO window, check and make sure the Order Type (NB), Purchasing Group and Purch. Organization fields then choose Continue (Enter) to confirm.
    12.On the Create Purchase Order screen, select the requisition in the Document Overview section and choose Adopt in the left part of the Document Overview screen.
    13.Choose Save.

  • Doubt in creating a sales order with reference to contract

    Hi all,
    when I create the sales order with reference to contract, in the table VBFA, the field PLMIN is set to zero some times and set to '+' some times. May I know whats the functionality behind this. Any pointers on this will be helpful.
    Regards,
    A.Rathinaprakash

    Hello A.Rathinaprakash,
    This is an Indicator which indicates the quantity or value in the target document(means Sales order) has a negative effect, positive effect, or no effect at all on the quantity still to be completed in the source document(means contract).
    Example from the Help file..
    In sales documents, for example, you can expect the following results:
    Quotation   -> Sales order: positive effect
    Contract    -> Return: negative effect
    Sales order -> Sales order: no effect
    In billing documents, for example, you can expect the following results:
    Delivery    -> Invoice: positive effect
    Delivery    -> Cancellation: negative effect
    Delivery    -> Pro-forma invoice: no effect
    Hope it helps..
    Regards,
    HP

  • Creation of Release order with reference to Contract

    Dear experts,
    We are doing upgradation from 4.6B to ECC6. During testing ,while creating release order with reference to contract,(Contract was created with Account assignment category-K and item category-D),cost center is copied from contract in purchase order in account assignment tab of item details,
    but when i save it window is poping up(account assignment service line item 10-small window) asking to enter cost center again. Even if i enter the same cost center in that window,cost center field,again it is asking same window is poping up for entering cost center.
    Can any body please tell me inspite of cost center is copied,why this window is coming ,please suggest.This problem is not there in 4.6B version
    Advance thanks,
    Regards,
    Dayanand

    Please check to OXK1, and compare it to both system.Or check the config guide in IMGMM-Purchasingacc.assigment--Set subscreen for acc assingment (coding) block.

  • Issue with Scheduling agreements created with reference to Contract

    We create scheduling agreements only with reference to contracts. A contract may have multiple Scheduling agreements linked to it. Now the problem is that when a scheduling agreement is being modified, it is creating a lock to all the other scheduling agreements which refers to the same contract. So till the time the user is out of change mode in Scheduling agreement, no other user is able to perform any transactions pertaining to other scheduling agreements (referring to the same Contract)
    Is there anyway that we can address this?? Please suggest.

    The record locks are needed to avoid data inconsistencies. If 2 users would be able to have the same document open in update mode, then how can you decide which entry will be used  for a table update? And what would you tell the other person? (Oh sorry, another user was quicker, please start all over again)
    In some high frequent transactions SAP has developed some options like late locks for good movements, but more often you have to take organization measures like educating the users, and maybe reducing the number of items in a document and creating more documents instead.
    If it is a real big headache then you have to talk to SAP, have to explain the situation, and hope that they either have already a solution or even realize that it is not needed to lock all and can create a solution per OSS note.

  • Service PO with reference to Contract

    Hi
    Can anyone help me out, when i create Service PO with reference to service contract system is not copying service line item detail from the contract with Full quantity as it was declared in Contract.
    For example in Contract service line item with quantity 10 EA. when i creating PO with reference to contract system only pick Service header line and when select the service line from service selection button system will only 1 quantity each time so that  in order to create PO with full quantity so you have to select 10 times each service line item.
    Kindly look into this.
    Regards,
    Muhammad Tahir

    Hi,
    Deleted by Moshe Naveh
    Regards
    Raj.
    Edited by: Moshe Naveh on Dec 21, 2011 2:05 PM

  • How to control Order/Target Quantity with reference to Contract Quantity

    Hello GURUs,
    In my current organization, there is one scenario in which i have to control target quantity in sales contract e.g., i have created sales contract of 100 MT (contract no : 123), and with reference to that contract i have created another contract for say 100 MT (contract no : 456), after that i have changed quantity (of contract no 456) to 150 from original quantity 100. In this case system allows to do so, which is not correct, and i want same to be control based original contract quantity.
    Is there any solution in standard system to control the same? If there is any then pleas let me know.
    Thanks,
    Pratik

    Hello,
    Let me clarify your requirement:
    You have created Contract no. 456 (100 MT) with reference to another Contract No. 123 (100 MT).
    Now you want that system should not allow to change quantity in Contract no. 456 & keep it as it is (100 MT) in Original Contract No. 123.
    Now, if the above requirment is from Sales Order created with reference to Contract then it can be easily don thru Item Category Controls.
    But as the second COntract (456) is entirely a new Contract with it own contral parameters (validity dates, etc) system will allow you to change Quantity & other feilds).
    You requirment is not standard & will have be achieved thru applying a User Exit. Speak to your ABAPer & he would do the needful .
    Hope this helps,
    Thanks,
    Jignesh Mehta

Maybe you are looking for

  • How do I find the file that spotlight index is stuck on? (already know the file name)

    I was re-indexing my whole drive and it was going pretty smoothly until it was stuck for about 24 hours. When i took a look in console, this is what appeared: mdworker32(7488) deny iokit-open IOHIDParamUserClient (Importing type 'com.makemusic.mus' u

  • Error while accessing Collaboration Demo - Outlook Web Access - Contacts

    Hi Experts, I am trying to use Contacts utility of Collaboration. For this purpose, I have assigned myself "Collaboration Demo" role. I am clicking on following link: Collaboration Demo ->Outlook Web Access ->Contacts. I am getting following error me

  • Can you install a program...

    Can you install a program, like the sims 2, to an external hard drive? Sorry is this has been asked a million times iMac G5 (without iSight)   Mac OS X (10.3.9)   Goldfrapp Fan

  • Where can I download example projects for Kinect for Windows v2?

    so for a project I am working on regarding the Kinect v2 I had initially planned on using Matlab to code for the Kinect. However, the code on the Mathworks website regarding the Kinect seems to only work with the Kinect v1 and I cannot figure out how

  • ProcessBuilder Syntax errors

    Hi, I'm getting syntax errors with the following two statements x ProcessBuilder pb = new ProcessBuilder("xxx.exe"); x pb.command(filename); It says there is no such constructor for the first statement. For the second one, no such a method for the da