Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

It is not ordinary but very easy to use DLL calls in ABAP language. Yuri Popov programmed a module, called DynamicWrapperX. It is an ActiveX component, which allow to call each function in a DLL you want via COM. A great module, you find the module here.

It is necessary before, with the transaction code SOLE, register the OLE application DynamicWrapperX in the SAP system. Type in:

• OLE Application: DynamicWrapperX
• CLSID: {89565275-A714-4a43-912E-978B935EDCCC}
• CLSID Type Lib: {89565275-A714-4a43-912E-978B935EDCCC}
• OLE-Objectname: DynamicWrapperX
• Language: EN
• Text: Component allows to call functions exported by DLLs

And it is necessary to register DynamicWrapperX on the client system too, with regsvr32.exe dynwrapx.dll.

Look at the following example how easy it is to use a Windows function from USER32.DLL:

Error rendering macro 'code': Invalid value specified for parameter 'lang'
INCLUDE OLE2INCL.
 
"-Constants------------------------------
  DATA IDYes TYPE i VALUE 6.
  DATA IDNo TYPE i VALUE 7.
 
"-Variables------------------------------
  DATA Win32 TYPE OLE2_OBJECT.
  DATA ret TYPE i.
 
CREATE OBJECT Win32 'DynamicWrapperX'.
 
CALL METHOD OF Win32 'Register'
  EXPORTING
    #1 = 'user32.dll' #2 = 'MessageBoxW'
    #3 = 'i=hwwu' #4 = 'r=l'.
 
CALL METHOD OF Win32 'MessageBoxW' = ret
  EXPORTING
    #1 = 0 #2 = 'Hello World'
    #3 = 'Test' #4 = 4.
 
IF ret = IDYes.
  WRITE 'Ja'.
ELSEIF ret = IDNo.
  WRITE 'Nein'.
ELSE.
  WRITE '?'.
ENDIF.
 
FREE OBJECT Win32.

 

Important hint: This method works only with foreground jobs and online processes and not with background jobs and batch processes.

  • No labels