2023 May 22 1:43 PM
Here is my current situation:
DATA: T_FCAT1 TYPE slis_fieldcat_alv,
t_fcat TYPE kkblo_t_fieldcat.
LOOP AT T_FCAT1 INTO LX_FCAT1.
LOOP AT LT_FCATALOG INTO LX_FCATALOG.
IF LX_FCAT1-FIELDNAME = LX_FCATALOG-FIELDNAME.
LX_FCAT1-COL_POS = LX_FCATALOG-COL_POS.
APPEND LX_FCAT1 TO T_FCAT1.
CLEAR LX_FCAT1.
ENDIF.
ENDLOOP.
ENDLOOP.
It is possible to eliminate the nested loop here?
My goal is to overwrite the COL_POS from LX_FCATALOG to T_FCAT1 or LX_FCAT1
but the pre-requisite is to map it into correct field.
example:
T_FCAT1 OR LX_FCAT1.
FIELDNAME COL_POS
EBELN 0
LT_FCATALOG OR LX_FCATALOG.
FIELDNAME COL_POS
EBELN 23 <-----I want this to overwrite to T_FCAT1 OR LX_FCAT1.
2023 May 22 2:16 PM
Looks to me like you've an endless loop (except where there are no shared FIELDNAME between the two internal tables), since you're looping through t_fcat1 you're adding new records into it.
2023 May 22 3:27 PM
Seems no need of nested loop here. You can loop once T_FCAT1 assigning field symbol, as you want modify COL_POS, read table LT_FCATALOG per field and just set <fs_fcat1>-COL_POS = ls_fcatalog-COL_POS.
BTW: You have many questions unclosed, are it really without valid answers to be closed ?
2023 May 22 3:40 PM
2023 May 22 4:39 PM
Try at least something such as
LOOP AT T_FCAT1 ASSIGNING <old>.
READ TABLE T_FCATALOG WITH KEY FIELDNAME = <old>-FIELDNAME ASSIGNING <new>.
IF <new> IS ASSIGNED.
<old>-COL_POS = <new>-COL_POS.
ENDIF.
ENDLOOP.
What's your version?
2023 May 22 4:51 PM
I guess experience says there's no need to close the questions as people keep answering...
2023 May 22 5:32 PM
I stopped answering several months ago when it was obvious that the only thing that would continue was the flow of questions.