cancel
Showing results for 
Search instead for 
Did you mean: 

Printing to Excel Article by Tobias Kaufmann

Former Member
0 Kudos

Does anyone know where to get the classes that need to be imported that are referenced in the printing to excel article by Tobias Kaufmann? I am interested in trying this technique, but cannot locate the classes that are mentioned in the article. Any help to get me going in the right direction would be very much appreciated. The article is located at https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/biw/business intelligence web printing with excel.pdf

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Mark,

Check the below link

service.sap.com/bw --> SAP BW InfoIndex --> Web Application Design 3.x -> How to... Enhance Web Printing (zip)

Download the zip file, it has the files you need. Hope it helps.

Sree

Former Member
0 Kudos

I had seen the article you mentioned and implemented those classes to implement the enhanced printing that the article talked about, but this article was different than the one that I mentioned in my original email. Do you know where I could find the files to import for the printing to Excel article?

Former Member
0 Kudos

I don't think the document and the related files are released yet.

Thanks.

Answers (23)

Answers (23)

0 Kudos

Hello All,

Anyone of you have these transport files needed for import for this how-to-paper? The link for this how-to-paper is not working anymore. I want to try to implement this one to see if this will solve our problem about excel download. Since the values we modified in the table interface does not reflect in the download file.

thanks all!

Jti

Sorry, please disregard this message. i found it now in the links below.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/business_packages/a1-8-4/h...

Edited by: JTi on Aug 5, 2008 10:16 PM

Former Member
0 Kudos

Hi,

i have a problem with the excel export. In the Class where generated the dynamic class eg. ZCL_RSR_XLS_TABLE ..the string n_request_device_class will cleared. The string where filled in method PROCESS_CMD which class ZCL_RSR_XLS_HELP_WINDOW_PRINT.

Code Snippet:

data:

l_cmd type string,

l_bookmark_id type rszwobjid,

    • TODO change device class

l_device_class type string value 'ZXLS'.

concatenate

n_r_page->n_s_url-plain_prefix

cl_rsr_www_page=>c_parameter_bookmark_id '=' l_bookmark_id

'&device_class=' l_device_class

'&format=XLS'

into n_sx_output-redirect_url.

End Code Snippet.

In the Method PROCESS_CMD which class CL_RSR_WWW_PAGE would the string cleared.

Code Snippet:

if e_r_page is not initial.

clear e_r_page->n_request_device_class.

endif.

end Code Snippet.

And then the Class with "Z" and "XLS" e.g. ZCL_RSR_XLS_TABLE would not used, but the class CL_RSR_WWW_TABLE would used.

Have anyone an idee, would i can help me.

Thanks for every post.

Former Member
0 Kudos

Hello,

How can I modify the following code to print more than one dataprovider whith only one button :

-


<b>BW Web Item</b>


<object>
<param name="OWNER" value="SAP_BW"/>
<param name="CMD" value="GET_ITEM"/>
<param name="NAME" value="TABLE_1"/>
<param name="ITEM_CLASS"
value="CL_RSR_WWW_ITEM_GRID"/>
<param name="DATA_PROVIDER"
value="DATA_PROVIDER_1"/>
<param name='HELP_SERVICE'
value='HELP_SERVICE_PRINT'/>
<param name='HELP_SERVICE_CLASS'
value='<pre><code>CL_RSR_XLS_HELP_WINDOW_PRINT'/>
ITEM: TABLE_1
</object>

==========================================================

<b>Button</b>


<table><tr><td class="SAPBEXBtnStdBorder" cellspacing="0"
cellpadding="0" border="0">
<table><tr><td class="SAPBEXBtnStd" cellspacing="0" cellpadding="0"
border="0">
<A href="<SAP_BW_URL CMD='PROCESS_HELP_WINDOW'
HELP_SERVICE='HELP_SERVICE_PRINT'
ITEM='TABLE_1' SUBCMD='PRINT_EXCEL'>">Web Printing
with Excel</A>
</td></tr></table>
</td></tr></table>

-


Thanks

Former Member
0 Kudos

Dear all.

We replaced the 0ANALYZER with a web template using EXCEL Printing as proposed by Tobias.

When printing from query result in Excel the print style sheet is not called. But if I execute the web template manually with a static query, printing is done correctly.

Same question as Frank: did I miss any parameter settings or part of BI-Web-Reports Installation.

I would very much appreciate your answer because web printing is urgently needed in production.

Thanks and best regards,

Turgay.

Former Member
0 Kudos

Hi Tobias,

the printing to Excel does not work in the following situation.

Our restraints:

- We are using a pre-query variable for our main query.

- We have two different templates. One for displaying and the other one for downloading purpose.

- The second template is needed, because of the varying layout as described in the howto topic 3.8

We think the problem is copying the dataprovider from the first template to the second template. We already tried a lot of things, like having two data provider in each template, but this also does not work.

Do you have any idea?

Regards

Sebastian

Former Member
0 Kudos

Hi everyone,

I'm trying to get rid of the images that are downloaded to the excel document, but I havent been succesful. I have a template that is a reference to 0ANALYZER and that has a table with ITEM_CLASS = CL_RSR_WWW_ITEM_GRID. I have tried to make a copy of my template and add the ZXLS but with no luck. The server does not want render the table. The MODIFY_CLASS ZCL_RSR_XLS_TABLE is not compatible. I've also tried with ZCL_RSR_XLS_ITEM_GRID and it didn't work either.

Anyone know how to fix this? I'm kinda stuck.

Kind regards,

Dionisios

Former Member
0 Kudos

Solved it!

regards,

Dion

Former Member
0 Kudos

Hi Tobias, All

Our problem is now solved. we retreive in Excel the Textelement.

<b>Thanks a lot</b>.

During the export to excel, the font format of text eelement is missing the values is not center in the excel table ...

We've change the method RENDER in the class ZCL_RSR_XLS_ITEM_TEMPLATE, to apply our own tag sending to Excel (like center strong ...). It is the correct way ?

Thanks in adavance.

Dan

Former Member
0 Kudos

Hello Dan!

The How to... paper is just a proposal and not shipped with the standard. Therefore it is not a problem to change the ABAP classes starting with Z* because they are in your customer namespace.

Anyhow, method RENDER in the class ZCL_RSR_XLS_ITEM_TEMPLATE is the right place, if you would like to change the output just before it is sent to Excel.

Yours,

Tobias

Former Member
0 Kudos

Dan,

How do you get the text element downloaded, I am trying to display a year period variable value. no luck so far.

Former Member
0 Kudos

Hi,

is there a way to set a column to have a colspan="2" in the generated html/xls file?

kind regards,

Dionisios

Former Member
0 Kudos

Hello,

How can I modify the following code to print more than one dataprovider whith only one button :

-


BW Web Item
<object>
<param name="OWNER" value="SAP_BW"/>
<param name="CMD" value="GET_ITEM"/>
<param name="NAME" value="TABLE_1"/>
<param name="ITEM_CLASS"
value="CL_RSR_WWW_ITEM_GRID"/>
<param name="DATA_PROVIDER"
value="DATA_PROVIDER_1"/>
<param name='HELP_SERVICE'
value='HELP_SERVICE_PRINT'/>
<param name='HELP_SERVICE_CLASS'
value='<pre><code>CL_RSR_XLS_HELP_WINDOW_PRINT'/>
ITEM: TABLE_1
</object>

==========================================================


Button
<table><tr><td class="SAPBEXBtnStdBorder" cellspacing="0"
cellpadding="0" border="0">
<table><tr><td class="SAPBEXBtnStd" cellspacing="0" cellpadding="0"
border="0">
<A href="<SAP_BW_URL CMD='PROCESS_HELP_WINDOW'
HELP_SERVICE='HELP_SERVICE_PRINT'
ITEM='TABLE_1' SUBCMD='PRINT_EXCEL'>">Web Printing
with Excel</A>
</td></tr></table>
</td></tr></table>

-


Former Member
0 Kudos

Hi Tobias

If I understand, you mean we have to manage tu ABAP of the classe ZCL_RSR_WWW_ITEM_TEXT_ELEM to be able to integrate this king of thing ?

It's the same with Label Web Item ?

We can only add text element in excel header sheet ?

yours

Dan

Former Member
0 Kudos

Hi All,

We need to fix the excel print to scale =80. As currently it comes up with fit to page always.

Tobias 's code says..

<x:Print>

<x:FitWidth>1</x:FitWidth>

<x:FitHeight>0</x:FitHeight>

<x:ValidPrinterInfo/>

<x:Scale>80</x:Scale>

<x:HorizontalResolution>600</x:HorizontalResolution>

<x:VerticalResolution>600</x:VerticalResolution>

</x:Print>

What modification I have to do to get scale =80 as default. Our excel version is 2000

Regards

Mahendra

Former Member
0 Kudos

Hello Mahendra!

This value must be specified in every Web Template within the <x:Print> block. It is not hardcoded at the backend side.

If you like, you can change the variable p_print with a set of fix values in the ABAP class ZCL_RSR_XLS_ITEM_TEMPLATE, method SET_ITEM (search for "* x:Print").

Yours,

Tobias

Former Member
0 Kudos

Hi Tobias,

We don't want to hardcore in the backend side. Yes we want to have the scale for some of the web Templates. So I have coded the following code in web Template within the <x:Print> block

//Print Scale

<x:Print>

<x:ValidPrinterInfo/>

<x:Scale>80</x:Scale>

<x:HorizontalResolution>600</x:HorizontalResolution>

<x:VerticalResolution>600</x:VerticalResolution>

</x:Print>

But this is not working for the web Template. Could you please let us know what else we have missed. Our excel version is MS 2000.

Thanks & Regards

Mahendra

Former Member
0 Kudos

Hi everyone and Tobias:

I am new to this forum and BW.

I have a question regarding to the repeated row stuff. This paper gives the user the choice to set the repeated row. I have a problem with that when we use the master template. When we use master template, we can't hard code the repeated row of the column heading of the table, since every report has different number of text element to be printed before the table.

Is there anyway we can turn it off and have it dynamically done like the old "Export to Excel". Do we actually need to change the ABAP Class, or it is impossble to change it?

Many thanks for the help in advance!

Former Member
0 Kudos

Hi all BW expert:

Is it possible that we can print out the system id, I mean the development environment like, DEV, QA, and Prod.

Is it possible to have it print on logon screen, variable selection page and the main web report?

Thanks and Regards!!!

Former Member
0 Kudos

Tobias,

I implemented this solution, it has been well accepted.

However, when it was dealing with huge data set, e.x. 50,000 records, it used more than one GB memory in the server and it timed out sometimes.

Do you know which piece of code is taking so much memory?

SAP standard solution of downloading to excel does not take that much though.

It seems it is stuck on ZCL_RSR_XLS or CL_HTTP_RE...

James

Former Member
0 Kudos

Hi Tobias

Thanks for your reponse (quick)

Concerned the Text element, my need is to send in an excel cell (eg range(B5)) the value of a text element not in the header.

Concern the Cell format it about the number cell format. I can't send my format during export (using table interface format modify display values)

Regards

Dan

Former Member
0 Kudos

Hi Dan!

Please read my previous answer: add a Web Item Text Elements for the required value to your Web Template.

Web Item Text Element is not supporting Web Design API for Tables (Table Interface), therefore a change of the stlye is only possible, if you change the ABAP class ZCL_RSR_WWW_ITEM_TEXT_ELEM...

Yours,

Tobias

Former Member
0 Kudos

Hello All

I've the same question previously posted by Fong

An 2 additionnal questions

- concerning the possibility to send not in the header but in the excel, the text element

- how can we change the cell format after the export. The excel template is in the Business Document Service: Documents (Transaction OAOR) ?

Thanks in advance for your help.

Dan

Former Member
0 Kudos

Also has any one tried using the BW Web Template Items along with the Download to Excel. The Download seems to work fine if the link is in the main template does not work from the Sub Template.

Thanks.

Former Member
0 Kudos

Hello Dukan!

1. Text elements: You simply have to add the Web Item Text Elements to you Web Template. You can also paramterize the Web Item that way that only a specific value is visible. Because this text is displayed via a Web Item, it is also transfer to Excel.

2. Cell format: sorry, I don't understand your question. What do you would like to achieve?

The Excel document is created on demand and not stored on the BW server.

Yours,

Tobias

Former Member
0 Kudos

Hello Deepu!

If you use the Template in Template concept, you should not forget to specify the prefix of the main template. E.g. if you like to refer to another item from the sub template with ITEM=abc, you have to add the main (or other template) prefix, like ITEM=xyz_abc.

Yours,

Tobias

Former Member
0 Kudos

Dear all,

I copied the 0ANALYZER template and implemented the solution with success. But, I run into several problems:

- How can I hide the Navigation-block in Excel

- Excel keeps on displaying red 'X'-icons for each available characteristic for navigation

- Excel keeps on displaying red 'X'-icons for the hierarchy icons although I used the command '<!hierarchy_icons hide=x>'. I if use a normal template without tabs, I don't have any problems, but we want to integrate the solution in the 0ANALYZER template.

Did anyone fixed these problems?

Best regards,

Maarten

Message was edited by: Maarten Kreijveld

Former Member
0 Kudos

Hi Tobias,

Thanks for your response. I am able to execute other web API commands from the sub template and it works fine. <b>The Excel download command is also executed successfully and it opens up Excel but the data which is getting downloaded is not correct, it comes back with X for Characstertic values.</b>

I used the code given below for Downloading to Excel and for hiding, both the cases the command is executed successfully but in case of Excel the output produced is distorted.


<table>
<tr><td class="SAPBEXBtnStd" cellspacing="0" cellpadding="0" border="0">
<A href="<sap_bw_url cmd='PROCESS_HELP_WINDOW' help_service='HELP_SERVICE_PRINT'
item='TABLE_1' subcmd='PRINT_EXCEL'>">
Web Printing with Excel from Sub Template</A>
</td></tr>

<tr><td class="SAPBEXBtnStd" cellspacing="0" cellpadding="0" border="0">
<a href="<SAP_BW_URL item='TABLE_1' Hidden='X'>">Hide Table</a>
</td></tr>

Thanks.

Former Member
0 Kudos

Hello Maarten!

1. How can I hide the Navigationblock in Excel? Use print-specific Web Templates as described in the How to... Paper.

2. 'X'-icons? The 'X'-icons are indicating pictures that cannot be displayed by Excel. Normally, the solution tries to remove the img-Tags but if you are using the Web Design API for Tables (Table Interface), the icons might be generated outside the control of the coding. Please check which item is responsible for adding the icon. Check the ZCL_RSR_WWW_ITEM_* class where the icon is added.

3. Hide hierarchy? Your syntax looks wrong. Please see How to... Paper.

Yours,

Tobias

Former Member
0 Kudos

Hello Deepu!

What do you mean with X for characteristic values? Please have a look at my answer to Maarten.

Yours,

Tobias

Former Member
0 Kudos

Hi Tobias,

The 'X' is displayed for the Characterstics even if there are no images to be downloaded, I am using this for a query which does not have any Hierarchies. Also this happens only with Sub Templates, I will mail you the o/p which from the Excel download.

Thanks.

-Deepu

Former Member
0 Kudos

Tobias, I have the following text element, but it does not get downloaded except the caption. The actual value of the text element is not downloaded, could you share some thoughts.

<object>

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

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

<param name="NAME" value="TABLE_TXT1">

<param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_TEXT_ELEMENTS">

<param name="DATA_PROVIDER" value="DP">

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

<param name="GENERATE_LINKS" value="">

<param name="BORDER_STYLE" value="NO_BORDER">

<param name="SHOW_COMMON_ELEMENTS" value="">

<param name="SHOW_FILTERS" value="">

<param name="ELEMENT_TYPE_1" value="VARIABLE">

<param name="ELEMENT_NAME_1" value="ZC_FYP1">

<param name="ONLY_VALUES" value="X">

ITEM: TABLE_TXT1

</object>

Former Member
0 Kudos

Does the printing to excel functionality only work for web items?

I have a html table that I have coded. How can this (not a web item) table show up in excel?

Former Member
0 Kudos

Hello Fong!

Own HTML is not possible. Only HTML generated by Web Items is transferred to Excel.

If you like, you can change the coding of the ABAP class ZCL_RSR_XLS_ITEM_TEMPLATE, method GET_TEMPLATE. The class is in the customer namespace anyhow.

Yours,

Tobias

Former Member
0 Kudos

Hi Tetsuya!

A transport request number must be created for the import step first, then we use STMS to transport. The BASIS guy did the importing for us, but would be great to know how it's done.

Former Member
0 Kudos

Ity,

Thanks to your kind supports, finally we were able to import the transport files by adding transport number manually on STMS.

Tetsuya

Former Member
0 Kudos

We implemented "How to Web Printing to Excel" and successfully download most of the web items, but we have a trouble in downloading "CHART" into Excel. "How to.." says that it supports "Chart and Map possible (via Web Archive/MHTML, not yet implemented)". Does anyone know how to print "CHART"?

Tetsuya

Former Member
0 Kudos

Hello Tetsuya!

Charts are technical possible but more complicate. Therefore it is currently not implementated. You cannot print charts with this solution.

Yours,

Tobias

Former Member
0 Kudos

Does anyone know whether it's possible to print directly on the web instead of having to download the report into Excel first?

Thanks in advance for your help.

Former Member
0 Kudos

No, I don't think there's a standard solution to this problem. As far as I know none is provided by SAP in their current BW release. Probably there'll be one in a future release. There are quite a few posts on this forum regarding web printing. So, you are not alone with this problem Obviously there are some third party vendors offering a pdf-based solution. To find out more you may want to search this forum for <i>web printing</i> or similar terms.

Cheers,

Yogen

Former Member
0 Kudos

I feel sorry to make similar questions, but we have difficulies in implemeting "How To Web Printing with Microsoft Excel" on BW3.1Content.

There are two files "R903281.QB8" and "K903281.QB8" and we copied them to sub-directories of sap\trans as written in "How to" manual. But our BASIS team doesn't have lot of experience, so they cannot import the transport files with STMS.

Could you please let us know how to import those files with STMS STEP by STEP basis? I'll appreciate your help.

Former Member
0 Kudos

Hi Tobias,

I am trying to implement the Download to Excel for the default BW template which will be used for all the web reports, the download works but the print stylesheet does not seem to have an effect i.e the fonts and color specified in the print style sheet is ignored when I download to Excel.

I tried setting a external breakpoint in the class ZCL_RSR_XLS_ITEM_TEMPLATE and method GET_STYLE_SHEET_FROM_TEMPL. In the debug mode it did not go into this method for the default template, but it went for all the other test templates I created. Is there any other manual setting which needs to be done for the default template?

The print stylesheet also works for templates other than the default template.

Thanks.

Former Member
0 Kudos

Hi Tobias!

I'm running a template, which in turn, references a default template called 0ANALYZER (BW3.5).

I use the graphic icons to filter values, navigate, slice-n-dice, etc. I want to be able to use these icons, but not have the graphics printed on my report.

Would your approach still work in this case?

Many thanks!

Former Member
0 Kudos

Hi Lee!

Yes, simply create a copy of 0ANALYZER and append your device class as postfix like 0ANALYZER_ZXLS.

To create the copy, you have use the BEx Web Application Designer for upload and download of the file or the report RS_TEMPLATE_MAINTAIN.

Yours,

Tobias

Former Member
0 Kudos

Tobias,

How do I suppress the navigatoin block, in some template, the navigation block will show in the download excel.

When i copied the same template, then download to excel, the navigation block will show. Very strange, how do we make them not shown at all.

thanks.

Former Member
0 Kudos

Hello Uran!

There must be a difference in the Web Templates. This solution transfers always the current state of a Web Item to Excel. If a Web Item is hidden, it is not transfered to Excel.

You can also use print-specific Web Templates (see How to... paper for details) to ensure that a Web Item is always visible or not.

Yours,

Tobias

Former Member
0 Kudos

Does anyone know how to suppress or prevent the graphic icons (eg. drilldown rows/columns icons, Select Filter Values, bookmark, etc.) from printing on a web report? When I try to print to Excel, "unrecognizeable" boxes are printed on the report. Can someone please tell me how to fix this?

Thanks for your help.

Former Member
0 Kudos

Hi Lee!

If these icons are part of a Web Item, you should create an own implementation of a ZCL_RSR_XLS_ITEM_... class to remove these icons. But in general, these icons are removed automatically by my implementation.

If these icons are part of the Web Template itself (<img> tag), you should create a copy of this Web Template with the name <...>_ZXLS (or your device class). You get a print-specific Web Template. See my paper for details.

Thank you,

Tobias

Former Member
0 Kudos

Got it to work. A transport request had to be created first.

Thanks!

Former Member
0 Kudos

Hello Tobias,

I may have gotten the correct authorizations. Normally, I would transport an existing request, but in this case, the two files (K903281.QB8 and R903281.QB8) were manually copied to a Unix Server (subdirectories under DIR_TRANS), so there wasn't a transport request number. In STMS, how would I import the two transport files w/o having a request number?

Thanks for your help.

Former Member
0 Kudos

Hi:

I've copied the transport file to the subdirectories as mentioned in "How to...Web Printing with Excel." Now, I want to import the transport files into BW. Can someone provide instructions on how to do this?

Thanks in advance for your help.

Former Member
0 Kudos

Hello Lee!

As mentioned in the paper, you can use transaction STMS. But if you are not familiar with transports, you should really contact your (basis) system administrator because you properly do not have the correct authorizations.

Yours,

Tobias

Former Member
0 Kudos

I am using C_CELL_TD_EXTEND = 'style="display:none;"' to hide a cell using the TABLE API. But when I download to excel this is not recogonised. Is there any work arounds for this other than commenting the HTML for that CELL.

Former Member
0 Kudos

Hello Deepu!

Excel seems to ignore this style information. You can do a device recognition (check if you are running in Excel) and simply delete the content of the cell.

Yours,

Tobias

In case your are using the Web Design API for Tables in your Web Template with the parameter MODIFY_CLASS, you have to redefine the method INIT of your ABAP class. This method receives the variable I_R_PAGE as input parameter. This variable contains the required reference to the page object (CL_RSR_WWW_PAGE).

Redefine the method INIT and call the method SUPER->INIT of the basis class to perform all initializations of the basis class.

Create an private attribute P_R_PAGE of type reference to CL_RSR_WWW_PAGE and fill this attribute in the method INIT with the input parameter I_R_PAGE.

Finally, you can use the variable P_R_PAGE->N_S_SESSION_PROPERTIES-DEVICE_CLASS to check the current device class in your own ABAP class. The device class could be WWW for a normal Web Browser or ZXLS for Web Printing with Microsoft Excel.

Depending on the device class you should adjust your rendering, e.g. no images in Microsoft Excel.

Former Member
0 Kudos

Tobias,

Thanks for the help. I was able to get the DEVICE CLASS in my TABLE API, but not able hide the column. Is there any way I can stop rendering of some particular column other than using C_CELL_TD_EXTEND = 'style="display:none;"' or commenting using HTML.

I was able manipulate the content of the individual cells using C_CELL_CONTENT.

Thanks.

Former Member
0 Kudos

Hi Tobias,

I was able to check the device class in the TABLE API as you had mentioned. Depending on the device class I added the code for hiding a column as attached below.

IF P_R_PAGE->N_S_SESSION_PROPERTIES-DEVICE_CLASS = 'ZXLS'.

C_CELL_TD_EXTEND = 'width=0'.

ELSE.

C_CELL_TD_EXTEND = 'style="display:none;"'.

ENDIF.

'width=0' is the HTML generated when I hide a column using excel and saved as HTML.

The parameters I attach to C_CELL_TD_EXTEND for device class ZXLS does not seem to work ie C_CELL_TD_EXTEND = 'width=0' does not seem to work for ZXLS device class.

. When I download to excel and save as local HTML file the code I attached using C_CELL_TD_EXTEND does not seem to appear in the HTML file. C_CELL_CONTENT method seems to work fine. Is there any thing else which needs to be done for C_CELL_TD_EXTEND to work with this?

Thanks.

Former Member
0 Kudos

Hello Deepu!

The problem is that Excel does not support this feature. Please check out the Microsoft documentation about this (it's pretty poor...).

If you want to hide a complete column, you can also use the <x:ColWidths> parameter in the Web Template (see How to... Paper).

Yours,

Tobias

Former Member
0 Kudos

Tobias,

I will not be able to add the <x:ColWidths> parameter in the Web Template as we are using the global template for the web reports and it will affect all the reports.

Is there anyway for us to force the parameter C_CELL_EXTEND for the Excel also. When I download the file to excel and add the parameter width=0 manually this parameter works for Excel also. So I think if we are able to add this parameter from the TABLE API it will work.

How can we force to add C_CELL_EXTEND?

Thanks.

Former Member
0 Kudos

I implemented the code as per the document "BusinessIntelligence WEBPrinting with Excel" by Tobias Kaufmann .

I could able to print the Table web item but not the Text elements or any other elements. I specified the code as he has given in the document that we can print Text elements also in the Header section. If I add Text elements code in the Header section, it is hanging and doesn't prompt anything.

mso-header-data:"&L&G&C&\0022Arial\,fed\0022&12&[<DATAPROVIDER_1>/<TEXTELEMENT_1>]"

also tried

mso-header-data:"&L&G&C&\0022Arial\,fed\0022&12&[<TEXTELEMENT_1>]"

Do I need to add any extra classes in the text element object also

<paramname="HELP_SERVICE" value="PRINT_WITH_EXCEL"/>

<paramname="HELP_SERVICE_CLASS" value="ZCL_RSR_XLS_HELP_WINDOW_PRINT"/>

I tried adding this class in the text elements object ZCL_RSR_XLS_ITEM_TEXT_ELEMENTS but it didn't help.

Any thoughts in printing or Passing it to header the Text elements to Excel???

Former Member
0 Kudos

Rammohan,

I specified the

> code as he has given in the document that we can

> print Text elements also in the Header section.

>

> mso-header-data:"&L&G&C&\0022Arial\,fed\0022&12&[<DATA

> PROVIDER_1>/<TEXTELEMENT_1>]"

> also tried

> mso-header-data:"&L&G&C&\0022Arial\,fed\0022&12&[<TEXT

> ELEMENT_1>]"

I think the code you are using is in some parts not correct.

For one thing, instead of \,fed\, it should either read \,bold\ or \,fett\ (the German

expression for bold).

The other thing is, that you don't write the name of your text element in that string.

Instead, you write the name of the specific part of text element, that you want to be displayed.

For example, if you want to display the query description (used as/in DATAPROVIDER_1), you would write:

mso-header-data:"<blabla>&[DATAPROVIDER_1/REPTXTLG]"

If you want to display the date and time the query was refreshed last, you would write:

mso-header-data:"<blabla>&[DATAPROVIDER_1/SYZEIT]"

This way, you are the displaying the COMMON text elements, as described in the Web API Reference, page 43.

(The API Reference can be found in the SAP Service Marketplace).

>

> Do I need to add any extra classes in the text

> element object also

> <paramname="HELP_SERVICE" value="PRINT_WITH_EXCEL"/>

No, I don't think you'll need to do this.

Actually, the method metionend above doesn't require any Text Elements in your web template.

Hope this helps,

Yogen

Former Member
0 Kudos

Hello Yogen!

You are right, the HELP_SERVICE needs to be specified only once. You can do it in the table or in the text elements web item.

Rammohan, the code of Yogen looks also correct:

mso-header-data:"<blabla>&[DATAPROVIDER_1/REPTXTLG]"

<...> indicates a placeholder that should be replaced by your own values (like DATAPROVIDER_1 or SYZEIT, etc.).

Text elements are described in http://help.sap.com/saphelp_nw04/helpdata/en/9f/4e9d39d44cd45ee10000000a11402f/content.htm.

Enjoy,

Tobias

Former Member
0 Kudos

Thanks alot to you both Yogen and Kaufmann...

I tried as you mentioned with Text element in the header section it is not working and also tried with the REPTXTLG .. botht the cases it is not promting me with the dialog box at all and hanging just like that... If i remove the text element it is working fine and prompting me with dialog box to open the excel.

I am attaching my code here, Could you please look at this code and guide me if i am doing any mistake in this...

Thanks in advance for your help

<HTML>

<!-- BW data source object tags -->

<object>

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

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

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

<param name="DATA_PROVIDER_ID" value="YEA_FI_ZMCSPLPL_SUM_VIEW_V1"/>

DATA_PROVIDER: DATAPROVIDER_1

</object>

<object>

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

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

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

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

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

TEMPLATE PROPERTIES

</object>

<HEAD>

<META NAME="GENERATOR" Content="Microsoft DHTML Editing Control">

<title>Summary P&L Web Report </title>

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

<script language="JavaScript">

SAPBWAddToMenu("Printwith Excel","myMenuProcessor","1","","","X","BOTTOM","","");

// Command Processing

function myMenuProcessor(parameter,cell_type,filter,parameter1,parameter2,item,dataprovider,x,y)

{

switch (parameter) {

case "1":

SAPBWOpenURL(SAP_BW_URL_Get() +"&CMD=PROCESS_HELP_WINDOW&help_service=PRINT_WITH_EXCEL&item=TABLE_1&subcmd=PRINT_EXCEL");

break;

}

}

</script>

<BODY>

<table><tr><td class="SAPBEXBtnStdBorder" cellspacing="0" cellpadding="0" border="0">

<table><tr><td class="SAPBEXBtnStd" cellspacing="0" cellpadding="0" border="0">

<A href="<sap_bw_url

cmd='PROCESS_HELP_WINDOW'

help_service='PRINT_WITH_EXCEL'

item='TABLE_1'

subcmd='PRINT_EXCEL'>">

Print with Excel</A>

</td></tr></table>

</td></tr></table>

<object>

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

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

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

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

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

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

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

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

<param name="HELP_SERVICE" value="PRINT_WITH_EXCEL"/>

<param name="HELP_SERVICE_CLASS" value="ZCL_RSR_XLS_HELP_WINDOW_PRINT"/>

ITEM: TABLE_1

</object>

<P></P>

<!-- Settings for Web Printing with Excel

// header with logo, footer, page orientation, margin, ...

@page

{mso-header-data:"&L&G&C&\0022Arial\,fed\0022&12&14Summary P and L>&[DATAPROVIDER_1/REPTXTLG]";

mso-footer-data:"Confidential ";

margin:1.0in .75in 1.0in .75in;

mso-header-margin:.5in;

mso-footer-margin:.5in;

mso-horizontal-page-align:center;}

// fit to page, grid lines, logo (header picture)

<x:Print>

<x:FitWidth>1</x:FitWidth>

<x:FitHeight>0</x:FitHeight>

<x:ValidPrinterInfo/>

<x:Scale>80</x:Scale>

<x:HorizontalResolution>600</x:HorizontalResolution>

<x:VerticalResolution>600</x:VerticalResolution>

</x:Print>

// page breaks

<x:PageBreaks>

<x:ColBreaks>

<x:ColBreak>

<x:Column>10</x:Column>

<x:RowEnd>78</x:RowEnd>

</x:ColBreak>

</x:ColBreaks>

<x:RowBreaks>

<x:RowBreak>

<x:Row>48</x:Row>

<x:ColEnd>10</x:ColEnd>

</x:RowBreak>

</x:RowBreaks>

</x:PageBreaks>

// column widths

<x:ColWidths>

<col width=180 style='mso-width-source:userset'>

<col style='mso-width-source:auto'>

</x:ColWidths>

// Repeated Rows

<x:RepeatedRows>$1:$2</x:RepeatedRows>

// Repeated Cols

<x:RepeatedCols>$A:$A</x:RepeatedCols>

// BW parameters

<x:BW>

<hierarchy_icons hide=X>

</x:BW>

End Settings for Web Printing with Excel -->

</BODY>

</html>

Former Member
0 Kudos

Yogen Weinreich, Tobias Kaufmann ...

Thanks alot for the previous post and I really appreciate if you could help me in this issue. why I am not able to print/pass any kind of text elements to excel.. Is there anything I need to look into your package to modify or Is there anyway I can debug this ???

Thanks in advance.

Former Member
0 Kudos

Hello Rammohan!

Please set a breakpoint in ABAP class ZCL_RSR_XLS_ITEM_TEMPLATE, method GET_STYLES. In this method the placeholders are replaced.

Yours,

Tobias

Former Member
0 Kudos

Sorry Rammohan,

right now I have no clue why it's not working on your system.

I copied your coding into a new webtemplate, modified the dataprovider, but left everything else unmodified. I was able to download the text elements.

So I'd say the problem is not the coding.

Just a suggestion: Have you tried using a different query (I know, this might sound silly, but I've had this before)? Are you using the latest version of the Abap classes?

Regards,

Yogen

Former Member
0 Kudos

Hi!

Yes, the paper including the ABAP classes are now available.

Please let me know, if you have any further question.

Yours,

Tobias

Former Member
0 Kudos

I have downloaded the ZIP file which contains the How To paper and 2 transport files. Our BASIS team tried to import the transport files but there was an error.

The error is "couldn't locate TA-info in .../cofiles (illegal format detected)" and later says "/usr/sap/trans/cofiles/K903281.QB8 contains no valid information".

I have no clue what any of this means or how to fix it. Has anyone successfully imported the transport files on BW 3.0B? And does anyone know what I need to do to resolve this?

Thanks.

Message was edited by: Audrey Fong

Former Member
0 Kudos

Hello Audrey!

Please have a look at OSS note 456196 'Couldn't locate TA information in .../co-files'. Check the conditions described in the OSS note:

1. Check the version of tp

2. Check your transport landscape, maybe you have to do the step describe under Solution ("1. Generate a corrected cofile by calling...")

We were able to import the transport in our system.

Yours,

Tobias

Former Member
0 Kudos

Thank you. Our BASIS team was successfully able to import the files.

By going to to transaction se24, I verified that all 8 classes are there.

Question about the code implementation...

In step 4 on page 11, i'm supposed to add this code:

<param name='HELP_SERVICE' value='HELP_SERVICE_PRINT'/>

<param name='HELP_SERVICE_CLASS' value='<PREFIX>CL_RSR_XLS_HELP_WINDOW_PRINT'/>

However, the Web Application Designer will not validate the webpage. When I remove "<PREFIX>", the page is able to validate and I can run it. But I get an error in Internet Explorer saying, "System error in program CL_RSR_WWW_PAGE and form GET_DEVICE_CLASS_PARENT." I'm not sure if the reason is because I removed "<PREFIX>".

Any suggestions?

Thanks.

Former Member
0 Kudos

I figured it out.

"<PREFIX>" should be replaced by "Z".

Another question...

Does this printing solution support multiple data providers?

Former Member
0 Kudos

Audrey,

In the introduction of the article it states:

"This solution allows exporting and printing <b>multiple Data Providers</b> and all Web Items of a BEx Web

Application"

Kind regards,

Hans de Klein

Former Member
0 Kudos

I tried to get fit to set some of the print settings in the BW web template, but am not able to get any of the settings to take effect. I have Excel XP on my computer. The web template opens in Excel fine, but the print settings do not seem to be applied. I have included the below code (as well as other options) before the </body> end tag and nothing seems to happen.

<!--

<x:Print>

<x:FitWidth>2</x:FitWidth>

<x:FitHeight>2</x:FitHeight>

</x:Print>

-->

Former Member
0 Kudos

Hello Mark!

Sorry, I cannot reproduce your problem. Maybe you could set an external breakpoint in the ABAP method ZCL_RSR_XLS_ITEM_TEMPLATE->SET_ITEM (using transaction SE24). In this method the template is read. <x:Print> should be read in this method.

Yours,

Tobias

Former Member
0 Kudos

Hi Tobias,

I do have the same problem as Mark. There might be a point here.

The Excel Application does not react as expected. The Web Template has the following settings:

<x:FitWidth>1</x:FitWidth>

<x:FitHeight>0</x:FitHeight>

In the Excel Sheet in the html view the settings can also be found. So it should work. However it does not. In the Excel print preview the exported table is not shown as expected (with fitwidth=1 the right half of the paper is empty). However with fitwidth=5 the actual width is still one page but it is filled by 80% and not 50% anymore.

Below you can find some of the source code from the Web Template and the exported xls file. I could also send you the exported file and Web Template for further analysis. My email address is: uhlig@gmx.com

From the Web Template:

-

-


-

-


From the extracted Xls-Sheet:

-

-


@page

{mso-header-data:"&L&Z&0022Arial,fed0022&16DL013 Dokumentation Geldwäsche&R13.06.2005 11:28:12";

mso-footer-data:"Seite &S von &A";

margin:.98in .74in .98in .74in;

mso-header-margin:.51in;

mso-footer-margin:.51in;

mso-page-orientation:landscape;}

-

-


From the extracted Xls-Sheet:

-

-


<x:WorksheetOptions>

<x:FitToPage/>

<x:FitToPage/>

<x:DefaultColWidth>10</x:DefaultColWidth>

<x:Print>

<x:FitWidth>1</x:FitWidth>

<x:FitHeight>0</x:FitHeight>

<x:ValidPrinterInfo/>

<x:PaperSizeIndex>9</x:PaperSizeIndex>

<x:HorizontalResolution>600</x:HorizontalResolution>

<x:VerticalResolution>600/x:VerticalResolution>

</x:Print>

<x:Selected/>

-

-


Former Member
0 Kudos

Hi Sebastian and Mark!

The only thing that the solution described in the How to.. paper can do, is to take the content of the Web Template and add it into the generated xls (HTML/XML) file.

You should save this file before you open it with Excel to check whether the settings are added correctly to the output. If you open the file with Excel and save it again, Excel changes the output.

My suggestion would be that you take Excel and the numbers you would like to print. Arrange and format these numbers as you like. Ensure that Excel also print them the right way. If you now save the file in Excel as HTML page, check whether the settings are working again after re-open the file. If all these steps are working, you can view the settings in the file with Notepad and finally add them to the Web Template.

Yours,

Tobias

Former Member
0 Kudos

Can Tobias Kaufmann please supply an update to when he believes the How to document he refers to in his presentation will be released.

Former Member