Menu

Using the SAP function module interface

Overview

This blog contains some information about how SAP data can be extracted to Adele via remote enabled SAP function modules. If you have an SAP Netweaver ABAP system in your landscape you can use this interface to transfer data to the desktop in a very fast way.
For this kind of integration you have to develop own function modules with a special API. No Plugin or smiliary is required.

Prerequisites

The Adele plugin for SAP RFC connections via SAP Java Connector (SAPJCo 3.x) has to be found by Adele. The Adele plugin itself is included already. But the SAPJCo is missing by default.
You will need a SAP user for login to the SAP system, the technical system information fpr login and the required authorizations (remote access, developer).

Create a function group

By defaut all function groups in the customer name space are allowed: e.g. ZADELE_YOUR_EXTRACTOR.
If you want to create other type of names, the wildcard for searching these modules can be modified by the local propertiy files.

Please keep in mind that the text for the function group will be used as node within Adele. Please use enduser valid descriptions and translate this to all used desktop languages.

Create the Adele interface

Adele expects a special interface for the function modules. To make it easier to develop own extractor function a special abap include is available with macros inside. But if you want this: the code is up to you.

Download a current version of this include file from the file section of the Adele project site: https://sourceforge.net/projects/adele/files/plugins/saprfc/.
Create a SAP ABAP include program and copy the code. Activate the code.
If required by company restrictions you can modify the name and keep this new name in mind.

Create a function module

There are three types of integration available:
A) Extract a table without parameters (e.g. custizing, small tables)
B) Extract a table with parameters, simple statistic operations (normal tables)
C) Extract a table or cube with parameters (very large tables)

Create a new function module and make it remote enabled. Per default the new function should start with Z and a "ADELE_EXP" has to be included: e.g. "Z_MYAPI_ADELE_EXP_TYPE1".
The description will be used as a node within Adele. Please use understandable texts here and translate it to all desktop languages.

Include the adele interface by a INCLUDE statement. Depending on the type of integration you have to implement the corresponding interface and macro based coding.

Example simple type A:

FUNCTION z_bsp1_adele_exp_noopt .
"----------------------------------------------------------------------
""Lokale Schnittstelle:
" IMPORTING
" VALUE(IV_MAX) TYPE SYTABIX
" TABLES
" ET_DATA STRUCTURE SFLIGHT OPTIONAL
" EXCEPTIONS
" WRONG_INTERFACE
" WRONG_SQL
" ERRORS_OCCURED
"----------------------------------------------------------------------

  • -------- include ADELE interface
    INCLUDE zadele_func_export_interface.

TRY.
------------ process
ade_datadef.
ade_process_select sflight.
------------ process errors
CATCH cx_sy_dynamic_osql_semantics.
RAISE wrong_sql.
ENDTRY.

ENDFUNCTION.

Example complex type C:
FUNCTION Z_BSP1_ADELE_EXP_SELOLAP .
"----------------------------------------------------------------------
""Lokale Schnittstelle:
" IMPORTING
" VALUE(IS_SELOPT) TYPE ZADELE_EXAMPLES_SFLIGHT_SELDIM
" VALUE(IV_MAX) TYPE SYTABIX OPTIONAL
" VALUE(IV_DIM) TYPE STRING OPTIONAL
" VALUE(IV_FCT) TYPE STRING OPTIONAL
" TABLES
" ET_DATA STRUCTURE ZADELE_EXAMPLES_SFLIGHT_COUNT OPTIONAL
" IT_SELOPT STRUCTURE AQDBOS OPTIONAL
" EXCEPTIONS
" WRONG_INTERFACE
" WRONG_SQL
" ERRORS_OCCURED
"----------------------------------------------------------------------

  • -------- include ADELE interface
    INCLUDE zadele_func_export_interface.

TRY.
* ------------ check every field of structure is_selopt
ade_prepare_where_selopt.
IF lv_ade_lin GT 0.
ade_check_selopt carrid.
ade_check_selopt connid.
ade_check_selopt fldate.
ade_check_selopt price.
ade_check_selopt currency.
ade_check_selopt planetype.
ENDIF.

  • ------------ process
    ade_process sflight.
  • ------------ process errors
    CATCH cx_sy_dynamic_osql_semantics.
    RAISE wrong_sql.
    ENDTRY.

ENDFUNCTION.

In the complex scenarios you have to create ddic structures define the parameter fields. These fields have to processed manually (see code example). To use statistic and olap functionality the result structure has to be enhanced by a count fields (ADESYS_COUNT TYPE SYDBCNT).

Further information is located in the interface file.

Test

After restarting Adele and login to the SAP system the new extractor functions should be found and displayed as nodes.

Posted by joomp.de 2015-06-30 Labels: sap extractor connector

Log in to post a comment.