11-01-2007 2:45 PM
HI,
I use that function for alv and fieldcat and its working o.k. but i wont to add
field name to colman and its not working ,and optimaize colman for text , and title how i do that?
Regards
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = &2.
ls_fieldcat-fix_column = &3. "this is not working
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
DATA l_rnd_value TYPE integer2.
FIELD-SYMBOLS : <itab> LIKE LINE OF itab .
LOOP AT itab ASSIGNING <itab>.
CASE <itab>-object.
WHEN 'Badi'.
<itab>-line_color = 'C510'. " Blue.
WHEN 'User Exit'.
<itab>-line_color = 'C611'. " Red.
ENDCASE.
ENDLOOP.
ENDFORM.
FORM f_display_data.
DATA:
ls_layout TYPE slis_layout_alv,
ls_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv.
* Build the field catalog
m_fieldcat 'OBJECT' 'ITAB' 'X'.
m_fieldcat 'OBJECT_NAME' 'ITAB' 'X' .
* m_fieldcat 'VBELN' 'VBAK'.
* m_fieldcat 'NETWR' 'VBAK'.
* Fill Layout - Name of the field with color
ls_layout-info_fieldname = 'LINE_COLOR'.
* Display the list
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = lt_fieldcat
TABLES
t_outtab = itab.
ENDFORM. "f_display_data
11-01-2007 3:02 PM
You need to use the
in field catalog
fieldcat-reptext_ddic = 'Col 1'. " Column heading
in layout
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
Regards,
Naimesh Patel
11-01-2007 3:02 PM
You need to use the
in field catalog
fieldcat-reptext_ddic = 'Col 1'. " Column heading
in layout
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
Regards,
Naimesh Patel
11-01-2007 3:12 PM
hi naimesh
Thanks the optimize is working well.
i try to your suggestion and add the line in fcat but what i get is un the 2 column i have 'column 1' how i change it and get in all colman diffrent text?
Regards
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = &2.
ls_fieldcat-fix_column = &3.
ls_fieldcat-reptext_ddic = 'Col 1'. "here
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
11-01-2007 3:24 PM
You will have to use this:
1. Change the macro following way:
DEFINE m_fieldcat.
add 1 to ls_fieldcat-col_pos.
ls_fieldcat-fieldname = &1.
ls_fieldcat-ref_tabname = &2.
ls_fieldcat-fix_column = &3.
ls_fieldcat-reptext_ddic = &4. " << will repalce from the macro's argument
append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
2. Call the macro like this.
m_fieldcat 'OBJECT' 'ITAB' 'X' 'Object'
m_fieldcat 'OBJECT_NAME' 'ITAB' 'X' 'Oject Name'.
Regards,
Naimesh Patel
11-01-2007 3:36 PM
Oh.. I forgot that you also need the title of the ALV
To give a TITLE,
Pass this Exporting parameter in the FM REUSE_ALV_GRID_DISPLAY
I_GRID_TITLE = 'This is my Title'.
Regards,
Naimesh Patel
11-01-2007 3:44 PM