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.

Usage in Velocity

On application pages, add-ons with the element Static text with the option "Programming, default language only" can be used

or a VTL include element.

The add-on is initialized via the Connector for SAP Business Suite and references

  • the ID of the add-on

  • the SAP data source

  • the application that uses it

Example (for addon "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 short form:

            $GSAP.getAddOn('sapbop', 'saperp', $Request).<api-methode-addon>

        

Usage in Groovy script

The usage in Groovy is similar to that in Velocity. The following sample coding is used for all addons (here "sapbop").

            import net.initall.ixapi.groovy.IxSapGroovyAPI;
def g_sap = IxSapGroovyAPI.getInstance();
if(g_sap == null){
g_log.error("No SAP Adapter access");
}else{
// 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");
}else{
// use addon api -- insert your code
// destroy addon api
g_api.destroy();
}
g_sap.destroy();
}

        

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 for importing documents such as PDFs, technical drawings and the like. on all user interfaces. The documents are provided in the SAP system and in most cases use the SAP standard "Smartforms" and "Report". This means that, for example, various forms (e.g. customer master sheet, visit report, surgery list, etc.) can be made available for the customer object (technically "KNA1").

Configuration

The business object documents are configured in the SAP system below the customizing of the portal plugin in the "Extensions" folder.

Handlers

Handlers have already been prepared for the most important generations and are included in the standard delivery:

  • /IATL/POPI_IXAPI_SMARTFORM

    Call Smartforms with POPI API

  • /IATL/POPI_IXAPI_REPORT

    Call Reports with POPI API

  • /IATL/POPI_IXAPI_NO_DOC

    Dummy handler for hiding

  • /IATL/POPI_IXAPI_CFW_FORM

    Call forms of the cockpit FW

  • /IATL/POPI_IXAPI_DEFAULT

    Sample template; also simple saving

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.

Documents and variants

Business objects, their variants and their reference to a handler are maintained in the "Business object documents - configuration" customizing item.

The following entry provides, for example, the call of the report "/IATL/POPI_IXAPI_BODOC_REP" via the call "Object type = "KNA1"" and "Variant/Subtype = "TEST"". The report "/IATL/POPI_IXAPI_BODOC_REP" can also be used as a copy template for your own implementations.

Test

The "Test business object document" item provides a simple test option.

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.

Custom handlers

Custom handlers are required if the data-generating programs already exist (e.g. reports, smart forms). At least the call interface needs to be adjusted here. This section shows the procedure for calling up transaction "MB53". Behind this transaction is the program "RM07MWRKK".

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. The connector for SAP Business Suite provides the class "/IATL/POPI_CL_IXAPI_BUSDOC_REP" on the ABAP side for calling up reports. To begin with, create an SAP ABAP class that inherits from this handler. The "REPORT_MODIFY_PARAMETERS" method is then inherited and adapted. The coding for calling transaction "MB53" is shown 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
CHANGING
cv_program = cv_program
cv_variant = cv_variant
ct_params = ct_params
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
RAISE failed.
ENDIF.
* -------- 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.
ENDLOOP.
ENDMETHOD.

        

This coding should be easy to understand. The selection parameters in the "RSPARAMS" structure are provided in the "ct_params" parameter. The externally transferred ID is saved as the "ID" selection parameter and must be converted. If required, the ID can also be checked and changed if necessary (e.g. add leading zeros). The next step registers the class just created as a handler in the customizing.

The handler can then be assigned to a specific business object (here "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" starts the report in display mode.

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

If there are already existing smart forms that you would like to call up, the procedure is the same as for reports. Take "/IATL/POPI_CL_IXAPI_BUSDOC_SF" as the inheriting class. The function module of the Smartform API is called in 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.
endif.
* -------- 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.
endif.
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.
endif.
endif.
* --------- call data preparation
call function 'LE_SHP_DLV_OUTP_READ_PRTDATA'
exporting
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
importing
es_dlv_delnote = ls_dlv_delnote
exceptions
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.
endif.
* ----------- call smartform
lv_saved_langu = sy-langu.
sy-langu = me->current_language.
catch system-exceptions others = 1.
call function me->sf_function
exporting
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
importing
document_output_info = document_output_info
job_output_info = job_output_info
job_output_options = job_output_options
exceptions
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.
endif.
endcatch.
if sy-subrc ne 0.
trace( 'Error calling smartform module.' ).
raise failed.
endif.
endmethod.

        

API methods

Generate links:

  • String getBoImage(String p_objtype, String p_subobj, String p_objid)

    Creates an icon with a link to the document if the business object has been configured in the SAP system. This icon can be positioned after an Object ID on the interface.

  • String getBoLink(String p_objtype, String p_subobj, String p_objid, String p_text, String p_style)

    This function generates a text link to the document. Here you can specify the text to be displayed in the "p_text" parameter and a style for the HTML element <a></a> (optional).

  • String getBoURL(String p_objtype, String p_subobj, String p_objid)

    If only the URL to the document is required (e.g. because it is to be used in your own HTML generation), this function can be used.

Configuration:

setImageNormal(String p_image) setImageHover(String p_image) eigenes Bild für den Link setzen

Examples

Velocity - Long call:

            #set( $Api = $GSAP.getAddOn('sapbop', 'saperp', $Request) )
#if( $Api )
#set( $strId = $DC.getValueHolder('textvcontrol159CC346').getValue())
$Api.getBoImage('LIKP', '', $strId)
#else
##<b>No API<b/>#end

        

Velocity - Short call:

            $GSAP.getAddOn('sapbop', 'saperp', $Request).$Api.getBoLink('LIKP', '', '0080000031', 'Text', '')

        

More information

General

Installation

Create connection

Integration in applications

SAP Script Generator

SAP Trust Manager SSO configuration

API Description Part 1 - Overview

API Description Part 2 - SAP Portal Plugin

API description part 3 - Implementation of own processing modules

API description part 4 - sample coding

Developer manual part 1

Developer's Guide Part 2 - Integration scenario SAP external data group

Developer's Guide Part 3 - Scripting integration scenario

Developer Manual Part 4 - Personalized SAP Access / Single Sign On (SSO)

Developer manual Appendix

Developer manual - Sample coding