Exemplo n.º 1
0
        public bool connectSAPserver(string _sapUserName, string _sapPassword, string _sapClient = null,
                                     string _sapLanguage = null, string _sapSystemNumber      = null, string _sapHost = null,
                                     string _sapSystemID = null, bool _replaceExistingInCache = false)
        {
            registerSAPServerDetails(_sapUserName, _sapPassword, _sapClient, _sapLanguage,
                                     _sapSystemNumber, _sapHost, _sapSystemID, _replaceExistingInCache);
            try
            {
                m_rfcDestination = RfcDestinationManager.GetDestination(DataCache.GetObject().SapDestinationName);

                //attempt actual function call
                IRfcFunction function = m_rfcDestination.Repository.CreateFunction("BAPI_COMPANYCODE_GETLIST");

                //RfcSessionManager.BeginContext(m_rfcDestination);

                //    function.Invoke(m_rfcDestination);

                //RfcSessionManager.EndContext(m_rfcDestination);

                //IRfcTable             returnTable        =  function.GetTable("COMPANYCODE_LIST");

                //for (int y = 0; y <= (returnTable.RowCount - 1); y += 1)
                //{
                //    for (int z = 0; z <= (returnTable[y].ElementCount - 1); z += 1)
                //    {
                //        string par = returnTable[y][z].Metadata.Name;
                //        string val = returnTable[y].GetString(z);

                //        string messageLine = par + " : " + val;
                //    }
                //}

                //foreach (var r in returnStructure.)
                //{
                //    foreach (var t in r)
                //    {
                //        //string par = returnTable[y][z].Metadata.Name;
                //        //string val = returnTable[y].GetString(z);

                //        //string messageLine = par + " : " + val;
                //        //writer.WriteLine(messageLine);

                //        string a = r.Metadata.Name;
                //        string b = r.GetString(a);
                //    }
                //    //writer.WriteLine(" ");
                //}

                OnLogonComplete?.Invoke();

                return(true);
            }
            catch (Exception exception)
            {
                throw exception;
            }

            return(false);
        }
Exemplo n.º 2
0
        public bool connectSAPserver()
        {
            m_rfcDestination = null;
            try
            {
                m_rfcDestination = RfcDestinationManager.GetDestination(DataCache.GetObject().SapDestinationName);

                OnLogonComplete?.Invoke();

                return(true);
            }
            catch (Exception exception)
            {
                throw exception;
            }

            return(false);
        }