‎2008 Apr 29 12:43 PM
i used this code in my program.
MODIFY TABLE int_fdata FROM int_fdata
TRANSPORTING shkzg.
but it is not updating. This row already exists. i want to update the value of SHKZG.
‎2008 Apr 29 12:51 PM
Hi,
You should not use tables with header lines. It is obsolete. Can you paste the definition of the table? The key value in working area have to match with at least one record in table. Are you sure that it is true? Here is the example from ABAP documentation:
PARAMETERS p_carrid TYPE scarr-carrid.
DATA scarr_tab TYPE SORTED TABLE OF scarr
WITH UNIQUE KEY carrid.
DATA: idx TYPE sy-tabix,
scarr_wa TYPE scarr.
SELECT *
FROM scarr
INTO TABLE scarr_tab.
READ TABLE scarr_tab
WITH TABLE KEY carrid = p_carrid
TRANSPORTING NO FIELDS.
idx = sy-tabix.
scarr_wa-currcode = 'EUR'.
MODIFY scarr_tab INDEX idx FROM scarr_wa
TRANSPORTING currcode.
‎2008 Apr 29 12:46 PM
hi Christy,
In that case pass all the primary key fields in the internal table for the record which you want to update ...You can avoid using transporting statement ...
Regards,
Santosh
‎2008 Apr 29 12:48 PM
check the following :
1) is this modify within the loop?
2) if the internal table is with header line, do you still explicitely require modify table itab FROM itab clause or simple
Modify table itab transporting... will do?
Do let me know if this helped.
Thanks,
Pranjal.
‎2008 Apr 29 12:49 PM
Hi,
Try using :
MODIFY int_fdata.
clear int_fdata.
Thanks,
Sriram Ponna.
‎2008 Apr 29 12:49 PM
Hi
You have two options
1) Add a where condition
MODIFY TABLE int_fdata FROM int_fdata
TRANSPORTING shkzg Where XYZ = 'ABC'.
Where XYZ is a key in the internal table and 'ABC is the value where you want to change SHKZG
2) Add Index
MODIFY TABLE int_fdata FROM int_fdata
TRANSPORTING shkzg Index Sy-Tabix/Sy-Index/Index.
Hope this helps.
santhosh
‎2008 Apr 29 1:34 PM
thanks to all......
i did in this way.
MODIFY int_fdata index idx FROM int_fdata
TRANSPORTING shkzg.
‎2008 Apr 29 12:51 PM
Hi!
I personally like to use the modify using indexes, it makes the update always correct.
DATA: lv_tabix LIKE sy-tabix.
LOOP AT itab INTO wa.
MOVE sy-tabix TO lv_tabix.
...
MOVE 'S' TO wa-shkzg.
MODIFY itab FROM wa INDEX lv_tabix.
ENDLOOP.
Regards
Tamá
‎2008 Apr 29 12:51 PM
Hi,
You should not use tables with header lines. It is obsolete. Can you paste the definition of the table? The key value in working area have to match with at least one record in table. Are you sure that it is true? Here is the example from ABAP documentation:
PARAMETERS p_carrid TYPE scarr-carrid.
DATA scarr_tab TYPE SORTED TABLE OF scarr
WITH UNIQUE KEY carrid.
DATA: idx TYPE sy-tabix,
scarr_wa TYPE scarr.
SELECT *
FROM scarr
INTO TABLE scarr_tab.
READ TABLE scarr_tab
WITH TABLE KEY carrid = p_carrid
TRANSPORTING NO FIELDS.
idx = sy-tabix.
scarr_wa-currcode = 'EUR'.
MODIFY scarr_tab INDEX idx FROM scarr_wa
TRANSPORTING currcode.