Quantcast
Channel: SCN : All Content - Scripting Languages
Viewing all articles
Browse latest Browse all 522

CCo (COM Connector) for SAP NetWeaver RFC Library for Scripting Languages

$
0
0

Hello community,

 

SAP offers different connectors to develop ABAP compatible components and applications. JCo for Java environments, NCo for dotNET languages and the NetWeaver RFC SDK for C++. But what's up if you work neither with Java or dotNET environments nor with C++?

 

Here is another alternative, CCo - the COM Connector for SAP. CCo is a COM library and offers wrappers around all functions of the SAP NetWeaver RFC library. So it is possible to use all functionalities of the SAP NetWeaver RFC library inside any language which support COM technic.

 

With CCo it is easily possible to use the SAP NetWeaver RFC functions inside VBScript, Visual Basic for Applications (VBA) or AutoIt script.

 

Here a VBScript example to connect an SAP system:

 

'-Begin-----------------------------------------------------------------  '-Directives----------------------------------------------------------    Option Explicit  '-Variables-----------------------------------------------------------    Dim SAP, hRFC, rc  '-Main----------------------------------------------------------------    Set SAP = CreateObject("COMNWRFC")    If IsObject(SAP) Then      SAP.About      hRFC = SAP.RfcOpenConnection("ASHOST=ABAP, SYSNR=00, " & _        "CLIENT=001, USER=BCUSER")      If hRFC Then        MsgBox "Check connection with TAC SMGW in the SAP system"        rc = SAP.RfcCloseConnection(hRFC)      End If      Set SAP = Nothing    End If
'-End-------------------------------------------------------------------

 

Here a VBA example to ping an SAP system:

 

'-Begin-----------------------------------------------------------------  Option Explicit  '-Constants-----------------------------------------------------------    Const RFC_OK = 0  '-Sub Ping------------------------------------------------------------    Sub Ping()        '-Variables-------------------------------------------------------        Dim SAP As CCo.COMNWRFC        Dim hRFC As Long        Dim rc As Integer        Dim hFunc, hFuncDesc As Long      Set SAP = CreateObject("COMNWRFC")      If IsObject(SAP) Then          hRFC = SAP.RFCOPENCONNECTION("ASHOST=ABAP, SYSNR=00, " & _          "CLIENT=001, USER=BCUSER")        If hRFC Then                  '-Variant1----------------------------------------------------            hFuncDesc = SAP.RFCGETFUNCTIONDESC(hRFC, "RFC_PING")            If hFuncDesc Then              hFunc = SAP.RFCCREATEFUNCTION(hFuncDesc)              If hFunc Then                If SAP.RFCINVOKE(hRFC, hFunc) = RFC_OK Then                  Debug.Print "Ping successful"                Else                  Debug.Print "Ping not successful"                End If                SAP.RFCDESTROYFUNCTION hFunc              End If            End If                    '-Variant2----------------------------------------------------            If SAP.RFCPING(hRFC) = RFC_OK Then              Debug.Print "Ping successful"            Else              Debug.Print "Ping not successful"            End If                  rc = SAP.RFCCLOSECONNECTION(hRFC)        End If        Set SAP = Nothing          End If          End Sub
'-End-------------------------------------------------------------------

 

To the duality of accesses via SAP GUI Scripting and RFC with scripting languages

ScriptStructure1.jpg

 

CCo opens a powerful second channel to communicate with an SAP backend. You can code in your favorite COM-enabled scripting language and use two ways: on the one hand the SAP GUI Scripting to communicate via SAP GUI for Windows with an SAP system, and on the other hand the COM Connector (CCo) to communicate via SAP NetWeaver RFC library with an SAP application server.

CCo is an ideal complementation to SAP GUI Scripting in this application area. You can e.g. use the wide range of thousands of remote-enabled function modules from an SAP system. Use the transaction code BAPI to open the BAPI explorer and find a lot in the alphabetical hierarchy tree.

Enrich your SAP GUI Scripting operation processes. Get information easy and fast via CCo RFC interface in your scripting environment. Combine the best of both worlds.

 

 

Hint: CCo has at the moment experimental character. Don't use it in production environments.

 

Hint: CCo needs SAP RFC SDK, you find it here.

 

Download

You find CCo here: http://cco.stschnell.de

 

 

2013/11/29:

  • New Version 0.93 is available.
  • New methods ClipBoardClear, ClipBoardRead and ClipBoardWrite to communicate via clip board.
  • Stable RFC interface since version 0.8 from 02.08.2013.
  • New HTA examples.

 

 

Comments are welcome.

 

Cheers

Stefan


Viewing all articles
Browse latest Browse all 522

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>