Skip to Content
avatar image
Former Member

About adding new fields into ALV

Hello guys,

I am going to enhance a ALV with some new fields.

I have done all the changes (enhance structure, fieldcatlog, filling values), but the fields don't appear on the ALV. And only after I change the layout settings and create a new settings, it appears.

I assume the new fields is hidden by the layout settings. But before my enhancements, there is also no layout settings. Why the original fields appear without the layout settings?

Thanks in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Apr 14, 2010 at 12:23 AM

    There are a number of ways to create a fieldcat, you have to declare your new fields

    ( the fields which you want them to appear in your ALV grid ) in the code

    depends on the way you are using to create your fieldcat:

    for example:

    
    form build_fieldcatalog.
    
    fieldcatalog-fieldname = 'EBELN'.
    fieldcatalog-seltext_m = 'Purchase Order'.
    fieldcatalog-col_pos = 0.
    fieldcatalog-outputlen = 10.
    fieldcatalog-emphasize = 'X'.
    fieldcatalog-key = 'X'.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    
    fieldcatalog-fieldname = 'EBELP'.
    fieldcatalog-seltext_m = 'PO Item'.
    fieldcatalog-col_pos = 1.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    
    fieldcatalog-fieldname = 'AEDAT'.
    fieldcatalog-seltext_m = 'Item change date'.
    fieldcatalog-col_pos = 2.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    
    endform. " BUILD_FIELDCATALOG
    
    

    hope it will help you...

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 13, 2010 at 11:30 PM

    Was there a global display variant?

    Add comment
    10|10000 characters needed characters exceeded

    • Hi William

      you can add as much as you can cols to the Alv grid just copy and paste in the code :

      it_fieldcatalog-fieldname = 'NAME'.
      it_fieldcatalog-seltext   = 'NAME OF THE STUDENT'.
      it_fieldcatalog-coltext =   'NAME OF THE STUDENT'.
      APPEND it_fieldcatalog TO it_fieldcat.
      CLEAR it_fieldcatalog.
      

      or you can try to remove the line:

      is_variant = i_variant

  • avatar image
    Former Member
    Apr 14, 2010 at 04:31 AM

    Hi william,

    whenever you want to add new fields to the alv displayed table you have to add

    new fields to the fieldcatalog there is nothing like it hide unless you explicitly define it to be.

    if i want to add seatsmax and seatsocc in my table then i add this for the existing fieldcatelog

    code.

    fcat-fieldname = 'SEATSMAX'.

    fcat-outputlen = 15.

    fcat-ref_table = 'SFLIGHT'.

    fcat-key_sel ='X'.

    APPEND fcat TO t_fcat.

    fcat-fieldname = 'SEATSOCC'.

    fcat-outputlen = 15.

    fcat-ref_table = 'SFLIGHT'.

    fcat-key_sel ='X'.

    APPEND fcat TO t_fcat.

    the other way is to pass directly the structure to the parameter i_structure_name

    of the method set_table_for_first_display.

    i hope it helped you.

    Regards and Best wishes.

    Add comment
    10|10000 characters needed characters exceeded