cancel
Showing results for 
Search instead for 
Did you mean: 

Change column headers in ALV report

odysseas_spyroglou
Participant
0 Kudos

Hi experts,

I have created a new simple ALV report (it uses only internal tables, no structures). I would like to change the names of column headers in the ALV report. Is this possible? How can I do it?

Thanks in advanced.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

[]

odysseas_spyroglou
Participant
0 Kudos

Thanks for your reply,

I am trying to use the code mentioned in the link but I think that something

is missing, probably a CASE statement before WHEN in the LOOP.

Can you help me? What do I have to put before WHEN statement?

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = <program name>

i_structure_name = <DDIC structure>

i_bypassing_buffer = 'X'

CHANGING

ct_fieldcat = gi_fieldcat[]

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3. "#EC *

LOOP AT gi_fieldcat INTO wa_fieldcat.

WHEN 'XXXX'.

wa_fieldcat-seltext_s = 'Fac'.

wa_fieldcat-seltext_m = 'Factory'.

wa_fieldcat-seltext_l = 'Factory'.

wa_fieldcat-reptext_ddic = 'Factory'.

MODIFY gi_fieldcat FROM wa_fieldcat.

ENDLOOP.

Former Member
0 Kudos

You are on right path....

For example the above FM will give the names stored in the data elemnt of the structure.

Now if u want to change the nsame to Fac1, Factory1... Give that & modify.

LOOP AT gi_fieldcat INTO wa_fieldcat.

WHEN 'XXXX'.

wa_fieldcat-seltext_s = 'Fac'.

wa_fieldcat-seltext_m = 'Factory'.

wa_fieldcat-seltext_l = 'Factory'.

wa_fieldcat-reptext_ddic = 'Factory'.

MODIFY gi_fieldcat FROM wa_fieldcat.

ENDLOOP.

U will then pass the same to REUSE_ALV................

U shkd find the change.

Regards,

Bhargava

odysseas_spyroglou
Participant
0 Kudos

Thanks I solved the problem

Edited by: Odysseas Spyroglou on Jul 9, 2009 9:16 AM

Former Member
0 Kudos

LOOP AT gi_fieldcat INTO wa_fieldcat.

case wa_fieldcat- fieldname.

WHEN 'XXXX'. " (This shld be the actual field name, U can see that in the Debgging)

wa_fieldcat-seltext_s = 'Fac'.

wa_fieldcat-seltext_m = 'Factory'.

wa_fieldcat-seltext_l = 'Factory'.

wa_fieldcat-reptext_ddic = 'Factory'.

MODIFY gi_fieldcat FROM wa_fieldcat.

endcase.

ENDLOOP.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello,

You can check field catalog properties for field names,

Usually the following properties are taken and required text is passed.

seltext_l like dd03p-scrtext_l, " long key word

seltext_m like dd03p-scrtext_m, " middle key word

seltext_s like dd03p-scrtext_s, " short key word

Check the field catalog properties.

Hope this would help

Regards,

Former Member
0 Kudos

Hi,

The name of columns come from the field catlog which is build & given as a input to FM- ALV.

U can change it there have that reflected.

Regards,

Bhargava