Can you avoid the nested loop on these two internal tables?
DATA: t_fieldcat TYPE slis_fieldcat_alv,
t_fcat TYPE kkblo_t_fieldcat.
LOOP AT T_FIELDCAT INTO LX_FIELDCAT.
LOOP AT T_FCAT INTO LX_FCAT.
***If they have the same fieldname, the col_pos from FCAT will be passed to FIELDCAT.***
IF LX_FIELDCAT-FIELDNAME = LX_FCAT-FIELDNAME.
LX_FIELDCAT-COL_POS = LX_FCAT-COL_POS.
APPEND lx_fieldcat TO t_fieldcat.
CLEAR lx_fieldcat.
ENDIF.
ENDLOOP.
ENDLOOP.
I want to know if it is possible to assign the field COL_POS of the internal table T_FCAT to the field COL_POS of the internal table T_FIELDCAT without the nested looping.
Use could just use the read table statement.
But you're not passing the field col_pos to the other fieldcatalog. You're adding a new line to it which will probably run into an endless loop. I would assign a field-symbol in the first loop and write the col_pos into it: