Skip to Content
author's profile photo Former Member
Former Member

save data from matrix in form to database

Dear all,

I am trying to save data in database from matrix in the form.

Is it Possible or matrix is for show data only.

Good day.

Regards

Bodhisatya Bhattacharjee

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 12, 2007 at 07:13 AM

    Hai,

    U please try this code. It is easy and works....

    Dim oTxt As SAPbouiCOM.EditText

    Dim oCmb As SAPbouiCOM.ComboBox

    Dim Rec As SAPbobsCOM.Recordset

    Dim i As Integer

    Dim oUt As SAPbobsCOM.UserTable

    Dim oMat As SAPbouiCOM.Matrix

    frm = app.Forms.ActiveForm

    Rec = com.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

    Try

    oUt = com.UserTables.Item("PLANT_ACTIVITYSUB")

    oMat = frm.Items.Item("gd_act").Specific

    oCmb = oMat.Columns.Item("g_act").Cells.Item(i).Specific

    oCmb = oMat.Columns.Item("g_freq").Cells.Item(i).Specific

    oTxt = oMat.Columns.Item("g_genl").Cells.Item(i).Specific

    oTxt = oMat.Columns.Item("g_remark").Cells.Item(i).Specific

    oUt.UserFields.Fields.Item("U_Activity").Value = oCmb.Selected.Value

    oUt.UserFields.Fields.Item("U_General").Value = oTxt.String

    oUt.UserFields.Fields.Item("U_Remark").Value = oTxt.String

    oUt.UserFields.Fields.Item("U_Freq").Value = oCmb.Selected.Value

    oUt.Add()

    Next

    Catch ex As Exception

    app.MessageBox(ex.Message)

    End Try

    End Sub

    Regards,

    Anitha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 11, 2007 at 09:54 AM

    You need to create object of DB datasouce and bind the same object with UDT (user define table). and then assign the value of Matrix's column to the respective field of DB datasource. after assign the value, call ADD method of DB data source to save the record.

    for (int iRow = 1; iRow <= oMatrix.VisualRowCount; iRow++)

    {

    UDTKIN1.UserFields.Fields.Item("U_WhsCode").Value = ((SAPbouiCOM.EditText)oMatrix.Columns.Item(ClsConstant.strPIC_MtxWareHouse).Cells.Item(iRow).Specific).Value;

    UDTKIN1.UserFields.Fields.Item("U_BseLnNo").Value = ((SAPbouiCOM.EditText)oMatrix.Columns.Item(ClsConstant.strPIC_MtxBseLnNo).Cells.Item(iRow).Specific).Value;

    UDTKIN1.UserFields.Fields.Item("U_UoM").Value = ((SAPbouiCOM.EditText)oMatrix.Columns.Item(ClsConstant.strPIC_MtxUOM).Cells.Item(iRow).Specific).Value;

    UDTKIN1.UserFields.Fields.Item("U_Quantity").Value = ((SAPbouiCOM.EditText)oMatrix.Columns.Item(ClsConstant.strPIC_MtxQty).Cells.Item(iRow).Specific).Value;

    iRet = UDTKIN1.Add();

    if (iRet != 0)

    {

    LineFlag = true;

    break;

    }

    else

    LineFlag = false;

    }

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 11, 2007 at 09:23 AM

    You need to get the data from the matrix and save them back in the DB by

    using DI API. DB data sources are for reading only

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.