-
-
Notifications
You must be signed in to change notification settings - Fork 7
SAP RFC
Clownfish can interact with SAP ERP via remote function calls to retrieve data. The connection between Clownfish and SAP is handled with the SAP Java Connector (SAP JCo) library. In order to use this you need to download the library from https://support.sap.com/en/product/connectors/jco.html.
When running Clownfish on Windows you need the DLL and copy it to the windows/system32 folder. When running on Linux you need the .so file and copy it to the /usr/lib folder.
In the installation folder of Clownfish you need a sapconnection.props file where you have to set the connection parameters for your SAP system.
SAPHOST=hostname
SAPSYSTEM=00
SAPCLIENT=100
SAPUSER=yoursapuser
SAPPW=yoursappassword
SAPLANGUAGE=de
SAPDESTINATION=DST1
You should customize these settings to your needs.
To use your implemented SAP RFC in your templates you have to call Clownfish API methods. There are two methods. One for reading asyncchronous data and the second for reading syncchronous data from RFC.
The API method for asyncchronous calls:
public Map executeAsync(String rfcFunction, Map parametermap)
The rfcFunction is the RFC function name. The parametermap is used for the imported data. You can access your data in the template with the rfcFunction name.
The API method for syncchronous calls:
public Map execute(String rfcFunction)
The rfcFunction is the RFC function name. You can access your data in the template with the rfcFunction name.
Here is an example for receiving the data from the SAP RFC BAPI_SFLIGHT_GETLIST.
<#assign bapi_sflight_getlist = sapBean.executeAsync("BAPI_SFLIGHT_GETLIST", parameter)>
<#if (bapi_sflight_getlist.sap.BAPI_SFLIGHT_GETLIST.table.FLIGHTLIST?has_content)>
<table id="expresstable" class="table table-striped table-hover">
<thead class="thead-dark">
<tr>
<th scope="col">CARRIER ID</th>
<th scope="col">CONNECTION ID</th>
<th scope="col">FLIGHT DATE</th>
<th scope="col">AIRPORT FROM</th>
<th scope="col">AIRPORT TO</th>
<th scope="col">DEPARTURE</th>
<th scope="col">SEATS MAX</th>
<th scope="col">SEATS OCCUPIED</th>
</tr>
</thead>
<tbody id="expressbody">
<#list bapi_sflight_getlist.sap.BAPI_SFLIGHT_GETLIST.table.FLIGHTLIST as tab>
<tr>
<th scope="row">${tab.CARRID}</th>
<td>${tab.CONNID}</td>
<td>${tab.FLDATE}</td>
<td>${tab.AIRPFROM}</td>
<td>${tab.AIRPTO}</td>
<td>${tab.DEPTIME}</td>
<td>${tab.SEATSMAX}</td>
<td>${tab.SEATSOCC}</td>
</tr>
</#list>
</tbody>
</table>
</#if>