R/3 RFC from JavaScript

來源:互聯網
上載者:User

1 安裝必要的DLL
在需要執行JavaScript調用SAP的RFC的機器上安裝SAP GUI Application

2網頁範例
<script language="JavaScript">
 

<!--retcd = 0;exceptions = 0;// *** SAPLogon() creates an object that has the methods to //        execute a call to an SAP function module function SAPlogon()   {     
fns            = new ActiveXObject("SAP.Functions"); trans        = fns.Transactions; conn        = fns.connection;   /* get a new connection object */ conn.System     = "DEV";   /* Set the system ID (see: SY-SYSID) */ conn.user = "userid";          /* set userid (blank for dialog) */ conn.password         = "";   /* set password (blank for dialog) */ conn.Client       = "100";     /* set password (blank for dialog) */ conn.Language         = "E"; /* set language (blank for default) */ conn.tracelevel    = 6;    /* set password (blank for dialog) */ conn.RFCWithDialog = 1;    /* true: opens visible session window */ exceptions = 0; conn.logon(0, 0);     /* *** this call creates the object *** */   };
function SAPlogoff()   {      conn.logoff(0, 0); exceptions = 0;   };
// *** execute the SAP function MODULE "RFC_CALL_TRANSACTION_USING"//      as a method execution of object type SAP.functionsfunction SAPcallTransaction(tcode) {
  exceptions              = 0; callta                  = fns.add("RFC_CALL_TRANSACTION_USING"); callta.exports("TCODE") = "VA02"; callta.exports("MODE") = "E"; retcd                   = callta.call;  conn.logoff();                   alert(retcd); SAPcallTransaction      = retcd;}; // --></script> <body><!—Create an HTML button with a JavaScript call attached -->Call VA02 <input TYPE    = "submit"        VALUE   = "VA02"       OnClick = "SAPlogon();                   SAPcallTransaction(&quot;VA02&quot;);                   SAPlogoff()"></body>
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.