Application Development and Automation 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: 
Read only

ALV Headers are truncating while export to excel sheet

ashish_goyal2
Participant
0 Likes
4,246

Hi experts ,

I am exporting output of my report in an excel sheet, but column headings are truncating in the excel as shown in the below screenshot.

the output is displayed as:

as I have used the solution"wa_fieldcat-ddictxt = 'L'." But this is also not working as i am using the factory methods to display the ALV as shown below.

Please help and thanks in advance.

Regards,

Ashish

1 ACCEPTED SOLUTION
Read only

Juwin
Active Contributor
0 Likes
3,094

Hi Ashish,

The option you are using is a Local file download and is not download the file as an Excel file.

I see that you are using SALV to display ALV. In that case, you get the option to download the ALV as an actual spreadsheet through this menu path.

Try this option and see if you still face issues.

Thanks,

Juwin

Hi experts ,

I am exporting output of my report in an excel sheet, but column headings are truncating in the excel as shown in the below screenshot.

the output is displayed as:

as I have used the solution"wa_fieldcat-ddictxt = 'L'." But this is also not working as i am using the factory methods to display the ALV as shown below.

Please help and thanks in advance.

Regards,

Ashish

5 REPLIES 5
Read only

Former Member
0 Likes
3,094

Hi Ashish,

The requirement is not very clear to me.Still I would suggest - please check the separator that you are using.

Can you try using  cl_abap_char_utilities=>horizontal_tab.

Regards,

Shiwali

Read only

Juwin
Active Contributor
0 Likes
3,095

Hi Ashish,

The option you are using is a Local file download and is not download the file as an Excel file.

I see that you are using SALV to display ALV. In that case, you get the option to download the ALV as an actual spreadsheet through this menu path.

Try this option and see if you still face issues.

Thanks,

Juwin

Read only

ashish_goyal2
Participant
0 Likes
3,094

Hi Juwin,

Thanks for your response.

But I want to export my output using this Local file download only in the excel.

Read only

0 Likes
3,094

Hi Ashish,

Check output length in fieldcatalog, heading passed to fieldcatalog-seltext_L & if you creating fieldcatalog from internal table, then check length of columns in final internal table structure.

If not working post your fieldcatalog.

Regards,

Ajinkya

Read only

lucilacon
Explorer
0 Likes
3,094

Hi ashish.goyal2,

I read you thread and solve the problem like this:

- I Set the column optimize;

- After getting the column data as in your code, I set the short and midium text with empty value;

-Then I used the method set_fixed_header_text to make a similar efect as the "wa_fieldcat-ddictxt = 'L'", but thinking right now I made so many tests that I am not sure that this part is realy necessary, please try without it and check if you get the excel with the complete text of the header.

I hope this helps you.

*** columns settings
    lo_columns = lo_alv->get_columns( ).
    lo_columns->set_optimize(  ).  

    lo_col_ref = lo_columns->get( ).

    LOOP AT lo_col_ref ASSIGNING <fs_col_ref>.
          <fs_col_ref>-r_column->set_short_text( '' ).
          <fs_col_ref>-r_column->set_medium_text( '' ).

      CALL METHOD <fs_col_ref>-r_column->set_fixed_header_text
        EXPORTING
          value = 'L'.
    ENDLOOP.