Skip to Content
0
Former Member
Feb 05, 2005 at 12:37 AM

Export to excel with more than 1 dataprovider

34 Views

I have looked at examples in this forum of how others have used an "export to excel" button with more than 1 dataprovider but I cannot get these examples to work for my situation.

I have a web template with 2 (or more) dataproviders. The template has a button for "export to excel". The code came from 0QUERY_TEMPLATE. It also uses tabs and has a javascript function which hides all items except for the one on the selected tab and sets the property for the selected tab. I got the code for this from the WEB API reference for BW 3.x.

I cannot get the button "export to excel" to export the selected (non-hidden) data provider.

Any help would be greatly appreciated.

Provided below is my template.

<object>

<param name="OWNER" value="SAP_BW"/>

<param name="CMD" value="SET_PROPERTIES"/>

<param name="TEMPLATE_ID" value="ZTEST_EXPORT"/>

<param name="VARIABLE_SCREEN" value="X"/>

TEMPLATE PROPERTIES

</object>

<object>

<param name="OWNER" value="SAP_BW"/>

<param name="CMD" value="SET_DATA_PROVIDER"/>

<param name="NAME" value="DATAPROVIDER_1"/>

<param name="QUERY" value="ZPC_010"/>

<param name="INFOCUBE" value="ZPC_M01"/>

DATA_PROVIDER: DATAPROVIDER_1

</object>

<object>

<param name="OWNER" value="SAP_BW"/>

<param name="CMD" value="SET_DATA_PROVIDER"/>

<param name="NAME" value="DATAPROVIDER_2"/>

<param name="QUERY" value="ZPC_011"/>

<param name="INFOCUBE" value="ZPC_M01"/>

DATA_PROVIDER: DATAPROVIDER_2

</object>

<html>

<head>

<link href="/sap/bw/Mime/Customer/StyleSheets/ServicePortalBWReports.css" type="text/css" rel="stylesheet"/>

<Script type="text/javascript">

<!--

/* function goto_tab: Show all items, starting with tabname, Hide all other items */

function goto_tab(tabname) {

SAPBWOpenURL(SAP_BW_URL_Get()'&item=TAB*&multi=X&hidden=X&cmd_1=item%3d'tabname+'*%26hidden%3d %26multi%3dX');

}

/* DHTML function to set correct span-Tag visible

For each Tab in Tab-Header (head_TAB) check, if item TABx is visible

If Item is visible set Header as selected

Otherwise set corresponding span-Tag to not visible */

function set_actual_tab() {

i=0;

do {

i++;

if (document.getElementById('head_TAB'+i) != null) {

/* Check if Object tag is hidden */

var prop = SAPBWGetItemProp('TAB'+i);

var hidden=true;

if (prop != null){

for(j=1;j<prop.length;j++){

if (prop[j][0] == "HIDDEN") hidden = (prop[j][1]=='X');

}

}

if (hidden) {

document.getElementById("TAB"+i).setAttribute('style', 'display:none;visibility:false;',false);

}

else {

document.getElementById("head_TAB"+i).setAttribute('className', 'SAPBEXTbsTABsel',false);

}

}

} while (document.getElementById('head_TAB'+i) != null)

}

-->

</script>

</head>

<body>

<TABLE class=SAPBEXNavLineBorder cellSpacing=0 cellPadding=1 width=5 border=0>

<TR>

<TD width="5%">

<TABLE cellSpacing=1 cellPadding=2 width="100%" border=0>

<TR>

<!-- Display Export Excel--->

<TD class=SAPBEXNavLine><A href="<SAP_BW_URL CMD='EXPORT' FORMAT='XLS' DATA_PROVIDER='DATAPROVIDER_1'>">

<IMG alt="Export to MS Excel" src="Mime/BEx/Icons/S_X_XLS.gif" border=0></A></TD>

</TD></TR></TABLE></TD></TR></TABLE>

<TABLE cellSpacing=1 cellPadding=5 width="75%" border=0>

<TR>

<TD vAlign=top>

<P>

<TABLE cellSpacing=0 cellPadding=5 border=0>

<TR>

<TD class=SAPBEXTbsTab id=head_TAB1><A href="javascript:goto_tab('TAB1')">Tab 1</A></TD>

<TD class=SAPBEXTbsTab id=head_TAB2><A href="javascript:goto_tab('TAB2')">Tab 2</A></TD>

</TR></TABLE>

<TABLE class=SAPBEXTbsBdyEdg cellSpacing=0 cellPadding=5 width="5%"

border=0>

<TR>

<TD vAlign=top>

<SPAN id=TAB1><object>

<param name="OWNER" value="SAP_BW"/>

<param name="CMD" value="GET_ITEM"/>

<param name="NAME" value="TAB1"/>

<param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_GRID"/>

<param name="DATA_PROVIDER" value="DATAPROVIDER_1"/>

<param name="GENERATE_CAPTION" value=""/>

ITEM: TAB1

</object></SPAN>

<SPAN id=TAB2><object>

<param name="OWNER" value="SAP_BW"/>

<param name="CMD" value="GET_ITEM"/>

<param name="NAME" value="TAB2"/>

<param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_GRID"/>

<param name="DATA_PROVIDER" value="DATAPROVIDER_2"/>

<param name="GENERATE_CAPTION" value=""/>

<param name="HIDDEN" value="X"/>

ITEM: TAB2

</object></SPAN>

</TD></TR></TABLE></P>

<SCRIPT type=text/javascript>

<!--

/* This function call is needed to set the correct state */

set_actual_tab();

-->

</SCRIPT>

</TD></TR></TABLE>

</body>

</html>