cancel
Showing results for 
Search instead for 
Did you mean: 

Export to Excel as text fields from BSP app

Former Member
0 Kudos

Hi,

I followed the example in <b>Creating a BSP Extension for Downloading a Table</b> to get data from an internal table into excel.

weblog address ==> /people/thomas.jung3/blog/2004/09/02/creating-a-bsp-extension-for-downloading-a-table

My client really wants to have all value exported as text. That way the format is the same for all cells, because i have a column that contains code that can sometimes be 6B or 7. The 6B gets formatted as text, but the 7 as a number.

is there a way to overcome this formatting as number?

Greets

Luk

Accepted Solutions (0)

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

What you are describing is pretty much on the Excel side. If you save the file to your disk instead of opening it directly you can open it with a text editor. You will see that inside the file there is no difference between these two value cells. What we are outputting is simply a tab delimited text file.

The automatic import into Excel makes certain assumptions about the column and cell formats based upon the data that it finds in them. If you want to override this behavior, save the file locally and then open Excel. Once you have Excel running, do a file->open operation on the file (don't just double click the downloaded text file either). You then should get an import wizard that allows the user to override the default import settings and chose the column types.

I know this isn't optimal, but is really an "Excel thing". The only other solution I know of is to go a different route with your download. You can try and open Excel as an ActiveX control via Office Web Controls or by hosting the Excel control directly. These options require you to populate Excel through frontend scripting calls and to support ActiveX in the browser for your applciation.

Another interesting approach is to output an XML file. This is what WebDynpro ABAP does for its Excel Export. They use an XSLT program to convert the ABAP data to Excel's XML Schema. This XML format is well documented in Microsoft's knowledge base. This way you can set all the cell formats yourself. However this produces a significantly larger file!

Former Member
0 Kudos

Thanks a lot for the elaborate answer Thomas.

I had the feeling that it wouldn't be that simple. The XML approach seems the right way to go, but as the deadline approaches quite fast, this feature will be put on the nice to have list rather than on the must have list.

Greets

Luk

guillaume-hrc
Active Contributor
0 Kudos

Hi Luk,

Concerning your specific Excel problem, this workaround solution (as "<b>ugly</b>" as it is) might help you.

Just put the following around the data you want to be <b>displayed</b> as text by Excel : ="xxx" , where xxx is the data.

Obviously, it means <i>mass-modifying</i> your table before export to Excel.

Best regards,

Guillaume

Former Member
0 Kudos

Salut Guillaume,

191 messages, tu dois pas beaucoup bosser

A plus

Former Member
0 Kudos

Please remember to keep your messages in English.

Former Member
0 Kudos

Thanks Guillaume! That solved my problem. I was using double quotes but I was missing the equals sign!

Regards,

Mohammed