Application Development and Automation 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: 
In this forum we only discus how to connect SAP from different scripting languages. We never talk about the possibility how to use a scripting language from the SAP side. I published a little bit in 2009 about this theme in my blog with AutoItX. But AutoItX, the ActiveX component of Autoit, is, compared with AutoIt, restricted in its functionality. Now from this point I want to introduce another brilliant script language: Freestyle BASIC Script Language.

Freestyle BASIC Script Language (FBSL) is a multi-syntax all-in-one high-level language (HLL) development environment. Its interpretative layer is a vastly extended superset of traditional BASIC that targets seamless integration of FBSL applications with Windows API and third-party dynamic link libraries. Its integrated Dynamic Assembler and Dynamic C JIT compiler layers enable the user to interleave BASIC code with verbatim Intel-style assembly and ANSI C, respectively. FBSL is not longer available anymore.

To use FBSL inside ABAP I build an ActiveX library, called ScriptX. ScriptX contains FBSL and you have the possibility to use FBSL inside any language which is COM-enabled, also ABAP. The integration of FBSL insisde ABAP offers inter alia the possibilities to use on the presentation server easily

  • API/DLL functions,

  • a console window for input and/or output,

  • a GUI window,

  • memory functions,

  • memory map files for interprocess communication (IPC),

  • etc. etc. etc.


Here an example how easy it is to use FBSL inside ABAP:
"-Begin-----------------------------------------------------------------
Program ZFBSL.

"-Constants---------------------------------------------------------
Constants CrLf(2) Type c Value %_CR_LF.

"-Variables---------------------------------------------------------
Data oFBSL Type OLE2_OBJECT.
Data Buffer Type String Value ''.
Data rc Type i.
Data RetVal Type i.

"-Macros------------------------------------------------------------
Define _.
Concatenate Buffer &1 CrLf Into Buffer.
End-Of-Definition.

Define Flush.
Call Function 'AC_SYSTEM_FLUSH' Exceptions Others = 1.
End-Of-Definition.

"-Main--------------------------------------------------------------
Create Object oFBSL 'FbslX'.

If sy-subrc <> 0 Or oFBSL-Handle = 0 Or oFBSL-Type <> 'OLE2'.
Call Function 'ZFBSL_WININC'.
Call Function 'ZFBSL_DLL'.
Call Function 'ZFBSLX'.
Create Object oFBSL 'FbslX'.
EndIf.

If sy-subrc = 0 And oFBSL-Handle > 0 And oFBSL-Type = 'OLE2'.

Call Method cl_gui_frontend_services=>get_sapgui_workdir
Changing SAPWORKDIR = WorkDir Exceptions Others = 1.
Concatenate '#Include "' WorkDir '\Windows.inc"' Into WinInc.

"-FBSL script begin-----------------------------------------------------

_ WinInc
_ '#Option Strict'.
_ '#AppType GUI'.

_ 'Dim %rc'.
_ 'rc = Msgbox(Null, "Message", "Title", MB_ABORTRETRYIGNORE)'.
_ 'Return rc'.

"-FBSL script end-------------------------------------------------------

"-Here we execute the script------------------------------------
Call Method Of oFBSL 'ExecuteScriptBuffer' = rc
Exporting #1 = Buffer.
Flush.

"-Here we get the return value of the script--------------------
Call Method Of oFBSL 'GetReturnValueInteger' = RetVal.
Flush.

Write: RetVal.

Free Object oFBSL.
EndIf.

"-End-------------------------------------------------------------------

 

FBSL offers a lot of new possibilities to integrate the presentation server in the context of ABAP on the application server. To implement FBSL complete in the ABAP context I use BinFile2ABAP, it works excellent.

 

Further links:

  • Here an example how to use C code inside ABAP.


 



 

Here another example which shows  a Mandelbrot benchmark test with FbslX and FBSL inside ABAP.

 

4 Comments