Matrix editable con SDK


#1

Buen día
Alguien sabe como hacer que toda mi matrix sea editable usando sdk?

Muchísimas gracias de antemano

Un saludo


#2

Disculpa mi ignorancia, pero cuál sería el sentido de hacer una matrix editable?


#4

Para eso debes generar las columnas en tiempo de ejecucion usando la UI API.
Ejemplo;

    private SAPbouiCOM.Form FormWithMatrix()
    {
        SAPbouiCOM.Form oForm = oApplication.LoadForm(CCMMAF.Properties.Resources.CM, "OTCM");
        SAPbouiCOM.EditText oEditText = null;
        SAPbouiCOM.ComboBox oComboBox = null;
        SAPbouiCOM.Matrix oMatrix = null;
        SAPbouiCOM.Columns oColumns = null;
        SAPbouiCOM.Column oColumn = null;
        oForm.Visible = false;

        try
        {

            oEditText = (SAPbouiCOM.EditText)oForm.Items.Item("txtIdEntry").Specific;
            oEditText.DataBind.SetBound(true, "@OTCM", "DocEntry");

            oEditText = (SAPbouiCOM.EditText)oForm.Items.Item("txtDocDate").Specific;
            oEditText.DataBind.SetBound(true, "@OTCM", "U_DocDate");
            oEditText.Item.Enabled = true;

            oEditText = (SAPbouiCOM.EditText)oForm.Items.Item("txtComment").Specific;
            oEditText.DataBind.SetBound(true, "@OTCM", "U_Comments");
            oEditText.Item.Enabled = false;

            oComboBox = (SAPbouiCOM.ComboBox)oForm.Items.Item("cmbStatus").Specific;
            oComboBox.DataBind.SetBound(true, "@OTCM", "Status");
            oComboBox.Item.DisplayDesc = true;
            oComboBox.Item.Enabled = false;

            oEditText = (SAPbouiCOM.EditText)oForm.Items.Item("txtTId").Specific;
            oEditText.DataBind.SetBound(true, "@OTCM", "U_TransId");

            oEditText = (SAPbouiCOM.EditText)oForm.Items.Item("txtCMA").Specific;
            oEditText.DataBind.SetBound(true, "@OTCM", "U_CMAct");

            oEditText = (SAPbouiCOM.EditText)oForm.Items.Item("txtCMD").Specific;
            oEditText.DataBind.SetBound(true, "@OTCM", "U_CMDp");

            oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtxCM").Specific;
            oColumns = oMatrix.Columns;

            oColumn = oColumns.Add("1", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Clase activo fijo";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_ClaseAF");
            oColumn.Width = 100;

            oColumn = oColumns.Add("2", BoFormItemTypes.it_LINKED_BUTTON);
            oColumn.TitleObject.Caption = "Codigo del AF";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_ItemCode");
            oColumn.Width = 100;

            oColumn = oColumns.Add("3", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Descripcion del AF";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_ItemName");
            oColumn.Width = 100;

            oColumn = oColumns.Add("4", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Fecha de alta";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_CapDate");
            oColumn.Width = 100;

            oColumn = oColumns.Add("5", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Factor indice CCMM";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_Factor");
            oColumn.Width = 100;

            oColumn = oColumns.Add("6", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Valor AF";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_ValorAF");
            oColumn.Width = 100;

            oColumn = oColumns.Add("7", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Adiciones";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_ValorAD");
            oColumn.Width = 100;

            oColumn = oColumns.Add("8", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Valor CM";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_ValorCM");
            oColumn.Width = 100;

            oColumn = oColumns.Add("9", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Valor AF corregido";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.RightJustified = true;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_ValorAct");
            oColumn.Width = 100;

            oColumn = oColumns.Add("10", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Valor deprec inicial";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_ValorDIn");
            oColumn.Width = 100;

            oColumn = oColumns.Add("11", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "CCMM Dep Inic";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_CMDpIn");
            oColumn.Width = 100;

            oColumn = oColumns.Add("12", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Vida del ejercicio";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_UseFLif");
            oColumn.Width = 100;

            oColumn = oColumns.Add("13", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Saldo vida";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_RmdLife");
            oColumn.Width = 100;

            oColumn = oColumns.Add("14", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Deprec mensual";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_ValDmen");
            oColumn.Width = 100;

            oColumn = oColumns.Add("15", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Deprec total periodo";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_ValDtot");
            oColumn.Width = 100;

            oColumn = oColumns.Add("16", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Total deprec acum";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_TotDAc");
            oColumn.Width = 100;

            oColumn = oColumns.Add("17", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Valor neto AF";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_ValNetAf");
            oColumn.Width = 100;

            oColumn = oColumns.Add("18", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Periodo de correccion";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_Periodo");
            oColumn.Width = 100;

            oColumn = oColumns.Add("19", BoFormItemTypes.it_EDIT);
            oColumn.TitleObject.Caption = "Centro de costo";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_Ccosto");
            oColumn.Width = 100;

            oColumn = oColumns.Add("20", BoFormItemTypes.it_LINKED_BUTTON);
            oColumn.TitleObject.Caption = "Cta Activo";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_CtaAct");
            oColumn.Width = 100;

            oColumn = oColumns.Add("21", BoFormItemTypes.it_LINKED_BUTTON);
            oColumn.TitleObject.Caption = "Cta Dep Acum";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_CtaDep");
            oColumn.Width = 100;

            oColumn = oColumns.Add("22", BoFormItemTypes.it_LINKED_BUTTON);
            oColumn.TitleObject.Caption = "Cta CCMM";
            oColumn.Visible = true;
            oColumn.Editable = false;
            oColumn.DataBind.SetBound(true, "@TCM1", "U_CtaCM");
            oColumn.Width = 100;

            oForm.DataBrowser.BrowseBy = "txtIdEntry";

            return oForm;

        }
        catch (Exception ex)
        {
            Funciones.LogFile(LogFileName, string.Format(@"{0};{1};{2};{3};{4}", DateTime.Now.ToString("yyyyMMdd_HH:mm:ss"), "ERR", this.GetType().Name, System.Reflection.MethodBase.GetCurrentMethod(), ex.Message));
            return null;
            throw;
        }
        finally
        {
            oComboBox = null;
            oEditText = null;
            oColumn = null;
            oColumns = null;
        }
    }

#5

Este tema se cerró automáticamente 7 días después del último post. No se permiten nuevas respuestas.