SAP,JAVA环境下RFC调用示例

import lotus.domino.*;
import com.sap.mw.jco.*;
import Java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Vector;
import java.io.PrintWriter;
import java.io.*;


public class JavaAgent extends AgentBase {
 
   private String viewName       = "v_key_saplinkbyusename";
   private String configDbName    = "AIS_Org.nsf";
   private String SAP_Name        = null;           //要连接的SAP名称
       private String SAP_Client      = null;           //SAP连接客户端名称
       private String user_Id         = null;           //用户名称
       private String password        = null;           //密码
       private String language        = null;           //语言
       private String sysnr           = null;           //SAP系统号码
       private String host_Name       = null;
       private String PrintPath="" ;
       JCO.Client mConnection = null;
public Document getDoucumet2(Database CurDb, Session session,AgentContext agentContext)throws Exception{
  //读取个人配置中的SAP帐户密码的DOC
               Database Configdb = null;
               Database SysDb = null;
               Document SapConfigDoc = null;
               Document Sysdoc = null;
               View ConView = null;
               View DepView = null;
               View ComView = null;
               View SysView = null;
               String sysdbname = "AIS_Org.nsf";
               String depkey = "";
               String comkey = "";
               try{         
                  String DbPath;
      String DbPath1;    
                  DbPath = CurDb.getFilePath();
                  DbPath = DbPath.substring(0,DbPath.length() - CurDb.getFileName().length());
                  DbPath1 = DbPath + sysdbname;
                  DbPath = DbPath + configDbName;
                
                  //读取组织库
                  SysDb = session.getDatabase(CurDb.getServer(),DbPath1,true);
                  //读取个人配置试图
                  SysView = SysDb.getView("v_or_deptbyperson_new");
                  //读取个人配置文档
                  Sysdoc = SysView.getDocumentByKey(agentContext.getEffectiveUserName().toUpperCase(),true);
               
        
                  return Sysdoc;
                }catch(Exception e) {
                  e.printStackTrace();
                return null;
                }
     }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwpwjg.html