다음 코드를 사용하여 SAP를 열고 gui에 연결하려고합니다. 게시물의 실수로 인해 이전 게시물을 삭제해야했습니다. SAP 로그온 730 화면을 연 다음 로그온 화면으로 진행하여 일부 자격 증명을 사용하여 로그인하려고합니다. opensap라는 첫 번째 코드에서 찾을 수없는 연결 엔트리 포인트의 오류가 발생합니다. 로그인이 지금 작동 중입니다. SapBOX 화면이 자동으로 로그인 화면으로 처리되도록 할 수 없습니다. 코드에서 도와주세요. 어떤 도움을 주시면 감사하겠습니다. "당신의 코드에 감사수액을 열고 C# 자동화를 통해 로그인 화면으로 진행
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SAPFEWSELib;
using SapROTWr;
using AVTAR.SAPLibrary;
using AVTAR.CustomLibrary;
namespace AvatarTest1 {
public class Sap {
public static GuiApplication SapGuiApp { get; set; }
public static GuiConnection SapConnection { get; set; }
public static GuiSession SapSession { get; set; }
public static void openSap(string env) {
Sap.SapGuiApp = new GuiApplication();
string connectString = null;
if (env.ToUpper().Equals("DEFAULT")) {
connectString = "1.0 Test ERP (DEFAULT)";
//connectString = "ASHOST = n7p.naan.as.com SYSNR = N7P
CLIENT =
460 _USER = ***** PASSWD = ****";*******";
} else {
connectString = env;
}
Sap.SapConnection = Sap.SapGuiApp.OpenConnection(connectString,
Sync: true); //creates connection
//Sap.SapSession = (GuiSession)Sap.SapConnection.Sessions.Item(0);
//creates the Gui session off the connection you made
}
public void Login(string userId,string pass,string clientid) {
try {
for (int i = 0; i <= 50; i++) {
Sap.SapSession = SapGuiApp.ActiveSession;
}
// System.Diagnostics.Process.Start(@"C:\Program
Files\SAP\FrontEnd\SAPgui\saplogon.exe");
GuiTextField Clientfield =
(GuiTextField)SapSession.ActiveWindow.FindById("wnd[0]/usr/txtRSYST -
MANDT");
GuiTextField UserIDField =
(GuiTextField)SapSession.ActiveWindow.FindById("wnd[0]/usr/txtRSYST-BNAME");
GuiTextField PassField =
(GuiTextField)SapSession.ActiveWindow.FindById("wnd[0]/usr/pwdRSYST-BCODE");
//GuiTextField LanguageField =
(GuiTextField)SapSession.ActiveWindow.FindById("wnd[0]/usr/txtRSYST-BNAME");
Clientfield.SetFocus();
Clientfield.Text = clientid;
UserIDField.SetFocus();
UserIDField.Text = userId;
PassField.SetFocus();
PassField.Text = pass;
//Sap.SapSession ssn= new SapSession.FindById("wnd[0]")
GuiButton enter =
(GuiButton)SapSession.ActiveWindow.FindById("wnd[0]");
enter.Press();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
Lemme도 함께 시도해보십시오. 당신의 도움을 주셔서 감사합니다. –
감사합니다. 이제 직접 로그인 할 수 있습니다. 문제는 이전에 트랜잭션 코드 필드에 값을 입력 할 수 있지만 지금은 불가능합니다. 그 문제를 해결하려고 노력할 것입니다. 가장 좋은 점은 코드를 통한 다중 로그온 오류가 표시되지 않는다는 것입니다. –