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

ALV Reference Field

Murali_Shanmu
SAP Champion
SAP Champion
0 Likes
3,341

Hi

I have want to display a custom label for a field in ALV. But that field uses REFERENCE Table and Field name. hence the label for that column is picked from dictionary level. I even used SEL_TEXT_L of the fieldCatalog, But still the text maintained in Dataelement of the REF field is only displayed.

Here is the code:

CLEAR LS_FIELDCAT.

LS_FIELDCAT-COL_POS = 10.

LS_FIELDCAT-FIELDNAME = TEXT-032.

LS_FIELDCAT-TABNAME = GC_TAB.

LS_FIELDCAT-REF_TABNAME = 'MYTABLE'.

LS_FIELDCAT-REF_FIELDNAME = 'MYFIELD'.

LS_FIELDCAT-OUTPUTLEN = 8.

LS_FIELDCAT-SELTEXT_L = TEXT-012.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,720

Hi Murali,

Move your custom text to FIELDCAT-REPTEXT_DDIC

Regards,

Raghavendra

6 REPLIES 6
Read only

varun_maharshi
Active Participant
0 Likes
1,719

You remove the reference table then you can get the text. I think it is because you are giving only Long text ie seltext_l give others too then you can get the text you want

Read only

Former Member
0 Likes
1,719

Hi Muralidaran,

Try this out...

CLEAR LS_FIELDCAT.

LS_FIELDCAT-COL_POS = 10.

LS_FIELDCAT-FIELDNAME = 'MYFIELD'.

LS_FIELDCAT-TABNAME = GC_TAB.

LS_FIELDCAT-OUTPUTLEN = 8.

Reward points if the answer was helpful...

Regards,

Kunal

Read only

0 Likes
1,719

It didnt work. I cannot remove the reference table and field

Read only

Former Member
0 Likes
1,719

Murali,

Try maintaining the values for

LS_FIELDCAT-SELTEXT_M

LS_FIELDCAT-SELTEXT_s

as well, _L will work only when you have the column width set to max.

Regards,

Ravi

Note : Please mark the helpful answers

Read only

Former Member
0 Likes
1,719

hi,

comment those 2 lines of code

LS_FIELDCAT-REF_TABNAME = 'MYTABLE'.

LS_FIELDCAT-REF_FIELDNAME = 'MYFIELD'.

in the population.

& give outputlen = 15 like that.

try out this.

regards

srikanth

Read only

Former Member
0 Likes
1,721

Hi Murali,

Move your custom text to FIELDCAT-REPTEXT_DDIC

Regards,

Raghavendra