Exemplo n.º 1
0
        public IRfcTable tablaEscalas(string knumh)
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_043");//Módulo de función

                bapi.SetValue("KNUMH", knumh);
                //bapi.SetValue("USUARIO", usuario);

                bapi.Invoke(oDestino);

                IRfcTable tabla = bapi.GetTable("KONM");
                for (int i = 0; i < tabla.Count; i++)
                {
                    tabla.CurrentIndex = i;
                }

                return(tabla);
            }
            else
            {
                return(null);
            }
        }
        public InvoiceValueModel GetInvoiceValue(RfcDestination rfcDest)
        {
            InvoiceValueModel invoiceValueModel = new InvoiceValueModel();
            RfcDestination    SAPRfcDestination = RfcDestinationManager.GetDestination("accelyides");

            RfcRepository rfcrep = SAPRfcDestination.Repository;
            IRfcFunction  BapiGetCompanyDetail = null;


            BapiGetCompanyDetail = rfcrep.CreateFunction("BAPI_INCOMINGINVOICE_GETDETAIL");
            BapiGetCompanyDetail.SetValue("INVOICEDOCNUMBER", "1000000020");
            BapiGetCompanyDetail.SetValue("FISCALYEAR", "2013");
            BapiGetCompanyDetail.Invoke(rfcDest);
            IRfcTable tblReturn = BapiGetCompanyDetail.GetTable("ITEMDATA");
            DataTable TBL       = tblReturn.ToDataTable("TBL");

            for (int i = 0; i < TBL.Rows.Count; i++)
            {
                InvoiceValueModel invoiceValueModel1 = new InvoiceValueModel();

                invoiceValueModel1.REF_DOC = TBL.Rows[i]["REF_DOC"].ToString();
                // invoiceValueModel.lstInvoiceValue.Add(invoiceValueModel1);
            }

            IRfcStructure IRS_OS_HEADER = BapiGetCompanyDetail.GetStructure("HEADERDATA");

            invoiceValueModel.Value = IRS_OS_HEADER.GetValue("USERNAME").ToString();
            //Console.WriteLine(invoiceValueModel.Value);
            //Console.ReadKey();
            RfcSessionManager.EndContext(rfcDest);

            return(invoiceValueModel);
        }
Exemplo n.º 3
0
        // Kiểm tra dữ liệu phát sinh
        public static string Prc_check_data_ps(string p_short_name, DataRow p_dr, RfcDestination p_sap)
        {
            string v_error_code = "";
            // Need a repository for the metadata from the ABAP Dictionary
            // of the corresponding destination system.
            RfcRepository v_repo  = p_sap.Repository;
            IRfcFunction  v_babi  = v_repo.CreateFunction("ZFM_PSCD_MAPPING_TK_DC");
            IRfcStructure v_struc = v_babi.GetStructure("I_SOURCE");

            v_struc.SetValue("ROW_NUM", p_dr["STT"].ToString());
            v_struc.SetValue("DOC_TYPE", p_dr["LOAI"].ToString());
            v_struc.SetValue("TAX_OFFICE_CODE", p_dr["MA_CQT"].ToString());
            v_struc.SetValue("TIN", p_dr["TIN"].ToString());
            v_struc.SetValue("PROFIT_CENTER", p_dr["MA_CHUONG"].ToString());
            v_struc.SetValue("BUSINESS_AREA", p_dr["MA_KHOAN"].ToString());
            v_struc.SetValue("SEGMENT", p_dr["MA_TMUC"].ToString());
            v_struc.SetValue("PAY_GROUP", p_dr["TKHOAN"].ToString());
            v_struc.SetValue("POSTING_DATE", p_dr["NGAY_HTOAN"].ToString());
            v_struc.SetValue("START_PERIOD", p_dr["KY_PSINH_TU"].ToString());
            v_struc.SetValue("END_PERIOD", p_dr["KY_PSINH_DEN"].ToString());
            v_struc.SetValue("DUE_DATE", p_dr["HAN_NOP"].ToString());
            v_struc.SetValue("RETURN_CODE", p_dr["MA_TKHAI"].ToString());
            v_struc.SetValue("AMOUNT", p_dr["SO_TIEN"].ToString());

            v_babi.Invoke(p_sap);

            v_error_code = v_babi.GetString("E_ERROR_CODE");

            return(v_error_code);
        }
Exemplo n.º 4
0
        public IRfcTable ListaPLTYP() //Trae TODAS las listas de precios
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_007");//Módulo de función

                //bapi.SetValue("SPRAS", ");
                //bapi.SetValue("PERNR", pr);
                //bapi.SetValue("SPART", sp);
                //bapi.SetValue("ZTIWF", "005");

                bapi.Invoke(oDestino);

                //IRfcTable tabla = bapi.GetTable("IT_KNVP");
                string    cadena = "";
                IRfcTable tabla  = bapi.GetTable("IT_T189T");

                return(tabla);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 5
0
        public responce_ZMOV_10000 sapRun(request_ZMOV_10000 import)
        {
            RfcDestination configSap        = RfcDestinationManager.GetDestination("SCLEM");
            RfcRepository  SapRfcRepository = configSap.Repository;
            IRfcFunction   rfcFunction      = SapRfcRepository.CreateFunction("ZMOV_10000");

            rfcFunction.SetValue("CHARG", import.CHARG);
            rfcFunction.SetValue("MATNR", import.MATNR);
            rfcFunction.Invoke(configSap);
            string aa = rfcFunction.ToString();
            responce_ZMOV_10000 res = new responce_ZMOV_10000();
            IRfcTable           rfcTable_CHAR_OF_BATCH = rfcFunction.GetTable("CHAR_OF_BATCH");

            res.CHAR_OF_BATCH = new ZMOV_10000_CHAR_OF_BATCH[rfcTable_CHAR_OF_BATCH.RowCount];
            int i_CHAR_OF_BATCH = 0;

            foreach (IRfcStructure row in rfcTable_CHAR_OF_BATCH)
            {
                ZMOV_10000_CHAR_OF_BATCH datoTabla = new ZMOV_10000_CHAR_OF_BATCH();
                datoTabla.ATNAM                    = row.GetString("ATNAM");
                datoTabla.ATWTB                    = row.GetString("ATWTB");
                datoTabla.XDELETE                  = row.GetString("XDELETE");
                datoTabla.CHAR_NOT_VALID           = row.GetString("CHAR_NOT_VALID");
                datoTabla.ATINN                    = row.GetInt("ATINN");
                datoTabla.ATWTB_LONG               = row.GetString("ATWTB_LONG");
                res.CHAR_OF_BATCH[i_CHAR_OF_BATCH] = datoTabla; ++i_CHAR_OF_BATCH;
            }

            return(res);
        }
Exemplo n.º 6
0
        public IRfcTable AutoCHARG(string ma, string ch) //Trae la lista de clientes para autocompletar
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_046");//Módulo de función

                bapi.SetValue("MATNR", ma);
                bapi.SetValue("CHARG", ch);

                bapi.Invoke(oDestino);

                IRfcTable tabla = bapi.GetTable("it_MCHB");
                for (int i = 0; i < tabla.Count; i++)
                {
                    tabla.CurrentIndex = i;
                }

                return(tabla);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 7
0
        public IRfcTable getClienteP(string vk, string vt, string sp, string ku, string em, string tp) //Trae el cliente consultado
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_005");//Módulo de función

                bapi.SetValue("VKORG", vk);
                bapi.SetValue("VTWEG", vt);
                bapi.SetValue("SPART", sp);
                bapi.SetValue("KUNNR", ku);
                //if (!tp.Equals("A"))
                if (tp.Trim().Equals("V") | tp.Trim().Equals("C")) //ADD RSG 23.06.2017
                {
                    bapi.SetValue("PERNR", em);
                }

                bapi.Invoke(oDestino);

                IRfcTable tabla = bapi.GetTable("IT_KNVP");
                for (int i = 0; i < tabla.Count; i++)
                {
                    tabla.CurrentIndex = i;
                }

                return(tabla);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 8
0
        public IRfcTable AutoKUNNR(string vk, string vt, string sp, string ku, string em) //Trae la lista de clientes para autocompletar
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_003");//Módulo de función

                bapi.SetValue("VKORG", vk);
                bapi.SetValue("VTWEG", vt);
                bapi.SetValue("SPART", sp);
                bapi.SetValue("KUNNR", ku);
                bapi.SetValue("PERNR", em);

                bapi.Invoke(oDestino);

                IRfcTable tabla = bapi.GetTable("IT_KNAVV");
                for (int i = 0; i < tabla.Count; i++)
                {
                    tabla.CurrentIndex = i;
                }

                return(tabla);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 9
0
        public IRfcTable AutoMATKL(string mk, string sp) //Trae la lista de clientes para autocompletar
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_014");//Módulo de función

                bapi.SetValue("MATKL", mk);
                if (!sp.Equals(""))
                {
                    bapi.SetValue("SPART", sp);
                }

                bapi.Invoke(oDestino);

                IRfcTable tabla = bapi.GetTable("IT_T023T");
                for (int i = 0; i < tabla.Count; i++)
                {
                    tabla.CurrentIndex = i;
                }

                return(tabla);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 10
0
        public List <string> monedas() //Trae cadena de mail y teléfono
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_021");//Módulo de función

                bapi.Invoke(oDestino);

                IRfcTable     tcurr = bapi.GetTable("IT_TCURC");
                List <string> m     = new List <string>();

                for (int i = 0; i < tcurr.Count; i++)
                {
                    tcurr.CurrentIndex = i;
                    m.Add(tcurr.GetString("WAERS"));
                }

                return(m);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 11
0
        public List <meins> meinss() //Trae cadena de mail y teléfono
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_045");//Módulo de función

                bapi.Invoke(oDestino);

                IRfcTable    tcurr = bapi.GetTable("IT_T006A");
                List <meins> mm    = new List <meins>();

                for (int i = 0; i < tcurr.Count; i++)
                {
                    tcurr.CurrentIndex = i;
                    meins m = new meins();
                    m.MSEHI = tcurr.GetString("MSEHI");
                    //m.MSEHI = tcurr.GetString("MSEH3");
                    m.MSEH3 = tcurr.GetString("MSEH3");
                    m.desc  = tcurr.GetString("MSEHL");
                    mm.Add(m);
                }
                //List<string> ms = new List<string>();
                //foreach(meins m in mm)
                //{
                //    ms.Add("<option value='"+m.MSEHI+"'>"+ m.MSEH3+ " - " + "</option>");
                //}

                return(mm);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 12
0
        public IRfcTable consultaLPDetail(string vk, string vt, string sp, string ku, string ma, string mk, string pl, string ta)//Trae detalle KONH por lista de precio
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_011");//Módulo de función

                bapi.SetValue("VKORG", vk);
                bapi.SetValue("VTWEG", vt);
                bapi.SetValue("SPART", sp);
                bapi.SetValue("KUNNR", ku);
                bapi.SetValue("MATNR", ma);
                bapi.SetValue("MATKL", mk);
                bapi.SetValue("PLTYP", pl);
                bapi.SetValue("TABLA", ta);

                bapi.Invoke(oDestino);

                IRfcTable tabla = bapi.GetTable("IT_LP");

                return(tabla);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 13
0
        public IRfcTable consultaLODetail(string sp, string ma, string ta, bool ch)//Trae detalle KONH por lista de precio
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_024");//Módulo de función

                bapi.SetValue("SPART", sp);
                bapi.SetValue("MATNR", ma);
                bapi.SetValue("TABLA", ta);
                if (ch)
                {
                    bapi.SetValue("DEGRADADO", "X");
                }

                bapi.Invoke(oDestino);

                IRfcTable tabla = bapi.GetTable("IT_LP");

                return(tabla);
            }
            else
            {
                return(null);
            }
        }
        public void tableLList(string plant)
        {
            connect();
            RfcDestination rfcDest = RfcDestinationManager.GetDestination(parms);
            RfcRepository  rfcRep  = rfcDest.Repository;
            IRfcFunction   IReader = rfcRep.CreateFunction("ZSSCN_DYNAMIC_SELECT");

            IReader.SetValue("IV_SELECT", "COD_ITEM DESCRICAO");
            IReader.SetValue("IV_FROM", "/SSCN/LLIST");
            IReader.SetValue("IV_WHERE", "NOME_LISTA = 'CENTRO_TRAB' AND CENTRO = '" + plant + "' AND EXTRA_FLD3 = 'X' AND IDIOMA = 'EN'");
            IReader.SetValue("IV_ORDER", "COD_ITEM DESCRICAO");
            IReader.Invoke(rfcDest);
            string optionData = (string)IReader.GetValue("EV_RESULT_SET");

            Directory.CreateDirectory("Relatorio");
            filePathTxt = filePathTxt + @"\pathLList.txt";
            System.IO.File.WriteAllText(filePathTxt, optionData);
            List <IndividualCapacity_SapTable> jsonList = JsonConvert.DeserializeObject <List <IndividualCapacity_SapTable> >(optionData);

            if (jsonList.Count() > 0)
            {
                //file
                CreateExcel1 = new IndividualCapacity_LListExcel();
                CreateExcel1.CreateWorkbook(filePathXlsx = filePathXlsx + @"\DadosLList.xlsx");
                //Adicionar Celulas
                jsonList
                .Select((mandante, x) => new { mandante, position = x })
                .ToList()
                .ForEach(item => CreateExcel1.AddCell(item.position, item.mandante));
                //Salvando dados no excel
                CreateExcel1.Save();
            }
        }
        public void tablePlants()
        {
            connect();
            RfcDestination rfcDest = RfcDestinationManager.GetDestination(parms);
            RfcRepository  rfcRep  = rfcDest.Repository;
            IRfcFunction   IReader = rfcRep.CreateFunction("ZSSCN_DYNAMIC_SELECT");

            IReader.SetValue("IV_SELECT", "USERID PLANT");
            IReader.SetValue("IV_FROM", "/SSCN/PLANT");
            IReader.SetValue("IV_WHERE", "USERID = 'SIGGA127'");
            IReader.Invoke(rfcDest);
            string optionData = (string)IReader.GetValue("EV_RESULT_SET");

            Directory.CreateDirectory("Relatorio");
            filePathTxt = filePathTxt + @"\pathPlant.txt";
            System.IO.File.WriteAllText(filePathTxt, optionData);
            List <IndividualCapacity_SapTable> jsonList = JsonConvert.DeserializeObject <List <IndividualCapacity_SapTable> >(optionData);

            if (jsonList.Count() > 0)
            {
                //file
                CreateExcel = new IndividualCapacity_PlantExcel();
                CreateExcel.CreateWorkbook(filePathXlsx = filePathXlsx + @"\DadosPlant.xlsx");
                //Adicionar Celulas
                jsonList
                .Select((mandante, x) => new { mandante, position = x })
                .ToList()
                .ForEach(item => CreateExcel.AddCell(item.position, item.mandante));
                //Salvando dados no excel
                CreateExcel.Save();
            }
        }
        public void tableLPer_Wkc(string plant, string workcenter)
        {
            connect();
            RfcDestination rfcDest = RfcDestinationManager.GetDestination(parms);
            RfcRepository  rfcRep  = rfcDest.Repository;
            IRfcFunction   IReader = rfcRep.CreateFunction("ZSSCN_DYNAMIC_SELECT");

            IReader.SetValue("IV_SELECT", "A~PERNR A~ENAME");
            IReader.SetValue("IV_FROM", "/SSCN/LPERSON AS A INNER JOIN /SSCN/LPER_WKC AS B ON ( A~PERNR = B~PERNR )");
            IReader.SetValue("IV_WHERE", "B~WERKS = '" + plant + "' AND B~ARBPL = '" + workcenter + "'");
            IReader.Invoke(rfcDest);
            string optionData = (string)IReader.GetValue("EV_RESULT_SET");

            Directory.CreateDirectory("Relatorio");
            filePathTxt = filePathTxt + @"\pathLPerWkc.txt";
            System.IO.File.WriteAllText(filePathTxt, optionData);
            List <IndividualCapacity_SapTable> jsonList = JsonConvert.DeserializeObject <List <IndividualCapacity_SapTable> >(optionData);

            if (jsonList.Count() > 0)
            {
                //file
                CreateExcel3 = new IndividualCapacity_LperWkcExcel();
                CreateExcel3.CreateWorkbook(filePathXlsx = filePathXlsx + @"\DadosLPerWkc.xlsx");
                //Adicionar Celulas
                jsonList
                .Select((mandante, x) => new { mandante, position = x })
                .ToList()
                .ForEach(item => CreateExcel3.AddCell(item.position, item.mandante));
                //Salvando dados no excel
                CreateExcel3.Save();
            }
        }
Exemplo n.º 17
0
        public IRfcTable ListaVKORG(string v, string p) //Trae TODAS las Organizaciones de compra
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_001");//Módulo de función

                if (!v.Equals(""))
                {
                    bapi.SetValue("VKORG", v);
                }
                if (!p.Equals(""))
                {
                    bapi.SetValue("PERNR", p);
                }

                bapi.Invoke(oDestino);

                IRfcTable tabla = bapi.GetTable("IT_TVKO");
                for (int i = 0; i < tabla.Count; i++)
                {
                    tabla.CurrentIndex = i;
                }

                return(tabla);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 18
0
        public IRfcTable busquedaL(string vk, string vt, string sp, string pr, string p1, string p2, string fs, string fa, string k1, string k2)
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_030");//Módulo de función

                bapi.SetValue("VKORG", vk);
                bapi.SetValue("VTWEG", vt);
                bapi.SetValue("SPART", sp);
                bapi.SetValue("PERNR", pr);
                bapi.SetValue("KUNNR1", k1);
                bapi.SetValue("KUNNR2", k2);
                bapi.SetValue("FECHA_S", fs);
                bapi.SetValue("FECHA_A", fa);
                bapi.SetValue("PLTYP1", p1);
                bapi.SetValue("PLTYP2", p2);

                bapi.Invoke(oDestino);

                IRfcTable tabla = bapi.GetTable("IT_DATA");
                for (int i = 0; i < tabla.Count; i++)
                {
                    tabla.CurrentIndex = i;
                }

                return(tabla);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 19
0
        public IRfcTable ListaVTWEG(string v, string p, string k) //Trae TODOS los canales de distribución
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_002");//Módulo de función

                if (!v.Equals(""))
                {
                    bapi.SetValue("VTWEG", v);
                }
                if (!p.Equals(""))
                {
                    bapi.SetValue("PERNR", p);
                }
                if (!k.Equals(""))
                {
                    bapi.SetValue("VKORG", k);
                }

                bapi.Invoke(oDestino);

                IRfcTable tabla = bapi.GetTable("IT_TVTW");
                for (int i = 0; i < tabla.Count; i++)
                {
                    tabla.CurrentIndex = i;
                }

                return(tabla);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 20
0
        public IRfcTable getBitacora(string tipo, string folio) //Trae el cliente consultado
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                //IRfcFunction bapi = repo.CreateFunction("ZFWF_WFO_005");//Módulo de función
                IRfcFunction bapi = repo.CreateFunction("ZFWF_PFI_011");//Módulo de función

                bapi.SetValue("P_ZTIWF", "005");
                bapi.SetValue("P_ZKYWF", folio);

                bapi.Invoke(oDestino);

                IRfcTable tabla = bapi.GetTable("P_BITACORA");
                //IRfcTable tabla = bapi.GetTable("P_FLUJOBIT");
                for (int i = 0; i < tabla.Count; i++)
                {
                    tabla.CurrentIndex = i;
                }

                return(tabla);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 21
0
        public IRfcTable AutoMATNR(string ma, string sp) //Trae la lista de materiales para autocompletar
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_013");//Módulo de función

                bapi.SetValue("MATNR", ma);
                bapi.SetValue("SPART", sp);

                bapi.Invoke(oDestino);

                IRfcTable tabla = bapi.GetTable("IT_MAKT");
                for (int i = 0; i < tabla.Count; i++)
                {
                    tabla.CurrentIndex = i;
                }

                return(tabla);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 22
0
        public string estatusSol(string tipo, string folio) //Trae la desc o unidad de material
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_WFO_004");//Módulo de función

                bapi.SetValue("P_ZTIWF", "005");
                bapi.SetValue("P_ZKYWF", folio);

                bapi.Invoke(oDestino);

                string oper   = bapi.GetString("P_ZSWAR");
                string evto   = bapi.GetString("P_ZEVTI");
                string cadena = "";

                if (oper.Equals("P"))
                {
                    cadena = "Pendiente";
                }
                else if (oper.Equals("R"))
                {
                    cadena = "Rechazada";
                }
                else if (oper.Equals("A"))
                {
                    cadena = "Aprobada";
                }
                return(cadena);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 23
0
        public IRfcTable AutoPLTYP(string pl, string sp, string pr) //Trae la lista de clientes para autocompletar
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_016");//Módulo de función

                bapi.SetValue("PLTYP", pl);
                bapi.SetValue("PERNR", pr);
                bapi.SetValue("SPART", sp);
                bapi.SetValue("ZTIWF", "005");
                bapi.SetValue("TIPO", "02");
                bapi.SetValue("CONDICION", "X");

                bapi.Invoke(oDestino);

                IRfcTable tabla = bapi.GetTable("IT_T189T");
                for (int i = 0; i < tabla.Count; i++)
                {
                    tabla.CurrentIndex = i;
                }

                return(tabla);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 24
0
        public IRfcTable tablaCabeceraL(string visto, string pernr)
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_018");//Módulo de función

                bapi.SetValue("VISTO", visto);
                //bapi.SetValue("USUARIO", usuario);
                bapi.SetValue("PERNR", pernr);

                bapi.Invoke(oDestino);

                IRfcTable tabla = bapi.GetTable("IT_CABECERA");
                for (int i = 0; i < tabla.Count; i++)
                {
                    tabla.CurrentIndex = i;
                }

                return(tabla);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 25
0
        public IRfcTable getCliente(string vk, string vt, string sp, string ku) //Trae el cliente consultado
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_005");//Módulo de función

                bapi.SetValue("VKORG", vk);
                bapi.SetValue("VTWEG", vt);
                bapi.SetValue("SPART", sp);
                bapi.SetValue("KUNNR", ku);

                bapi.Invoke(oDestino);

                IRfcTable tabla = bapi.GetTable("IT_KNAVV");
                for (int i = 0; i < tabla.Count; i++)
                {
                    tabla.CurrentIndex = i;
                }

                return(tabla);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 26
0
        public IRfcTable consultaDetalleL(string folio, string pernr)
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_019");//Módulo de función

                bapi.SetValue("FOLIO", folio);
                bapi.SetValue("PERNR", pernr);

                bapi.Invoke(oDestino);

                IRfcTable tabla = bapi.GetTable("IT_DETALLE");
                for (int i = 0; i < tabla.Count; i++)
                {
                    tabla.CurrentIndex = i;
                }

                return(tabla);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 27
0
        public string getLP_Desc(string idioma, string lista) //Trae la descripción lista de precio consultada
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_007");//Módulo de función

                //bapi.SetValue("SPRAS", ");
                bapi.SetValue("PLTYP", lista);

                bapi.Invoke(oDestino);

                //IRfcTable tabla = bapi.GetTable("IT_KNVP");
                string    cadena = "";
                IRfcTable tabla  = bapi.GetTable("IT_T189T");
                for (int i = 0; i < tabla.Count & i < 1; i++)
                {
                    tabla.CurrentIndex = i;
                    cadena             = tabla.GetString("PLTYP") + " " + tabla.GetString("PTEXT");
                }

                return(cadena);
            }
            else
            {
                return(null);
            }
        }
        public static string RFCxSociedad(string xname, string appsh, string xsapr, string sysn, string xuser, string pasw, string cliente, string sociedad)
        {
            RfcConfigParameters parms = new RfcConfigParameters();

            parms.Add(RfcConfigParameters.Name, xname);
            parms.Add(RfcConfigParameters.AppServerHost, appsh);
            parms.Add(RfcConfigParameters.SAPRouter, xsapr.ToString().Trim());
            parms.Add(RfcConfigParameters.SystemNumber, sysn.ToString().Trim());
            parms.Add(RfcConfigParameters.User, xuser.ToString().Trim());
            parms.Add(RfcConfigParameters.Password, pasw.ToString().Trim());
            parms.Add(RfcConfigParameters.Client, cliente.ToString().Trim());
            parms.Add(RfcConfigParameters.Language, "ES");
            parms.Add(RfcConfigParameters.PoolSize, "5");
            parms.Add(RfcConfigParameters.PeakConnectionsLimit, "10");
            parms.Add(RfcConfigParameters.PoolIdleTimeout, "600");

            RfcDestination rfcDest = null;

            rfcDest = RfcDestinationManager.GetDestination(parms);
            RfcRepository repo     = rfcDest.Repository; //Crea repositorio para la función
            IRfcFunction  conexion = repo.CreateFunction("Z_URFC");

            conexion.SetValue("SOCIEDAD", sociedad);
            conexion.Invoke(rfcDest);                  //Se ejecuta la consulta
            //string xresul = conexion.GetString("RFC");
            return(conexion.GetString("RFC"));
        }
Exemplo n.º 29
0
        public Address GetUserAddress(string username)
        {
            IRfcFunction fun;

            try
            {
                RfcRepository repository = Dest.Repository;
                fun = repository.CreateFunction("BAPI_USER_GET_DETAIL");
                fun.SetValue("USERNAME", username);
                fun.Invoke(Dest);
            }
            catch (RfcCommunicationException ex)
            {
                throw new SapCommunicationException("Keine Verbindung zum SAP-Server", ex);
            }

            IRfcStructure address = fun.GetStructure("ADDRESS");

            string street   = address.GetString("STREET");
            string number   = address.GetString("HOUSE_NO");
            string postcode = address.GetString("POSTL_COD1");
            string city     = address.GetString("CITY");

            return(new Address(street, number, postcode, city));
        }
Exemplo n.º 30
0
        public IRfcTable tablaEscalasSol(string folio, string pos)
        {
            if (conectar())
            {
                RfcRepository repo = oDestino.Repository;
                IRfcFunction  bapi = repo.CreateFunction("ZFWF_AP_044");//Módulo de función

                bapi.SetValue("FOLIO", folio);
                bapi.SetValue("POS", pos);
                //bapi.SetValue("USUARIO", usuario);

                bapi.Invoke(oDestino);

                IRfcTable tabla = bapi.GetTable("IT_ESCALAS");
                for (int i = 0; i < tabla.Count; i++)
                {
                    tabla.CurrentIndex = i;
                }

                return(tabla);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 31
0
 public PlainRfcPreparedFunction(string functionName,
                                 PlainRfcStructureMapper structureMapper, 
                                 RfcRepository repository, 
                                 RfcDestination destination)
     : base(functionName)
 {
     this.repository = repository;
     this.destination = destination;
     this.structureMapper = structureMapper;
 }
Exemplo n.º 32
0
 private void EnsureConnectionIsOpen()
 {
     if (!isOpen)
     {
         try {
             this.destination = RfcDestinationManager.GetDestination(destinationName);
             this.repository = this.destination.Repository;
             this.isOpen = true;
         }
         catch (Exception ex)
         {
             throw new SharpRfcCallException("Could not connect to SAP.", ex);
         }
     }
 }
Exemplo n.º 33
0
        public Boolean CreateConnection()
        {
            try
            {
                this.con = new SapConnection();
                RfcDestinationManager.RegisterDestinationConfiguration(con);
                this.dest = RfcDestinationManager.GetDestination("NSP");
                this.repo = dest.Repository;
            }
            catch (Exception ex)
            {
                try
                {
                    // Break connection
                    RfcDestinationManager.UnregisterDestinationConfiguration(con);
                }
                catch (Exception ex2) { }
                throw ex;
            }

            return true;
        }