Approval process when updating a Sales Order

I have created a UDF that specifies whether a Sales Order has been "Picked" and would like to ensure that a user cannot modify the Order after this change of status without an Approval. I have my SQL code and it works properly but only when the Sales Order is created and does not get triggered when it gets modified.
Thanks, Richard.

This is far more complex to implement and can hamper the performance. 
FYI.  The user updating the Sales Order can be only found in the ADOC (History table)
SELECT TOP 1 T0.DocNum AS 'Document Number', T0.UserSign AS 'User Signature', T0.UpdateDate AS 'Update Date' FROM  ADOC T0  WHERE T0.ObjType = N'17'   AND  T0.DocEntry = @list_of_cols_val_tab_del AND T0.UserSign != 1 ORDER BY T0.UpdateDate DESC
Apart from the aboce, you have to also check in the ADOC table, the Update datetime with the Update datetime of the sales order and the updated field. You have to test this thoroughly before implemting
Suda

Similar Messages

  • Creating a Service Order automatically when saving a Sales Order

    Hello SDN,
    I'm trying to have SAP automatically create a Service Order when a Sales Order is created. To this end, I've tried implementing BADI workitem_template and have been using method before_update. I've been using BAPI BAPI_ALM_ORDER_MAINTAIN to create the service order.
    The problem is that in order for the BAPI to save the service order, the sales order needs to be fully saved and operational. Otherwise it just keeps saying 'sales order does not exist'. So the problem is that the BADI is intervening too soon in the saving process. The temporary sales order numbers have been replaced with actual ones, but the records do not show in the database just yet. I think there's a commit that still needs to be done or something.
    However, I cannot find a BADI or user exit that intervenes after the sales order is saved into the database, so this leaves me stranded.
    Any suggestions would be heartily apprechiated.
    Kind Regards,
    Niels.
    Edited by: Niels Ruelens on Feb 20, 2008 4:20 PM
    Edited by: Niels Ruelens on Feb 20, 2008 4:22 PM

    Following your suggestions, I've created an update function module and inserted it into the USEREXIT_SAVE_DOCUMENT. In this function module, I'm calling the BAPI.
    Problem with this approach is that I cannot debug, nor is he actually doing anything. Here's the code that is put in the function. Is there anything wrong with the way I call the BAPI perhaps?
      DATA:
        lt_srule     TYPE TABLE OF bapi_alm_order_srule,
        lt_bheader   TYPE TABLE OF bapi_alm_order_headers_i,
        lt_srule_up  TYPE TABLE OF bapi_alm_order_srule_up,
        lt_methods   TYPE TABLE OF bapi_alm_order_method,
        lt_return    TYPE TABLE OF bapiret2,
        ls_vbak      TYPE vbak,
        ls_vbap      TYPE vbap,
        ls_bheader   TYPE bapi_alm_order_headers_i,
    *    ls_header    TYPE cobai_s_header,
        ls_prps      TYPE prps,
        ls_srule     TYPE bapi_alm_order_srule,
        ls_srule_up  TYPE bapi_alm_order_srule_up,
        ls_methods   TYPE bapi_alm_order_method.
    *    ls_item      TYPE cobai_s_item.
      SELECT SINGLE * INTO ls_vbak
      FROM vbak
      WHERE vbeln = vbeln.
      SELECT SINGLE * INTO ls_vbap
      FROM vbap
      WHERE vbeln = vbeln.
      FREE: lt_methods, lt_bheader, lt_srule.
    * Fill methods
      CLEAR ls_methods.
      ls_methods-refnumber  = 1.
      ls_methods-objecttype = 'HEADER'.
      ls_methods-method     = 'CREATE'.
      ls_methods-objectkey  = '%00000000001'.
      APPEND ls_methods TO lt_methods.
    *  CLEAR ls_methods.
    *  ls_methods-refnumber  = 1.
    *  ls_methods-objecttype = 'SRULE'.
    *  ls_methods-method     = 'CREATE'.
    *  ls_methods-objectkey  = '%00000000001'.
    *  APPEND ls_methods TO lt_methods.
      CLEAR ls_methods.
      ls_methods-refnumber  = 1.
      ls_methods-objecttype = ''.
      ls_methods-method     = 'SAVE'.
      ls_methods-objectkey  = '%00000000001'.
      APPEND ls_methods TO lt_methods.
    * Fill header
      CLEAR ls_bheader.
      ls_bheader-orderid    = '%00000000001'.
      ls_bheader-order_type = 'ZM02'.
      ls_bheader-funct_loc  = 'FERBL_TD5C_DER'.
      ls_bheader-planplant  = 'B006'.
      ls_bheader-sales_ord  = vbeln.
      ls_bheader-s_ord_item = '00010'.
      APPEND ls_bheader TO lt_bheader.
    ** Convert the internal WBS to an external WBS element
    *  SELECT SINGLE * INTO ls_prps
    *  FROM prps
    *  WHERE pspnr = ls_vbap-ps_psp_pnr.
    **   Fill settlement rules
    *  ls_srule-objnr =   ls_item-aufnr.
    ****    ls_srule-sales_ord = caufvd_imp-kdauf_aufk.
    ****    ls_srule-s_ord_item = caufvd_imp-kdpos_aufk.
    *  ls_srule-wbs_element = ls_item-projn.
    *  ls_srule-settl_type = 'FUL'.
    *  ls_srule-percentage = 100.
    *  ls_srule-extnr = 1.
    *  APPEND ls_srule TO lt_srule.
    *  ls_srule_up-wbs_element = 'X'.
    *  ls_srule_up-sales_ord = 'X'.
    *  ls_srule_up-s_ord_item = 'X'.
    *  ls_srule_up-orderid = 'X'.
    *  ls_srule_up-settl_type = 'X'.
    *  ls_srule_up-percentage = 'X'.
    *  ls_srule_up-extnr = 'X'.
    *  APPEND ls_srule_up TO lt_srule_up.
      CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
        TABLES
          it_methods              = lt_methods
          it_header               = lt_bheader
    *          IT_HEADER_UP            =
    *          IT_HEADER_SRV           =
    *          IT_HEADER_SRV_UP        =
    *          IT_USERSTATUS           =
    *          IT_PARTNER              =
    *          IT_PARTNER_UP           =
    *          IT_OPERATION            =
    *          IT_OPERATION_UP         =
    *          IT_RELATION             =
    *          IT_RELATION_UP          =
    *          IT_COMPONENT            =
    *          IT_COMPONENT_UP         =
    *          IT_OBJECTLIST           =
    *          IT_OBJECTLIST_UP        =
    *          IT_OLIST_RELATION       =
    *          IT_TEXT                 =
    *          IT_TEXT_LINES           =
    *     it_srule                = lt_srule
    *     it_srule_up             = lt_srule_up
    *          IT_TASKLISTS            =
    *          EXTENSION_IN            =
             return                  = lt_return.
    *          ET_NUMBERS              =.
      IF sy-subrc = 0.
      ENDIF.
    Edited by: Niels Ruelens on Feb 20, 2008 4:58 PM

  • Project Revenue Plan Not Update from Sales Order Item

    I am generating a network and project from the sales order item using Assembly processing. I am using milestone billing on the sales order item and the milestones attached to the project network activities are appearing as billing blocks on the sales order item billing plan. However, the project revenue is not getting updated from the sales order billing plan. Can someone please help?
    I have deleted the billing plan on the billing WBS element and activated revenue planning update from sales order in cusomization for PS. I am looking at CNS41 under the project revenue sched in version 0. Is there a different report I should be looking at?
    Regards,
    Venkat.

    HI Venkat,
    You are looking at the correct report & I believe you have also done the necessary customization. If you create a sales order and reference it to a quotation, the related plan values in the WBS element are refreshed automatically.
    When the payment data is recorded, the terms of payment and the customer payment history are taken into consideration. One of the probable causes could be the credit limit of the customer might have been exceeded. Take help of your SD consultant & increase the credit limit for that customer (from the sales document), t-code FD32 if it is permitted in the business.
    After the new credit limit is set execute the following steps:
    u2022     Go to the t-code Change billing request (VA02)
    u2022     Open the required billing request
    u2022     Remove the account assignment of WBS element from each line item
    u2022     Save the billing request
    u2022     Reopen the billing request in change mode
    u2022     Reassign the WBS elements to all line items
    u2022     Now the changed credit limit will take affect
    u2022     Check the Planned Revenue for the said project in CNS41, it should get updated.
    Rgds
    Deepak

  • Can't change quantity when copy from Sale order for Delivery

    Hi all!
    Can i use authorization for can't change quantity when copy from Sale order for Delivery.

    Tien,
    Approval will not work when you have mutiple rows of data.  You would have to work with SP Transaction Notification
    There has been threads before on the forum on the same topics.
    Block the Quantity in Sales Delivery
    Approval Procedure for chaning quantity in Delivery Document
    Suda

  • No update of sales order from purchase order

    Hi,
    When I am trying to change the delivery date of a purchase order line item, I get the error
    "No update of sales order xxxxx from purchase order (error V1 348)" How can I resolve this?
    Sincerely,
    Ketan

    Hi,
    Check whether this PO is created w.r.t. PR and PR is created automatically during Sales order creation.
    If it is so then need no to change the delivery date in PO, it will always get updated as per the Schedule Line date of sales order.
    You can go for GR w.r.t. PO directly.

  • Inserting Pricing condition in Sales order when saving the sales order

    Dear ABAPers,
           My customers requirement is when saving the sales order new pricing condition has to be updated in the line item.for this i am using the User Exit 'USEREXIT_SAVE_DOCUMENT_PREPARE' ( MV45AFZZ).While saving the Sales order i am calculating the Price and updating in the Pricing conditions.
    In XKOMV internal table i am appending the pricing condition.But the problem is ,it is not calculating the taxes and it is Updating in VBAK and VBAP.
    How to do this.
    Thanks & Regards,
    Ashok.

    Dear ABAPers,
    I have Solved this Problem.
    Thanks & Regards,
    Ashok.

  • Exchange rate automatic update in Sale Order

    Dear All,
    This is regarding Exchange rate automatic update in Sale Order and requirement said below.
    Process:
    User will created a Export Sale order in the month of November , that time Exchange rate is 50.00, this  will
    get updated in Sale order Header and Item level.
    But user will create billing in the month of December , at that time Exchange rate is 40.00. So in Billing
    document Header level exchange rate will be 40.00 (Current rate) and Item level exchange rate will be
    50.00.
    Requirement:
    User requirement is like this the current exchange rate 40.00 to be updated in Sale Order Header and Item
    level automatically, because user using  Sale order Exchange rate  for Z-Report.
    As of now user manually updating Exchange rate in Sale Order.
    Let me know if there is any solution.
    Regards
    S Kumar

    I dont think this is possible.  You should be aware any change in subsequent document would not have any impact in the preceding document which means, whatever exchange rate flowing in billing cannot be updated in sale order.  May you can update your zee table by considering the billing document exchange rate by way of exit.
    thanks
    G. Lakshmipathi

  • Warning popup when raising a sale order

    Hi
    I have a reqt, where in when raising a sale order, the user will enter the Price manually, the PR00 has to compare with the VPRS of the material master & if the sale price is less than the cost, a pop up should appear on the sale order screen (Warning Message).
    Could anyone tell how to achieve this.
    Thanks in advance
    Aravind

    Dear Aravind,
    You can try this requirement through User Exit with the help of ABAPer
    Try with this User Exits in the program MV45AFZZ    
    USEREXIT_SAVE_DOCUMENT                                                 
    Use this user exit to fill user-specific statistics update tables.     
    The user exit is called up by the FORM routine BELEG-SICHERN before    
    the COMMIT command.                                                    
    Note                                                                   
    If a standard field is changed, the field r185d-dataloss is set to     
    X. The system queries this indicator at the beginning of the safety    
    routine. This is why this indicator must also be set during the        
    maintenance of user-specific tables that are also to be saved.                                                                               
    USEREXIT_SAVE_DOCUMENT_PREPARE                                         
    Use this user exit to make certain changes or checks immediately       
    before saving a document. It is the last possibility for changing or   
    checking a document before posting.                                    
    The user exit is carried out at the beginning of the FORM routine      
    BELEG_SICHERN.        
    I hope this will help you,
    Regards,
    Murali.

  • Updating a sales order through DI API

    Hi All,
         I have an issue regarding updating a sales order.
    The problem is:
      If there r 2 items(A00001&A00002) existed in the sales order and if I am adding two more items(A00003 & 4)the sales order is updated in a fashion that first item is replaced with third item and forth item is added as last record.The items to that particular sales order after updating will be like this(A00003,A00002,A00004).My doubt is why the 3rd item is replaced with first record.I am sending the code also i have written.
    objRecordSet = SBOCOMUtil.newRecordset(company);
                          IDocuments  oOrder =SBOCOMUtil.newDocuments(company,SBOCOMConstants.BoObjectTypes_Document_oOrders);
                                  objRecordSet.doQuery("select DocEntry from ORDR where DocNum=" + 1111);
                                  DocEntryL =objRecordSet.getFields().item(new String("DocEntry")).getValueInteger().intValue();
                          str += DocEntryL;
                          System.out.println(DocEntryL);
                          if (oOrder.getByKey(new Integer(DocEntryL))) {
                                  //objRecordSet2.doQuery("delete  from rdr1 where DocEntry="+DocEntryL);
                                  str += "2";
                                  System.out.println(str);
                                  //oOrder.remove();
                                  oOrder.setDiscountPercent(new Double(5));
                                  oOrder.setComments("success");
                                  System.out.println(str);
                                  IDocument_Lines oOrderLines = oOrder.getLines();
                                  str += "3";
                                  String[] item={"A00005","A00006"};
                                  for (int counter = 0; counter < item.length; counter++) {
                                       //  oOrderLines.setCurrentLine(new Integer(counter));
                                         if (counter > 0)
                                                 oOrder.getLines().add();
                                         str += "4";
                                  oOrderLines.setItemCode(item[counter]);
                                  System.out.println(item[counter]);
                                     //oOrderLines.setBaseType(new Integer(-1));
                                     //oOrderLines.setBaseEntry(new Integer(0));
                                   //oOrder.getLines().setCurrentLine(new Integer(counter));
                               //oOrderLines.setQuantity(new Double(1));
                                         //oOrderLines.setPrice(new Double(1500));
                                         //oOrderLines.setCurrency(strCurrency[counter]);
                                         //oOrderLines.setLineTotal(new Double(dblLineTotal[counter]));
                                  str += "5";
                                  //oOrder.getLines().getUserFields().getFields().item("Quantity").setValue(new Integer(2));
                                  System.out.println(str);
                                  int result = oOrder.update();
                                  str += "6" + result;
                                  if (result == 0) {
                                         System.out.println("successfully updated");
                                         company.disconnect();
                                  } else {
                                         company.getLastErrorDescription();
                                         System.out.println(
                                                 "Error :" + company.getLastErrorDescription());
                                         company.disconnect();

    If you are using SBP 2004 there are many threads on this forum talking about bugs when updating sales order lines through DI API. This issue was supposed to be fixed with patch level 45 for 2004 which was recently released.
    If u are using 2005 or SP1 I think you may have found a new bug.

  • Condition update error  :There is no condition update from sales orders.

    I am testing the condition update by condition type K005 , which have been set the condition update indicator ,and I have also set the Max.number.of.orders  to 1 , but after I created the first sales order ,the condition record still make effect in the second  and third sales order ,which was created without referece to the first one .
    And  when I  look at the cumulative value in the condition record ,it says "There is no condition update from sales orders."
    Anyone can give me some light ?
    BTW , the sales order type is ZOR ,which I copy from the standard order type .And the item category is ZTAN , copy from  standard IC TAN .
    thanks for your help in advance .

    hello, friend.
    there are at least 3 things that you will have to check, since records for condition type K005 is created for a specific combination:
    1.  check if the item category with condition update was the one determined in the order
    2.  check if the customer has a valid K005 record
    3.. check if the material has a valid K005 record
    also, since you specified "1" as maximum number of orders, this could have prevented any updates.
    regards.
    Edited by: jonathan y on Sep 17, 2009 2:59 PM

  • RDR1.GrossBuyPr 'Field cannot be updated' error : Sales Order DTW update

    Hi all.
    This is my first post, so please be gentle :-).
    I am attempting to update the unit prices on a bunch of Sales Orders via DTW.
    Some items update successfully, but some do not, failing with the error :
    RDR1.GrossBuyPr line: x, 'Field cannot be updated (ODBC -1029)'Application-defined or object-defined erroroOrders
    I am not attempting to modify this column, although I am guessing that this is calculated by Business One internally.
    I am using 2 tab-delimited files :
    Documents.txt, which contains the RecordKey & DocEntry columns.
    Documents_Lines.txt, which at the moment contains RecordKey, LineNum, UnitPrice & ItemCode.
    I have tried it with the UnitPrice column renamed to Price, and with and without the ItemCode column present, and they give exactly the same error.
    If I remove the price column completely, then it works (but nothing has updated, obviously).
    I have searched the forums, the only thing I can see that comes close is the UnitPrice / Price renaming.
    Or am I going about this the wrong way? The prices that I want to import already exist as a price list, and we can manually change these in Business One by going Form Settings -> Price List when in a Sales Order, but I am unsure how to do this via DTW. There are approx 3000 items that need changing, so doing it manually is not really an option.
    Grateful for any and all help.
    Thanks,

    Here you go....
    Documents.txt :
    RecordKey     DocEntry
    RecordKey     DocEntry
    0     18664
    1     19397
    2     19578
    3     20804
    4     20808
    5     20884
    6     21114
    7     21801
    8     22222
    9     22390
    10     22455
    11     22513
    12     22889
    Document_Lines.txt :
    RecordKey     LineNum     UnitPrice
    RecordKey     LineNum     UnitPrice
    0     0     22.000000
    1     2     49.000000
    2     0     0
    3     0     109.000000
    3     1     115.000000
    3     2     98.000000
    3     3     104.000000
    3     4     159.000000
    3     5     32.000000
    3     6     41.000000
    3     7     82.000000
    4     0     131.000000
    5     0     207.000000
    6     4     49.000000
    7     0     87.511900
    8     0     72.000000
    9     1     306.000000
    10     5     0.000000
    11     0     58.000000
    12     4     1.000000

  • Update of Sales Order Delivery Dates from Production Order Date Changes

    I work at a discrete made-to-order manufacturer. 
    When our factories maintain their production orders, they will often have to change their order dates.  Is there a way so that these changes can automatically update our sales orders so we can re-send sales order confirmations?

    hi,
    this comes under development part.
    please check the feasibility with your abaper because you will have to change standard code.
    regars,
    balajia

  • Automatic creation of intercompany PO when creating a Sales Order

    Hi Experts
    Is there a standard way of triggering an intercompany PO when creating a sales order to the final customer (or the other way around, triggering a sales order to the end customer upon creation of an intercompany PO)? Scenario: business has setup a logistics company (company code X), which its purpose is to deliver goods to the final customer (home customers). However, sales orders are created from seperate chain of stores which belong to another company code (company code Y). This chain of stores have one sales organisation (since there is over 1000 stores under a chain). I need a way to represent that a sale originated from a store/plant belonging to company Y to end customer A. Also, I need a billing document (intercompany) from company code X to store/plant beloning to company Y.
    Issues: in the intercompany config (assign intern customer numbers to sales org) - is there a way to assign a customer number at site/plant level so that when creating an intercompany billing it can be picked instead of the one assigned to the sales org and where can this be specified in the sales order (remember: in my scenario there are multiple stores/plants that belong to one sales organisation and it is not possible to use one customer number linked to the sales organisation.)
    Desired results:
    Sales order from store/plant YY belonging to company code Y to end customer A
    Intercompany billing from plant XX belonging to company code X to store/plant YY
    End customer billing from store/plant YY to end customer A
    Thank you in advance for your help.

    Hello Tsmash  
    I think you can acheive this with Regular Sales order + Inter Company STO combination.
    Maintain customer numbers for each of the Plants from Company Y for the sales area belonging to Company X.
    Then do the config for STO in MM using this menu path:
    SPRO/Materials Management/Purchasing/Purchase Order/Set up Stock Transport Order
    Here, in the activity 'Define Shipping Data for Plants',  enter each of the plant-customers and the Sales area belonging to Comany code Y. Carry out other activities in this area appropriately.
    Similarly set up Custom ( say Z1) Special Procurement type for Plant YY for stock transfer from XX using this menu path:
    SPRO/Production/Material Requirements Planning/Master Data/Define Special Procurement Type:
    Here maintain procurement type as F, Special procurement as U and plant as XX. You may need to repeat this config for each of the receiving plants (over 1000 stores under a chain)  from co code Y.
    In the material master MRP 2 for Plant YY,  maintain procurement type as F and Special Procurement as Z1.
    Sales order will be received under Co Code Y and sales area belonging to Y form customer A,
    Because of the MRP config, a PO (STO) requirement will be raised on Co code X and plant XX. XX will send the goods to YY via a STO delivery using the Shipping data from 'Set up STO' config,
    Plant YY will send the goods to A and bill that customer. Co Code X will raise an inter-comany bill on Co code Y.
    That's how it should work. Try it and revert with any issues.

  • Sale Order Item Quantity Not Populating When Create A Sale Order Using BAPI

    I am having a problem when creating a sale order using BAPI
    BAPI_SALESORDER_CREATEFROMDAT2
    Problem is that sale order item quantity field is not populating
    code is as follows
    ORDER_ITEMS_IN-ITM_NUMBER = '0010'.
    ORDER_ITEMS_IN-MATERIAL = '000000000010000262'.
    ORDER_ITEMS_IN-TARGET_QU = 'LB'.
    ORDER_ITEMS_IN-TARGET_QTY = 1.

    Hi,
    Try populating ORDER_SCHEDULES_IN table in the bapi field REQ_QTY.
    Regds,
    Rudra

  • Error on ATP check when Creating a Sales Order

    Hello,
    I encounter error  on ATP check while creating a Sales Order.
    The error is when I create Sales Order using material A, with or with out indicating the Plant and Storage Location, the Purchase Order quantity is returned on ATP check, but when I create an SO with out indicating the Plant and Storage Location, no PO quantity was returned. Note that we applied SAP Note # 387482 to automatically determine the Storage Location. I have also checked material maintenance in MM03 of Materials A and Material B and nothing was different, they have the same Availabity check condition.
    Is it possible that the SAP note that I applied causes the error?
    By the way I have noticed that when I create Material B and manually populate the Plant and Storage Location there is a pricing error(but it returns the PO during ATP check).
    Thanks.
    Noreen

    Hello,
    I encounter error  on ATP check while creating a Sales Order.
    The error is when I create Sales Order using material A, with or with out indicating the Plant and Storage Location, the Purchase Order quantity is returned on ATP check, but when I create an SO with out indicating the Plant and Storage Location, no PO quantity was returned. Note that we applied SAP Note # 387482 to automatically determine the Storage Location. I have also checked material maintenance in MM03 of Materials A and Material B and nothing was different, they have the same Availabity check condition.
    Is it possible that the SAP note that I applied causes the error?
    By the way I have noticed that when I create Material B and manually populate the Plant and Storage Location there is a pricing error(but it returns the PO during ATP check).
    Thanks.
    Noreen

Maybe you are looking for

  • Problems with getting 2nd screen sharp

    Dear everyone! Not too long ago I've bought myself a Macbook Pro 15 inch (version 10.7.3) and with it I also got myself a Mini DisplayPort to HDMI Adapter (by Moshi). After I got those I also got myself a HDMI-cable to connect my MBP to my Samsung tv

  • How to send a predefined email

    Hello, I'm trying to send a predefined email which contains the subject and the body text in my bsp/abap application but it doesn't work. <i><b>Does anyone could help me, please?</b></i> I have this error message : <b>Exception  CX_SY_DYN_CALL_PARAM_

  • [REQ][Arch64] lib32-nvidia-96xx-utils

    Hello. I've got a Geforce 4 ti4200, and I'm trying to play etpro. The textures are ugly and the FPS much worse than my old 32bit Arch installation. The problem should be that I've installed the 97xx series utils, and not the 86xx 32bit series.

  • Does iTunes convert video

    I added many videos to my library converted in the AppleTv friendly format. When trying to add a video to the iphone, an error says video not playable on iPhone (format issue). Does iTunes itself have the ability to re convert video to iPhone playabl

  • Why not to be unlocked iPhone working with GSM and CDMA/LTE in one device?

    why not to be unlocked iPhone working with GSM and CDMA/LTE in one device?