Hi everyone,
I am trying to assign a value to fields of an internal table based on the value of ls_col that I get from "get current cell" function. This has to be dynamically done (because this value assignment depends on the name of the field that derives from the function. The fields I want to assign values to are named like "********_DB2_PRZT" so all of them end with "_DB2_PRZT", therefore I have to split them. I've started out with this code, which is not actually working. Any ideas how this can be fixed ?
TYPES: BEGIN OF col_str,
colname TYPE string,
END OF col_str.
DATA: lt_col TYPE TABLE OF string.
CONSTANTS: con_tab TYPE string VALUE '_DB2_PRZT'.
FIELD-SYMBOLS: <lfs_line> LIKE LINE OF lt_col,
<lfs_component> TYPE string.
CALL METHOD grid_alv->get_current_cell
IMPORTING
e_row = le_row
e_value = ld_db2_prz
e_col = le_col
es_row_id = ls_row
es_col_id = ls_col
es_row_no = le_row_no.
.
SPLIT ls_col-fieldname AT con_tab INTO TABLE lt_col.
LOOP AT lt_col ASSIGNING <lfs_line>.
ASSIGN COMPONENT sy-tabix OF STRUCTURE <lfs_line> TO <lfs_component>.
IF <lfs_component> IS ASSIGNED.
TRY .
* gr_rep_out-><lfs_component> = lv_db2_prz.
CATCH cx_sy_conversion_no_number.
ENDTRY.
ENDIF.
IF <lfs_line> IS ASSIGNED.
UNASSIGN <lfs_line>.
ENDIF.
ENDLOOP.
Thank you in advance,
Shkelqim