Quantcast
Channel: SCN : Document List - All Communities
Viewing all articles
Browse latest Browse all 2380

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

scriptingstructure.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

 

2015/11/20

  • New Version 1.7 is available.
  • Externalization of the routine to register the library without admin rights as script, because this function doesn't work with Windows 10.
  • Checked with Windows 10 x64.
  • Checked with actual RFC library patch level 38.

 

2015/01/01

  • New Version 1.5 is available.
  • It includes now for arguments by reference a set of typed attributes, e.g. lngByRef for a long variable by reference. This attributes gets and sets the arguments by reference, on any method with a corresponding in and out argument.
  • So it is now possible to use CCo with JavaScript inside IE11 in edge mode, to use it in UI5 environments. New examples are included.
  • Also you can use CCo on the same way with PowerShell. New examples are included.
  • CCo is now backwards compatible, the new SAP functions since the first PL - implemented in version 1.4 - doesn't create an error message at the creation of the instantiation.
  • Checked with actual RFC library patch level 33.

 

2014/12/21:

  • New Version 1.4 is available.
  • Implementation of the functions RfcAppendNewRows, RfcGetRowType, RfcLanguageIsoToSap, RfcLanguageSapToIso and RfcSetCpicTraceLevel - Hint: From this point CCo is not backward compatible, use always the actual SAP NetWeaver RFC library.
  • New examples to create SAP server applications - synchronous and asynchronous.
  • New interprocess communication functions (IPC) to enable implementation of other processes.

 

2014/12/11:

  • Updated Version 1.3 is available.
  • No functional changes, only a few interface changes in the context of bgRFC calls.
  • Many new examples, e.g. VBScript BAPI examples, t/qRFC and bgRFC examples.
  • Checked with actual RFC library patch level 31.
  • Corrected register routine.

 

2014/09/21:

  • Updated Version 1.2 is available.
  • No functional changes, new compilation with advanced header files.
  • Checked with actual RFC library patch level 25.
  • Corrected register routine.

 

 

Comments are welcome.

 

Cheers

Stefan


Viewing all articles
Browse latest Browse all 2380

Trending Articles



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