on 04-07-2015 10:46 AM
I have created a field in WOR1 as test. Table in production order rows
i have created one new tab and new matrix in it and a column test
i have given like this
oColumn = oColumns.Add("Col_test", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.TitleObject.Caption = "test1"
oColumn.Width = 200
oColumn = oColumns.Item("Col_test")
oColumn.DataBind.SetBound(True, "WOR1", "U_test")
bt while addding data. data in not adding
any extra coding is needed for it?
Hi Nikhil,
You need to define your own data source, it should look like this:
form.DataSources.DataTables.Add("oMatrixDT");
form.DataSources.DataTables.Item("oMatrixDT").Clear();
string sSql = "Select t0.U_ItemCode, t1.ItemName "
+ "FROM [@OFYPROM_ART] t0 "
+ "inner join OITM t1 on t0.U_ItemCode = t1.ItemCode "
+ "inner join [@OFYPROM_CAB] t2 on t2.Code = t0.Code ";
form.DataSources.DataTables.Item("oMatrixDT").ExecuteQuery(sSql);
//// matriz
var oItem = form.Items.Add("oMatrix", BoFormItemTypes.it_MATRIX);
oItem.Top = form.Items.Item("UserFolder").Top + 30;
oItem.Left = form.Items.Item("112").Left + 10;
oItem.Width = form.Width - 35;
oItem.Height = form.Height - 340;
oItem.FromPane = 5;
oItem.ToPane = 5;
var oMatrix = (Matrix)oItem.Specific;
//#
var oColumn = oMatrix.Columns.Add("#", BoFormItemTypes.it_EDIT);
oColumn.TitleObject.Caption = "#";
oColumn.Editable = false;
//Codigo Articulo
oColumn = oMatrix.Columns.Add("1", BoFormItemTypes.it_LINKED_BUTTON);
oColumn.TitleObject.Caption = "Número de artículo";
oColumn.Editable = false;
oColumn.DataBind.Bind("oMatrixDT", "U_ItemCode");
//linkedObject
LinkedButton oLinkedButton = oColumn.ExtendedObject;
oLinkedButton.LinkedObject = BoLinkedObject.lf_Items;
//Descripcion
oColumn = oMatrix.Columns.Add("2", BoFormItemTypes.it_EDIT);
oColumn.DataBind.Bind("oMatrixDT", "ItemName");
oColumn.TitleObject.Caption = "Descripción";
oColumn.Editable = false;
then when you create the document, insert your data in the production order line,
[B1Listener(BoEventTypes.et_FORM_DATA_ADD, false, new string[] {"65211"})]
public virtual void OnAfterFormDataAdd(BusinessObjectInfo pVal)
{
Form form = B1Connections.theAppl.Forms.Item(pVal.FormUID);
// ADD YOUR ACTION CODE HERE ...
Documents oDoc;
oDoc = B1Connections.diCompany.GetBusinessObject(BoObjectTypes.oProductionOrders);
oDoc.Browser.GetByKeys(pVal.ObjectKey);
oDoc.DocDueDate = DateTime.Today;
oDoc.Lines.Add();
oDoc.Lines.ItemCode = "A00002";
oDoc.Lines.Quantity = 1;
oDoc.Lines.Price = 0;
oDoc.Lines.UnitPrice = 0;
oDoc.Lines.UserFields.Fields.Item("U_DefinedField").Value = 1;
int err = oDoc.Update();
string errMsg;
B1Connections.diCompany.GetLastError(out err, out errMsg);
}
Best Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
please help me
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
100 | |
12 | |
11 | |
6 | |
6 | |
4 | |
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.