2009 Mar 04 11:54 AM
Hi,
I have an internal table with XXXXXXXX records. I have to UPDATE 1 field with the same value.
Is there a faster way?
LOOP AT lt_order_adm_h INTO wa_order_adm_h.
wa_order_adm_h-process_type = 'Z002'.
MODIFY lt_order_adm_h FROM wa_order_adm_h TRANSPORTING process_type.
ENDLOOP.
tnx, Adibo.
2009 Mar 04 12:02 PM
HI Adibo,
Try below
data: lv_tabix type i. "take this index aswell for better perfromance.
LOOP AT lt_order_adm_h INTO wa_order_adm_h .
lv_index = sy-tabix.
wa_order_adm_h-process_type = 'Z002'.
MODIFY lt_order_adm_h FROM wa_order_adm_h index lv_index TRANSPORTING process_type.
ENDLOOP.or you can do one more thing.
if you want to modify only process_type field ( which is initail ) for whole table.
just do below
wa_order_adm_h-process_type = 'Z002'.
modify lt_order_adm_h from wa_order_adm_h tranporting process_type where process_type is ' ' .
any ways modify is the faster way.
Regards
Edited by: Prasanth on Mar 4, 2009 5:35 PM
Hi,
I have an internal table with XXXXXXXX records. I have to UPDATE 1 field with the same value.
Is there a faster way?
LOOP AT lt_order_adm_h INTO wa_order_adm_h.
wa_order_adm_h-process_type = 'Z002'.
MODIFY lt_order_adm_h FROM wa_order_adm_h TRANSPORTING process_type.
ENDLOOP.
tnx, Adibo.
2009 Mar 04 12:02 PM
Hi,
maybe this is faster.
process_type = 'Z002'.
MODIFY lt_order_adm_h TRANSPORTING process_type WHERE process_type ne 'Z002'.
2009 Mar 04 12:02 PM
HI Adibo,
Try below
data: lv_tabix type i. "take this index aswell for better perfromance.
LOOP AT lt_order_adm_h INTO wa_order_adm_h .
lv_index = sy-tabix.
wa_order_adm_h-process_type = 'Z002'.
MODIFY lt_order_adm_h FROM wa_order_adm_h index lv_index TRANSPORTING process_type.
ENDLOOP.or you can do one more thing.
if you want to modify only process_type field ( which is initail ) for whole table.
just do below
wa_order_adm_h-process_type = 'Z002'.
modify lt_order_adm_h from wa_order_adm_h tranporting process_type where process_type is ' ' .
any ways modify is the faster way.
Regards
Edited by: Prasanth on Mar 4, 2009 5:35 PM
2009 Mar 04 12:04 PM
Hi Adibo,
Try this...
LOOP AT lt_order_adm_h INTO wa_order_adm_h where process_type = 'Z002'
if sy-subrc = 0.
MODIFY lt_order_adm_h FROM wa_order_adm_h TRANSPORTING process_type.
endif.
ENDLOOP.Hope it is helpful...
Regards,
Kittu
2009 Mar 04 12:06 PM
Hi
Use field symbols
Loop at itab assigning <ITAB>.
<ITAB>-name1 = 'KIRAN'.
endloop.
no need of update or modify statement.
Kiran
2009 Mar 04 12:08 PM
I have to update ALL records but only one field, process_type
2009 Mar 04 12:17 PM
You can evaluate from Se30?.Tips and tricks>Internal tables>Modifying single lines. It is bit explanatory as well.
2009 Mar 04 12:28 PM
2009 Mar 04 12:41 PM
This is OK.
LOOP AT lt_order_adm_h INTO wa_order_adm_h.
wa_order_adm_h-process_type = 'Z002'.
MODIFY lt_order_adm_h FROM wa_order_adm_h INDEX sy-tabix TRANSPORTING process_type.
ENDLOOP.
1 XXXX 2323444
2 XXXX 4749239
3 XXXX 3840505
4 XXXX 4049494
5 XXXX 4048372
So XXXX should be updated to Z002, that's is.
2009 Mar 04 1:11 PM
Hi,
More faster way to do this would be to Use "LOOP AT itab ASSIGNING ." instead of using a work area , you avoid data transport into the work area. The field symbol is a pointer into(!) the table so that you can modify the table line directly; you don't need MODIFY thus avoiding another data transport.
FIELD-SYMBOLS: <fs> TYPE <type of lt_order_adm_h>.
LOOP AT lt_order_adm_h ASSIGNING <fs>.
<fs>-process_type = 'Z002'.
ENDLOOP.Regards,
Neha