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 Heading truncating - Excel

Former Member
0 Likes
2,200

Hi,

When downloading ALV output to excel, the headings the getting truncated.

Program is using  CL_SALV_TABLE for ALV processing.

Can any one help on how to fix this.

In general fieldcatalog there is a field - DDICTXT by which we can pass 'L'/'M'/'S' - is there any thing available in OO ALV so that to fix this issue.

Thanks,

Chandra.

Hi,

When downloading ALV output to excel, the headings the getting truncated.

Program is using  CL_SALV_TABLE for ALV processing.

Can any one help on how to fix this.

In general fieldcatalog there is a field - DDICTXT by which we can pass 'L'/'M'/'S' - is there any thing available in OO ALV so that to fix this issue.

Thanks,

Chandra.

12 REPLIES 12
Read only

former_member201275
Active Contributor
0 Likes
1,956

have you tried:

  lr_columns->set_optimize( if_salv_c_bool_sap=>true ).

Read only

0 Likes
1,956

Hi Glen,

I tried, but still headings truncated in excel. Is there any DDICTXT equal method.

Read only

0 Likes
1,956

Can you post your entire code here. It would help.

Read only

Former Member
0 Likes
1,956

Hi Chandra sekhar ,

Paste the code for ALV displaying.
Are headings getting displayed as short text or actually getting truncated ?

Regards ,
Giri

Read only

0 Likes
1,956

Hi Giri,

Actually I tried with short text with more that 10 chars, but its getting truncated to 10 chars. only.

Read only

0 Likes
1,956

Hi Chandra,

Are you downloading the data of ALV in program or from the ALV output you are selecting the download option.

If it is through program then please share your code.

Regards,

Rafi

Read only

0 Likes
1,956

Hi Chandra,

If it is through program then try to set the column text as below

      gr_column ?= gr_columns->get_column( lv_col_text ).
       gr_column->set_medium_text( lv_med_text ).
       gr_column->set_long_text( lv_lng_text ).
       gr_column->set_short_text( lv_shrt_txt ).


This will set the text to the column of ALV for a respective field.



Regards,

Rafi

Read only

0 Likes
1,956

hi ,
Try passing null to short and medium.       

TRY.

gr_column ?= gr_columns->get_column( lv_field ).

gr_column->set_long_text( lv_long ).

gr_column->set_medium_text(' ').

gr_column->set_short_text(' ').

CATCH cx_salv_not_found .

ENDTRY.

Regards,
Giri


Read only

0 Likes
1,956

Hi - It is directly through output download icon option - standard.

Read only

0 Likes
1,956

Hi Chandra,

When you are downloading complete data of ALV by selecting the icon, why can't you write the download code in the program. When you  click on 'BACK' button of ALV download the data to the respective path with column names.

Regards,

Rafi

Read only

Former Member
0 Likes
1,956

Hi.

Try setting the field  outputlen at the correct length.

hope this helps.

Read only

lucilacon
Explorer
0 Likes
1,956

Hi,

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.