Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with encoding when exporting Excel from Webdynpro ALV

Monsores
Active Participant
0 Kudos

Dear experts,

I have a standard table where texts are stored with special characters (latin ones, in my case) in hex coding. The word 'correção', for example, is stored as 'correção'.

Then I created a Webdynpro ALV to show data from this table and magically these texts are displayed with the latin characters, without needing to code any conversion from hex.

My problem is that, when I click at the "Export to Excel" button, the spreadsheet is generated with texts in hex coding (according to the source table), rather than with the latin characters (according to the ALV).

Which class/method or FM should I use to force this conversion?

Is there any other solution I can use to obtain the spreadsheet in the same coding of the Webdynpro ALV?

Thanks in advance!

Marcelo Monsores

4 REPLIES 4

Former Member
0 Kudos

Hi Marcelo,

Before passing the xstring to excel, convert it back to text. Try the below FM to convert your hex data.

CALL FUNCTION 'SO_SOLIXTAB_TO_SOLITAB'

       EXPORTING

         ip_solixtab = t_content_hex[]

       IMPORTING

         ep_solitab  = t_data.

Regards,

Raju

0 Kudos

Hi Raju.

   Thank you so much for your quick response. I wrote a quick test here with your suggestion, but got no luck. Did I miss anything?

DATA: itabhex TYPE SOLIX_TAB WITH HEADER LINE.
DATA: itab    TYPE SOLI_TAB  WITH HEADER LINE.

itabhex-line = 'correção'.
APPEND itabhex.

CALL FUNCTION 'SO_SOLIXTAB_TO_SOLITAB'
        EXPORTING
          ip_solixtab = itabhex[]
        IMPORTING
          ep_solitab  = itab[].
 
LOOP AT itab.
  WRITE itab-line.
ENDLOOP.

CALL FUNCTION 'GUI_DOWNLOAD'
   EXPORTING
     FILENAME                      = 'C:\test.csv'
     FILETYPE                      = 'ASC'
     CODEPAGE                      = '1100'
     WRITE_FIELD_SEPARATOR         = '*'
   TABLES
     DATA_TAB                      = itab.



I also tried with 4110 codepage, but no luck anyway.

Is your suggestion only gonna work with webdynpro/download to excel button?

Sorry if I'm asking something basic, but I'm an abap newbie...


Thank you once more

Marcelo Monsores

0 Kudos

Hi Marcelo,

Can you please let us know the standard table where the hex data is stored.

Regards,

Raju.

0 Kudos

Hi Raju.

The table is /ORM/ORMTEVNT, from SAP GRC-PC.

The field with which I'm having problems is DESCR. I attached here a sample screenshot of a record from this table.

In this case, the result for DESCR should be "Teste com espação e acentos á 'e â õ n ç"

Thank you once more.

Marcelo