ALV new column mimics previous column value

Hi. I’m new here and I need a little help with a problem (that seems easy but I guess it’s not…).

I have to add a new column to an ALV, but it’s not working how I expected it to work. Does not matter where I set it, it keeps copying previous column data, and if I try to make it be the first column the report crashes.

Step by step what I did:

1. Add new column to fieldcat.

There is a subroutine named “build_fieldcatalog” where I put my new column the next way (just copied the other columns):

ls_fieldcat-fieldname = ‘commentaire2_desc’.

ls_fieldcat-seltext_m = ‘Comment’.

ls_fieldcat-col_pos = 34.

APPEND ls_fieldcat TO i_fieldcat.

CLEAR :ls_fieldcat.

2. Add the new value to the internal table that corresponds to the table receiving the ALV.

The ALV is being called in a subrouting named “LIST_DISPLAY” with a line with “CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY'”.

This function receives the catalog and a table named “t_echedit1” that corresponds to “t_outtab”, and a lot more things.

CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’

EXPORTING

i_callback_program = ls_program

i_callback_pf_status_set = ‘GUI_STAT’

i_callback_user_command = ‘F_USER_COMMAND’ ” Drill Down Form

is_layout = ls_layout

i_save = alvvr_sav_all

is_variant = alvvr

it_fieldcat = i_fieldcat

it_sort = i_sort

* i_save = ls_alvvr_sav_all

* is_variant = ls_alvvr

it_events = i_events

TABLES

t_outtab = t_echedit1 “i_t001

EXCEPTIONS

program_error = 1

OTHERS = 2.

I modified that table to get the new value and when I run the report, at this point, the new field is filled.

I asked a coworker and tolds me that this could be caused because the it_fieldcat and t_outtab does not have the same fields. Fieldcatalog has 35 columns added but the outtab has 6 lines with 48 values each.

The thing is that new my new column is the only one that don’t work properly… The others works even if there is this difference of columns.

Any ideas? And let me know if I’m missing any information.There’s something I’m not seing and I’m sure it will be something very easy to see…

Thank you in advance!

Scroll to Top