Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
stefan_schnell
Active Contributor
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 supports 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



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 needs SAP RFC SDK, you can find it here.

Download

You can find CCo here: Download is not longer available.

2018/01/01

  • Checked with actual RFC library version 7.50 patch level 0.


2016/09/09

  • New version 2.0 is available.

  • New methods GetUserPasswordDialog and GetPasswordDialog to set the corresponding fields.

  • The HTML examples, for VBScript and JavaScript, and the FBSL examples are not longer available because they have no relevance anymore.

  • The PowerShell examples are not longer available, because with PowerShell it is better to use the dotNET connector NCo.

  • The registry VBScripts are not longer available, because the Windows registry files works also.

  • New VBScript examples, e.g. to use SSO.

  • Checked with actual RFC library patch level 40.


2016/02/23

  • Actualization of the documentation and the examples


2015/12/06

  • An update is available.

  • Add the property UsePwdRequest to disable the password requester in the case of using SAPNWRFC.INI via DEST connection parameter or the using of MYSAPSSO2 connection parameter.


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.

58 Comments