on 2005 Aug 04 6:49 PM
Hey,
I hope someone can help me with this problem. I have created a product tree (BOM) using the SDK. I can successfully add this item to the matrix on the sales quotation form in Business One. I also want to allow the user to have the same function on the Order form. I use the exact same code, product tree etc.. but the application simply hangs when I try to add the BOM itemcode to the matrix on the order form. Is there something different that I must do in order to add this on the order form?
Has anyone been able to add a BOM to the order form through the SDK?
Here is a snippet of code I am using:
SAPbouiCOM.Column col= null;
SAPbouiCOM.Columns cols;
OItem = m_ParentForm.SboForm.Items.Item(matrixId.ToString());
OMatrix = (SAPbouiCOM.Matrix)OItem.Specific;
cols = OMatrix.Columns;
SAPbouiCOM.EditText temp;
m_ParentForm.SboForm.Freeze(true);
//set ItemCode of BOM
col = cols.Item(v33_QUOT_MATRIXITEMCODE);
temp = (SAPbouiCOM.EditText)col.Cells.Item(numRows).Specific;
temp.Value = bomCode;
Does anyone have any ideas?
If you can't add a BOM to the order - why don't you add the items (and quantities) of the BOM to the order. You can add some kind of reference to notify the user that certain item lines of an order pertains to the BOM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the reply Barend but that is not an option with this client. As I said the user wants the same function that I have given them with the sales quotation.
Does anyone know why I would not be able to add the BOM to the sales order, even though I can add it to a quote and then I can import the quote to the sales order. That will work fine.
Any help would be appreciated?
Hi Laura,
I'm posting some code I use to create a sales order. I have no problem at all:
Try
oSalesOrder = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
oProdTree = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oProductTrees)
oSalesOrder.CardCode = "C40005"
oSalesOrder.DocDate = Now
oSalesOrder.DocDueDate = Now
oSalesOrder.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Items
oSalesLines = oSalesOrder.Lines
oSalesLines.AccountCode = "_SYS00000000010"
oSalesLines.ItemCode = "C7689"
oSalesLines.Quantity = 7
'Line added to test adding value in notactive cell.
oSalesLines.SerialNum = "12345"
Dim oTree As SAPbobsCOM.ProductTrees
Dim oTreeLines As SAPbobsCOM.ProductTrees_Lines
Dim l_long As Long
Dim i As Integer
oTree = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oProductTrees)
If oTree.GetByKey("C7689") Then
oTreeLines = oTree.Items()
l_long = oTreeLines.Count
If l_long > 0 Then
For i = 0 To l_long - 1
'From the 2nd line we have too add the row first and then fill data.
oSalesLines.Add()
oTreeLines.SetCurrentLine(i)
oSalesLines.ItemCode = oTreeLines.ItemCode
'oSalesLines.AccountCode = "_SYS00000000010"
Next
End If
End If
Now, regarding the usage of Form.Freeze. Are you using exactly the same code? I think you have to release it by setting it to false. Might be that this is causing the problem. You can read more about it in the following thread:
HTH,
Felipe
User | Count |
---|---|
113 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.