Skip to Content
avatar image
Former Member

Copy Matrix Data

Hello,

i have created a user form with a matrix and a button using SAP B1 studio for vs2010.

I need to copy data from the matrix, when the button is pressed. I saw that there is a menu "Copy Table" with the id "784", but unfortunately is disabled and i cannot use it in my addon.

What do you propose to do?

Thank you in advance!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Sep 28, 2017 at 12:43 PM

    Hi Makis,

    You can opt to use the following:

    SAPbouiCOM.Matrix oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx_0000").Specific;
    oMatrix.Clear();
    oForm.DataSources.DBDataSources.Item("@LINETABLENAME").Clear();
    SAPbouiCOM.DBDataSource oDB = (SAPbouiCOM.DBDataSource)oForm.DataSources.DBDataSources.Item("@LINETABLENAME");
    oForm.DataSources.DBDataSources.Item("@LINETABLENAME").InsertRecord(oDB.Size);
    oDB.SetValue("U_LineID", oDB.Size - 1, Convert.ToString(oRecSet.Fields.Item("LineID").Value));
    oDB.SetValue("U_Code", oDB.Size - 1, Convert.ToString(oRecSet.Fields.Item("Code").Value));
    oDB.SetValue("U_Name", oDB.Size - 1, Convert.ToString(oRecSet.Fields.Item("Name").Value));
    oMatrix.LoadFromDataSource();
    

    Kind regards,

    ANKIT CHAUHAN

    SAP SME Support

    Add comment
    10|10000 characters needed characters exceeded