Adding a new item to an already existing BOM

Hi,
    I am having a problem adding a new item to an already existing parent BOM.I excute the following code (as per the SDK).
    Dim vProdTree As SAPbobsCOM.ProductTrees
    Set vProdTree = vCmp.GetBusinessObject(oProductTrees)
    'Set Values to the fields
    vProdTree.TreeCode = "Item1"
    vProdTree.TreeType = iProductionTree
    'Set Values to the Assembly parts of the
    'First Assembly
    vProdTree.Items.ItemCode = Excel.Row(Cell1)
    vProdTree.Items.Price = 20
    vProdTree.Items.Quantity = 1
    vProdTree.Items.Currency = "Eur"
    'Adding the Product Tree
    RetVal = vProdTree.Add
    If (RetVal <> 0) Then
        vCmp.GetLastError ErrCode, ErrMsg
        MsgBox ErrCode & " " & ErrMsg
    End If
If there is no parent BOM production tree with keycode Item1, then when the above code is run for the first time, it works.The issue occurs when I run change my excel, Cell1 to a different value and run the program again. The error states that the code already exists, which is correct, but does not  append the item to the existing BOM.
I have tried vProdTree.Update, but this line overwrites the original child item in the BOM, rather than appending a new item, which is what I want it to do.
Any  help is appreciated.
- Adrian.V

Your issue here is how the "Items" (which is actually pointing to ProductTree_Lines object) works. It is a List of items, and when you get the object is always pointing at the first item in the list.
So for example, to add a BOM with two items you would need to set the details of the first Item and then add a line using vProdTree.Items.Add() before setting the values for that item.
e.g.:
Dim vProdTree As SAPbobsCOM.ProductTrees
Set vProdTree = vCmp.GetBusinessObject(oProductTrees)
'Set Values to the fields
vProdTree.TreeCode = "Item1"
vProdTree.TreeType = iProductionTree
'Set Values to the Assembly parts of the
'First Assembly
vProdTree.Items.ItemCode = Excel.Row(Cell1)
vProdTree.Items.Price = 20
vProdTree.Items.Quantity = 1
vProdTree.Items.Currency = "Eur"
'Add a second item to the BOM
vProdTree.Items.Add
vProdTree.Items.ItemCode = Excel.Row(Cell2)
vProdTree.Items.Price = 50
vProdTree.Items.Quantity = 1
vProdTree.Items.Currency = "Eur"
'Adding the Product Tree
RetVal = vProdTree.Add
If (RetVal 0) Then
vCmp.GetLastError ErrCode, ErrMsg
MsgBox ErrCode & " " & ErrMsg
End If
To do what you want to do, which is get the BOM and add a new item to it, you will need to do this:
Dim vProdTree As SAPbobsCOM.ProductTrees
Set vProdTree = vCmp.GetBusinessObject(oProductTrees)
'Get your BOM by key
vProdTree.GetByKey("Item1")
'Add a second item to the BOM
'First Item exists so you need to add a new row
vProdTree.Items.Add
vProdTree.Items.ItemCode = Excel.Row(Cell1)
vProdTree.Items.Price = 50
vProdTree.Items.Quantity = 1
vProdTree.Items.Currency = "Eur"
'Update the Product Tree
RetVal = vProdTree.Update
If (RetVal 0) Then
vCmp.GetLastError ErrCode, ErrMsg
MsgBox ErrCode & " " & ErrMsg
End If
Method one allows you to add multiple lines as you add the object (which makes more sense), method 2 allows you to get the object after it has been added and add multiple lines to it. This is similar to how the Document_Lines object works.

Similar Messages

  • Installing firefox 4 on mac window says a newer item called firefox already exists

    I downloaded FF4, clicked on the download and a window came up saying drag the FF icon to applications. When I do, a warning windo pops up saying "there is already a newer item called firefox. Do you want to replace it with this older one?"

    Try to drag the old Firefox version to the trash to see if that allows to install the new version.
    *https://support.mozilla.org/kb/Installing+Firefox+on+Mac
    See also [[/questions/795198]]

  • ADDING A NEW ITEM IN THE CREDIT REQUEST DETAILS PAGE.

    Dear friends,
    Please help me with this scenario.Thanks so much for your help.
    Task: ADDING A NEW ITEM IN THE CREDIT REQUEST DETAILS PAGE.
    Need to create a new item on this page called "approver notes" (column notes).
    Can this be achieved by personalization?
    Scenario:
    On credit request details page disputed invoice number, request date, status, bill to, ship to, etc are displayed.
    When the status is "not approved”, item should be displayed along the "rejected" comment.
    If the status is other than "not approved" then the item should not be displayed.

    what page is this ? are you sure it is a OAF page ?
    If it is a OAF page, you would need to extend the controller to fire a partial action for the item and then control the display property of the comments field
    Tapash

  • Legacy data transfer for new depreciation area for already existing assets

    Hi all,
    I am doing legacy data transfer for New deprecaition area for already existing assets through AS92.
    I like to give Ordinay depreciation posted amount  for the current FY for these assets in AS92, but i find this field is not editable inAS92.
    Please guide me to upload the Posted deprecaiton amount (for current FY) for these assets. I have assets both which are acquired in Last FY year and also this FY year.
    Regards,
    Srinivas

    HI,
    I have to migrate Posted dpereciation for new depreciation for nearly 3000 assets, In transaction 147, where i need give Acquituion value aslo, please note these are not new assets, these are prior year assets wiht opeing balances. If we use 147 system will take it is current acquition.
    Please note my transter date is 28.02.2010, I have already run AFAB for this company cdoe Feb 2010 for other depreciation areas.
    Now i am trying to update Opening APC Cost and Opening Accumulated deprecation for these assets and also posted depreciation for this FY.
    Where in AS92, i am able to update Opeing APC Cost and Opeing  Acc Dep succsfully for new dep area for already existingassets, bu Posted deprecation field is not editable.
    Please guide me how to update posted deprecation for new deprecaition area  in AS92 or some other way for already existing assets.
    REgards,
    Srinivas

  • Adding a new DB Node in the existing SharePoint 2007 Farm.

    Hello,
    Recently we got a requirement to add a new DB server (SQL Server 2007) to the existing MOSS 2007 Production Farm. Can any one please help me out to list out the steps that need to be followed for adding the new DB server to the existing Production Farm.
    We are planning to use the new DB server only for holding Content DB's and no plan for any Config DB,SSP DB or Search DB.
    Thanks in advance for your help

    Hi,
    Also I am going to clone from Source app tier (RHEL4) to target app tier (RHEL5)?
    Are there any issue with the platform version changing?There should be no issue -- Just make sure you have all the OS pre-req. software and packages installed on the RHEL5 node.
    FAQ: Cloning Oracle Applications Release 11i [ID 216664.1] -- 13. Can I clone from one operating system version to another?
    Oracle Applications 11i Installation on OEL5 or RHEL5 [ID 730444.1]
    Oracle Applications Installation Update Notes, Release 11i (11.5.10.2) [ID 316806.1]
    Thanks,
    Hussein

  • Adding new custom field in already existing custom tab for MM01

    Hello Guru,
    I have a requirement that add a custom field in already existing custom view of MM01. I did the following steps :
    1. I have cerated a new field in MARA using APPEND structure.
    2. I have found the function group(Y_FE_MARA) that already there other subscreens, so that I have added another subscreen in that function group and created a field from MARA in the screen.
    3. in SPRO went for the path Logistics General->Material Master->Configuring the Material->Define Structure of Data screens for Each Screen sequence
    In the 3rd step, I have choosen already existing screen sequence(Y1) and went for Data Screens and choosen for Custom tab and double click on subscreens and then I have added the program as SAPLY_FE_MARA and subscreen number(011) and saved it.
    After all the above steps, I have run MM02/MM03 then the field is not getting displayed in the screen of custom view.
    Did I miss any steps here? Please suggest me if I did something wrong.
    Thanks and Regards,
    Muralikrishna Peravali

    Hi Raymond,
    Thank you for the reply. As per the note some one already implemented the Screen Enhancement with 2 custom views. I need to add the field in any one of existing custom view. So for this I have created a Subscreen in copied function group of MGD1(Y_FE_MARA). But in the function group already 10 Subscreens were created. Is this is the problem? or else copy the FG MGD1 into another FG and create the subscreen will be feasible to my scenario?
    Please suggest me.
    Thanks and Regards,
    Muralikrishna Peravali

  • Hi,Error when adding chart of account This entry already exists in the foll

    Hi,
    I am getting these below error while adding new chart of account.
    This entry already exists in the following tables  '' (UDO1) (ODBC -2035)  [Message 131-183]
    This entry already exists in the following tables  'G/L Accounts' (OACT) (ODBC -2035)  [Message 131-183]
    please suggest solving .  Thanks Advance.
    Regards
    Rajkumar Gupta

    Hi,
    You may check this thread:
    Re: This entry already exists in the following tables -Message
    Also check SAP Note Number: 1054713 to see if it applies to you. It might be a bug too.
    Thanks,
    Gordon

  • New address creation for already existing customer in Oracle

    Hi,
    We are working on customer conversion and loading all the data into customer interface tables so that we can run the customer interface to move the data into oracle tables.
    We need to create another address as per client’s requirement to already existing customer in oracle which has active primary bill_to address.
    Can we do this by using customer interface tables or use the API’s for it.
    Any pointers regarding this will be highly appreciated.
    Thank and Regards,
    Rekha Palagani.

    i have heared form someone that i should copy some text (from files) or some files which resides in bin folder (i don't know the exact path) in the sql console to access existing tables. is that ture?Not sure what that means... to access existing tables, or to create new ones you have to use Sql commands (or some graphic stuff).
    What about reading some documentation ?
    System user is a DBA, and can possibly read any tables, but most probably is not the owner of emp table. To know it you can do
    SQL> select owner from dba_tables where table_name='EMP';
    then connect to that user, or, as system user, do
    SQL> select * from <owner>.emp;

  • Adding a new Big INT column to existing table in production, which holds 700 million records will impact anything in production?

    Hi Guys,
    I have to add a new Big INT column to existing table in production, which holds 700 million records and would like to know the impact?
    I have been tolled by one of my colleagues that last time they tried adding a column to same table during working hour and it locked out the table and impacted the users.
    Please suggest/share If any one had similar experience.
    Thanks Shiven:) If Answer is Helpful, Please Vote

    If you add a new column to a table using an ALTER TABLE ADD command and specify that the new column allows NULLs and you do not define a default value, then it will take a table lock.  However, once it gets the table lock, it will essentially run instantly
    and then free the table lock.  That will add this new column as the last column in the table, for example
    ALTER MyTable ADD MyNewColumn bigint NULL;
    But if you your change adds a new column with a default value, or you do something like using table designer to add the new column in the middle of the current list of columns, then SQL will have to rewrite the table.  So it will get a table lock, rewrite
    the whole table and then free the table lock.  That will take a considerable amount of time and the table lock will be held for that whole period of time.
    But, no matter how you make the change, if at all possible, I would not alter a table schema on a production database during working hours.  Do it when nothing else is going on.
    Tom

  • Custom SharePoint 2010 designer page throws "The data source control failed to execute the insert command" exception while adding the new item after the August 13, 2013 CU has installed

    We have the SharePoint Server 2010 with SP1 environment on which the custom SP2010 designer pages were working as expected before the
    August 13, 2013 CU has installed. But, getting the below exception while trying to add the new item after the CU has installed.
    Error while executing web part: System.NullReferenceException: Object reference not set to an instance of an object.     at Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteInsert(IDictionary values)     at
    System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc
    06/19/2014 16:49:37.65  w3wp.exe (0x1240)                        0x1300 SharePoint Foundation        
     Runtime                        tkau Unexpected Microsoft.SharePoint.WebPartPages.DataFormWebPartException: The data source control
    failed to execute the insert command. 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc    at Microsoft.SharePoint.WebPartPages.DataFormWebPart.InsertCallback(Int32 affectedRecords, Exception ex)     at System.Web.UI.DataSourceView.Insert(IDictionary
    values, DataSourceViewOperationCallback callback)     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.FlatCommit()     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.HandleOnSave(Object sender, EventArgs e)    
    at Microsoft.SharePoint.WebPartPages.DataFormWebPart.RaisePostBackEvent(String eventArgument)     at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)     at System.Web.UI.Page.ProcessRequestMain(Boolean
    inclu... 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc
    06/19/2014 16:49:37.65* w3wp.exe (0x1240)                        0x1300 SharePoint Foundation        
     Runtime                        tkau Unexpected ...deStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc
    I have tried changing the "DataSourceMode" as below, now the insert command is working, but update command is not working.
    <SharePoint:SPDataSource runat="server" DataSourceMode="ListItem" />
    Also, the lookup dropdown fields are displaying the value as "<a href="Daughterhttp://cpsp10/sites/Employees/_layouts/listform.aspx?PageType=4&ListId={8F62F444-FB6A-4F03-9522-C4696B45DCD1}&ID=10&RootFolder=*">Daughter</a>"
    instead of only "Daughter".
    Please provide the solution to get rid of this issue.
    Thanks
    Ramasubbu

    Try below:
    http://social.technet.microsoft.com/Forums/en-US/ae910269-3a0c-4506-844b-e8bc89d95b71/data-source-control-failed-to-execute-the-insert-command
    http://blog.jussipalo.com/2012/01/sharepoint-2010-data-source-control.html
    While there can be many causes for this generic error message, in my case the first parameter or ddwrt:DataBind function inside the SharePoint:FormFields element was
    'i' and I was working with an Edit Form. Changing it to
    'u' as it was with every other FormField fixed the issue.
    <SharePoint:FormField runat="server" id="ff1{$Pos}" ControlMode="Edit" FieldName="Esittaja" __designer:bind="{ddwrt:DataBind('u',concat('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Esittaja')}"
    />
    Explanation:
    DataBind operation type parameters (the first parameter) are listed below:
    'i' stands for INSERT,
    'u' stands for UPDATE,
    'd' stands for DELETE.
    http://webcache.googleusercontent.com/search?q=cache:d9HHY4I7omgJ:thearkfloats.blogspot.com/2014/03/sharepoint-2010-data-source-control.html+&cd=4&hl=en&ct=clnk&gl=in
    If this helped you resolve your issue, please mark it Answered

  • When upgrading Firefox I get the message, "An older item named "Firefox" already exists in this location. Do you want to replace it with the newer one you're moving?". Choosing YES results in "Operation can't be completed because item "Firefox" in use."

    Using Mac Snow Leopard 10.6.7
    Current Firefox: 3.6.18
    Trying to update latest version: 5.0.1
    This seems quirky. In Updating a newer version of Firefox is should seem obvious that the existing firfox executable would be replaced by the newer version ?!?
    Thanks for any help you can give.

    If you have problems with updating or with the permissions then easiest is to download the full version and trash the currently installed version to do a clean install of the new version.
    Download a new copy of the Firefox program and save the DMG file to the desktop
    * Firefox 5.0.x: http://www.mozilla.com/en-US/firefox/all.html
    * Trash the current Firefox application to do a clean (re-)install
    * Install the new version that you have downloaded
    Your profile data is stored elsewhere in the Firefox Profile Folder, so you won't lose your bookmarks and other personal data.
    * http://kb.mozillazine.org/Profile_folder_-_Firefox

  • BADI CRM_ISA_BASKET_ITEMS adding a new item

    In B2C Webshop, we are trying to use badi CRM_ISA_BASKET_ITEMS to, depending on what is in the customer's shopping basket, add an additional item to the basket.  We are trying to do this on the ABAP side.  I have started by adding the item in method CHANGEITEMS_BEFORE_IL , but it doesn't seem to work.  Does anyone know if this can be done in ABAP, or does some or all of the customization have to happen on the Java side.
    Thanks in advance for any help.

    Lee,
    There are two types of basket java basket and crm basket, if you are using java basket you have to do that in the java side.
    But if you are using the crm basket this method should work.
    Please check your XCM settings and confirm which basket you are using.
    Thanks and Regards
    shanto aloor

  • How do i add a new page to my already existing pages template document?

    help i'm really confused and in a hurry! I am working on something using a template, but it doesn't have enough pages, but i can't add a new one.

    whoops sorry figured it out thanks!

  • How do I add a new song to an already existing playlist on the new iso7 for iPhone 5?

    I tried to add a new song and I go to playlist, edit and go to song to add and it won't. So confused!

    This should come handy:
    http://docs.info.apple.com/article.html?artnum=107240

  • How do I add a new track to an already existing CD-R?

    I want to be able to purchase tunes over an extended time period. I want to create a cd-r by adding tracks at different times. How may I do this without reformatting the cd and reburning the entire list?
    dell dimension3000   Windows XP  

    This should come handy:
    http://docs.info.apple.com/article.html?artnum=107240

Maybe you are looking for