leonardo-m
12/6/2018 - 5:14 PM

Filtrar combo del sistema en SAP (no probado)

TConstantes.SBOLDObjeto.SBO_Application.StatusBar.SetSystemMessage("Hola", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);
            TTransaction _Transaccion = TRutinas.CreaTransaccion();
            TQuery _Query = new TQuery(_Transaccion.Conexion);
            SAPbobsCOM.Recordset recset;//= new SAPbobsCOM.Recordset();
            recset = (SAPbobsCOM.Recordset)TConstantes.SBOLDObjeto.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

            _Query.Selected(new TField("A", "Code"));
            _Query.Selected(new TField("A", "Name"));
            _Query.Selected(new TField("A", "U_LDT_Activo"));
            _Query.From(new TFrom("@LDT_IMPRESOR", "A"));
            _Query.Where(new TField("A", "U_LDT_Activo"), OperadoresFiltros.Igual, new TValue("Y"));
            _Query.Genere_Query();
            recset.DoQuery(_Query.SQL);
            if (!recset.EoF)
            {
                recset.MoveFirst();

                Matrix oMatrix = (Matrix)pForma.Items.Item("3").Specific;
                ComboBox oCmbBox = (ComboBox)oMatrix.Columns.Item("U_LDT_Impresor").Cells.Item(1).Specific;
                int a = oCmbBox.ValidValues.Count;

                for (int i = 0; i < recset.RecordCount; i++)
                {

                    string sss = oCmbBox.ValidValues.Item(oCmbBox.ValidValues.Count - 1).Value;
                    string kkk = (string)recset.Fields.Item("Name").Value;
                    if (oCmbBox.ValidValues.Item(oCmbBox.ValidValues.Count - 1).Value.ToString() == recset.Fields.Item("Name").Value.ToString())
                    {

                    }
                    else
                    {
                        oCmbBox.ValidValues.Add(recset.Fields.Item("Code").Value.ToString(), recset.Fields.Item("Name").Value.ToString());

                    }

                    int s = oCmbBox.ValidValues.Count;


                    recset.MoveNext();
                }

            }