Skip to Content

There is an OFB solution how to model drill down using Analysis Items in WAD. What it takes is to pass selection from parent analysis item to child one. But this solution has two major problems:

  • Bad Performance (since there is no parent Analysis Item initial selection, it takes long time to load detailed data of child analysis item);
  • Not intuitive interface (since there is no parent Analysis Item initialial selection, it is not clear that parent analysis item should limit data of child one).

In my blog I will explain how to model drill down with initial selection to make analysis application both responsive and intuitve (some JavaScript knowledge will be required).

    Once my analysis application is refreshed it looks like this

Analysis Application.jpg

This is what is required to make initial selection work:

Lets see each step in details.

Initially hide child Analysis Item

ANALYSIS_ITEM_2_Properties.jpg

Find first Product from parent Analysis Item

Add Data Provider Info Item for DP_1 (used by 1st Analysis Item)

DATA_PROVIDER_INFO_ITEM_1.jpg

Define JavaScript function to read first Product.

function Get_Product() {

var s;
var xml;
xml = document.getElementById(‘DATA_PROVIDER_INFO_ITEM_1’).innerHTML;
xmlDoc=new ActiveXObject(“Microsoft.XMLDOM”);
xmlDoc.async=false;

xmlDoc.loadXML(xml);

var Product = xmlDoc.getElementsByTagName(“AXIS”)[0].getElementsByTagName(“MEMBER”)[0].getAttribute(“text”)

return Product;

}

Select first row in parent Analysis Item

Define JavaScript function to select first row in 1st Analysis Item

function Select_Row() {
var tableModel;
var element =  document.getElementById(‘ANALYSIS_ITEM_1_ia_pt_a’);
  if (typeof(element) != ‘undefined’ && element != null)  {
// BW 7.3
  tableModel = ur_Table_create(‘ANALYSIS_ITEM_1_ia_pt_a’); 
  }
  else {
// BW 7.0
    tableModel = ur_Table_create(‘ANALYSIS_ITEM_1_interactive_pivot_a’); 
  }

var oRow = tableModel.rows[ 2 ];
sapbi_acUniGrid_selectRowCellsInternal( tableModel, oRow, true, null);

}

Limit child Analysis Item data to fist Product in parent Analysis Item and unhide child Analysis Item

Define JavaScript function that executes command sequence of two commands:

function Filter_N_Unhide( Product ){

//Note: information can be extracted using the parameter ‘currentState’

// and ‘defaultCommandSequence’. In either case create your own object

// of type ‘sapbi_CommandSequence’ that will be sent to the server.

// To extract specific values of parameters refer to the following

// snippet:

//  var key = currentState.getParameter( PARAM_KEY ).getValue();

//  alert( “Selected key: ” + key );

//

// (‘PARAM_KEY’ refers to any parameter’s name)

//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_SELECTION_STATE_SIMPLE”

    */

var commandSET_SELECTION_STATE_SIMPLE_1 = new sapbi_Command( “SET_SELECTION_STATE_SIMPLE” );

/* Create parameter TARGET_DATA_PROVIDER_REF_LIST */

var paramTARGET_DATA_PROVIDER_REF_LIST = new sapbi_Parameter( “TARGET_DATA_PROVIDER_REF_LIST”, “” );

var paramListTARGET_DATA_PROVIDER_REF_LIST = new sapbi_ParameterList();

// Create parameter TARGET_DATA_PROVIDER_REF

var paramTARGET_DATA_PROVIDER_REF1 = new sapbi_Parameter( “TARGET_DATA_PROVIDER_REF”, “DP_2” );

paramListTARGET_DATA_PROVIDER_REF_LIST.setParameter( paramTARGET_DATA_PROVIDER_REF1, 1 );

  // End parameter TARGET_DATA_PROVIDER_REF!

paramTARGET_DATA_PROVIDER_REF_LIST.setChildList( paramListTARGET_DATA_PROVIDER_REF_LIST );

commandSET_SELECTION_STATE_SIMPLE_1.addParameter( paramTARGET_DATA_PROVIDER_REF_LIST );

/* End parameter TARGET_DATA_PROVIDER_REF_LIST */

/* Create parameter RANGE_SELECTION_OPERATOR */

var paramRANGE_SELECTION_OPERATOR = new sapbi_Parameter( “RANGE_SELECTION_OPERATOR”, “EQUAL_SELECTION” );

var paramListRANGE_SELECTION_OPERATOR = new sapbi_ParameterList();

// Create parameter EQUAL_SELECTION

var paramEQUAL_SELECTION = new sapbi_Parameter( “EQUAL_SELECTION”, “MEMBER_NAME” );

var paramListEQUAL_SELECTION = new sapbi_ParameterList();

// Create parameter MEMBER_NAME

var paramMEMBER_NAME = new sapbi_Parameter( “MEMBER_NAME”, Product );

paramListEQUAL_SELECTION.addParameter( paramMEMBER_NAME );

  // End parameter MEMBER_NAME!

paramEQUAL_SELECTION.setChildList( paramListEQUAL_SELECTION );

paramListRANGE_SELECTION_OPERATOR.addParameter( paramEQUAL_SELECTION );

  // End parameter EQUAL_SELECTION!

paramRANGE_SELECTION_OPERATOR.setChildList( paramListRANGE_SELECTION_OPERATOR );

commandSET_SELECTION_STATE_SIMPLE_1.addParameter( paramRANGE_SELECTION_OPERATOR );

/* End parameter RANGE_SELECTION_OPERATOR */

/* Create parameter CHARACTERISTIC */

var paramCHARACTERISTIC = new sapbi_Parameter( “CHARACTERISTIC”, “D_NW_PRID” );

commandSET_SELECTION_STATE_SIMPLE_1.addParameter( paramCHARACTERISTIC );

/* End parameter CHARACTERISTIC */

// Add the command to the command sequence

commandSequence.addCommand( commandSET_SELECTION_STATE_SIMPLE_1 );

/*

  * End command commandSET_SELECTION_STATE_SIMPLE_1

    */

/*

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

    */

var commandSET_ITEM_PARAMETERS_2 = new sapbi_Command( “SET_ITEM_PARAMETERS” );

/* Create parameter ITEM_TYPE */

    var paramITEM_TYPE = new sapbi_Parameter( “ITEM_TYPE”, “ANALYSIS_ITEM” );commandSET_ITEM_PARAMETERS_2.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_2.addParameter( paramINIT_PARAMETERS );

// Create parameter VISIBILITY

var paramVISIBILITY = new sapbi_Parameter( “VISIBILITY”, “VISIBLE” );

paramListINIT_PARAMETERS.addParameter( paramVISIBILITY );

  // End parameter VISIBILITY!

paramINIT_PARAMETERS.setChildList( paramListINIT_PARAMETERS );

/* End parameter INIT_PARAMETERS  */

/* Create parameter TARGET_ITEM_REF */

var paramTARGET_ITEM_REF = new sapbi_Parameter( “TARGET_ITEM_REF”, “ANALYSIS_ITEM_2” );

commandSET_ITEM_PARAMETERS_2.addParameter( paramTARGET_ITEM_REF );

/* End parameter TARGET_ITEM_REF */

// Add the command to the command sequence

commandSequence.addCommand( commandSET_ITEM_PARAMETERS_2 );

/*

  * End command commandSET_ITEM_PARAMETERS_2

    */

//Send the command sequence to the server

    return sapbi_page.sendCommand( commandSequence );

}

Code call of all onload JavaScripts

Define JavaScript function to call all above and attach it to BODY onload event

function initial_selection( )  {

Select_Row();
Filter_N_Unhide(Get_Product());

};

        </head>

        <body onload=”initial_selection();” >

            <bi:QUERY_VIEW_DATA_PROVIDER name=”DP_1>

See attached EPM_DEMO Web Application templete for complete implementation details (rename to EPM_DEMO.bisp before upload to WAD)

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply