Exemplo n.º 1
0
        public static List <Activity> getAllActivies(RfcDestination destination, ControllingArea iControllingArea, int iFiscalYear)
        {
            List <Activity> ret = new List <Activity>();

            RfcRepository repo         = destination.Repository;
            IRfcFunction  activityList = repo.CreateFunction("BAPI_CTR_GETACTIVITYPRICES");

            activityList.SetValue("COAREA", iControllingArea.ControllingAreaCode);
            activityList.SetValue("FISCYEAR", iFiscalYear);
            //activityList.SetValue("VERSION", 0);
            activityList.SetValue("PERIODFROM", 1);
            activityList.SetValue("PERIODTO", 12);

            activityList.Invoke(destination);

            IRfcTable activities = activityList.GetTable("ACTPRICES");
            IRfcTable rett       = activityList.GetTable("RETURN");


            for (int cuIndex = 0; cuIndex < activities.RowCount; cuIndex++)
            {
                activities.CurrentIndex = cuIndex;
                Activity activityT = new Activity();
                activityT.CostCenterCode        = activities.GetString("COSTCENTER");
                activityT.ActivityTypeCode      = activities.GetString("ACTTYPE");
                activityT.ActivityCurrency      = activities.GetString("CURR_COAREA");
                activityT.ActivityFixPrice      = double.Parse(activities.GetString("PRICE_CCURR_FIX"));
                activityT.ActivityVariablePrice = double.Parse(activities.GetString("PRICE_CCURR_VAR"));
                activityT.ActivityFiscalYear    = iFiscalYear;
                activityT.ActivityMonth         = int.Parse(activities.GetString("PERIOD"));
                activityT.controllingArea       = iControllingArea;
                ret.Add(activityT);
            }
            return(ret);
        }
Exemplo n.º 2
0
        public static List <ControllingArea> getAllControllingAreas(RfcDestination destination)
        {
            List <ControllingArea> ret = new List <ControllingArea>();

            RfcRepository repo = destination.Repository;
            IRfcFunction  controllingAreaList = repo.CreateFunction("BAPI_CONTROLLINGAREA_GETLIST");

            controllingAreaList.Invoke(destination);
            IRfcTable controllingAreas = controllingAreaList.GetTable("CONTROLLINGAREA_LIST");

            for (int cuIndex = 0; cuIndex < controllingAreas.RowCount; cuIndex++)
            {
                controllingAreas.CurrentIndex = cuIndex;
                ControllingArea area = new ControllingArea();
                area.ControllingAreaCode = controllingAreas.GetString("CO_AREA");
                area.ControllingAreaName = controllingAreas.GetString("Name");
                ret.Add(area);
            }
            return(ret);
        }
Exemplo n.º 3
0
        public static List <ActivityType> getAllActivityTypes(RfcDestination destination, ControllingArea iControllingArea)
        {
            List <ActivityType> ret = new List <ActivityType>();

            RfcRepository repo             = destination.Repository;
            IRfcFunction  activityTypeList = repo.CreateFunction("BAPI_ACTIVITYTYPE_GETLIST");

            activityTypeList.SetValue("CONTROLLINGAREA", iControllingArea.ControllingAreaCode);
            activityTypeList.SetValue("DATE", DateTime.Now);

            activityTypeList.Invoke(destination);

            IRfcTable activityTypes = activityTypeList.GetTable("ACTIVITYTYPE_LIST");

            for (int cuIndex = 0; cuIndex < activityTypes.RowCount; cuIndex++)
            {
                activityTypes.CurrentIndex = cuIndex;
                ActivityType activityT = new ActivityType();
                activityT.ActivityTypeCode    = activityTypes.GetString("ACTTYPE");
                activityT.ActivityTypeName    = activityTypes.GetString("NAME");
                activityT.ActivityDescription = activityTypes.GetString("DESCRIPT");
                activityT.ControllingArea     = iControllingArea;
                ret.Add(activityT);
            }
            return(ret);
        }
Exemplo n.º 4
0
        public static List <CostCenter> getAllCostCenters(RfcDestination destination, ControllingArea iControllingArea)
        {
            List <CostCenter> ret = new List <CostCenter>();

            RfcRepository repo           = destination.Repository;
            IRfcFunction  costCenterList = repo.CreateFunction("BAPI_COSTCENTER_GETLIST");

            costCenterList.SetValue("CONTROLLINGAREA", iControllingArea.ControllingAreaCode);

            costCenterList.Invoke(destination);

            IRfcTable costCenters = costCenterList.GetTable("COSTCENTER_LIST");

            for (int cuIndex = 0; cuIndex < costCenters.RowCount; cuIndex++)
            {
                costCenters.CurrentIndex = cuIndex;
                CostCenter costC = new CostCenter();
                costC.CostCenterCode  = costCenters.GetString("COSTCENTER");
                costC.CostCenterName  = costCenters.GetString("COCNTR_TXT");
                costC.ControllingArea = iControllingArea;
                ret.Add(costC);
            }
            return(ret);
        }