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

Changing ALV Header

Former Member
0 Likes
507

I have been using the following table to be displayed in ALV grid:

DATA: BEGIN OF gt_display OCCURS 0,

pernr LIKE pernr-pernr,

stat2 LIKE p0000-stat2,

begda LIKE p0002-begda,

endda LIKE p0002-endda,

famdt LIKE p0002-famdt,

END OF gt_display.

  • Store report name

gv_repid = sy-repid.

  • Create Fieldcatalogue from internal table

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = gv_repid

i_internal_tabname = 'GT_DISPLAY'

i_inclname = gv_repid

CHANGING

ct_fieldcat = gt_fieldcat

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

IF sy-subrc NE 0.

MESSAGE e052(yhr) .

ELSE.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = gv_repid

it_fieldcat = gt_fieldcat

i_save = 'A'

it_events = gt_eventstab[]

TABLES

t_outtab = gt_display

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc NE 0.

MESSAGE e053(yhr) .

ENDIF.

ENDIF.

But the column headings are not the ones which I wanted. I want to change the headings and give my own headings and display the data in the internal table in GRID format. Please help me in this.

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
481

After calling REUSE_ALV_FIELDCATALOG_MERGE, loop at the field catalog and modify the fields used for column heading :

SELTEXT_L
SELTEXT_M
SELTEXT_S
REPTEXT_DDIC

System will use the text that fits best, you can try to force the choice by filling parameter

DDICTXT (values space, L, M, S and R for the fields above)

Regards

3 REPLIES 3
Read only

Former Member
0 Likes
481

Hi,

If u wantto change the headings then u cannot Use FM 'REUSE_ALV_FIELDCATALOG_MERGE' which actaully take takes the Labels from Data dicatiary.

so to display ur own text u need to cretae ur own Field catalog.

data: w_fcat type slis_fcat_alv,

t_fcat tpe slis_t_fcat_alv.

w_fcat-col_pos = 1.

w_fcat-fieldname= 'PERNR'.

w_fcat-seltext_m = 'My_own_text'.

append w_fcat to t_fcat.

w_fcat-col_pos = 2.

w_fcat-fieldname= 'stat2'.

w_fcat-seltext_m = 'own_text'.

append w_fcat to t_fcat.

Call FM' Reuse_alv_geid_disply'

it_fieldcat = t_fcat.

revert back if any issues,

Reward with poinst if helpful.

Regards,

naveen

Read only

RaymondGiuseppi
Active Contributor
0 Likes
482

After calling REUSE_ALV_FIELDCATALOG_MERGE, loop at the field catalog and modify the fields used for column heading :

SELTEXT_L
SELTEXT_M
SELTEXT_S
REPTEXT_DDIC

System will use the text that fits best, you can try to force the choice by filling parameter

DDICTXT (values space, L, M, S and R for the fields above)

Regards

Read only

Former Member
0 Likes
481