2007 Jul 02 3:07 AM
Hi Friends,
I want to pick the second record from the internal table and modify it,
I have used the following code to do that but it is not working pls tell me what to do.,
LOOP AT lt_check INTO lw_check.
read table lt_check into lw_check with key xblnr where sy-tabix = 2.
IF sy-tabix = 2.
itab_temp-trans = lw_check-trans.
itab_temp-lifnr = lw_check-lifnr.
itab_temp-xblnr = lw_check-xblnr.
itab_temp-bukrs = lw_check-bukrs.
itab_temp-usnam = lw_check-usnam.
itab_temp-procese = lw_check-procese.
itab_temp-appdate = lw_check-appdate.
itab_temp-status = lw_check-status.
MOVE 'CL' TO itab_temp-clear.
endloop.
Thank in advance,
Line
2007 Jul 02 4:56 AM
i am not enough clear that which table you want to modify? as per your code it seems you want to modify(or append) the itab_temp table. if it is so then...
LOOP AT lt_check INTO lw_check.
read table lt_check into lw_check with key xblnr where sy-tabix = 2.
IF sy-tabix = 2.
itab_temp-trans = lw_check-trans.
itab_temp-lifnr = lw_check-lifnr.
itab_temp-xblnr = lw_check-xblnr.
itab_temp-bukrs = lw_check-bukrs.
itab_temp-usnam = lw_check-usnam.
itab_temp-procese = lw_check-procese.
itab_temp-appdate = lw_check-appdate.
itab_temp-status = lw_check-status.
MOVE 'CL' TO itab_temp-clear.
append itab_temp
" if data is not there in itab_temp or use modify itab_temp index 2 if the there
"are at least 2 rows in your itab_temp.
endif.
endloop.
please let us know what is your exact requirement... and with some sample data in both the int table...
regards
shiba dutta
Hi Friends,
I want to pick the second record from the internal table and modify it,
I have used the following code to do that but it is not working pls tell me what to do.,
LOOP AT lt_check INTO lw_check.
read table lt_check into lw_check with key xblnr where sy-tabix = 2.
IF sy-tabix = 2.
itab_temp-trans = lw_check-trans.
itab_temp-lifnr = lw_check-lifnr.
itab_temp-xblnr = lw_check-xblnr.
itab_temp-bukrs = lw_check-bukrs.
itab_temp-usnam = lw_check-usnam.
itab_temp-procese = lw_check-procese.
itab_temp-appdate = lw_check-appdate.
itab_temp-status = lw_check-status.
MOVE 'CL' TO itab_temp-clear.
endloop.
Thank in advance,
Line
2007 Jul 02 3:12 AM
Hi,
LOOP AT lt_check INTO lw_check.
read table lt_check into lw_check with key xblnr where sy-tabix = 2.
IF sy-tabix = 2.
itab_temp-trans = lw_check-trans.
itab_temp-lifnr = lw_check-lifnr.
itab_temp-xblnr = lw_check-xblnr.
itab_temp-bukrs = lw_check-bukrs.
itab_temp-usnam = lw_check-usnam.
itab_temp-procese = lw_check-procese.
itab_temp-appdate = lw_check-appdate.
itab_temp-status = lw_check-status.
MOVE 'CL' TO itab_temp-clear.
modify itab_temp index 2 transporting trans lifnr xblnr bukrs usnam procese appdate status .
endif.
endloop.
Message was edited by:
Jayanthi Jayaraman
2007 Jul 02 3:18 AM
hi Jayanthi,
In my loop sy-tabix value is not becoming to 2, what to do ?
Regards,
Line
2007 Jul 02 3:23 AM
Hi,
If you want to modify only the second record, read statement is enough with modify.One more thing which table you want to modify lt_check or itab_temp?If itab_temp which record you want to modify?
read table lt_check into lw_check index 2.
IF sy-subrc eq 0.
....
endif.
2007 Jul 02 4:11 AM
Hi Line,
As said by Jayanthi use READ only, but before that just see if the LT_CHECK has more than 2 entries, if there are less than 2 entries then you will get a ABAP dump.
So use
<b>DESCRIBE TABLE lt_check LINES lv_lines.
IF lv_ines > 1.</b>
read table lt_check into lw_check index 2.
IF sy-subrc eq 0.
....
endif.
<b>ENDIF.</b>
Regards,
Atish
2007 Jul 02 4:56 AM
i am not enough clear that which table you want to modify? as per your code it seems you want to modify(or append) the itab_temp table. if it is so then...
LOOP AT lt_check INTO lw_check.
read table lt_check into lw_check with key xblnr where sy-tabix = 2.
IF sy-tabix = 2.
itab_temp-trans = lw_check-trans.
itab_temp-lifnr = lw_check-lifnr.
itab_temp-xblnr = lw_check-xblnr.
itab_temp-bukrs = lw_check-bukrs.
itab_temp-usnam = lw_check-usnam.
itab_temp-procese = lw_check-procese.
itab_temp-appdate = lw_check-appdate.
itab_temp-status = lw_check-status.
MOVE 'CL' TO itab_temp-clear.
append itab_temp
" if data is not there in itab_temp or use modify itab_temp index 2 if the there
"are at least 2 rows in your itab_temp.
endif.
endloop.
please let us know what is your exact requirement... and with some sample data in both the int table...
regards
shiba dutta
2007 Jul 02 6:09 AM
LOOP AT ITAB.
IF sy-tabix = 2.
itab_temp-trans = lw_check-trans.
itab_temp-lifnr = lw_check-lifnr.
itab_temp-xblnr = lw_check-xblnr.
itab_temp-bukrs = lw_check-bukrs.
itab_temp-usnam = lw_check-usnam.
itab_temp-procese = lw_check-procese.
itab_temp-appdate = lw_check-appdate.
itab_temp-status = lw_check-status.
MODIFY ITAB.
ENDIF.
ENDLOOP.
IF USEFULL REWARD
2007 Jul 02 6:27 AM
DESCRIBE TABLE lt_check LINES lv_lines.
IF lv_ines > 1.
read table lt_check into lw_check index 2.
IF sy-subrc eq 0.
loop at lw_check.
move lw_check into it_temp.
modify it_temp.
endloop.
endif.
endif.
reward if useful.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |