Skip to Content

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

method: set_table_for_first_display - how to change fieldcat

HI,

im using method: set_table_for_first_display to show my tabel entries in ALV.

call method go_grid2->set_table_for_first_display

exporting

i_structure_name = 'ZSTRUC1'

is_layout = gs_layout

changing

it_outtab = gt_table

exceptions

others = 4.

How can i edit the fieldcat ? I would like to get rid of some fields in the ALV ?

Tags:
Former Member
Former Member replied

Hi,

Try like this.....


data : lv_tab_name type dd02l-tabname.

  field-symbols: <lwa_fcat>  type lvc_s_fcat.

  clear :lv_tab_name.
    lv_tab_name = '/RAD/NOT_LINKED_TRACKINGINFO'.
    refresh : gt_fcat[].
    call function 'LVC_FIELDCATALOG_MERGE'
      exporting
        i_structure_name       = lv_tab_name
      changing
        ct_fieldcat            = gt_fcat[]
      exceptions
        inconsistent_interface = 1
        program_error          = 2
        others                 = 3.
    if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.

    loop at gt_fcat assigning <lwa_fcat>.
      case <lwa_fcat>-fieldname.
        when 'CLAIM_NUMBER'.
          <lwa_fcat>-no_out = 'X'.
          endcase.
    endloop.

 call method gcc_grid_tr->set_table_for_first_display
      exporting
*          i_structure_name              = c_s_dmhdr
        is_variant                    = gs_variant
        i_save                        = 'A'
        is_layout                     = gs_layout
*        it_toolbar_excluding          = gt_excl_fun[]
      changing
        it_outtab                     = gt_not_linked_trackinginfo[]
        it_fieldcatalog               = gt_fcat[]                                     "field catalog
      exceptions
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        others                        = 4.
    if sy-subrc <> 0.
*     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.

Hope it will helps

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