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 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
-
the ID of the add-on
-
the SAP data source
-
the application that uses it
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-methode-addon>
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");
}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 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.
Configuration
Configuration The configuration of the BusinessObject documents takes place in the SAP system within the customizing of the portal plugin in the "Extensions" folder.
Handlers
Handlers have already been created for the most important generations. These are available as standard:
- /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
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.
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.
Custom handlers
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
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. 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.
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)
Generates an icon with a link to the document, if the BusinessObject 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. The text to be displayed can be defined in the parameter "p_text" and the style for HTML element in <a></a> (optional).
- String getBoURL(String p_objtype, String p_subobj, String p_objid)
If you only require the URL to the document (e.g. because this should be used in custom HTML generation), use this function.
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
SAP Trust Manager SSO configuration
API description Part 1 - Overview
API description Part 2 - SAP Portal Plugin
API description Part 3 - Implementing custom processing modules
API description Part 4 - Sample coding
Developer's Manual Part 2 - Integration scenario, SAP external data group
Developer's Manual Part 3 - Scripting integration scenario
Developer's Manual Part 4 - Personalized SAP Access / Single Sign On (SSO)