Код:
BSAD_TB -|
BSID_TB -| -- внутриние таблицы
KNA1_TB -|
Code:
DATA LIN LIKE LINE OF bsad_tb.
data kna1_str like KNA1.
LOOP AT bsad_tb INTO LIN.
CLEAR kna1_str.
SELECT SINGLE *
INTO kna1_str
FROM KNA1
WHERE KUNNR = LIN-KUNNR.
read table KNA1_TB WITH KEY KUNNR = LIN-KUNNR.
IF SY-SUBRC <> 0.
MODIFY KNA1_TB FROM kna1_str INDEX SY-TABIX .
ENDIF.
ENDLOOP.
Вываливается в дамп:
Code:
Error in ABAP statement when processing an internal table.
-------------
Анализ ошибки
When changing or deleting one or more lines of the internal table
"\PROGRAM=ZFI_BSAD_AND_BSID=============FT\DATA=%_OKNA1_TB[]" or when inserting
in the table "\PROGRAM=ZFI_BSAD_AND_BSID=============FT\DATA=%_OKNA1_TB[]", 0
was used as
the line index. An index less than or equal to zero is not
allowed.
The error can occur when using the following options:
1. "INDEX idx" for specifying the line number in the table
"\PROGRAM=ZFI_BSAD_AND_BSID=============FT\DATA=%_OKNA1_TB[]"
where you want to change, insert or delete.
2. "FROM idx" for specifying the start index when deleting a line
area from or inserting a line area into the table
"\PROGRAM=ZFI_BSAD_AND_BSID=============FT\DATA=%_OKNA1_TB[]".
3. "TO idx" for specifying the end index when deleting a line
area from or inserting a line area into the table
"\PROGRAM=ZFI_BSAD_AND_BSID=============FT\DATA=%_OKNA1_TB[]".
When the program terminated, the table had 0 lines.
-----------------------------------------------------------
000310 LOOP AT bsad_tb INTO LIN.
000320 CLEAR kna1_str.
000330 SELECT SINGLE *
000340 INTO kna1_str
000350 FROM KNA1
000360 WHERE KUNNR = LIN-KUNNR.
000370
000380 read table KNA1_TB WITH KEY KUNNR = LIN-KUNNR.
000390 IF SY-SUBRC <> 0.
000400 MODIFY KNA1_TB FROM kna1_str INDEX SY-TABIX .
> INSERT KNA1_str INTO KNA1_TB INDEX SY-TABIX.
000420
000430 ENDIF.
000440 ENDLOOP.
000450
Может ктото поправит
