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

Hard code field

Former Member
0 Likes
698

Hi Experts,

i need one field has hard code in ALV

Descrption of field is CITY

Hard code is Hyderabad.

i am using this logic

POS = POS + 1.

CLEAR LS_FIELDCAT.

LS_FIELDCAT-COL_POS = POS.

LS_FIELDCAT-FIELDNAME =

LS_FIELDCAT-SELTEXT_M =

APPEND LS_FIELDCAT TO RT_FIELDCAT.

CLEAR LS_FIELDCAT.

POS = POS + 1.

Thanks & Regards,

Sreedhar.

4 REPLIES 4
Read only

amit_khare
Active Contributor
0 Likes
672

Hi,

As an alternative add this field to your internal table and pass the value as Hyderabad.It will be easy to handle then.

Regards,

Amit

Read only

Former Member
0 Likes
672
POS = POS + 1.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-COL_POS = POS.
LS_FIELDCAT-FIELDNAME = 
LS_FIELDCAT-SELTEXT_M = 'CITY'
APPEND LS_FIELDCAT TO RT_FIELDCAT.
CLEAR LS_FIELDCAT.
POS = POS + 1.

Hyderabad is a value of the field , so u cannot hard code that in fieldcatalog

loop at itab.
  itab-city = 'hyderabad'.
endloop.
Read only

Former Member
0 Likes
672

I think u need to hard code the field in ur internal table which you are passing to ALV. That will serve the purpose.

Read only

Former Member
0 Likes
672

sorry cannot under stand your proper requirement. But what i can understand you need to show Hyderabad only in the CITY column heading.

For this you have to take the values Hyderabad in your internal table for all the rows.

regards

shiba dutta