How to prevent  Sales Orders to be added if the BP...

does not have enough funds (considering other open orders).
I have a problem where operaters can add as many sales order for a BP as they would like as long as the total amount on the order is below his available credit (OCRD_CreditLine minus OCRD_Balance)
I would like to add a stored procedure that will also take OCRD_OrdersBal into consideration.
If a BP has a credit limit of 50,000 and account balance of 31,000 and no other open orders, any order with a document total of 19,000 or less should be allowed to be captured.
If however the BP has a credit limit of 50,000 and account balance of 31,000 with a open order of 10,000, no orders above 9,000 should be able to get added.
Hope how I explained make sense?
All help will be greatly appreciated.

Skillet wrote:
Manvendra Singh Niranjan wrote:
> Hello,
> > Try this in SP_transaction Notification it will work
> > -
Order Amount Value----
> > IF (@transaction_type = 'A' Or @transaction_type = 'U')  AND @object_type = '17'
> > BEGIN
> > Declare @OpenOrderAmount as decimal(10,2)
> > Declare @CreditLimitAmount as  decimal(10,2)
> > Declare @CurrentOrderAmount as decimal(10,2)
> > Declare @Balance as  decimal(10,2)
> > Declare @AvailOrder as Decimal(10,2)
> >
> > Set @CreditLimitAmount = (Select CreditLine from OCRD where CardCode = (Select CardCode from ORDR where DocEntry =@list_of_cols_val_tab_del))
> > Set @Balance = (Select Balance from OCRD where CardCode = (Select CardCode from ORDR where DocEntry =@list_of_cols_val_tab_del))
> > Set @OpenOrderAmount = (Select OrdersBal from OCRD where CardCode = (Select CardCode from ORDR where DocEntry =@list_of_cols_val_tab_del))
> > Set @CurrentOrderAmount = (select Convert(decimal(10,2),DocTotal) from ORDR where DocEntry =@list_of_cols_val_tab_del)
> > Set @AvailOrder = (@CreditLimitAmount-(@Balance +@OpenOrderAmount))
> >
> > If @AvailOrder < @CurrentOrderAmount
> >      begin
> >           SET @error = 10
> >           SET @error_message = N'Total Order Amount Should be ' + cONVERT(NVARCHAR(20),@AvailOrder)
> >      end
> > END
> > -
End----
> >
> >
> > Thanks
> > Manvendra Singh Niranjan
>
> Hi Mavendra
>
> You query worked wonderfully! I had to make a few small changes to have work 100%:
>
>
> IF (@transaction_type = 'A' Or @transaction_type = 'U')  AND @object_type = '17'
> BEGIN
> Declare @OpenOrderAmount as decimal(10,2)
> Declare @CreditLimitAmount as  decimal(10,2)
> Declare @CurrentOrderAmount as decimal(10,2)
> Declare @Balance as  decimal(10,2)
> Declare @AvailOrder as decimal(10,2)
> Declare @ExceedOrder as decimal(10,2)
>
> Set @CreditLimitAmount = (Select CreditLine from OCRD where CardCode = (Select CardCode from ORDR where DocEntry =@list_of_cols_val_tab_del))
> Set @Balance = (Select Balance from OCRD where CardCode = (Select CardCode from ORDR where DocEntry =@list_of_cols_val_tab_del))
> Set @OpenOrderAmount = (Select OrdersBal from OCRD where CardCode = (Select CardCode from ORDR where DocEntry =@list_of_cols_val_tab_del))
> Set @CurrentOrderAmount = (select Convert(decimal(10,2),DocTotal) from ORDR where DocEntry =@list_of_cols_val_tab_del)
> Set @AvailOrder = (@CreditLimitAmount-(@Balance @OpenOrderAmount)__ @CurrentOrderAmount_)_
> set @ExceedOrder =(@CurrentOrderAmount-@AvailOrder)
>
> If @AvailOrder < @CurrentOrderAmount
>        begin
>                SET @error = 13
>                SET @error_message = N'Total Possible Order Amount is Only M ' + cONVERT(NVARCHAR(20),@AvailOrder) + N' You Have Tried to Exceed this by M ' + cONVERT(NVARCHAR(20),@ExceedOrder) + N' Please Reduce the Order and Try Again - THANK YOU'
>           end
> END
>
>
> Only problem I have now is that the error message that gets displayed when the conditions are not met, is one of the other messages from another code that i have written to do weight checking. If I remove that other codes it works fine. Why could this be?
Wrong error code message fixed by adding my new code to the bottom of the list of codes. Thanks!

Similar Messages

  • How to update sales order number (KAUFN) characteristic in the profitability segment of the PA document created at the time of service entry sheet confirmation, as a result of shipment cost document

    Hi,
    We have a scenario wherein we create shipment cost documents against delivery. As a result of shipments fully transferred, a PO for freight vendor is automatically created and a service entry sheet confirmation happens. As a result of service entry sheet confirmation, we have Financial accounting, Controlling and profitability analysis documents created. We have a requirement wherein we need to have the characteristic “sales order number (KAUFN)” populated in the profitability analysis document created as a result of service entry sheet confirmation.
    Could someone please advice how could this be attained in COPA. Thanks for your help in advance.
    Regards,
    Sandeep

    Hi Ajay,
    Thank you for the quick update.
    The document is updated to COPA through OKB9 settings. The profitability segment is updated with fields like customer, product, company code, plant, sales area data, profit center, etc; however the sales order number is missing.
    Could you please elaborate further how could FI substitution be implemented to call for the FM COPA_PROFITABILITY_SEGMENT through user exit? Are you recommending the substitution through GGB1? What could be the possible validation to call for the user exit to be implemented?
    Regards,
    Sandeep Kulkarni

  • How to drive sales order Organizational Unit to equal the Sales Office

    CRM 7.0, sales order is using org rule ORGMAN_23 which has FM CRM_ORGMAN_ORGOBJECTS_FIND_11
    The sales order finds the sales org, dist channel, division, sales office, and sales group but the Organizational Unit always matches the sales group.
    Will any of the delivered FM's used in PFAC
    CRM_ORGMAN_ORGOBJECTS_FIND_1
    CRM_ORGMAN_ORGOBJECTS_FIND_2
    CRM_ORGMAN_ORGOBJECTS_FIND_3 ......
    return the results I desire? or will we need to copy and modify one of these FM's.

    Hello,
    You need to adjust your org structure in ppoma_crm.
    Currently the org unit which is mapped to an ECC sales group holds the attributes that mapped to the BP's sales area data.
    (If you are using rule ORGMAN_23).
    Please create an org unit, which is not mapped to the sales group, with the desired attributes, then assign the BP to this org unit.
    Best regards,
    Maggie

  • How to display Sales order creater and whole modified the SO, when modified

    Dear ,
       I want to know a Sales order whol created it, and who modified it , which time modifed. What can I do?

    Hi,
    Go to VA02, then select Environment -> Changes -> Click on Additional Info .
    If you want to check a particular line item , you can put the item number in the Item field.
    Otherwise if you want to look at the entire order changes, then just leave it blank and click on execute.
    Now double click on any of the action and you would be able to see the previous and the changed value.
    Hope it helps you.
    Reward points if helpful.
    Regards
    Ravi

  • Prevent Sales order Duplication

    Hi gurus,
                If anyone could help me in preventing Sales order Duplication ?
    The scene is My customer orders me through phone-call and for that particular P.O I have created a Sales Order and when i am not in my seat ,one of my colleague gets the same order from the Customer by Fax and he also creates  a new sales order and now the material will be allocated for both cases.
    How can we prevent it by throwing an error when he tries to create a new sales order for an existing order?
    Regards,
    S.Ravi kumar

    Hi,
    As already suggested to you by others that you can configure the documet type to check the duplicate PO number.
    I would like to add some points to this.
    in standard SAP this message comes as a warning.Means you can still process the new document with same PO number.
    If your requirement is that system should not allow at all (Error message) then proced as below.
    1.Check the message number the system gives as a warning for PO number duplication.As per me it should be
    V4,115,Purchase order number in document number: & already exists
    Check in your system.
    1.Go to Tcode OVAH.Select the message and change the message category at extrem right side from W(Warning) to E(Error)
    So with this if system find same PO number,you will not able to proceed furthur.
    Reward points if helpful
    Regards,
    Amrish Purohit

  • How to compare sale order bom and production order bom.

    i would like to provide report with respect to comparation of sale order bom and production order bom, but i am not familiar with SD and PP, can anyone give me some clue? i only know sale order bom is created via 'CS61', afterwards run mrp to get production order, the process appears complicated, i needn't know the process detail, just want to know how to get sale order bom and relative production order bom. please guide me.

    Hi,
    Check Tcode:CS14 to SD/PP BOM's
    Chidambaram

  • WMS :  How to Process Sales Order Released before Turning on WMS

    Hello Gurus,
    How to process sales orders released before WMS enable flag is turned on in the  new WMS enviournment in Oracle 11.5.10 ?

    Helios,
    Thanks for the document.
    I m looking for how to perform Pick confirm transactions for already printed Pick slips before WMS enabled flag is turn on for the org.
    One option is to close all the deliveries  but if there is no on hand at that point the they will remain option.
    Other option is to Back order those deliveries and re release them post wms enable flag is turned on... The only issue i see here is that if there are more new orders for one of the items  and the orders are released then which orders will get allocated/reserved if there is limited on hand quantity to statisfy the SO need.
    Let me know if you can think off some alternative solution.
    Apprecite help !!
    Thanks,
    Sam

  • How to Add Sales order from one database to another database

    Hi All,
    I am trying to add sales order with sales order object.
    I have completed connectivity from one database to another database.
    but i am unable to post sales order with orders object.
    My code is
    ObjSales = objMain.objUtilities.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
                ObjSales.DocDate = Date.Parse(System.DateTime.Now().ToString("d"))
                ObjSales.DocDueDate = Date.Parse(System.DateTime.Now().ToString("d"))
                ObjSales.TaxDate = Date.Parse(System.DateTime.Now().ToString("d"))
                ObjSales.CardCode = "C0006"
               ObjSales.Series = 92
                ObjSales.PaymentGroupCode = 3
                ObjSales.Comments = "vivek"
               ObjSales.Lines.Add()
               ObjSales.Lines.SetCurrentLine(1)
               ObjSales.Lines.ItemCode = "5127"
               ObjSales.Lines.Quantity = 100
               ObjSales.Lines.UnitPrice = 10
               ObjSales.Lines.WarehouseCode = "01"
                ObjSales.Lines.TaxCode = "0"
                ObjSales.Lines.DiscountPercent = "0.00"
                ObjSales.DocTotal = 1000
                 If ObjSales.Add <> 0 Then
                   objMain.objApplication.SetStatusBarMessage("Sales or Not Posted", SAPbouiCOM.BoMessageTime.bmt_Short, True)
                   Exit Sub
                else
                  objMain.objUtilities.ShowSuccessMessage("Sales Order Posted successfully")
                End If
    The above code is executing successfully.But the Sales order is not getting added.
    Thanks in advance.

    Hi Vivek,
    If the code you posted is not throwing any errors, then the order really does get created. Apparently just not to both databases, am I correct ?
    vivek.Y wrote:
    > I have completed connectivity from one database to another database.
    That means that apparently you have not gotten this bit right.
    Generally speaking if you want to create an order into two databases, you first need to connect to both databases and create separate order objects for each database. So you need to do this bit twice; once for each database. Something like this:
    ObjSales1 = objMain.objUtilities1.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
    ObjSales2 = objMain.objUtilities2.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
    Then at the end you also need to add both objects separately:
    If ObjSales1.Add <> 0 Then
    etc.
    If ObjSales2.Add <> 0 Then
    etc
    Good luck,
    Johan

  • How to Copy Sales Order Filed in FI from SD while Creating Billing

    Hi Everyone
    I was checking the line item report for my sales account. (FS10N or FBL3N). The problem is i am not able to see the original sales document number filed against that Sales Gl. Its not even visible on customer account line item details as it only provides billing number field detail. Can anyone guide me is it possible to fill out the sales order number field while creating the accounting document from SD. I have observed only once the sales document field is filled but i struggling how it has been copied from SD and not possible on remaining one? Your kind help will be really appreciated.
    Kind Ragards

    Hello,
    This can be done in your copying control for Billing by using
    - Reference Number
    - Allocation Number
    in the header node of the copying control.
    You can find the allocation number under additional information in the (document) line item that is forwarded from
    SD to FI. If the field was not filled in the order, you can determine
    For that you have an option of maintaining in Reference & Allocation Number:
    A-Purchase order number
    B-Sales order number
    C-Delivery number
    D-External delivery number
    E-Actual billing document number
    Say, if you do not make an entry and the field is not filled in the order, the field remains empty. If you would like to link the delivery to invoices in accounting (which is necessary in the self-billing procedure), enter 'C' for the relevant invoices.
    Check in the relevant tcode VTFA / VTFL / VTFF, based on your business process.
    Thanks & Regards
    JP

  • How to create sales order Automatically with reference to contract?

    how to create sales order automatically through batch or online? can anyone please suggest what needs to be change in SAPMV45A program?

    Hi,
    Wt am able to understand from the above question is, you want to create automatic sales order against contract on a day to day basis by doing batch program, hope am wright.
    See you can do it in two ways.
    1. By using BDC, in SHDB T code record how exactly you will do transaction and then give it to your abaper rest he will do. he will write a program and he will schedule that program every day night.
    2. By using BAPI. Just check in there are many threads are there which gives sales order bapi. Tell your abaper to map that bapi and tell them to schedule back ground job.
    Hope this will help out in solving your problem.
    Regards,
    Nagesh

  • How to list Sales Order with credit block

    Hi, Gurus,
    I really don't know how to list sales orders with credit block?
    Is there any way for end user to do it?
    If so, is it possible to list SO with credit block for certain period of time such as one month?
    Any help would be appreciated.

    HI
    Check T-Code VKM2 (Released documents)
    You need to check VKM1 (Blocked Documents)
    Sorry before i gave wrong information , myself i corrected VKM2 for released not for blocked list (Due to non Availability of SAP access )
    Regards,
    Prasanna
    Edited by: prasanna_sap on Feb 7, 2012 7:12 AM

  • How to print sales order acknowledgement while printing purchase order

    how to print sales order acknowledgement while printing corresponding purchase order
    in me22n

    in print program of Purchase order.. try to trigger output for Order Ack. as well...
    Order acknowledgement

  • How to find sales order no., purchase order no. using sales order ID,PO ID

    hi,
    how to find sales order no., purchase order no. using sales order ID,PO ID
    Thank you,
    hari om

    Dear Hari Om,
    Could you please tell me, to what are you referring Sales Order ID and P.O. ID?
    meanwhile check with:
    T. Code: SE16
    Table: VBKD
    Execute (F8) the Report.
    On to next Screen, Go to Menu-bar
    Settings --> Format_Lists --> Choose Fields
    Field: VBELN - Sales Order
    Field: BSTKD - Purchase Order No.
    Best Regards,
    Amit

  • How to search sales order

    Hie Guys,
    Can anyone plz help me how to search sales order in SRM.
    I worked on CRM but it looks to be new applcation.. also kindly suggest me sme basic transactions..
    Many thanks!
    Regards,
    Dinesh.

    Hi Dinesh,
    in SRM we don't have sales order, but for the basic transctions please see the thread:
    https://forums.sdn.sap.com/click.jspa?searchID=26421773&messageID=4950023
    Regards,
    Peter

  • How to cancel sales order which I placed?

    How to cancel sales order which I placed? And this order had not been delivered.

    Rejection SO & Cancellation SO both are same. So please follow the below steps-
    1. Use Tcode VA02
    2. Enter Sales order number which you want to cancel.
    3. Click "enter"
    4. Click the icon "Reject Document"
    5. Select suitable u2018Reason for rejectionu2019.
    6. Save
    Many Thanks & Regards,
    Susanta K Senapati

Maybe you are looking for

  • Payment Rule maintenance per currency in Bank Communication Management

    Hi, We have maintained Rules for Payment Grouping in Bank Communication Management based on amount limits. The basic currency we expected is GBP so we have the same set of amount limits for all Company Codes until now. We've now introduced a new Comp

  • How to display XML file in browser using Servlets?

    Hi My XML file is like this: <?xml version="1.0" encoding="UTF-8"?> <ns0:purchase_order_MT xmlns:ns0="http://filetohttp.com"> <ORDER_HEADER_IN> <purchase_date/> <purchase_group/> <purchase_org/> </ORDER_HEADER_IN> <vendor/> <ORDER_ITEMS_IN> <item> <s

  • How to determine GPIB-ENET firmware version?

    I have several of the older GPIB-ENET units. I see the latest firmware binary on the FTP site is A5. I'm pretty sure our units have olders revs since they were installed several years ago. However the manual says to only update the firmware when nece

  • Problem with airprintin​g between HP 7510e and ipad2

    Have just installed HP7510e printer. I am unable to print directly from ipad to printer. Ipad recognises that printer is available on network and says "contacting printer", then nothing except silence. I can send emails from ipad to printer using HP

  • Perdu mot de passe pour deverouiller la sauvegarde iphone

    Bonjour, j'ai realisé une mise a jour durant la nuit, je viens de faire une mise a jour dans mon logiciel iOS.5.0.1 de iphone et voila que pendant 4H que mon tel est connecter maintenant je ne sais pas ce qui c passé il m'annonce qu'il est entrain de