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: 

ALV Column Name in Excel download

Former Member
0 Kudos

Need Long Text for ALV column in the excel download.Appreciate anyone feedback.

In the below code when i download my ALV report into Excel for column "ADATUM"

i have the short text "Acp UpDate" . However i want  'Acceptance Upload Date'

Current Code:

DATA: gx_column     TYPE REF TO cl_salv_column_table.

LOOP AT gt_column_ref INTO gv_column_ref.


    TRY.

        gx_column ?= gx_columns->get_column( gv_column_ref-columnname ).

      CATCH cx_salv_not_found.

    ENDTRY.

    IF gx_column IS NOT INITIAL.

      CASE gv_column_ref-columnname.

           WHEN 'ADATUM'.
          gx_column->set_short_text( 'Acp UpDate'(025) ).                    "The excel download of ALV report displays this Short Text.
          gx_column->set_medium_text( 'Accp Upload Date'(022) ).
          gx_column->set_long_text( 'Acceptance Upload Date'(019) ).

      ENDCASE.

ENDLOOP.

3 REPLIES 3

Former Member
0 Kudos

I do not have a good answer, but maybe I can give you some hints.

There seems to be a connection between the Excel export and ALV grid print preview. If you switch to the print preview and change the layout, you can change the output length of the columns. If the length is big enough, the long text is shown. If you then start the Excel export, the column name is the same as shown in the print preview.

As far as I know, you can not store this information within your layout variant.

See also:

http://scn.sap.com/message/6695515

Since we have a newer version of the SAP GUI (720) within our company, the "spreadsheet export", NOT the "export local file" function, always uses the long text by default, so this problem does no longer exist.

Former Member
0 Kudos

Hi,

These text depends on the col width.

Here your its a date fields which can have a min width of 8 chars for format DDMMYY

and a max width of 10 for format DDMMYYYY.

IF you want to display the medium text , can you reudce your short text to 8 char.

And medium should follow thereafter.

Also pass col_width optimised= X.

Hope this will help.

Regards,

Amit

Former Member
0 Kudos

Hi Vasu,

                 Please check this link "http://wiki.sdn.sap.com/wiki/display/Snippets/Simple+OOPS+ALV+report+in+Full+Screen"

TRY.

        gr_column ?= gr_columns->get_column( 'NAME1' ).

        gr_column->set_long_text('Vendor Name').

        gr_column->set_short_text( 'V.Name' ).

        gr_column->set_medium_text('Vendor Name').

        ls_color-col = 3.

        gr_column->set_color( ls_color ).

      CATCH cx_salv_not_found.

    ENDTRY.

Regard's

Smruti