Skip to Content
author's profile photo
Former Member

adding a column in ALV

can anyone pls tel me how to add a one more column in alv layout.It is alv report using ABAP OOPS

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • Best Answer
    author's profile photo
    Former Member
    Oct 05, 2005 at 10:08 AM

    Karthik,

    You need add that new field in the catalog and then the new field also should be as one of the columns of the internal table where the data is going to reside.

    It has nothing to do with layout.

    Regards,

    Ravi

    NOte : Please reward points if this helps you.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Oct 05, 2005 at 10:07 AM

    Hi,

    You must add the column to the structure and internal table you pass to the ALV.

    Regards,

    Ville

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Oct 05, 2005 at 10:09 AM

    Hi

    you have to insert your new colunm in catalog table, but you should give us more details.

    Max

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Oct 05, 2005 at 10:10 AM

    Hi,

    define a field to your itab or your structure.

    regards,

    venu.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 05, 2005 at 10:10 AM

    If u have used an internal table add the field naem in the table or if u have used structure add that in the structure, Then in the modify fieldcatalog add this colummn name too.

    • Internal Tables

    DATA: BEGIN OF IALV OCCURS 0,

    VBELN TYPE VBAP-VBELN,

    POSNR TYPE VBAP-POSNR,

    MATNR TYPE VBAP-MATNR,

    KWMENG TYPE VBAP-KWMENG,

    END OF IALV .

    Can do here

    FORM BUILD_FIELD_CATALOG.
    
    DATA: LS_FCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
    REFRESH: FIELDCAT.
    
    CLEAR: LS_FCAT.
    LS_FCAT-REPTEXT_DDIC = 'Sales Doc Number'.
    LS_FCAT-FIELDNAME = 'VBELN'.
    LS_FCAT-OUTPUTLEN = '10'.
    LS_FCAT-COL_POS = 1.
    APPEND LS_FCAT TO FIELDCAT.
    
    CLEAR: LS_FCAT.
    LS_FCAT-REPTEXT_DDIC = 'SD Item'.
    LS_FCAT-FIELDNAME = 'POSNR'.
    LS_FCAT-OUTPUTLEN = '6'.
    LS_FCAT-COL_POS = 2.
    APPEND LS_FCAT TO FIELDCAT.
    
    CLEAR: LS_FCAT.
    LS_FCAT-REPTEXT_DDIC = 'Material'.
    LS_FCAT-FIELDNAME = 'MATNR'.
    LS_FCAT-OUTPUTLEN = '18'.
    LS_FCAT-COL_POS = 3.
    LS_FCAT-NO_OUT = 'X'.
    LS_FCAT-REF_FIELDNAME = 'MATNR'.
    LS_FCAT-REF_TABNAME = 'MARA'.
    APPEND LS_FCAT TO FIELDCAT.
    
    CLEAR: LS_FCAT.
    LS_FCAT-REPTEXT_DDIC = 'Quantity'.
    LS_FCAT-FIELDNAME = 'KWMENG'.
    LS_FCAT-OUTPUTLEN = '12'.
    LS_FCAT-COL_POS = 5.
    APPEND LS_FCAT TO FIELDCAT.
    
    Add the next column name here as above.
    
    ENDFORM.

    OR

      FIELD-SYMBOLS : <lfs_fieldcat> TYPE lvc_s_fcat.
    
      LOOP AT p_fieldcat ASSIGNING <lfs_fieldcat>.
    
        CASE <lfs_fieldcat>-fieldname.
          WHEN 'BUKRS'.
            <lfs_fieldcat>-coltext = text-003.
          WHEN 'BELNR'.
            <lfs_fieldcat>-coltext = text-004.
    Add one more case which u want to add.
        ENDCASE.
    
      ENDLOOP.
    
    ENDFORM.                    " f9002_modify_field_cat
    

    Hope this helps.

    Add comment
    10|10000 characters needed characters exceeded