Exemplo n.º 1
0
        public System.Data.DataTable GetBsItemsDetail()
        {
            // validation
            if (string.IsNullOrEmpty(this.CompanyCode))
            {
                throw new Exception("公司代码参数不能为空!");
            }
            if (string.IsNullOrEmpty(this.ReportYear))
            {
                throw new Exception("年度参数不能为空!");
            }
            if (string.IsNullOrEmpty(this.ReportPeriod))
            {
                throw new Exception("期间参数不能为空!");
            }

            RfcDestination sap      = DestinationProvider.GetSAPDestination();
            IRfcFunction   function = sap.Repository.CreateFunction("Z_BS_BALANCES");

            function.SetValue("COMPANYCODE", this.CompanyCode);
            function.SetValue("FISCALYEAR", this.ReportYear);
            function.SetValue("FISCALPERIOD", this.ReportPeriod);

            function.Invoke(sap);

            IRfcTable bsItems = function.GetTable("ACC_BALANCES");

            return(SAPUtils.ToDataTable(bsItems));
        }
Exemplo n.º 2
0
        public DataTable GetTableFields(string tableName)
        {
            RfcDestination sap      = DestinationProvider.GetSAPDestination();
            IRfcFunction   function = sap.Repository.CreateFunction("RFC_READ_TABLE");

            function.SetValue("QUERY_TABLE", tableName.ToUpper());
            function.SetValue("NO_DATA", "X");
            function.Invoke(sap);

            IRfcTable fieldsTable = function.GetTable("FIELDS");

            return(SAPUtils.ToDataTable(fieldsTable));
        }
Exemplo n.º 3
0
        public DataTable ReadTableUsingFields(string tableName,
                                              String[] selectedFields,
                                              string delimeter,
                                              int rowCount,
                                              string options = "")
        {
            RfcDestination sap      = DestinationProvider.GetSAPDestination();
            IRfcFunction   function = sap.Repository.CreateFunction("RFC_READ_TABLE");

            function.SetValue("QUERY_TABLE", tableName.ToUpper());
            function.SetValue("DELIMITER", delimeter);
            function.SetValue("ROWCOUNT", rowCount);

            // options parameter
            if (!String.IsNullOrEmpty(options))
            {
                IRfcTable optionsTable = function.GetTable("OPTIONS");
                optionsTable.Append();
                optionsTable.CurrentRow.SetValue("TEXT", options);
            }

            // fields parameter
            IRfcTable fieldsTable = function.GetTable("FIELDS");

            foreach (var item in selectedFields)
            {
                fieldsTable.Append();
                fieldsTable.CurrentRow.SetValue("FIELDNAME", item.ToString());
            }

            function.Invoke(sap);

            IRfcTable data = function.GetTable("DATA");
            DataTable dt   = SAPUtils.ToDataTable(data);

            return(this.SplittedFields(dt, selectedFields, delimeter));
        }