Restrict Adding Sales Order with ProjectCode

Hi Experts,
i try restrict Sales ORder from Adding without ProjectCode (from itemlevel - RDR1.Project). Below is my script on TransactionNotification, but still it doesnt work..please help my with my script...
IF @transaction_type IN ('A', 'U') AND @object_type = '17'
BEGIN
IF EXISTS (SELECT t0.DocNum FROM ORDR t0 inner join RDR1 t1 on t0.docentry
= t1.docentry WHERE t1.Project ='' AND t0.Docentry = @list_of_cols_val_tab_del)
BEGIN
SELECT @Error = 1, @error_message = 'Please enter the field "Project Code" first ! by: IT Dept.'
END
END
Thanks,
jonathan

Try with this modification:
IF @transaction_type IN ('A', 'U') AND @object_type = '17'
BEGIN
IF EXISTS (SELECT t0.DocNum FROM ORDR t0 inner join RDR1 t1 on t0.docentry
= t1.docentry WHERE isnull( t1.Project,'') ='' AND t0.Docentry = @list_of_cols_val_tab_del)
BEGIN
SELECT @Error = 1, @error_message = 'Please enter the field "Project Code" first ! by: IT Dept.'
END
END

Similar Messages

  • Problem adding sales order with freight since 8.8 pl 20 (and 8.81 pl 0)

    Dear All,
    Since the upgrade to 8.8 patch 20 I have a problem with adding a sales orders with freight (expensecode 1 does exist!) through the XML import of (the same problem with 8.81 pl 0).
    This is the XML:
    <BOM>
         <BO>
              <Documents>
                   <row>
                        <DocType>dDocument_Items</DocType>
                        <DocDate>20110328</DocDate>
                        <DocDueDate>20110328</DocDueDate>
                        <CardCode>INT_C_PenS</CardCode>
                   </row>
              </Documents>
              <Document_Lines>
                   <row>
                        <ItemCode>10000024</ItemCode>
                        <ItemDescription>Afvalbak CONSTRUCTO 50</ItemDescription>
                        <Quantity>4.00</Quantity>
                        <ShipDate>20110328</ShipDate>
                        <DiscountPercent>20.00</DiscountPercent>
                        <UnitPrice>528.00</UnitPrice>
                        <LineStatus>bost_Open</LineStatus>
                        <LineType>dlt_Regular</LineType>
                   </row>
              </Document_Lines>
              <DocumentsAdditionalExpenses>
                   <row>
                        <ExpenseCode>1</ExpenseCode>
                        <LineTotal>64.00</LineTotal>
                   </row>
              </DocumentsAdditionalExpenses>
         </BO>
    </BOM>
    When the DocumentsAdditionalExpeses part is deleted then there is no problem.
    The error with the DocumentsAdditionalExpeses is 'Internal error accured'.
    Can anyone confirm that this not is working through XML import (DTW works) or is there a solution?
    Thanks and best regards,
    Wim Kleinsman

    Hi,
    Try this one.
    <BOM>
    <BO>
    <Documents>
    <row>
    <DocType>dDocument_Items</DocType>
    <DocDate>20110328</DocDate>
    <DocDueDate>20110328</DocDueDate>
    <CardCode>INT_C_PenS</CardCode>
    </row>
    </Documents>
    <Document_Lines>
    <row>
    <ItemCode>10000024</ItemCode>
    <ItemDescription>Afvalbak CONSTRUCTO 50</ItemDescription>
    <Quantity>4.00</Quantity>
    <ShipDate>20110328</ShipDate>
    <DiscountPercent>20.00</DiscountPercent>
    <UnitPrice>528.00</UnitPrice>
    <LineStatus>bost_Open</LineStatus>
    <LineType>dlt_Regular</LineType>
    <ExpenseCode>1</ExpenseCode>
    <LineTotal>64.00</LineTotal>
    </row>
    </BO>
    </BOM>
    Regards,
    Siva

  • How to Restrict Return Sales Order with reference to a cancelled invoice

    SAP Standard is allowing to create Return Sales Order with reference to a cancelled invoice which practically should not be allowed.
    Has any body worked on this problem and what could be the possible solutions so that return sales orders can not be created against a cancelled invoice.
    Kindly share your possible solutions.

    Hi Standard Process will not allow to create a Sales Order With Cancelled invoice,
    Kindly go through at Copy Controls
    T.CODE:VTAF
    in that some body might have maintained between S1 invoice to RE Sales Document.
    Remove the settings then u will be not able to create Sales Order w.r.t to Cancelled Document.
    Rewards if Usefull
    B.Shyam Sunder
    SAP SD Consultant

  • Adding Sales Order with multiple lines

    Hi all,
    I have a C# program whereby I am trying to get Sales Orders from one database (source) and create them in another database (destination). I can't get the code to work properly as lRetCode is never equal to 0 but is -5002.
    How can I fix it so that it adds the sales orders properly?
    Here is the code snippet:
                unaddedSOs = sList.Except(dList).ToList(); // contains the header information
                // Add the Sales Orders that are missing to destination database
                SAPbobsCOM.Documents sboSO =   (SAPbobsCOM.Documents)oCompanyDestination.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);  // Destination
                // Loop through unadded Sales Orders
                foreach (var item in unaddedSOs)
                    // Set properties of the Sales Order object
                    sboSO.CardCode = item.cardCode;
                    sboSO.CardName = item.cardName;
                    sboSO.DocDate = item.docDate;
                    sboSO.DocDueDate = item.docDueDate;
                    // Add Sales Order Document Lines
                    SAPbobsCOM.Recordset rsLines = oCompanySource.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); // Source of lines
                    // Get Sales Orders from source database
                    rsLines.DoQuery("SELECT ItemCode, Quantity, Price FROM RDR1 WHERE DocEntry = '" + item.docNum + "'");
                    rsLines.MoveFirst();
                    if (rsLines.RecordCount > 0)
                        while (!rsLines.EoF)
                            sboSO.Lines.ItemCode = rsLines.Fields.Item("ItemCode").Value;
                            sboSO.Lines.Quantity = rsLines.Fields.Item("Quantity").Value;
                            sboSO.Lines.Price = rsLines.Fields.Item("Price").Value;
                            sboSO.Lines.Add();
                            rsLines.MoveNext();
                    // Try to add the Sales Order to the database
                    int lErrCode = 0;
                    string sErrMsg = "";
                    int lRetCode = sboSO.Add();
                    if (lRetCode != 0)
                        int temp_int = lErrCode;
                        string temp_string = sErrMsg;
                        oCompanyDestination.GetLastError(out temp_int, out temp_string);
                        // Incase adding a Sales Order failed
                        if (lErrCode != -4006)
                            // Display error message
                            MessageBox.Show(lErrCode + " " + sErrMsg);
                MessageBox.Show("Done!!!");
    Kind Regards,
    Kinyanjui.

    Hi Kinyanjui,
    I think you're always writing to the same line:
    int row = 0;
    while (!rsLines.EoF)
        sboSO.Lines.SetCurrentLine(row);
        sboSO.Lines.ItemCode = rsLines.Fields.Item("ItemCode").Value;
        sboSO.Lines.Quantity = rsLines.Fields.Item("Quantity").Value;
        sboSO.Lines.Price = rsLines.Fields.Item("Price").Value;
        sboSO.Lines.Add();
        rsLines.MoveNext();
        row++;
    Best regards,
    Pedro Magueija

  • Restrict manual change in sales order with respect to quotation

    Hi All,
    The user use to create sales order with respect to quotation.  The user can able to change pricing as well as some header and item fields.  How can I restrict user for manual change in sales order expect some specific fields.
    Thanks.

    Hi Sunil,
    It is possible through configuration better you can post in sd forums.
    For the condition type settings , ensure that the manual entries is 'D'. it wont allow any changes in the order.
    Regards,
    Madhu.
    Edited by: madhurao123 on Aug 1, 2011 1:08 PM

  • HOW TO CONTROL ON CREATION OF SALES ORDER WITH REFERENCE TO EARLIER SO?

    Dear All,
    I want to contol on creation of Sales order with reference to earlier SO?  While creation of sales order our enduser are creating sales order with reference to earlier month SO which I want to restrict. Recently I made changes in sales order like payment terms is grayed, system will atomatically pick pay terms from customer master.Now I am getting correct data also but enduser is using old SO no while creating new SO and old payment data is reflecting in fbl5n.
    I want to restrict enduser while creating new SO with ref. to old SO. Only for returns they should be able to use Billing refrence. Pl. suggest how to control the with reference to ealier SO.
    Nikhil

    Nikhil Deshpande,
          If you dont want allow create a sales order in referent to other one, just delete the copy control between these sales order type, so when the user tries to create a SO in reference to other one a message is displayed that is not possible.
    Thanks,
    Mariano.

  • Changing quantities in sales order with reference to quotation

    Hi,
    Quotation has been created for Product -- A, 10 quantities.
    Sales order created with reference to quotation, system copies 10 quantity in sales order.
    How do you restrict in sales order end user should not change quantities, system should not allow for changes by end user. If end user changes Qty system should give an "Error message", so that sales can not be saved.
    Could you suggest solution ASAP.
    Thanks in Advance.
    Regards,
    vamsi.

    Normally You will have a warning message set for this. under class V1. if you want the error to be hard error then you would have to hard code it in a user exit under mv45afzz "userexit_save_document_prepare" where u can check if the quantities in the quote and sales order are different and create a hard error.
    the other option which I am not sure if it is possible is to propose the eror in message class v4 which you can control thru customisation under SPRO>SD>message settings
    reward points if it helps
    regards
    Biju

  • Creation of sales order with reference - Zfields in Add data B are not cop

    Hi all,
              Please help me in the issue . I am creating sales order with reference to returns order . All item fields are getting copied but the Zfields which are added in addtional data b of sales order are not getting copied. Can anyone please let me know the procedure to copy the custom fields.
    Thanks in advance,

    The setting of field when copy by reference is best done in the copy rules.
    If you go to transaction VTAA, and look to the order type you are copying to, you will find a data transfer rule number. 
    Then go to transaction VOFM, menu option DATA TRANSFER -> ORDERS and find the matching data transfer rule number.
    Select and press the "Source text"  button, here you will find the data from the copied order in structure CVBAK, and you can apply the code to set the VBAK structure fields appropriately.
    This should then populate the data on the copied order.

  • Error in adding Sales Order

    Hello Experts,
    I have created a addon through which in Sales Order while entering the quantity and then pressing tab in qty column automatic Batch allocation is done row wise for items . This process is working fine while entering .
    But from last two days while adding the Sales order with batch allocated sap is throwing an error message that
    "Another User has altered the quantity of Batch B01 in Warehouse SYD in row - 11"
    This is not my addon error message .This error is thrown by SAP which has blocked the Sales Order Entry.
    Sales Order is not getting added in any case.
    I am confused about what to do with this .Since this problem need to be resolve urgently .
    Please help me regarding this.
    thanks ,
    Amit

    Hi,
    Can you please tell me how you solved this?  I'm experiencing the same error.
    Thanks
    Mike

  • Line items restriction in sales order

    Hi,
    how to restrict enduser to enter 10 line items if he enters more than 10 line items system has to restrict.What settings we have to done for this
    Regards
    Karthik.R

    Hi,
    There is no restriction in sales order level.SAP has given this facility for restriction in billing document
    However you can use userexit SAVE_DOCUMENT_PREPARE in program MV45AFZZ in sales order creation creation program and write the desired code with help of ABAPer.
    Reward Points if useful
    Regards,
    Amrish Purohit

  • Sales Order with different sold to party & ship to party

    Hi experts,
    We have one sold to party customer code DE0009 .  There is no other ship to party code assigned with this customer in the masters. but still user can make Sales order with Sold to party DE0009 & another ship to  party code ( DN0020 ) which is not assigned.
    Ideally , system should restrict it .
    Please guide us how to control.
    Regards,
    ( Rajneesh Gulati )

    Hello Rajneesh Gulati,
    Ship-to party doesn't have to be assigned to the sold-to party in the master data.
    You can kindly refer to Note 380507 which can provides you with more info.
    Best regards,
    Miri Shimony
    Solution Management
    Globalization Services

  • Sales order with 2 different series

    hello everyone,
    can anyone help me out in my following query:
    I have a sales order with 2 different series: Design and Marketing
    i am creating a sales order with design series and sending it for approval and once approved i am adding it ,similarly  i iam creating sales order with marketing series.
    Now is it possible  unless and until i don't add my sales order with design series, system don't allow me to add sales order with marketing series.
    Regards,
    Meghana

    Hello
    try It In   SP_transaction Notification
    if @object_type = '112' and @transaction_type = N'A'
    begin
    IF EXISTS (select * from ODRF WHERE DocStatus = 'O' or ObjType = '17' OR Series in( Select Series from ODRF where DocEntry = @list_of_cols_val_tab_del) AND DOCENTRY = @list_of_cols_val_tab_del )
    begin
    set @error = 1
    set @error_message = 'You Can create SO because another Document in pending'
    end
    end----
    Edited by: Manvendra Singh Niranjan on May 7, 2011 7:29 PM

  • Can we create a sales order with refrence to a purchase order(me21n)

    hi all
    I have a query can we create a sales order with refrence to a po.my scenerio releted warehouse. I am recievening a the goods from client (from port) and storing it in my warehouse. so i m charging the client some cost(transporation cost ,machine handling cost etc) so when I am doing goods reciept(po----inbound delevery). so the moment i will doing the grn i want to charge my customer. so i want to create a invoice .  so please suggest me how to map this scenerio in sap. plz plz help me out

    Not possible to create sales order with reference to PO.
    but if to capture cost, you can consider adding cost to customer's invoice.
    e.g.
    SO -> PO -Inb/IR -> GR -> OB -> Inv(Add here)
    to add in that invoice, its either manual or through automatic condition.

  • Restrict specific sales order type during data collection............

    Hello Gurus,
    Can we restrict a specific order type of sales order in getting collected during the data collection, or is that the only way is customization, like remove all the sales orders with a specific order type after the data collection.
    can somebody help me on this.
    Thanx & Regards

    You can try defaulting rules to default the demand class so that you can exclude these demand classes during MDS..

  • Sales order with more than 9 items causing problem

    Hi,
    I have a situation here.
    A sales order is created in the system and since it is order related billing so its billing document is also generated. The billing document is not relevant for accounting. So, the only 2 documents are a sales order and its billing document.
    Due to some technical restrictions,if the number of lines is more than 9 the printout wont come.Henceforth,the user is unable to take a printout so I need to give him a solution.
    What shall I suggest him?

    Hi,
    >So, my question is that,should I ask the user to create a credit memo wrt the billing document and then split the sales order with 2 invoices(one with say 5 and the other invoice with the rest of the quantities)?
    So, if my undestanding is right then you want to create a credit memo after invoice ? If yes, then why are you splitting the sales order ? Also, this is something strange kind of ABAP logic which would not allow to print an invoice with more than 9 line items... Now, as you said if your sales order is having more than 9 line items then only print doesn't come.. right ? then in your case at this moment there are only 9 line items so ideally you'd be able to get a print.. right ?
    I think there is some confusion out here with your two posts.. kindly clarify...
    Hrishi

Maybe you are looking for

  • Different sequence between original physical inventory doc & the one on RF

    Hi, We've implemented warehouse management with RF, the problem is, 1) I created one physical inventory docuemtn via tcode LX26,     there're 3 lines in the physical inventory docuement, and the   sequence is:     item 10, material A         item 20

  • Nested for loop logic

    I am trying to create a triangle with for loop. i wrote this codepublic class Test {     public static void main(String[] args) {         for(int x = 1; x <= 6; x++) {             for(int y = 1; y <= (x*2-1); y++) {                 System.out.print("

  • Arabic Language not shown in IDT results

    Hi Experts, I am using IDT to create universe on top of Oracle EBS, when i preview the report directly from EBS it shows the ARABIC Language BUT when i preview same results in IDT it shows "Question marks" instead of Arabic. Snapshot is attached. Any

  • Skinning/Styling adfp:portlet component while consuming portlets.

    Hi Everyone, I am trying to skin the adfp:portlet component in my portal application. However, every styling that appears in JDeveloper to take effect ( for example if I change the background color, it shows up in editor) seems to go off at runtime.

  • RFC MONITOR

    Hi When from a SAP/R3 system I call a BAPI program using the transaction SE37 to SAP XI and the awnser is correct, I can not see in the monitoring transaction (sxmb_moni) of XI the message I sent, but when the execution fail I can. Can someone tell m