Skip to Content
0
Former Member
Apr 22, 2005 at 09:16 PM

Calling Print Service and changing data provider

42 Views

Using the WAD, I am trying to open a new window for printing the output of a table, but want to change the display of certain infoobjects (from KEY_TEXT to KEY) prior to calling the print service. I can successfully change the display in the new print window, however my calling window (the main web application) changes as well. This causes the main application to be missing the infoobject texts the next time that I navigate. I presume this is happening because I am using the same data provider in both windows.

I would like to be able to do the following:

1. Open a new window for printing but prior to printing, change the navigation so that only the key of the infoobject is to be printed.

2. Leave the navigation in the main window with key and text displayed for the infoobjects.

Here is the javascript that I was using to call the print screen:

"function PrintTable(parameter, cell_type, filter, parameter1, parameter2, item, dataprovider, x, y) 
{
//Release Data Provider for detail print screen
  var pURL = SAP_BW_URL_Get() + "&DATA_PROVIDER=DP_AGING&CMD=RELEASE_DATA_PROVIDER";
//  pURL = pURL + "&APPLY_CMD_ON_TARGET=X";

//Set the characteristics for printing to KEY only and open window
  pURL = pURL + "&CMD_1='" + SetIobjDisplay("DP_AGING","0COMP_CODE","KEY",false, false) + "'";
  pURL = pURL + "&CMD_2='" + SetIobjDisplay("DP_AGING","0PLANT","KEY",false, false) + "'";  
  window.open(pURL, cPrintVar, "width=800, height=600, menubar=yes, toolbar=no, scrollbars=yes, resizable=yes");

//Call Print Function in Print Window 
  var url = SAP_BW_URL_Get(); 
  url = url + "&CMD=PROCESS_HELP_WINDOW&HELP_SERVICE=ZPRINTING&ITEM=AGING_TAB"; 
  url = url + "&P_HEADER_LEFT=%26TITLE%26&P_HEADER_CENTER=&P_HEADER_RIGHT=";
  url = url + "&P_HEADER_HEIGHT=0.50&P_HEADER_INDENT_LEFT=0&P_HEADER_INDENT_RIGHT=0";
  url = url + "&P_DATA_AREA_PADDING_TOP=.5&P_DATA_AREA_ROWS=38";
  url = url + "&P_PAGE_WIDTH=25.50&P_PAGE_HEIGHT=17.70";
  url = url + "&P_FOOTER_LEFT=%26PAGE%26 of %26PAGETOT%26&P_FOOTER_CENTER=&P_FOOTER_RIGHT=";
  url = url + "&P_FOOTER_HEIGHT=0.50&P_FOOTER_INDENT_LEFT=0&P_FOOTER_INDENT_RIGHT=0";
  url = url + "&P_SHOW_FILTER=&P_SHOW_VARIABLES=";
  url = url + "&P_STYLESHEET=/sap/bw/Mime/Customer/StyleSheets/zBWReports_smallfont_print.css";
  SAPBWOpenWindow(url, cPrintVar, 800, 600);

} /*function PrintTable*/

function SetIobjDisplay(DataProvider, InfoObject, Display, zDirect, zOutput) {
//  var tURL = SAP_BW_URL_Get();
  var tURL;
  var zEq;
  var zAmp; 
//zDirect lets us know if we are calling a single command (true) or sequence (false)
  if (zDirect == true) {
    zAmp = "&";
    zEq = "=";
  }
  else {
    zAmp = "%26";
    zEq = "%3D";
  }
  tURL = zAmp + "DATA_PROVIDER" + zEq + DataProvider + zAmp + "CMD" + zEq + "SET_PRESENTATION";
  tURL = tURL + zAmp + "IOBJNM" + zEq + InfoObject;
  tURL = tURL + zAmp + "PRESENTATION" + zEq + Display;
//See if we want to output the data, or save for final call
  if (zOutput == false)
    tURL =  tURL + zAmp +"NO_OUTPUT" + zEq + "X"; 
   return tURL;
}/*function SetIobjDisplay*/"

I am fairly new to the WAD, so I'm not sure if what I want to do is possible or not. Any help would be appreciated.

thanks

Eric