Show TOC

 Calling a BSP Page Specifying the Data Provider StatusLocate this document in the navigation structure

In this example, the Custom Extension Web item is used to write the ABAP host name to the Web template as a JavaScript variable. The ABAP host name is used to call up a BSP page. The status of the data provider is transferred to the BSP page as XML.

Web Template 0BWVT_RUNTIME_EXPORT_XML_BSP

This Web Template transfers the XML from the command Export Data Provider as XML (EXPORT_XML) to the BSP page ZEXPORT_XML_BSP. The BSP page displays the result in an HTML text area (HTML tag <textarea>). 

In this Web template, the Custom Extension Web Item is also used with ABAP class ZCL_BICS_CONS_WEBITEM_ABAP_SER to retain the host name and port of the Web Application server and to insert this string into a JavaScript variable. The JavaScript-Variable is used in the Script Web item to create a cross-system URL for the BSP page.

Process Flow

To run the command, press XML Transfer to BSP Page in the Web application. You can also navigate prior to this in order to transfer a result of your choosing to the BSP page. The XML corresponds to the current navigation status.

Used Objects

Name of the Web template: 0BWVT_RUNTIME_EXPORT_XML_BSP

Name of the BSP page: ZEXPORT_XML_BSP

Name of the ABAP class: ZCL_BICS_CONS_WEBITEM_ABAP_SER

The following section shows you the coding for the objects used here:

Web Template 0BWVT_RUNTIME_EXPORT_XML_BSP

XHTML

<bi:bisp  xmlns="http://www.w3.org/TR/REC-html40" xmlns:bi="http://xml.sap.com/2005/01/bi/wad/bisp" xmlns:jsp="http://java.sun.com/JSP/Page" >

<html>

 <head>

<title>XML Export with redirect</title>

<meta http-equiv="Content-Language" content="en" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

</head>

<body style="FONT-FAMILY: Arial" bgcolor="#ffffff" leftmargin="0" topmargin="0" >

<bi:QUERY_VIEW_DATA_PROVIDER name="DP_1" >

<bi:INITIAL_STATE type="CHOICE" value="QUERY" >

<bi:QUERY value="0D_DX_M01_Q0002" text="DalSegno Company Umsatz-Analyse" />

</bi:INITIAL_STATE>

</bi:QUERY_VIEW_DATA_PROVIDER>

<bi:TEMPLATE_PARAMETERS name="TEMPLATE_PARAMETERS" />

<bi:CUSTOMER_EXIT_ITEM name="CUSTOMER_EXIT_ITEM_1" designheight="120" designwidth="300" >

<bi:CUSTOMER_EXIT type="COMPOSITE" >

<bi:CUSTOMER_EXIT_TYPE type="CHOICE" value="ABAP_CLASS_NAME" >

 <bi:ABAP_CLASS_NAME value="ZCL_BICS_CONS_WEBITEM_ABAP_SER" />

</bi:CUSTOMER_EXIT_TYPE>

</bi:CUSTOMER_EXIT>

<bi:DATA_PROVIDER_ACCESS_LIST type="ORDEREDLIST" >

<bi:DATA_PROVIDER_ACCESS type="COMPOSITE" index="1" >

<bi:DATA_PROVIDER_REF value="DP_1" />

<bi:NAVIGATIONAL_STATE_ACCESS value="X" />

<bi:RESULT_SET_ACCESS value="X" />

</bi:DATA_PROVIDER_ACCESS>

</bi:DATA_PROVIDER_ACCESS_LIST>

</bi:CUSTOMER_EXIT_ITEM>

<bi:SCRIPT_ITEM name="SCRIPT_ITEM_1" designwidth="300" designheight="120" >

<bi:SCRIPT value="biLargeData:5AIA8AK1DXI8JQ5B6413CU5RZ" />

</bi:SCRIPT_ITEM>

<p >

<bi:BUTTON_GROUP_ITEM name="BUTTON_GROUP_ITEM_1" designheight="70" designwidth="300" >

<bi:BUTTON_LIST type="ORDEREDLIST" >

<bi:BUTTON type="COMPOSITE" index="1" >

<bi:CAPTION value="XML Redirect to BSP" />

<bi:ACTION type="CHOICE" value="SCRIPT_FUNCTION" >

<bi:SCRIPT_FUNCTION value="setRedirectURL" />

</bi:ACTION>

</bi:BUTTON>

<bi:BUTTON type="COMPOSITE" index="2" >

<bi:CAPTION value="XML" />

<bi:ACTION type="CHOICE" value="INSTRUCTION" >

<bi:INSTRUCTION >

<bi:EXPORT_XML >

<bi:TARGET_DATA_PROVIDER_REF value="DP_1" />

<bi:RESULT_SET value="X" />

</bi:EXPORT_XML>

</bi:INSTRUCTION>

</bi:ACTION>

</bi:BUTTON>

</bi:BUTTON_LIST>

</bi:BUTTON_GROUP_ITEM>

</p>

<p >

<bi:ANALYSIS_ITEM name="ANALYSIS_ITEM_1" designwidth="400" designheight="200" >

<bi:DATA_PROVIDER_REF value="DP_1" />

</bi:ANALYSIS_ITEM>

</p>

</body>

</html>

</bi:bisp>

 

JavaScript

function setRedirectURL( currentState, defaultCommandSequence ){

//Create a new object of type sapbi_CommandSequence

var commandSequence = new sapbi_CommandSequence();

/*

 * Create a new object of type sapbi_Command with the command named "SET_ITEM_PARAMETERS"

*/

var commandSET_ITEM_PARAMETERS_1 = new sapbi_Command( "SET_ITEM_PARAMETERS" );

/* Create parameter ITEM_TYPE */

var paramITEM_TYPE = new sapbi_Parameter( "ITEM_TYPE", "BUTTON_GROUP_ITEM" );commandSET_ITEM_PARAMETERS_1.addParameter( paramITEM_TYPE );

 

/* End parameter ITEM_TYPE  */

/* Create parameter INIT_PARAMETERS */

var paramINIT_PARAMETERS = new sapbi_Parameter( "INIT_PARAMETERS" );

var paramListINIT_PARAMETERS = new sapbi_ParameterList();commandSET_ITEM_PARAMETERS_1.addParameter( paramINIT_PARAMETERS );

 

// Create parameter BUTTON_LIST

var paramBUTTON_LIST = new sapbi_Parameter( "BUTTON_LIST", "" );

var paramListBUTTON_LIST = new sapbi_ParameterList();

// Create parameter BUTTON

var paramBUTTON1 = new sapbi_Parameter( "BUTTON", "" );

var paramListBUTTON1 = new sapbi_ParameterList();

// Create parameter ACTION

var paramACTION = new sapbi_Parameter( "ACTION", "INSTRUCTION" );

var paramListACTION = new sapbi_ParameterList();

// Create parameter INSTRUCTION

var paramINSTRUCTION = new sapbi_Parameter( "INSTRUCTION", "" );

paramListACTION.addParameter( paramINSTRUCTION );

// End parameter INSTRUCTION!

paramACTION.setChildList( paramListACTION );

paramListBUTTON1.addParameter( paramACTION );

// End parameter ACTION!

paramBUTTON1.setChildList( paramListBUTTON1 );

paramListBUTTON_LIST.setParameter( paramBUTTON1, 1 );

// End parameter BUTTON!

paramBUTTON_LIST.setChildList( paramListBUTTON_LIST );

paramListINIT_PARAMETERS.addParameter( paramBUTTON_LIST );

// End parameter BUTTON_LIST!

paramINIT_PARAMETERS.setChildList( paramListINIT_PARAMETERS );

/* End parameter INIT_PARAMETERS  */

 

/* Create parameter TARGET_ITEM_REF */

var paramTARGET_ITEM_REF = new sapbi_Parameter( "TARGET_ITEM_REF", "BUTTON_GROUP_ITEM_1" );

commandSET_ITEM_PARAMETERS_1.addParameter( paramTARGET_ITEM_REF );

 

/* End parameter TARGET_ITEM_REF */

 

// Add the command to the command sequence

commandSequence.addCommand( commandSET_ITEM_PARAMETERS_1 );

/*

 * End command commandSET_ITEM_PARAMETERS_1

*/

/*

 * Create a new object of type sapbi_Command with the command named "EXPORT_XML"

*/

var commandEXPORT_XML_2 = new sapbi_Command( "EXPORT_XML" );

/* Create parameter TARGET_DATA_PROVIDER_REF */

var paramTARGET_DATA_PROVIDER_REF = new sapbi_Parameter( "TARGET_DATA_PROVIDER_REF", "DP_1" );

commandEXPORT_XML_2.addParameter( paramTARGET_DATA_PROVIDER_REF );

 

/* End parameter TARGET_DATA_PROVIDER_REF */

 

/* Create parameter REDIRECT_URL */

var paramREDIRECT_URL = new sapbi_Parameter( "REDIRECT_URL", url_prefix + "/sap/bc/bsp/sap/zexport_xml_bsp/get_state.htm" );

commandEXPORT_XML_2.addParameter( paramREDIRECT_URL );

 

/* End parameter REDIRECT_URL */

 

// Add the command to the command sequence

commandSequence.addCommand( commandEXPORT_XML_2 );

/*

 * End command commandEXPORT_XML_2

*/

//Send the command sequence to the server

return sapbi_page.sendCommand( commandSequence );

}

BSP ZEXPORT_XML_BSP

Flow logic

Add a page with flow logic and enter the description get_state.htm.

Layout

<%@page language="abap"%><html>  <head>    <link rel="stylesheet" href="../../sap/public/bc/bsp/styles/sapbsp.css">    <title> iView </title>  </head>  <body class="bspBody1">    <h1>XML String</h1>    <p>      <textarea name="user_eingabe" cols="120" rows="40">        <%= p_xml_string %>      </textarea>    </p>  </body></html>

Eventhandler

OnInitialization

* event handler for data retrievaltype-pools: rrx1.data:      l_xml_string type string,      l_sx_view type rrx1_sx_view.l_xml_string = request->get_form_field( 'xml' ).p_xml_string = l_xml_string.call method cl_bics_cons_state_converter=>convert_xml  exporting    i_xml_string = l_xml_string  importing    e_sx_view    = l_sx_view.p_sx_view = l_sx_view.

Page Attributes

P_SX_VIEW   TYPE   RRX1_SX_VIEW

P_XML_STRINGTYPE   STRING

ABAP class ZCL_BICS_CONS_WEBITEM_ABAP_SER

Interfaces

IF_BICS_CONS_WEBITEM_CUST_EXIT

Attributes

P_URL_PREFIX TYPE STRING

METHOD IF_BICS_CONS_WEBITEM_CUST_EXIT~INITIALIZE.

 

DATA:

l_url_prefix type string.

 

CALL FUNCTION 'RSBB_URL_PREFIX_GET'

EXPORTING

I_MESSAGESERVER       = space

IMPORTING

E_URL_PREFIX          = l_url_prefix.

 

CONCATENATE p_url_prefix

'<script type="text/javascript">'

'var url_prefix="' l_url_prefix '";'

'</script>'

INTO p_url_prefix.

 

ENDMETHOD.

 

 

 

METHOD IF_BICS_CONS_WEBITEM_CUST_EXIT~EXECUTE.

 

DATA:

l_string TYPE  string.

 

CLEAR e_xml.

 

l_string = p_url_prefix.

 

TRY.

*     The customer exit returns HTML data to be displayed.

*     The result HTML needs to be stored in E_XML using UTF-8 encoding.

*     You can convert simple ABAP-strings to UTF-8 by calling the

*     following the method:

*     ==================================================================

CALL METHOD cl_bics_cons_webitem_util=>string_2_utf8_xstring

EXPORTING

i_string       = l_string

RECEIVING

r_utf8_xstring = e_xml.

 

CATCH cx_bics_cons_webitem_error.

*     exception handling

ENDTRY.

 

ENDMETHOD.