private void btnTestConn_Click(object sender, System.EventArgs e) { SAPServerConfig.SAPSeverInfo oInfo = (SAPServerConfig.SAPSeverInfo)pgServerConfig.SelectedObject; SAPServerConfig oSCfg = oInfo.owner; CallSAPProxy oProxy = new CallSAPProxy(); Cursor.Current = Cursors.WaitCursor; try { if (!ValidateSAPServerInfo()) { MessageBox.Show(this, "SAP Check the server connection settings.", this.Name, MessageBoxButtons.OK, MessageBoxIcon.Warning); Cursor.Current = Cursors.Arrow; return; } oProxy.SetConnectionInfo("3", oInfo.ASHOST, Convert.ToInt16(oInfo.SYSNR), Convert.ToInt16(oInfo.CLIENT), oInfo.LANG, txtUserID.Text, txtPassword.Text); if (oProxy.ConnectSAPServer()) { MessageBox.Show(this, "SAP Server Connection Success", this.Name, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(this, "SAP Server Connection Failed", this.Name, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception exp) { MessageBox.Show(this, exp.Message, this.Name, MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { if (oProxy != null) { oProxy.DisconnectSAPServer(); } } Cursor.Current = Cursors.Arrow; }
private bool StartBuild(string strFunctionName, string strLanguage, string strNamespace, string strClassName, string strOutPath, bool bClientProxy, bool bOutputCS) { CallSAPProxy oProxy = null; // Proxy 연결 및 메타 정보 클래스 개체 RFCProxyGen oProxyGen = null; // Proxy 생성 클래스 개체 SAPServerConfig.SAPSeverInfo oInfo = (SAPServerConfig.SAPSeverInfo)pgServerConfig.SelectedObject; string strXML = null; try { oProxyGen = new RFCProxyGen(); oProxy = new CallSAPProxy(); // Proxy 개체를 생성한다. oProxy.SetConnectionInfo("3", oInfo.ASHOST, Convert.ToInt16(oInfo.SYSNR), Convert.ToInt16(oInfo.CLIENT), oInfo.LANG, txtUserID.Text, txtPassword.Text); if (!oProxy.ConnectSAPServer()) { MessageBox.Show(this, "SAP Can not connect to server.", this.Name, MessageBoxButtons.OK, MessageBoxIcon.Warning); Cursor.Current = Cursors.Arrow; return(false); } strXML = oProxy.get_RFCProxyInfo(strFunctionName, strLanguage); // strXML null 값이면, 인자 정보가 없다. return(oProxyGen.gen_RFCProxyDLL(strNamespace, strClassName, strFunctionName, bClientProxy, strXML, bOutputCS, strOutPath)); } catch (Exception exp) { throw exp; } finally { if (oProxy != null) { oProxy.DisconnectSAPServer(); } } }
private void btnGetRFCFunctions_Click(object sender, System.EventArgs e) { string strFuncNameFilter = "*"; string strGroupNameFilter = ""; string strLanguageFilter = "EN"; string strErrMsg = ""; DataTable oDT = null; // 데이터 테이블 개체 CallSAPProxy oProxy = null; SAPServerConfig.SAPSeverInfo oInfo = (SAPServerConfig.SAPSeverInfo)pgServerConfig.SelectedObject; SAPServerConfig oSCfg = oInfo.owner; RFCFilter oFilter = (RFCFilter)pgRFCFilter.SelectedObject; Cursor.Current = Cursors.WaitCursor; try { // 목록 초기화 lbRFCFunctions.Items.Clear(); txtSelectedFuncName.Text = ""; if (!ValidateSAPServerInfo()) { MessageBox.Show(this, "SAP Check the server connection settings.", this.Name, MessageBoxButtons.OK, MessageBoxIcon.Warning); Cursor.Current = Cursors.Arrow; return; } strFuncNameFilter = String.IsNullOrEmpty(oFilter.NameFilter) ? "*" : oFilter.NameFilter; strGroupNameFilter = oFilter.GroupFilter; strLanguageFilter = String.IsNullOrEmpty(oFilter.Language) ? "EN" : oFilter.Language; oProxy = new CallSAPProxy(); // Proxy 개체를 생성한다. oProxy.SetConnectionInfo("3", oInfo.ASHOST, Convert.ToInt16(oInfo.SYSNR), Convert.ToInt16(oInfo.CLIENT), oInfo.LANG, txtUserID.Text, txtPassword.Text); if (!oProxy.ConnectSAPServer()) { MessageBox.Show(this, "SAP Cannot connect to server.", this.Name, MessageBoxButtons.OK, MessageBoxIcon.Warning); Cursor.Current = Cursors.Arrow; return; } oDT = oProxy.get_RFCFunctionNames(strFuncNameFilter, strGroupNameFilter, strLanguageFilter); // Add to Function Names for (int nCnt = 0; nCnt < oDT.Rows.Count; ++nCnt) { lbRFCFunctions.Items.Add(oDT.Rows[nCnt].ItemArray[0].ToString()); } } catch (Exception exp) { strErrMsg = exp.Message; if (strErrMsg.Length == 0) { strErrMsg = "No results found with the condition . Reset the search terms."; } MessageBox.Show(this, strErrMsg, this.Name, MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { if (oProxy != null) { oProxy.DisconnectSAPServer(); } } Cursor.Current = Cursors.Arrow; return; }