2006 Jan 02 1:10 PM
Hello,
While updating an internal table I am getting the following exception, would be nice if some one help me to figue it out, what happend here...
here is the code I am using to update an internal table...
read table lt_incomp_calib_wa
into ls_incomp_calib_wa
index ls_sel_rows-index.
check sy-subrc eq 0.
lv_gltgv = ls_incomp_calib_wa-gltgv.
If lv_gltgb gt lv_gltgv.
ls_incomp_calib_wa-gltgb = lv_gltgb.
MODIFY lt_incomp_calib_wa from ls_incomp_calib_wa.
"TRANSPORTING gltgb.
Endif.
when I try to do mobidy, if gives me exception..... and here is the exception details...
Possible reasons:
1. The relevant ABAP/4 statement does not include the addition
"...INDEX...", although the statement is not
inside a "LOOP...ENDLOOP" loop processing this table.
2. The relevant ABAP/4 statement was called from within a
"LOOP...ENDLOOP" loop after a DELETE
"\PROG=/CBP/SAPMUA0302_WARU\DATA=LT_INCOMP_CALIB_WA".
Thanks in advance,
2006 Jan 02 1:11 PM
The statement,
MODIFY lt_incomp_calib_wa from ls_incomp_calib_wa.
should have a index addition
like this
MODIFY lt_incomp_calib_wa from ls_incomp_calib_wa <b>index lv_index</b>.
lv_index should have the line number of the internal table for which you want this changes to occur.
2006 Jan 02 1:17 PM
You are modifying the table not in the loop, so you should mention the index value.
so the statement should come like this
MODIFY lt_incomp_calib_wa from ls_incomp_calib_wa index lv_index.
instead of
MODIFY lt_incomp_calib_wa from ls_incomp_calib_wa.
Alex
2006 Jan 02 1:14 PM
MODIFY lt_incomp_calib_wa from ls_incomp_calib_wa index sy-tabix.
mention the index along with modify..
thanks
vijay
2006 Jan 02 1:18 PM
Hi Haider,
Add INDEx to the MODIFY statement ie
MODIFY lt_incomp_calib_wa from ls_incomp_calib_wa index ls_sel_rows-index.
Regards,
Suresh Datti
2006 Jan 02 1:22 PM
Hello,
Thanks to all of you for your kind replies, the problem solved.
PS: As all answers are more or less same, hard to figure it out, to whom I reward the points
2006 Jan 02 1:24 PM
2006 Jan 10 4:37 PM
Hello friends,
I am facing more or less the same problem again but this time I am inside the loop, so where is the actuall problem in my code:
Loop at lt_selected_rows into ls_selected_rows.
if lv_gltgv is initial.
lv_gltgv = ls_selected_rows-gltgv.
endif.
If lv_gltgb gt lv_gltgv.
ls_alv_waru-gltgv = lv_gltgv.
ls_alv_waru-gltgb = lv_gltgb.
ls_alv_waru-new = 'X'.
Endif.
MODIFY lt_alv_waru from ls_alv_waru.
Endloop.
PS: I am receving the same exception as mentioned in my first post !
2006 Jan 10 4:42 PM
Hi Haider,
Let me tell you one thing, MODIFY in a LOOP...ENDLOOP doesnt require an index or a where cluase when you modify the same table which you are looping and it needs an INDEX or a WHERE clause if you are modifying someother table.
In the below case you are looping at lt_selected_rows and modifying lt_alv_waru. Put a where clause for the key.
Regards,
Srikanth
2006 Jan 10 4:44 PM
data: l_tabix type sy-tabix.
Loop at lt_selected_rows into ls_selected_rows.
l_index = sy-tabix.
if lv_gltgv is initial.
lv_gltgv = ls_selected_rows-gltgv.
endif.
If lv_gltgb gt lv_gltgv.
ls_alv_waru-gltgv = lv_gltgv.
ls_alv_waru-gltgb = lv_gltgb.
ls_alv_waru-new = 'X'.
Endif.
MODIFY lt_alv_waru from ls_alv_waru index l_index.
Endloop.
2006 Jan 10 4:45 PM
hi,
thanks for your reply.
Actually both internal tables ( lt_selected.. and lt_alv..) are from the same structure, and dont have any key! ( In structure cant specified the keys or ? so how I can put there where key clause inside the loop ?
Thanks for your help ...
2006 Jan 10 5:51 PM
By key what Srikanth meant was those fields that uniquely identify the particular row that you are trying to modify. You are tyring to modify some row of the internal table. You have to tell the system which row by either specifying the WHERE clause or the INDEX.
Srinivas
2006 Jan 10 5:55 PM
try this........
MODIFY table lt_alv_waru from ls_alv_waru transporting gltgv gltgb new.
2006 Jan 11 9:26 AM
Hello,
MODIFY table lt_alv_waru from ls_alv_waru transporting gltgv gltgb new.
I have have tried this statement, but gave me the same error.
2006 Jan 11 9:37 AM
Hi Haider,
Can you please paste the whole code telling what are you tring to do. By concept you will have a key or an index for sure logically. May be I will help you identify that.
Regards,
Srikanth
2006 Jan 11 9:59 AM
Hi Srikanth,
Its very kind of you,
I have now solved the problem and using the following statement..
MODIFY lt_alv_waru from ls_alv_waru Transporting gltgv gltgb new
where bname = ls_selected_rows-bname.
many thanks for your help and points goes to you