‎2007 Aug 03 8:03 AM
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.
‎2007 Aug 03 8:10 AM
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_DDICSystem 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
‎2007 Aug 03 8:09 AM
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
‎2007 Aug 03 8:10 AM
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_DDICSystem 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
‎2007 Aug 03 8:10 AM