doc = agentContext.getDocumentContext();
Database db = agentContext.getCurrentDatabase();
Database CurDb = agentContext.getCurrentDatabase();
Document CurDoc = agentContext.getDocumentContext();
Vector SapKey = new Vector();
Vector dd = new Vector();
SapKey.addElement("dev");
String writetime = null;
DateTime dt1 = session.createDateTime("Today");
dt1.setNow();
writetime = dt1.getLocalTime();
Document ConfigDoc = getDoucumet(agentContext.getCurrentDatabase(),SapKey,session);
//Document ConfigDoc = getDoucumet1(db,session,agentContext);
if (ConfigDoc == null){
System.out.println("SAP连接配置文档不存在!");
}else{
clientnew = ConfigDoc.getItemValueString("Client");
this.SAP_Client = ConfigDoc.getItemValueString("Client");
this.user_Id = ConfigDoc.getItemValueString("User");
this.password = ConfigDoc.getItemValueString("Password");
this.language = ConfigDoc.getItemValueString("Language");
this.sysnr = ConfigDoc.getItemValueString("SYSTEM");
this.host_Name = ConfigDoc.getItemValueString("HostName");
//System.out.println("SAP主机:" + this.host_Name);
//System.out.println("用户:" + this.user_Id);
//System.out.println("密码:" + this.password);
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
DateTime dt = session.createDateTime("Today");
dt.setNow();
//System.out.println("开始连接" + dt);
client = JCO.createClient(this.SAP_Client, // SAP client
this.user_Id, // userid
this.password, // password
this.language, // language
this.host_Name, // host name
this.sysnr); // system number
// Open the connection
client.connect();
dt.setNow();
//System.out.println("连接成功" + dt);
repository = JCO.createRepository("MYRepository", client);
IFunctionTemplate ftemplate;