Skip to Content
0
Former Member
Mar 12, 2014 at 09:22 AM

C++ and ActiveX

84 Views

Hello,

I have a Problem using the ActiveX controls within a C++ MFC application to call a BAPI.

What I have done:

- I have imported the ActiveX controls wdtlog.ocx, wdobapiu.ocx and wdtfuncs.ocs. Thus for all these .tlh and .tli stubs were generated.

- Then I included the generated namespaces.

- I created pointers for SAPLogonCtrl and SAPFunctionsOCX.

- Now, I instanciated them using CreateInstance for "SAP.Logoncontrol.1" and "SAP.Functions". These instances were created without error.

- Calling the logon was also successful, giving me an open connection (I tried with m_pLogonControl->GetIsConnected() ).

The next thing is to call the BAPI. So I added the connection to the generated pointer (ISAPFunctionsPtr). This also went ok.

Now, adding the BAPI name gives me an exception. My call is:

SAPFunctionsOCX::IFunctionPtr m_pFunctionPtr = m_pFunctions->Add("MY_BAPI_NAME_HERE");

My question is: What is wrong, how do I fix it and is there a manual for that? I only found tons of VB scriplets, which I tried to adopt to C++.

Thanks in advance,

Dirk Schulten.