Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Modify fieldcat

Former Member
0 Likes
1,573

Guys , Im creating a ALV using the following code ,

CALL METHOD grid1->set_table_for_first_display
      EXPORTING
        i_structure_name = 'CAUFVD'
        is_variant       = gs_variant
        is_layout        = gs_layout
        i_save           = x_save
      CHANGING
        it_outtab        = ti_saida[].

However I want to change the text of the fields ( columns ) , they come assigned for texts of CAUFVD , a friend told me that maybe is neccesary to change the fieldcat , how is that?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
997

Hi,

If you want to change column heading means you have to set field catalog coltext field not reptext field.

Hope you have understand

5 REPLIES 5
Read only

former_member194669
Active Contributor
0 Likes
997

Try thsi way


  v_structure = 'CAUFVD'.

  call function 'LVC_FIELDCATALOG_MERGE'
    exporting
      i_structure_name       = v_structure
      i_client_never_display = c_x
    changing
      ct_fieldcat            = i_fieldcat[].

  loop at i_fieldcat where fieldname eq 'PROD' .
 
    move : text-008 to i_fieldcat-scrtext_m,
                                        " Product code
           text-008 to i_fieldcat-reptext,
                                        " Product code
           text-008 to i_fieldcat-coltext.
                                        " Product code
    modify i_fieldcat index sy-tabix.
   endloop.
...
...
...
    call method grid1->set_table_for_first_display
      exporting
        is_layout                     = gs_layout
        is_variant                    = gs_variant
        i_save                        = 'A'
        it_toolbar_excluding          = i_exclude[]
      changing
        it_outtab                     = i_output[]
        it_fieldcatalog               = i_fieldcat[]
      exceptions
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        others                        = 4.


a®

Read only

0 Likes
997

Hi, I did it this way,


 call function 'LVC_FIELDCATALOG_MERGE'
    exporting
      i_structure_name       = 'CAUFVD'
      i_client_never_display = 'X'
    changing
      ct_fieldcat            = fieldcat[].

LOOP AT fieldcat where fieldname eq 'GSTRP' .
        fieldcat-reptext = 'Data solicitação'.
         modify fieldcat index sy-tabix.

   ENDLOOP.

   CALL METHOD grid1->set_table_for_first_display
      EXPORTING
*        i_structure_name = 'CAUFVD'
        is_variant       = gs_variant
        is_layout        = gs_layout
        i_save           = x_save
      CHANGING
        it_outtab        = ti_saida[]
        it_fieldcatalog  = fieldcat[]
      exceptions
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        others                        = 4.

  ENDIF.

but it still shows the old text. any idea please?

Read only

Former Member
0 Likes
997

Hi,

Try like this...



field-symbols: <lwa_fcat>  type lvc_s_fcat.

call function 'LVC_FIELDCATALOG_MERGE'
      exporting
        i_structure_name       = 'CAUFVD'
      changing
        ct_fieldcat            = fieldcat[]
      exceptions
        inconsistent_interface = 1
        program_error          = 2
        others                 = 3.

loop at fieldcat assigning <lwa_fcat>.
      case <lwa_fcat>-fieldname.
          when 'STATUS'.
          <lwa_fcat>-outputlen = 25.
          <lwa_fcat>-coltext   = 'STATUS'.
      endcase.
    endloop.


CALL METHOD grid1->set_table_for_first_display
      EXPORTING
*        i_structure_name = 'CAUFVD'
        is_variant       = gs_variant
        is_layout        = gs_layout
        i_save           = x_save
      CHANGING
        it_outtab        = ti_saida[]
        it_fieldcatalog  = fieldcat[]
      exceptions
        invalid_parameter_combination = 1
        program_error                 = 2
        too_many_lines                = 3
        others                        = 4.
 
  ENDIF.


Hope it will helps

Read only

0 Likes
997

it solved my problem , Could I know how happened ?

Read only

Former Member
0 Likes
998

Hi,

If you want to change column heading means you have to set field catalog coltext field not reptext field.

Hope you have understand