Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

TABLE_INVALID_INDEX

Former Member
0 Likes
1,646

Error in ST22, please help me.

Error in the ABAP Application Program; The current ABAP program "CL_ALV_CHANGED_DATA_PROTOCOL==CP" had to be

terminated because it has come across a statement that unfortunately cannot be executed.

Analysis

When changing or deleting one or more lines of the internal table "" or when inserting in the table "", 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

""

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

"".

3. "TO idx" for specifying the end index when deleting a line

area from or inserting a line area into the table

"".

Regards.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,083

possibly an empty table since the index is zero or possibly an error in setting the index value in the code...?

5 REPLIES 5
Read only

Former Member
0 Likes
1,083

Hi,

please insert code which causes error.

You just inserted analysis of the exception, but you want to find the reason.

Regards,

--

Przemysław

Read only

Former Member
0 Likes
1,084

possibly an empty table since the index is zero or possibly an error in setting the index value in the code...?

Read only

Former Member
0 Likes
1,083

Hello SAP,

Attached the code with error.

   15   if i_tabix is initial.                                                                     
   16     read table mt_mod_cells into ls_modi with key row_id = i_row_id.                         
   17     if sy-subrc = 0.                                                                         
   18       i_tabix = ls_modi-tabix.                                                               
   19     endif.                                                                                
20   endif.                                                                                
21                                                                                
22   read table <lt_tab> into <ls_wa> index i_tabix.                                            
   23   assign component i_fieldname of structure <ls_wa> to <l_field>.                            
   24   if i_value is initial.                                                                     
   25     clear <l_field>.                                                                         
   26   else.                                                                                
27     <l_field> = i_value.                                                                     
   28   endif.                                                                                
29   modify <lt_tab> from <ls_wa> index i_tabix.                                                
======   if sy-subrc = 0.                                                                           
   31     if i_row_id is initial.                                                                  
   32       read table mt_mod_cells into ls_modi index i_tabix.                                    
   33       i_row_id = ls_modi-row_id.                                                             
   34     endif.                                                                                

Regards.

Edited by: Víctor Barahona Cimas on Mar 16, 2010 2:23 PM

Edited by: Rob Burbank on Mar 16, 2010 9:38 AM

Read only

0 Likes
1,083

Hi,

use READ TABLE ... ASSIGNING <fs> not READ TABLE ... INTO <fs>

l_tabix is 0, you should add IF - ENDIF.

Regards,

--

Przemysław

Read only

Former Member
0 Likes
1,083

Hi

CHeck if in one of this cases:

1. "INDEX idx"

2. "FROM idx"

3. "TO idx"

your index is 0

also can be in "modify itab index idx" or just modify itab without index.

Best Regards

Yossi Rozenberg