‎2007 Feb 07 9:13 AM
Hello, Could abyone please advice me...I'm trying to modify the database table with internal table, but its updating with new record rather modify the same...
MODIFY dbtable FROM TABLE itab.
1st line fields are key fields...
BAREA PLTYP PLAN_OPT BEGDA ENDDA VALUE_DATE
space DMP space space space 25.05.2007
space DMP space 01.04.2007 30.06.2007 25.05.2007
PERCENTAGE STATUS CNAME CDATE UNAME AEDTM
1,0000
1,0000 1 BR 07.02.2007
Thanks in advance...
‎2007 Feb 07 9:16 AM
Make sure that structure of Internal table is same as Database table.
If the structures are same then, based upon the key fields it will add a new record or modify the record if the all the key fields are same
Check out if you are missing leading zeroes in any of the key fields
‎2007 Feb 07 9:17 AM
hi,
Include transporting statement .
MODIFY dbtable FROM TABLE itab <b>transporting <fields>.</b>
‎2007 Feb 07 9:20 AM
Hi,
Check whether entries are there in the internal table. Also check for the structure.
MODIFY dbtab FROM TABLE itab.
UPDATE dbtab FROM TABLE itab.Check for sy-subrc.
Also check for duplicate entries.
‎2007 Feb 07 9:22 AM
Hi,
1>First of all the structure of Internal table should be same as Database table.
use the below command
modify <dbtable> from table itab..
Regards,
nagaraj
‎2007 Feb 07 9:26 AM
Hi,
use modify instead of update or insert
like this
modify mara from wa.
Regards
Shiva
‎2007 Feb 07 9:36 AM
hi Database table structure and itab stucture same.
*-- internal data tables
DATA: i_yibrk_earnings TYPE STANDARD TABLE OF yibrk_earnings.
I'm using the st:
MODIFY YIBRK_EARNINGS FROM TABLE I_YIBRK_EARNINGS.
All fields are key fields: below is the test data. second row should not be created it...new values has to be modified in first one....
Fields:BAREA PLTYP PLAN_OPT BEGDA ENDDA VALUE_DATE
oldval: space DMP space space space 25.05.2007
newval:space DMP space 01.04.2007 30.06.2007 25.05.2007
‎2007 Feb 07 9:40 AM
Try this
LOOP AT I_YIBRK_EARNINGS.
MODIFY YIBRK_EARNINGS FROM I_YIBRK_EARNINGS.
CLEAR I_YIBRK_EARNINGS.
ENDLOOP.This will update table one by one, its not recommended, just check whether this works.
‎2007 Feb 07 9:44 AM
BR,
You have to use below code
MODIFY dbtable FROM TABLE itab transporting <fields>.
‎2007 Feb 07 9:51 AM
still it is inseting new row rather modify...even if use LOOP statement,,,,TRANSPORTING is not accepting as it has to use to modify only itab.
BAREA PLTYP PLAN_OPT BEGDA ENDDA VALUE_DATE are key fields
BAREA PLTYP PLAN_OPT BEGDA ENDDA VALUE_DATE PERCENTAGE STATUS CNAME CDATE
DMP 25.05.2007 5,0000
DMP 01.04.2007 30.06.2007 25.05.2007 5,0000 1 BR 07.02.2007
‎2007 Feb 07 10:01 AM
Hi,
I got ur problem, it will modify/update only <b>when all the key field values are the same</b>.
In ur case only one field is the same and othe two are blank so it will insert a new row.
Now you try with changing the inserted row with a new values. You can understand.
BAREA PLTYP PLAN_OPT BEGDA ENDDA VALUE_DATE PERCENTAGE STATUS CNAME CDATE
DMP 01.04.2007 30.06.2007 25.05.2007 5,0000 1 BR 07.02.2007
Update this with some new CNAME and CDATE.
Hope this solves ur problem.