on 07-15-2005 5:11 PM
Hey I am having problems with the following code:
qProductTree = (SAPbobsCOM.ProductTrees)this.m_SboAddon.SboCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oProductTrees);
int RetVal = 0;
qProductTree.TreeCode = "productTree1";
qProductTree.TreeType = SAPbobsCOM.BoItemTreeTypes.iProductionTree;
qProductTree.Quantity = 5;
qProductTree.Items.ItemCode = "test1";
qProductTree.Items.Price = 20;
qProductTree.Items.Quantity = 1;
qProductTree.Items.Currency = "Eur";
qProductTree.Items.Comment = "test comment";
qProductTree.Items.IssueMethod = SAPbobsCOM.BoIssueMethod.im_Manual;
RetVal = qProductTree.Add();
string errMsg;
int errCode;
if (RetVal != 0 )
{
this.m_SboAddon.SboCompany.GetLastError(out errCode, out errMsg);
MessageBox.Show(errMsg);
}
I get an error message with ID 2028 which when I look it up in the SDK it states DataSource - No Data found.
Any ideas?
Hi Laura,
Try Adding the Item before you add the Object.
qProductTree.Items.Add;
THEN
RetVal = qProductTree.Add();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Laura!
In DI reference you can find topic 'Add a Bill Of Material sample', hope it'll help you.
Note, that there are some lines in that sample:
Dim vItem As SAPbobsCOM.Items
<b>Set vItem = vCmp.GetBusinessObject(oItems)</b>
Dim vProdTree As SAPbobsCOM.ProductTrees
Set vProdTree = vCmp.GetBusinessObject(oProductTrees)
'Get the Item I want to create as Product Tree
<b>RetVal = vItem.GetByKey("MyProdTree")</b>
'Set Values to the fields
vProdTree.TreeCode = <b>"MyProdTree"</b>
vProdTree.TreeType = iProductionTree
In my mind, you should find an existing Item (via GetByKey) before you create ProductTree.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you're not adding the the items in the BOM, so you must write the command qProductTree.Items.Add() after every item definition.
In your code you must write this command just before the RetVal = qProductTree.Add()
Hope this helps.
Kind Regards,
Fabio Salucci
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
7 | |
6 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.