Adding Sales BOM to Sales Order through SDK

Hello Experts,
We're encountering an issue with adding Sales BOM items to the Sales Order through the SDK. When we add the parent, the object automatically adds the children as lines after all other lines. This causes issues with our batch delivery creation. When the Sales Order is created inside SBO Client, it always adds the child items right under the parent. We have a work around where we change the LineNum through SQL, but that seems like a sketchy method - what's the proper way of adding Sales BOM items to a Sales Order?
Here is the code we're using to add the Sales Order lines
olOrders.Lines.ItemCode = sItemCode
olOrders.Lines.ItemDescription = aRecSet.Fields.Item("name").Value
olOrders.Lines.UnitPrice = aRecSet.Fields.Item("cartprice").Value
olOrders.Lines.Quantity = aRecSet.Fields.Item("qty").Value
Thanks for the help!

Hi Rob,
I certainly wouldn't recommend you use a direct SQL command to update the LineNum on the sales order rows. This will invalidate your support agreement with SAP.
One way you can deal with this would be to add your Sales BOM header item to a draft document (of type sales order) and add this first. You can then retrieve it in the DI API and add the other Items before adding the document as a proper sales order (and removing the draft). You can do this using the Draft and Documents objects either by coding each property or by exporting the Draft to XML and using XLST to convert it to a Sales Order and reimporting it. It does require a fair bit of coding but it will achieve what you need.
Kind Regards,
Owen

Similar Messages

  • Preventing changes to component quantities of Sales BOM in Sales Order

    Hi All,
    I would like to enquire whether it is possible to prevent anyone from changing the quantity of the components when a Sales BOM is used in a Sales Order. I would like to archieve this without using any customer exits if this is at all possible.
    Currently you can change the quantities of the components and this has no effect on the quantity of the Header material.
    Thanking you in advance for your assistance.

    Hi,
    May be u can achieve this throguh blocking authoirzation at item level for users with the help of ABAPers...This is the only was other than sales order user exits...
    If u want to use user exit then please have a look into userexit_Field_modification, Userexit_save_document
    , userexit_save_document_prepare...
    Regards
    Sankar

  • Can sales bom contain sales bom?

    Hi,
       Can any tell me in SAP standard can one sales bom's item is another sales bom's header? For example, material code " A" is the header of sales bom, it has 3 component materials: A1, A2,A3. If A3 is another sales bom's header, it has 2 components:B1, B2. Can this suppose support in SAP ?
       When i entry material code "A" in sales order, will it bring out  A1,A2,A3, B1,B2 ?
       Thanks in advance!
    Edited by: Irene Shen on Apr 2, 2008 11:05 AM

    Hi Shen,
             I think you can get your requirement through Multilevel BOM concept.
    Here Iam giving the link about multilevel BOM go through this it may help you.
    http://help.sap.com/saphelp_47x200/helpdata/en/7e/cb7f2f43a311d189ee0000e81ddfac/content.htm
    I hope it will help you
    Regards,
    Murali.

  • In sales order does not not show sales bom component

    hi to all,
                it is possible if i create one sales order and i connect one sales bom to order and do not display component of sales bom in sales order so pls tell me procedure.pls tell me how to set print layout of sales order without sales bom component
    Regards
    vishal

    Hi,
    To do not show the component items in Sales Order, you should use Assembly type of BoM.
    Here I copied the differences between them which is from Online Help.
    The sales bill of materials and the assembly bill of materials represent a finished product which is assembled at the sales stage.
    The difference between the assembly bill of materials and the sales bill of materials is as follows:
    ·        Assembly bill of materials; the finished product appears in the sales order document.
    ·        Sales bill of materials; both the finished product and the components appear as separate items in the sales order document.
    Hope this helps you.
    regards,
    maggie an

  • Sales BOM Component not in order

    Hi All,
    I have created some Sales BOMs.
    I selected 3 Sales BOMs into Sales Order at one go using the block select. It is displayed without issue when there are no formatted searches setup at Sales Order row level. as shown below.
    SalesBom-01
      SalesBOM-01-Comp-01
      SalesBOM-01-Comp-02
      SalesBOM-01-Comp-03
    SalesBom-02
      SalesBOM-02-Comp-01
      SalesBOM-02-Comp-02
    SalesBom-03
      SalesBOM-03-Comp-01
      SalesBOM-03-Comp-02
      SalesBOM-03-Comp-03
    I have created 2 User-Defined Fields (both have formatted search setup to refresh by Item No).
    = Avail Stock (in Stock - Is Committed from OITM)
       FS = SELECT $[$38.33.number] - $[$38.34.number]
            $[$38.33.number] = In Stock field (std field in Sales Order row)
            $[$38.34.number] = Commited field (std field in Sales Order row)
    = Maximum Selling Price (gets from the Maximum Price List)
       FS = SELECT T0.Price FROM ITM1 T0  INNER JOIN OPLN T1 ON T0.PriceList = T1.ListNum
               WHERE T1.[ListName] ='Maximum Price' and  T0.[ItemCode] =$[$38.1.0]
    After implementing the 2 formatted search, the 1st Sales BOM is not properly displayed. see below example. The components for SalesBom-01 are displayed at the end of the SalesBom-03.
    SalesBom-01
    SalesBom-02
      SalesBOM-02-Comp-01
      SalesBOM-02-Comp-02
    SalesBom-03
      SalesBOM-03-Comp-01
      SalesBOM-03-Comp-02
      SalesBOM-03-Comp-03
      SalesBOM-01-Comp-01
      SalesBOM-01-Comp-02
      SalesBOM-01-Comp-03
    Does anyone have any advise the cause and how i can rectify it?
    Regards
    Jessie

    Hi Gordon,
    I am using 2007B SP0 PL10.
    I have already tried it in SBODemo_SG and customer's TEST database.
    Both are showing me the same results when the Formatted Search are setup.
    Rgds
    Jessie

  • Change quantity of a component in a BOM created through SDK

    I am creating AR Invoices which are based on Sales Orders through SDK. These SO have a BOM which has only 1 component, when I create a AR Invoice off of these SO I have to be able to change the quantity which is delivered. How do I specify that I am changing the quantity of the component and not the amount of the Parent?
    thx,
    Richard

    Owen,
    If you go to Document Settings and change the selection to Price and Total for Parent Item Only, when you choose this BOM which is a Sales Item, you can modify the quantity of the Child Item and it does not affect the Parent Items price or quantity.
    This is what I am trying to accomplisg through the SDK, but it seems all I can insert is the Parent Item in the Marketing Document, how can I alter the Child quantity?
    thx,
    Richard

  • Error in Loading Sales Bom

    Hi ..
    When im  loading Sales BOM from Sales Quotation to Invoice with Sales Bom  via SDK , im receiving this error message .
    " Error The complete Sales BOM, not just some of the components, must be copied to an A/R Invoice or a Delivery  [INV1.TreeType][line: 42] " , im basically transfering record by record from  Sales Quotation to Invoice
    But if i used the copy to function to invoice this Sales Quotation , i can be invoice
    I would like to know, whats is reason of this error message?
    thanks
    Loren

    Hi Yatsea
    Thank you for your response,
    Yes i followed some of the documents in the forum on how to add /copy a document to another document . My problem right now, if i will load 2 or more bom items on one invoice,  i receive the same errror "Error The complete Sales BOM, not just some of the components, must be copied to an A/R Invoice or a Delivery http://INV1.TreeTypeline: 42"
    but if a sepate the sales bom on different invoice (1 invoice = 1 Sales BOM) , the transaction goes well ....
    please see code
      start code -
        Private Function CreateInvoiceFromQuotation()
            Dim oInvoice As SAPbobsCOM.Documents
            Dim oSalesQuotation As SAPbobsCOM.Documents
            Dim rsForInvoice As SAPbobsCOM.Recordset ' A recordset object
            Dim rsFrInvDtls As SAPbobsCOM.Recordset ' A recordset object
            Dim oRecordCount As Integer
            Dim rUpdateStatus As SAPbobsCOM.Recordset
            Dim SQLStr As String
            Try
                rsForInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                SQLStr = "SELECT OQUT.DocEntry,OQUT.DocDate, OQUT.DocDueDate, OQUT.CardCode, OQUT.NumAtCard, OQUT.Comments "
                SQLStr = SQLStr & "FROM [@TDOCPROC] INNER JOIN OQUT ON [@TDOCPROC].U_DocEntry = OQUT.DocEntry"
                rsForInvoice.DoQuery(SQLStr)
                oRecordCount = rsForInvoice.RecordCount
                Do While rsForInvoice.EoF = False
                    'oCompany.StartTransaction()
                    oInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
                    oInvoice.CardCode = rsForInvoice.Fields.Item("CardCode").Value
                    oInvoice.DocDate = rsForInvoice.Fields.Item("DocDate").Value
                    oInvoice.DocDueDate = rsForInvoice.Fields.Item("DocDueDate").Value
                    oInvoice.Comments = rsForInvoice.Fields.Item("Comments").Value
                    oInvoice.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Items
    details -
                    Dim StrFilter As String
                    Dim z As Integer
                    Dim RecCnt As Integer
                    Dim oInvNum As String = 0
                    rsFrInvDtls = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                    StrFilter = "SELECT * FROM qut1 WHERE DOCENTRY =" & rsForInvoice.Fields.Item("DocEntry").Value & " order by linenum "
                    rsFrInvDtls.DoQuery(StrFilter)
                    RecCnt = rsFrInvDtls.RecordCount
                    z = 0
                    Do While rsFrInvDtls.EoF = False
                        Dim prodCode As String
                        prodCode = rsFrInvDtls.Fields.Item("ItemCode").Value
                        If z = 0 Then
                            oInvoice.Lines.ItemCode = rsFrInvDtls.Fields.Item("ItemCode").Value
                            oInvoice.Lines.ItemDescription = rsFrInvDtls.Fields.Item("Dscription").Value
                            oInvoice.Lines.WarehouseCode = rsFrInvDtls.Fields.Item("WhsCode").Value
                            oInvoice.Lines.Quantity = rsFrInvDtls.Fields.Item("Quantity").Value
                            oInvoice.Lines.UnitPrice = rsFrInvDtls.Fields.Item("Price").Value
                            oInvoice.Lines.CostingCode = rsFrInvDtls.Fields.Item("OcrCode").Value '--- Profit Center             
                            ' oInvoice.Lines.TreeType = rsFrInvDtls.Fields.Item("TreeType").Value  '--- Profit Center
                            'oInvoice.Lines.AccountCode = rsFrInvDtls.Fields.Item("Acctcode").Value
                            oInvoice.Lines.LineTotal = rsFrInvDtls.Fields.Item("LineTotal").Value
                            oInvoice.Lines.BaseLine = rsFrInvDtls.Fields.Item("LineNum").Value
                            oInvoice.Lines.BaseEntry = rsForInvoice.Fields.Item("DocEntry").Value
                            oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oQuotations
                        Else
                            oInvoice.Lines.Add()
                            oInvoice.Lines.SetCurrentLine(z)
                            oInvoice.Lines.ItemCode = rsFrInvDtls.Fields.Item("ItemCode").Value
                            oInvoice.Lines.ItemDescription = rsFrInvDtls.Fields.Item("Dscription").Value
                            oInvoice.Lines.WarehouseCode = rsFrInvDtls.Fields.Item("WhsCode").Value
                            oInvoice.Lines.Quantity = rsFrInvDtls.Fields.Item("Quantity").Value
                            oInvoice.Lines.UnitPrice = rsFrInvDtls.Fields.Item("Price").Value
                            oInvoice.Lines.CostingCode = rsFrInvDtls.Fields.Item("OcrCode").Value '--- Profit Center             
                            'oInvoice.Lines.AccountCode = rsFrInvDtls.Fields.Item("Acctcode").Value
                            oInvoice.Lines.LineTotal = rsFrInvDtls.Fields.Item("LineTotal").Value
                            oInvoice.Lines.BaseLine = rsFrInvDtls.Fields.Item("LineNum").Value
                            oInvoice.Lines.BaseEntry = rsForInvoice.Fields.Item("DocEntry").Value
                            oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oQuotations
                        End If
                        z = z + 1
                        rsFrInvDtls.MoveNext()
                    Loop
                    rsFrInvDtls = Nothing
                    Dim cResult As String
                    Dim cMessage As String
                    Dim dPostDate As Date
                    cResult = ""
                    If oInvoice.Add <> 0 Then
                        ' MsgBox("Error " + oCompany.GetLastErrorDescription())
                        cMessage = "Error " + oCompany.GetLastErrorDescription()
                        cResult = "Failed"
                        dPostDate = DateTime.Now.ToString
                        dPostDate = Date.Parse(dPostDate)
                        rUpdateStatus = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                        SQLStr = "update [@TDOCPROC] set U_DOCSTATUS = '" & cResult & "' ,U_InvNum = " & oInvNum
                        SQLStr = SQLStr & ",U_REMARKS = '" & cMessage & "'"
                        SQLStr = SQLStr & ",U_POSTDATE = '" & dPostDate & "'"
                        SQLStr = SQLStr & " where u_DocEntry = " & rsForInvoice.Fields.Item("DocEntry").Value
                        rUpdateStatus.DoQuery(SQLStr)
                    Else
                        Dim rs1 As SAPbobsCOM.Recordset
                        Dim retval As Long
                        Dim cValues As Integer
                        cResult = "Success"
                        oInvNum = oCompany.GetNewObjectKey()
                        oSalesQuotation = oCompany.GetBusinessObject(BoObjectTypes.oQuotations)
                        cValues = rsForInvoice.Fields.Item("DocEntry").Value
                        If (oSalesQuotation.GetByKey(cValues) = True) Then
                            oSalesQuotation.Close()
                            oSalesQuotation.Update()
                        Else
                            Dim errcode As String
                            Dim errmsg As String
                            oCompany.GetLastError(errcode, errmsg)
                            MsgBox(oSalesQuotation.CardCode)
                            MsgBox("Failed to Retrieve the record " & errcode & " " & errmsg)
                        End If
                    End If
                    dPostDate = DateTime.Now.ToString
                    dPostDate = Date.Parse(dPostDate)
                    rUpdateStatus = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                    SQLStr = "update [@TDOCPROC] set U_DOCSTATUS = '" & cResult & "' ,U_InvNum = " & oInvNum & ","
                    SQLStr = SQLStr & " U_PostDate = '" & dPostDate & "'"
                    SQLStr = SQLStr & " where u_DocEntry =" & rsForInvoice.Fields.Item("DocEntry").Value
                    rUpdateStatus.DoQuery(SQLStr)
                    'If oCompany.InTransaction = True Then
                    '-ompany.EndTransaction(BoWfTransOpt.wf_Commit)
                    'End If
                    rsForInvoice.MoveNext()
                Loop
                rsForInvoice = Nothing
                '    'msg2send(NumOfInv) = oDocNum
                '    'Insert2OCTP(vDocNum, vDocDate, oDocNum, Now.ToShortDateString, vCardCode, vCardName)
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
        End Function
       end code
    thank you

  • Sales BOM and Incompletion Log

    Hi SAP experts.
    We are on ECC 5.0. Wer are exploding sales BOM in sales orders. I have a requirement that if for certain reason a BOM fails to explode for a particular line item then that item should be go an incomletion log. I was able to select field VBAP-STKEY (BOM ORIGIN) in incompletion procedure at the item category level.
    However the problem i have with this is even if the BOM explodes the order is set to incomplete once I add VBAP-STKEY to the incompletion procedure. I find the VBAPSTKEY also gets a value of 5 in the table however the order is stil shown as incomplete. I am not sure if this is a bug.
    If it is not possible to control this via incompletion log is there a way to ensure that if a sales BOM does not explode in sales order the system should not create delivery for that line item.
    Any response will be highly appreciated.
    Thanks
    Praful

    Dear Praful
    You can try with this.
    Go to OVA2, block "Sales-Item" and double click on "Procedures".  Again block on "Standard Item" and double click on "Fields".  There maintain as follows:-
    Table::Fld name::::::::Description:::::::::Screen:::Status
    VBAP:::UEPOS:::::::Higher-level item:::POST::::::04
    thanks
    G. Lakshmipathi

  • How to Create Specific SAP Query for Sales BOM

    Dear All Salute !!
    How I can create a SAP Query which provide information from the Sales Order-Line Item, this specific material is having any BOM or not?
    Suppose, user want Input,
    Sales Order No., Product Category, Duration of Sales Order Release.
    want Output,
    Sales Order No., Customer No., Customer Description, Sales Order Line Item, Material No., Material Description, Delivery Date, Quantity, Sales Order release Date
    Users requirement is, List of All Line Items for which BOM is yet to be Uploaded in the System.
    Please provide complete detail with Table & field by using SAP Query.
    Rgds
    Srivastav
    +91-9973504950

    If I am correct, in table KDST, you can see the details of Sales BOM with sale order.  Since right now, I dont have access to SAP, I am unable to confirm this.  You have to consider this table and develop on your own logic with the help of ABAPer.
    thanks
    G. Lakshmipathi

  • Sales BOM explosion

    Hi all,
    I have created a sales order specific BOM (usage 6 in CS61). I would like to know how the components will get reflected in sales order i.e. if we can re-explode the sales BOM in sales order.
    Strategy for parent material is 20.
    item cat group for both parent and child material is ERLA.
    let me know if you need more inputs.
    Regards,
    Yogesh

    hi
    Structure scope set to - A
    Application as SD01
    where you have maintained, for which document type you have maintained
    let us know for further
    Regards
    vardhan

  • Sales BOM vs. Bundle

    Can someone provide an overview of sales bundle functionality and if there is any good documentation on this, and how they can be used with a BOM or bundle containing a third party dropshipped material?
    Thanks
    John

    Hi,
    Sales BOM:
    The sales bill of materials represents a finished product which is assembled at the sales stage.
            Sales bill of materials; both the finished product and the components appear as separate items in the sales order document.
    For example, the finished product can be a set of garden furniture.
    the sales bill of materials you do not manage the finished product as an inventory item, but rather as a sales item. The components can also be sales and stock items in their own right. When you create the delivery to dispatch the customeru2019s order, the components are backflush issued from stock.
    The components for Sales bills of material must be sales items.
    production BOM:
    The Production Bill of Materials represents a finished product (parent )made up of different inventory components (children). During the production process, you turn the components into the finished product.
    Components in the production bill of materials are physical items (for example a screw, a wooden board, a measured quantity of lubricant or paint), or virtual objects (one work hour).
    Rgds,

  • Sales BOM is not working for one Distribution Channel

    HI Gurus
    In VA01, Line item, for material A Sales BOM is working ( Bom exploded ) for one distribution channel but not for other distribution channel.
    Material A is defined already for other distribution channel ( for which sales bom).
    Sales BOM ( CS01) is also define.
    Regards\Adnan

    this is solved by myself. Component ( child ) material was not defined for that Distribution channel.

  • Sales BOM and related to cost

    Dear All,
    Our client has requirement of sales package as below:
    1. They want sell sales BOM as sales package
    2. Material A is main item, and material B, C, and D as component
    3. They sell material A and want the revenue also cost post to material A
    My colleague said already set up the config sales BOM,  and the result are:
    Revenue post to material A (father/main item)
    Cost post to material b, c, and d.
    However our client need all cost moved to main item (material A)
    How's the behaviour of sales bom exactly? Especially the costing?
    And what must we do to cover the requirement.
    Regards,
    Dewi

    Hi,
    Go to VTFL --- > Select the document type --> Go to item level and tick the cumulate the cost.
    Cumulate cost
    This field is used in the main item to control whether the cost value (usually condition type VPRS) is to be copied from the relevant sub-items. The following cases are taken into account:
    Free of charge sub-items (free goods)
    Batch split items
    Bill of material components
    This function is needed especially if the sub-items involved are not relevant for billing. In this case the costs of these sub-items do not appear in CO-PA or the statistics
    Hope this will resolve your issue.
    REgards,
    Krishna O.

  • Unit price change through SDK

    Hi,
    We have set limited rights to sales user (permission not given for user to "change row amounts") at sales order row level. Is there any way to change Unit Price or discount  in sales order through SDK?  We have to reset Unit price/discount for free Item.
    Can any one done this type of possibilites?
    Regards,
    Manish

    Hello Manish,
    what do you mean "free" items? Discoun of All items can freely changed or there are several items which discounts can be changed/cleared.
    Stored procedure is not a good idea, because updating by SQL a field is not allowed by SAP.
    >Is there any way to change Unit Price or discount in sales order through SDK? We have to reset Unit price/discount for free Item.
    If the user do not have a permission to change the "change row amounts", and cannot clear the Unit Price/Discount via GUI, DI API / Addon using single sign on the client will not change the unit price/discount, because it is running with the same rights as GUI.
    I am suggesting the following steps:
    1.  Grant the correct rights to the user to change the unit price/discount
    2.  Create a Formatted Search on the Discount field which clears the discount when an item is "free" item
    3. Block the changes of discount/Unit Price for  non free items via SP Transaction_Notification
    in point (2), (3) you the "free" items should be marked somehow (item property, UDF in Item master data, etc).
    Regards,
    J.

  • Importing Sales Orders through DTW

    Hi,
    I´m trying to imports Orders through DTW, I wonder if it is possible to  define de the Base Document, in this case the Sales Quotations
    Thanks in Advanced

    Aridane,
    The DTW uses the Documents object, as well as Document Lines, etc., and the properties exposed in this object.  If the "Base Document" property is exposed per the Documents object in the SDK Help Center, then yes you should be able to import it.  The property of BaseEntry is exposed via the Document_Lines object.  This is equivalent to the the BaseEntry in the DTW template Document_Lines.csv.
    HTH,
    Eddy

Maybe you are looking for