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 heading not showing

0 Kudos

Hi, im creating alv report for self learning. When i tried to display the report, the column heading is showing abap dictionary name instead of seltext_m name, was wondering what i have missed

wa_fieldcat-col_pos = '1'.
wa_fieldcat-fieldname = 'matnr'.
wa_fieldcat-seltext_m = 'Material Number'.
wa_fieldcat-reptext_ddic = 'Material Number'.
wa_fieldcat-outputlen = 15.
CLEAR wa_mat.

wa_fieldcat-col_pos = '2'.
wa_fieldcat-fieldname = 'werks'.
wa_fieldcat-seltext_m = 'Plant'.
wa_fieldcat-outputlen = 15.
CLEAR wa_mat.

wa_fieldcat-col_pos = '3'.
wa_fieldcat-fieldname = 'name1'.
wa_fieldcat-seltext_m = 'Plant description'.
wa_fieldcat-outputlen = 15.
CLEAR wa_mat.

wa_fieldcat-col_pos = '4'.
wa_fieldcat-fieldname = 'mtart'.
wa_fieldcat-seltext_m = 'Material Type'.
wa_fieldcat-outputlen = 15.
CLEAR wa_mat.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING

I_CALLBACK_PROGRAM = sy-repid

I_STRUCTURE_NAME = 'ZMAT' (this is the part i created with structure in data dictionary)

IS_LAYOUT = wa_layout
IT_FIELDCAT = it_fieldcat

IT_SORT = it_sort

TABLES
T_OUTTAB = it_mat

9 REPLIES 9

venkateswaran_k
Active Contributor
0 Kudos

Include your internal table name - as below, remove wa_fieldcat-reptext_ddic = 'Material Number'.

  alv_fieldcat_line-tabname    = 'IT_MAT'.
  alv_fieldcat_line-seltext_l = 'Your heading goes here'.
  alv_fieldcat_line-fieldname  = 'MATNR'.
  lpos = lpos + 1.
  alv_fieldcat_line-outputlen = 20.
  alv_fieldcat_line-col_pos = lpos.
  APPEND alv_fieldcat_line TO alv_fieldcat.
  CLEAR alv_fieldcat_line.

venkateswaran_k
Active Contributor
0 Kudos

Hi

Please make sure you put interntal table reference at TABNAME

  alv_fieldcat_line-tabname    = 'IT_MAT'.
  alv_fieldcat_line-seltext_l = 'Your heading goes here'.
  alv_fieldcat_line-fieldname  = 'MATNR'.
  lpos = lpos + 1.
  alv_fieldcat_line-outputlen = 20.
  alv_fieldcat_line-col_pos = lpos.
  APPEND alv_fieldcat_line TO alv_fieldcat.
  CLEAR alv_fieldcat_line.

0 Kudos

Hi

thanks for your reply, i have fixed it

0 Kudos

The component TABNAME of the field catalog is ignored for REUSE_ALV_LIST_DISPLAY and REUSE_ALV_GRID_DISPLAY.

(It's only needed for REUSE_ALV_HIERSEQ_LIST_DISPLAY, and its value has to match parameter either I_TABNAME_HEADER or I_TABNAME_ITEM)

0 Kudos

Dear Sao

Thanks for the reply

Kindly update the Solution and close the thread.

Regards,

Venkat

Sandra_Rossi
Active Contributor
0 Kudos

If you learn ABAP, then you'd better learn modern ABAP, not old ABAP 😉

ALV is not really core ABAP but help you understand basic ABAP operations.

Learn with CL_SALV_TABLE, you'll learn Object Orientation.

If you want to learn UI, better learn UI5.

Sandra_Rossi
Active Contributor
0 Kudos

By default, the column header is dynamically chosen from DDIC by the ALV Grid, by using the text which has the length close to the width of column (which varies either according to the values in the column, or to the output length you have forced or to the length changed by the user at run time).

If you want to force the one from SELTEXT_M, do this:

wa_fieldcat-seltext_m = 'Material Number'.
wa_fieldcat-ddictext = 'M'. " always use medium text

or from REPTEXT_DDIC, do this:

wa_fieldcat-reptext_ddic = 'Material Number'.
wa_fieldcat-ddictext = 'R'. " always use reptext_ddic

Etc.

Again, if you learn ABAP programming or modern ALV, prefer using modern ABAP (Object Oriented) or CL_SALV_TABLE. If you learn modern UI, learn UI5, not dynpro.

0 Kudos

Hi Sandra

Thank you for your sharing.

Aside from ooalv, is there any new things i can explore as a abap newbie?

0 Kudos

Simply look at all SAP current trends (ABAP Programming Model and so on, UI5, Fiori, Restful, CDS, BOPF, ...)