Connector for SAP Business Suite - Developer's Manual part 5 - Add-ons

The Connector for SAP Business Suite provides a functional extension in the form of add-ons. These add-ons can be used on Intrexx pages via Velocity calls and in Intrexx processes in a Groovy script. Please note that the add-ons can be subject to specific license terms or require a minimum license.

1. Usage in Velocity

On application pages, add-ons can be integrated either with a static text element with the option "Programming, only default language".

or a VTL Include element.

The add-on is initialized via the Connector for SAP Business Suite and references Example (for add-on "sapbop"):
#set( $api = $GSAP.getAddOn('sapbop', 'saperp', $Request) )
The variable "$api" then provides the functions of the add-on and can also be called in the shortened form:
$GSAP.getAddOn('sapbop', 'saperp', $Request).<api-method-addon>

2. Usage in Groovy script

The usage in Groovy is similar to that in Velocity. The following example code is used for all add-ons ("sapbop" in this case).
import net.initall.ixapi.groovy.IxSapGroovyAPI;
def g_sap = IxSapGroovyAPI.getInstance();
if(g_sap == null){
g_log.error("No SAP Adapter access");
// syntax: getAddOn(<addonname>, <sap instance>, g_record);
def g_api = g_sap.getAddOn("sapbop", "saperp", g_record);
if(g_api == null){
g_log.error("No SAP Adapter Addon access");
// use addon api -- insert your code
// destroy addon api

3. sapbop add-on - BusinessObject documents

BusinessObject documents are for implementing object-oriented forums that should look the same on every interface in use (e.g. SAPGUI, internet portal, mobile end devices). The Connector for SAP Business Suite provides functions to make documents, such as PDFs, technical drawings etc., available to all user interfaces. The provision of these documents takes place in the SAP systems and uses the SAP standard "Smartforms" and "Report" in most cases. In doing so, different forms (e.g. customer data sheet, visit report, OP list etc.) for the object "Customer" (technically "KNA1") can be made available comprehensively.

3.1. Configuration

The configuration of the BusinessObject documents takes place in the SAP system within the customizing of the portal plugin in the "Extensions" folder.

3.1.1. Handlers

Handlers have already been created for the most important generations. These are available as standard:

Other handlers may also be in the system. With minor adjustments, custom handlers can be integrated through inheritance. This is required to modify the API of specialized Smartform forms or Reports, for example. In most cases, however, nothing needs to be configured here.

3.1.2. Documents and variants

In the customizing item "BusinessObject documents - Configuration", BusinessObjects, their variants and their reference to a handler are managed.

For example, the following entry provides the call of the Report "/IATL/POPI_IXAPI_BODOC_REP" via the call "Objekttyp = "KNA1"" and "Variante/Subtyp = "TEST"". The Report "/IATL/POPI_IXAPI_BODOC_REP" can also be using as a master copy for custom implementations.

3.1.3. Test

The item "Test BusinessObject document" provides a simple option for testing.

The test as a "popup" is only supported if the handler supports this. This is also the case for Smartforms and Reports.

Upon execution, the document will be displayed in the SAP system - as a PDF here. This function can also be used in the SAPGUI in standard processes.

Execution as a file stream (popup option deactivated) performs the actual application - to provide a file for external use.

With this call, only the file information will be displayed that would be available to an external call.

The test program can also be used to delete the internal cache and/or to pregenerate documents in the batch.

3.1.4. Custom handlers

Custom handlers are required if the programs that generate the data are in place (e.g. Reports, Smartforms). At least the call interface needs to be adjusted here. This section demonstrates the process for calling the transaction "MB53". The program "RM07MWRKK" is behind this transaction.

To generate the ouput of this report as a PDF, a custom handler needs to be implemented that implements specifically the interface of the report. To call reports, the Connector for SAP Business Suite provides the class "/IATL/POPI_CL_IXAPI_BUSDOC_REP" on the ABAP side. To begin with, create an SAP ABAP class that inherits from this handler. Afterwards, the method "REPORT_MODIFY_PARAMETERS" is passed on and adjusted. The coding for calling the transaction "MB53" is presented below.
METHOD report_modify_parameters.
* -------- local data
DATA: ls_params LIKE LINE OF ct_params.
DATA: lv_matnr TYPE matnr.
* -------- call super
CALL METHOD super->report_modify_parameters
cv_program = cv_program
cv_variant = cv_variant
ct_params = ct_params
failed = 1
IF sy-subrc <> 0.
RAISE failed.
* -------- set defaults for report calling
cv_program = 'RM07MWRKK'.
* -------- get prefilled id and map
LOOP AT ct_params INTO ls_params
WHERE selname = 'ID'.
ls_params-selname = 'MATNR'.
lv_matnr = ls_params-low.
ls_params-low = lv_matnr.
MODIFY ct_params FROM ls_params.
This coding should be easy to understand. In the parameter "ct_params", the selection parameters are made available in the structure "RSPARAMS". The externally transferred ID is saved as the selection parameter "ID" and needs to be transported. If required, the ID can be checked in this way and where appropriate modified (e.g. add leading zeroes). The next step registers the class just created as a handler in the customizing.

Afterwards, the handler can be assigned to a specific BusinessObject (in this case "MARA" and "MB53").

You can immediately test whether the class functions correctly via the test transaction. Debugging can also be performed from here.

The call "as popup" initializes the report in view mode.

Without the popup function the PDF is generated, but more than this is not available here.

If there are Smartphones that already exist and you would like to call, the procedure is the same as for the Reports. Use "/IATL/POPI_CL_IXAPI_BUSDOC_SF" as the class to be inherited from. The call of the function module of the Smartform API takes place in the method "SMARTFORM_CALL". Depending on the API of the Smartform, the data acquisition can be more detailed. The following code is an example for a call of Smartforms for delivery slips.
method smartform_call.
data: ls_nast type nast.
data: ls_likp type likp.
data: ls_document_output_info type ssfcrespd.
data: ls_job_output_info type ssfcrescl.
data: ls_job_output_options type ssfcresop.
data: ls_dlv_delnote type ledlv_delnote.
data: ls_delivery_key type leshp_delivery_key.
data: ls_print_data_to_read type ledlv_print_data_to_read.
data: lf_parvw type sna_parvw.
data: lf_parnr type na_parnr.
data: lf_language type na_spras.
data: lv_vbeln type vbeln.
data: lv_saved_langu type sylangu.
field-symbols: <parnr> type any.
* -------- check likp
lv_vbeln = me->current_id.
select single * from likp
into ls_likp
where vbeln = lv_vbeln.
if sy-subrc ne 0.
trace( 'wrong likp' ).
raise failed.
* -------- prepare access
lf_language = me->current_language.
ls_delivery_key-vbeln = lv_vbeln.
translate ls_print_data_to_read using ' X'.
lf_parvw = 'AG'.
if me->cust_doc-param_2 ne space.
lf_parvw = me->cust_doc-param_2.
lf_parnr = ls_likp-kunag.
if me->cust_doc-param_3 ne space.
unassign <parnr>.
assign component me->cust_doc-param_3 of structure ls_likp
to <parnr>.
if <parnr> is not assigned.
trace( 'wrong param 3. field not exists in table likp.' ).
raise failed.
* --------- call data preparation
is_delivery_key = ls_delivery_key
is_print_data_to_read = ls_print_data_to_read
if_parvw = lf_parvw
if_parnr = lf_parnr
if_language = lf_language
es_dlv_delnote = ls_dlv_delnote
records_not_found = 1
records_not_requested = 2
Intrexx Business Adapter - SAP
United Planet Seite 306
others = 4.
if sy-subrc <> 0.
trace( 'Error calling data likp read module.' ).
raise failed.
* ----------- call smartform
lv_saved_langu = sy-langu.
sy-langu = me->current_language.
catch system-exceptions others = 1.
call function me->sf_function
archive_index = archive_index
archive_index_tab = archive_index_tab
archive_parameters = archive_parameters
control_parameters = control_parameters
mail_appl_obj = mail_appl_obj
mail_recipient = mail_recipient
mail_sender = mail_sender
output_options = output_options
user_settings = user_settings
is_dlv_delnote = ls_dlv_delnote
is_nast = ls_nast
document_output_info = document_output_info
job_output_info = job_output_info
job_output_options = job_output_options
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
others = 5.
sy-langu = lv_saved_langu.
if sy-subrc ne 0.
trace( 'Error calling smartform.' ).
raise failed.
if sy-subrc ne 0.
trace( 'Error calling smartform module.' ).
raise failed.

3.2. API methods

Generate links: Configuration:

setImageNormal(String p_image) setImageHover(String p_image) Set custom image for the link

3.3. Examples

Velocity - Long call:
#set( $Api = $GSAP.getAddOn('sapbop', 'saperp', $Request) )
#if( $Api )
#set( $strId = $DC.getValueHolder('textvcontrol159CC346').getValue())
$Api.getBoImage('LIKP', '', $strId)
##<b>No API<b/>
Velocity - Short call:
$GSAP.getAddOn('sapbop', 'saperp', $Request).$Api.getBoLink('LIKP', '', '0080000031', 'Text', '')

4. More information

Developer's Manual - Example codings
API Developer's Manual