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: 

Urgent regrding ALV

Former Member
0 Kudos

Hi,

Am getting the field label name when i change the output lenght of alv list display instead of the sel_text name which i want to .

can any one help me in getting the sel_text name which is 20 char long.

early response is appreciated.

9 REPLIES 9

Former Member
0 Kudos

Syed

In the field Catalog, for the column u want to have a NAME of 20 chars, add the stmt

fieldcatlog-seltext = 'text to be displayed '

to the Field Catalog Internal Table.

Thanks

Kam.

Former Member
0 Kudos

Hi,

LW_FIELDCAT-FIELDNAME = '<field-name>'.

LW_FIELDCAT-SELTEXT_M = '<field-label>'.

LW_FIELDCAT-OUTPUTLEN = <field-length>."in your case its 20

APPEND LW_FIELDCAT TO W_FIELDCATALOG.

Hope this should work.

Don't forget to assign points if ur query solved

0 Kudos

Set these fields to your label.

FS_FIELDCAT-REPTEXT_DDIC,

FS_FIELDCAT-SELTEXT_L,

FS_FIELDCAT-SELTEXT_M,

FS_FIELDCAT-SELTEXT_S

Srinivas

Former Member
0 Kudos

Hi,

if you are using FM REUSE_ALV_GRID_DISPLAY then change your field_catalog....

fc_tmp-reptext_ddic = 'COMPANY CODE'. " here you need to type column name what you want

fc_tmp-fieldname = 'BUKRS'. " here you need to type field name of the table.


form write_report.
  perform build_field_catalog.
  perform build_sort.
* CALL ABAP LIST VIEWER (ALV)
  call function 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            it_fieldcat = fieldcat
            it_sort     = sort
 
       TABLES
            t_outtab    = itab.
 
 
endform.
 
**********************************************************
*BUILD_FIELD_CATALOG
**********************************************************
form build_field_catalog.
  data: fc_tmp type slis_t_fieldcat_alv with header line.
  clear: fieldcat.
  refresh: fieldcat.
  clear: fc_tmp.
  fc_tmp-reptext_ddic    = 'COMPANY CODE'.
  fc_tmp-fieldname  = 'BUKRS'.
  fc_tmp-tabname   = 'ITAB'.
  fc_tmp-outputlen  = '20'.
  fc_tmp-col_pos    = 2.
  append fc_tmp to fieldcat.
  clear: fc_tmp.
  fc_tmp-reptext_ddic    = 'VENDOR NUMBER'.
  fc_tmp-fieldname  = 'LIFNR'.
  fc_tmp-tabname   = 'ITAB'.
  fc_tmp-outputlen  = '8'.
  fc_tmp-col_pos    = 3.
  append fc_tmp to fieldcat.
 
ENDFORM.
 
**********************************************************

reward points for helpfull answers and close the thread if your question is solved.

regards,

venu.

Former Member
0 Kudos

w_fieldcat-fieldname = &1.

w_fieldcat-col_pos = &2.

w_fieldcat-ref_tabname = &3.

w_fieldcat-seltext_s = &4.

w_fieldcat-text_fieldname = &4.

w_fieldcat-outputlen = &5.

The above is macro which am using. For the ref_tabname am passing the table name and for the seltext_s the name of the field to be (e.g. Reward Fund Carton ),and the output length to 20. But it is picking the field label name which we can see by double clicking the field type in the table if the length exceeds the field length. The length of this field is 10 char.

Request an early response.

0 Kudos

SYED,

Use the field <b>COLTEXT</b> to provide the Column Headings!!! The value present in this field will override the Standard one. U can pass a maximum of 40 char length text as the Column Heading.

Thanks

Kam

Note: Allot points for all worthful postings

Former Member
0 Kudos

Hi,

While Building fieldcatalog


data: fieldcatalog type slis_t_fieldcat_alv with header line.
fieldcatalog-fieldname   = 'MATNR'.
fieldcatalog-<b>seltext_m</b>   = 'Mat Number'.
 append fieldcatalog to fieldcatalog.
 clear  fieldcatalog.

No need to specify the output length by default it will take the default length from dictionary.

Hope this helps u.

Reward points and close the thread if ur problem got solved.

Former Member
0 Kudos

Hi There,

The ALV work in such a way that by default they pick up the text defined at the data element level for the table field. The way in which you can override the data element text for the field is to use the felds:

seltext_l

seltext_m

seltext_s

of the field catalog in conjunction with the following field of the same structure:

<b>ddictxt</b>.

This is a single character field, and pass the type of text you wish to override((S)hort (M)iddle (L)ong).

This would definitely cater your requirement.

Cheers,

Naveen.

former_member188685
Active Contributor
0 Kudos

In alv Grid

DATA: IT_FIELDCAT TYPE LVC_T_FCAT,

X_FIELDCAT TYPE LVC_S_FCAT.

X_FIELDCAT-SCRTEXT_M = 'Material Number'(016). or X_FIELDCAT-COLTEXT = 'Material Number' (016).

X_FIELDCAT-FIELDNAME = 'MATNR'.

X_FIELDCAT-TABNAME = 'IT_FINAL'.

X_FIELDCAT-COL_POS = L_POS.

X_FIELDCAT-OUTPUTLEN = '20'.

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

L_POS = L_POS + 1.

In alv Normal List

DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

X_FIELDCAT-Seltext_M = 'Material Number'(016). or X_FIELDCAT-COLTEXT = 'Material Number' (016).

X_FIELDCAT-FIELDNAME = 'MATNR'.

X_FIELDCAT-TABNAME = 'IT_FINAL'.

X_FIELDCAT-COL_POS = L_POS.

X_FIELDCAT-OUTPUTLEN = '20'.

APPEND X_FIELDCAT TO IT_FIELDCAT.

CLEAR X_FIELDCAT.

L_POS = L_POS + 1.

Regards

Vijay