public List<CD010SINF> SearchProgram(String searchTerm, String classType, String devClass)
        {
            //if (String.IsNullOrEmpty(searchTerm))
            //{
            //    throw new SAPException(String.Format("{0} 不能为空",searchTerm));
            //}
            //SourceCode = new List<string>();
            //ProgramList = new List<string>();

            try
            {
                var destination = SAPDestination.GetDesByName(_sysName);
                IRfcFunction function = destination.Repository.CreateFunction("ZVI_RFC_READ_PROGRAM");
                function.SetValue("I_PROG", searchTerm);
                function.SetValue("I_CLASS", classType);
                function.SetValue("I_DEVCLASS", devClass);
                function.Invoke(destination);

                List<CD010SINF> _D010SINF_LIST = new List<CD010SINF>();

                IRfcTable rfctable_D010SINF = function.GetTable("ET_D010SINF");

                // C${rfctable.Name} _C${rfctable.Name};
                for (int i = 0; i < rfctable_D010SINF.RowCount; i++)
                {
                    var _D010SINF = new CD010SINF();
                    _D010SINF.prog = rfctable_D010SINF[i].GetString("PROG"); // 程序
                    _D010SINF.clas = rfctable_D010SINF[i].GetString("CLAS"); // 类别
                    _D010SINF.subc = rfctable_D010SINF[i].GetString("SUBC"); // 程序类型
                    _D010SINF.appl = rfctable_D010SINF[i].GetString("APPL"); // 应用
                    _D010SINF.cdat = rfctable_D010SINF[i].GetString("CDAT"); // 创建日期
                    _D010SINF.vern = rfctable_D010SINF[i].GetString("VERN"); //
                    _D010SINF.rmand = rfctable_D010SINF[i].GetString("RMAND"); //
                    _D010SINF.rload = rfctable_D010SINF[i].GetString("RLOAD"); //
                    _D010SINF.unam = rfctable_D010SINF[i].GetString("UNAM"); //
                    _D010SINF.udat = rfctable_D010SINF[i].GetString("UDAT"); // 更改日期
                    _D010SINF.utime = rfctable_D010SINF[i].GetString("UTIME"); //
                    _D010SINF.datalg = rfctable_D010SINF[i].GetInt("DATALG"); // 长度
                    _D010SINF.varcl = rfctable_D010SINF[i].GetString("VARCL"); //
                    _D010SINF_LIST.Add(_D010SINF);

                }
                //for (int i = 0; i < source.RowCount; i++)
                //{
                //    source.CurrentIndex = i;
                //    SourceCode.Add(source.GetString("ZEILE"));
                //}

                //for (int i = 0; i < programlist.RowCount; i++)
                //{
                //    programlist.CurrentIndex = i;
                //    ProgramList.Add(programlist.GetString("OBJ_NAME"));
                //}
                return _D010SINF_LIST;
            }
            catch (RfcAbapException abapException)
            {
                throw new SAPException(abapException.Key + abapException.Message);
            }
            catch (Exception)
            {

                throw;
            }
        }
Esempio n. 2
0
        public List <CTRDIR> SearchProgram(String searchTerm, String objecType, String devClass, bool reportOnly = true)
        {
            //if (String.IsNullOrEmpty(searchTerm))
            //{
            //    throw new SAPException(String.Format("{0} 不能为空",searchTerm));
            //}
            //SourceCode = new List<string>();
            //ProgramList = new List<string>();

            try
            {
                var          destination = SAPDestination.GetDesByName(_sysName);
                IRfcFunction function    = destination.Repository.CreateFunction("ZVI_RFC_READ_PROGRAM");
                function.SetValue("I_PROG", searchTerm);
                function.SetValue("I_OBJECT", objecType);
                function.SetValue("I_DEVCLASS", devClass);
                if (true == reportOnly)
                {
                    function.SetValue("I_NOT_LIMIT", 'X');
                }
                else
                {
                    function.SetValue("I_NOT_LIMIT", ' ');
                }
                function.Invoke(destination);
                // IRfcTable source = function.GetTable("ET_PROGRAM");
                // IRfcTable programlist = function.GetTable("ET_TADIR");


                // IRfcTable rfctable_TADIR = function.GetTable("ET_TADIR");
                // var dt = SAPINT.Function.SAPFunction.RfcTableToDataTable(rfctable_TADIR);
                List <CTRDIR> _TRDIR_LIST    = new List <CTRDIR>();
                IRfcTable     rfctable_TRDIR = function.GetTable("ET_TRDIR");

                // CTRDIR _CTRDIR;
                for (int i = 0; i < rfctable_TRDIR.RowCount; i++)
                {
                    var _TRDIR = new CTRDIR();
                    _TRDIR.name    = rfctable_TRDIR[i].GetString("NAME");    // Program
                    _TRDIR.sqlx    = rfctable_TRDIR[i].GetString("SQLX");    //
                    _TRDIR.edtx    = rfctable_TRDIR[i].GetString("EDTX");    //
                    _TRDIR.varcl   = rfctable_TRDIR[i].GetString("VARCL");   //
                    _TRDIR.dbapl   = rfctable_TRDIR[i].GetString("DBAPL");   //
                    _TRDIR.dbna    = rfctable_TRDIR[i].GetString("DBNA");    //
                    _TRDIR.clas    = rfctable_TRDIR[i].GetString("CLAS");    // Class
                    _TRDIR.type    = rfctable_TRDIR[i].GetString("TYPE");    // Selection screen version
                    _TRDIR.occurs  = rfctable_TRDIR[i].GetString("OCCURS");  //
                    _TRDIR.subc    = rfctable_TRDIR[i].GetString("SUBC");    // Prog. type
                    _TRDIR.appl    = rfctable_TRDIR[i].GetString("APPL");    // Appl.
                    _TRDIR.secu    = rfctable_TRDIR[i].GetString("SECU");    //
                    _TRDIR.cnam    = rfctable_TRDIR[i].GetString("CNAM");    // Created By
                    _TRDIR.cdat    = rfctable_TRDIR[i].GetString("CDAT");    // Created on
                    _TRDIR.unam    = rfctable_TRDIR[i].GetString("UNAM");    //
                    _TRDIR.udat    = rfctable_TRDIR[i].GetString("UDAT");    // Changed on
                    _TRDIR.vern    = rfctable_TRDIR[i].GetString("VERN");    //
                    _TRDIR.levl    = rfctable_TRDIR[i].GetString("LEVL");    //
                    _TRDIR.rstat   = rfctable_TRDIR[i].GetString("RSTAT");   // Program status
                    _TRDIR.rmand   = rfctable_TRDIR[i].GetString("RMAND");   //
                    _TRDIR.rload   = rfctable_TRDIR[i].GetString("RLOAD");   //
                    _TRDIR.fixpt   = rfctable_TRDIR[i].GetString("FIXPT");   //
                    _TRDIR.sset    = rfctable_TRDIR[i].GetString("SSET");    //
                    _TRDIR.sdate   = rfctable_TRDIR[i].GetString("SDATE");   //
                    _TRDIR.stime   = rfctable_TRDIR[i].GetString("STIME");   //
                    _TRDIR.idate   = rfctable_TRDIR[i].GetString("IDATE");   //
                    _TRDIR.itime   = rfctable_TRDIR[i].GetString("ITIME");   //
                    _TRDIR.ldbname = rfctable_TRDIR[i].GetString("LDBNAME"); // LDB name
                    _TRDIR.uccheck = rfctable_TRDIR[i].GetString("UCCHECK"); // Unicode checks
                    _TRDIR_LIST.Add(_TRDIR);
                }
                List <CD010SINF> _D010SINF_LIST = new List <CD010SINF>();

                IRfcTable rfctable_D010SINF = function.GetTable("ET_D010SINF");

                // C${rfctable.Name} _C${rfctable.Name};
                for (int i = 0; i < rfctable_D010SINF.RowCount; i++)
                {
                    var _D010SINF = new CD010SINF();
                    _D010SINF.prog   = rfctable_D010SINF[i].GetString("PROG");  // 程序
                    _D010SINF.clas   = rfctable_D010SINF[i].GetString("CLAS");  // 类别
                    _D010SINF.subc   = rfctable_D010SINF[i].GetString("SUBC");  // 程序类型
                    _D010SINF.appl   = rfctable_D010SINF[i].GetString("APPL");  // 应用
                    _D010SINF.cdat   = rfctable_D010SINF[i].GetString("CDAT");  // 创建日期
                    _D010SINF.vern   = rfctable_D010SINF[i].GetString("VERN");  //
                    _D010SINF.rmand  = rfctable_D010SINF[i].GetString("RMAND"); //
                    _D010SINF.rload  = rfctable_D010SINF[i].GetString("RLOAD"); //
                    _D010SINF.unam   = rfctable_D010SINF[i].GetString("UNAM");  //
                    _D010SINF.udat   = rfctable_D010SINF[i].GetString("UDAT");  // 更改日期
                    _D010SINF.utime  = rfctable_D010SINF[i].GetString("UTIME"); //
                    _D010SINF.datalg = rfctable_D010SINF[i].GetInt("DATALG");   // 长度
                    _D010SINF.varcl  = rfctable_D010SINF[i].GetString("VARCL"); //
                    _D010SINF_LIST.Add(_D010SINF);
                }
                //for (int i = 0; i < source.RowCount; i++)
                //{
                //    source.CurrentIndex = i;
                //    SourceCode.Add(source.GetString("ZEILE"));
                //}

                //for (int i = 0; i < programlist.RowCount; i++)
                //{
                //    programlist.CurrentIndex = i;
                //    ProgramList.Add(programlist.GetString("OBJ_NAME"));
                //}
                return(_TRDIR_LIST);
            }
            catch (RfcAbapException abapException)
            {
                throw new SAPException(abapException.Key + abapException.Message);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public List<CTRDIR> SearchProgram(String searchTerm, String objecType, String devClass, bool reportOnly = true)
        {
            //if (String.IsNullOrEmpty(searchTerm))
            //{
            //    throw new SAPException(String.Format("{0} 不能为空",searchTerm));
            //}
            //SourceCode = new List<string>();
            //ProgramList = new List<string>();

            try
            {
                var destination = SAPDestination.GetDesByName(_sysName);
                IRfcFunction function = destination.Repository.CreateFunction("ZVI_RFC_READ_PROGRAM");
                function.SetValue("I_PROG", searchTerm);
                function.SetValue("I_OBJECT", objecType);
                function.SetValue("I_DEVCLASS", devClass);
                if (true == reportOnly)
                {
                    function.SetValue("I_NOT_LIMIT", 'X');
                }
                else
                {
                    function.SetValue("I_NOT_LIMIT", ' ');
                }
                function.Invoke(destination);
                // IRfcTable source = function.GetTable("ET_PROGRAM");
                // IRfcTable programlist = function.GetTable("ET_TADIR");

                // IRfcTable rfctable_TADIR = function.GetTable("ET_TADIR");
                // var dt = SAPINT.Function.SAPFunction.RfcTableToDataTable(rfctable_TADIR);
                List<CTRDIR> _TRDIR_LIST = new List<CTRDIR>();
                IRfcTable rfctable_TRDIR = function.GetTable("ET_TRDIR");

                // CTRDIR _CTRDIR;
                for (int i = 0; i < rfctable_TRDIR.RowCount; i++)
                {
                    var _TRDIR = new CTRDIR();
                    _TRDIR.name = rfctable_TRDIR[i].GetString("NAME"); // Program
                    _TRDIR.sqlx = rfctable_TRDIR[i].GetString("SQLX"); //
                    _TRDIR.edtx = rfctable_TRDIR[i].GetString("EDTX"); //
                    _TRDIR.varcl = rfctable_TRDIR[i].GetString("VARCL"); //
                    _TRDIR.dbapl = rfctable_TRDIR[i].GetString("DBAPL"); //
                    _TRDIR.dbna = rfctable_TRDIR[i].GetString("DBNA"); //
                    _TRDIR.clas = rfctable_TRDIR[i].GetString("CLAS"); // Class
                    _TRDIR.type = rfctable_TRDIR[i].GetString("TYPE"); // Selection screen version
                    _TRDIR.occurs = rfctable_TRDIR[i].GetString("OCCURS"); //
                    _TRDIR.subc = rfctable_TRDIR[i].GetString("SUBC"); // Prog. type
                    _TRDIR.appl = rfctable_TRDIR[i].GetString("APPL"); // Appl.
                    _TRDIR.secu = rfctable_TRDIR[i].GetString("SECU"); //
                    _TRDIR.cnam = rfctable_TRDIR[i].GetString("CNAM"); // Created By
                    _TRDIR.cdat = rfctable_TRDIR[i].GetString("CDAT"); // Created on
                    _TRDIR.unam = rfctable_TRDIR[i].GetString("UNAM"); //
                    _TRDIR.udat = rfctable_TRDIR[i].GetString("UDAT"); // Changed on
                    _TRDIR.vern = rfctable_TRDIR[i].GetString("VERN"); //
                    _TRDIR.levl = rfctable_TRDIR[i].GetString("LEVL"); //
                    _TRDIR.rstat = rfctable_TRDIR[i].GetString("RSTAT"); // Program status
                    _TRDIR.rmand = rfctable_TRDIR[i].GetString("RMAND"); //
                    _TRDIR.rload = rfctable_TRDIR[i].GetString("RLOAD"); //
                    _TRDIR.fixpt = rfctable_TRDIR[i].GetString("FIXPT"); //
                    _TRDIR.sset = rfctable_TRDIR[i].GetString("SSET"); //
                    _TRDIR.sdate = rfctable_TRDIR[i].GetString("SDATE"); //
                    _TRDIR.stime = rfctable_TRDIR[i].GetString("STIME"); //
                    _TRDIR.idate = rfctable_TRDIR[i].GetString("IDATE"); //
                    _TRDIR.itime = rfctable_TRDIR[i].GetString("ITIME"); //
                    _TRDIR.ldbname = rfctable_TRDIR[i].GetString("LDBNAME"); // LDB name
                    _TRDIR.uccheck = rfctable_TRDIR[i].GetString("UCCHECK"); // Unicode checks
                    _TRDIR_LIST.Add(_TRDIR);

                }
                List<CD010SINF> _D010SINF_LIST = new List<CD010SINF>();

                IRfcTable rfctable_D010SINF = function.GetTable("ET_D010SINF");

                // C${rfctable.Name} _C${rfctable.Name};
                for (int i = 0; i < rfctable_D010SINF.RowCount; i++)
                {
                    var _D010SINF = new CD010SINF();
                    _D010SINF.prog = rfctable_D010SINF[i].GetString("PROG"); // 程序
                    _D010SINF.clas = rfctable_D010SINF[i].GetString("CLAS"); // 类别
                    _D010SINF.subc = rfctable_D010SINF[i].GetString("SUBC"); // 程序类型
                    _D010SINF.appl = rfctable_D010SINF[i].GetString("APPL"); // 应用
                    _D010SINF.cdat = rfctable_D010SINF[i].GetString("CDAT"); // 创建日期
                    _D010SINF.vern = rfctable_D010SINF[i].GetString("VERN"); //
                    _D010SINF.rmand = rfctable_D010SINF[i].GetString("RMAND"); //
                    _D010SINF.rload = rfctable_D010SINF[i].GetString("RLOAD"); //
                    _D010SINF.unam = rfctable_D010SINF[i].GetString("UNAM"); //
                    _D010SINF.udat = rfctable_D010SINF[i].GetString("UDAT"); // 更改日期
                    _D010SINF.utime = rfctable_D010SINF[i].GetString("UTIME"); //
                    _D010SINF.datalg = rfctable_D010SINF[i].GetInt("DATALG"); // 长度
                    _D010SINF.varcl = rfctable_D010SINF[i].GetString("VARCL"); //
                    _D010SINF_LIST.Add(_D010SINF);

                }
                //for (int i = 0; i < source.RowCount; i++)
                //{
                //    source.CurrentIndex = i;
                //    SourceCode.Add(source.GetString("ZEILE"));
                //}

                //for (int i = 0; i < programlist.RowCount; i++)
                //{
                //    programlist.CurrentIndex = i;
                //    ProgramList.Add(programlist.GetString("OBJ_NAME"));
                //}
                return _TRDIR_LIST;
            }
            catch (RfcAbapException abapException)
            {
                throw new SAPException(abapException.Key + abapException.Message);
            }
            catch (Exception)
            {

                throw;
            }
        }
Esempio n. 4
0
        public List <CD010SINF> SearchProgram(String searchTerm, String classType, String devClass)
        {
            //if (String.IsNullOrEmpty(searchTerm))
            //{
            //    throw new SAPException(String.Format("{0} 不能为空",searchTerm));
            //}
            //SourceCode = new List<string>();
            //ProgramList = new List<string>();

            try
            {
                var          destination = SAPDestination.GetDesByName(_sysName);
                IRfcFunction function    = destination.Repository.CreateFunction("ZVI_RFC_READ_PROGRAM");
                function.SetValue("I_PROG", searchTerm);
                function.SetValue("I_CLASS", classType);
                function.SetValue("I_DEVCLASS", devClass);
                function.Invoke(destination);

                List <CD010SINF> _D010SINF_LIST = new List <CD010SINF>();

                IRfcTable rfctable_D010SINF = function.GetTable("ET_D010SINF");

                // C${rfctable.Name} _C${rfctable.Name};
                for (int i = 0; i < rfctable_D010SINF.RowCount; i++)
                {
                    var _D010SINF = new CD010SINF();
                    _D010SINF.prog   = rfctable_D010SINF[i].GetString("PROG");  // 程序
                    _D010SINF.clas   = rfctable_D010SINF[i].GetString("CLAS");  // 类别
                    _D010SINF.subc   = rfctable_D010SINF[i].GetString("SUBC");  // 程序类型
                    _D010SINF.appl   = rfctable_D010SINF[i].GetString("APPL");  // 应用
                    _D010SINF.cdat   = rfctable_D010SINF[i].GetString("CDAT");  // 创建日期
                    _D010SINF.vern   = rfctable_D010SINF[i].GetString("VERN");  //
                    _D010SINF.rmand  = rfctable_D010SINF[i].GetString("RMAND"); //
                    _D010SINF.rload  = rfctable_D010SINF[i].GetString("RLOAD"); //
                    _D010SINF.unam   = rfctable_D010SINF[i].GetString("UNAM");  //
                    _D010SINF.udat   = rfctable_D010SINF[i].GetString("UDAT");  // 更改日期
                    _D010SINF.utime  = rfctable_D010SINF[i].GetString("UTIME"); //
                    _D010SINF.datalg = rfctable_D010SINF[i].GetInt("DATALG");   // 长度
                    _D010SINF.varcl  = rfctable_D010SINF[i].GetString("VARCL"); //
                    _D010SINF_LIST.Add(_D010SINF);
                }
                //for (int i = 0; i < source.RowCount; i++)
                //{
                //    source.CurrentIndex = i;
                //    SourceCode.Add(source.GetString("ZEILE"));
                //}

                //for (int i = 0; i < programlist.RowCount; i++)
                //{
                //    programlist.CurrentIndex = i;
                //    ProgramList.Add(programlist.GetString("OBJ_NAME"));
                //}
                return(_D010SINF_LIST);
            }
            catch (RfcAbapException abapException)
            {
                throw new SAPException(abapException.Key + abapException.Message);
            }
            catch (Exception)
            {
                throw;
            }
        }