Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

HELP IN ALV FIELD CAT

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
 

Tags:
Former Member
replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question