02-06-2009 7:08 AM
Hi all,
I am updating the database table with following syntex, but table not updating.
MODIFY ZTEST_BAR FROM TABLE I_ZTESTBAR.
Please help.
PKB
02-06-2009 7:11 AM
hi,
Make sure that the primary key fields are completely specified in the internal table, and they are in the same order/ structure with respect to the database table...
Could you just paste your internal table structure so that, it can be evaluated against your database table...
Thanks
Sharath
02-06-2009 7:15 AM
Hi Sharath,
MANDT C 3 009
BWART C 3 103
HP_SERNR C 18 1234
SERNR C 18 26
MATNR C 18 000000119020000028
MBLNR C 10 5000101371
MJAHR N 4 2009
ZEILE N 4 0001
*WERKS C 4 *
This is structure of my internal table. inthis mandt, bwart and hp_sernr are my key fields which i am selecting from database. Only sernr field i am updating but unable to update table.
02-06-2009 7:18 AM
did you check return code (sy-subrc)? If this is ok (=0), then maybe adding a commit work might do the job.
02-06-2009 7:19 AM
hi,
in the internal table remove the column mandt and also check the value of the primay key fields whether they are matching with the values existing in the DB table for that particulary row and also make sure that there are no duplicate records of the same primary key in the internal table else it shall be over written.
thanks
Sharath
02-06-2009 7:21 AM
02-06-2009 7:52 AM
Hi,
First remove the MANDT field from the intrenal table,
Secondly check the data type of the fileds should match the data element of the fields of the table
thirdly check the sy-subrc value
fourthly use COMMIT after modify to actually inserting the new record if it does not exit or updating the already existing record.
Pooja
02-06-2009 8:34 AM
Hi ,
If the change intended to a line in the internal table will lead to a duplicate entry in the table with the same primary index the values will not be inserted.The other entries which are unique would be inserted.
So please do check the entries in the internal table.
regards,
Radhika
02-06-2009 9:10 AM
02-06-2009 10:11 AM
Hi , no need to give mandt field in the internal table structure .
and thyen you check in the table which is primary key and you should note that your r also giving atlease values for the key fields.
Then you check by putting bereak-point whether data is coimg to the internal table.
Thanks,
Rajendra
02-06-2009 10:28 AM
Hi,
Try this.
LOOP AT IT_TAB.
MOVE-CORRESPONDING IT_TAB TO ZINKT001.
MODIFY ZINKT001.
CLEAR IT_TAB.
ENDLOOP.
02-06-2009 10:38 AM
02-06-2009 11:03 AM
Hi,
The ztable and the internal table from where u modify ztab must hv same primary key.
also the no. of fields ,the complete structure.
If for the value in key of the itab has no record in the ztable, the record gets inserted into the ztable.
and the value in key of the itab has record in the ztable, the record in ztable gets overwritten.
if modification is successful
SY-SUBRC is set to 0. u can check the return code.
SY-DBCNT gives the number of lines in the internal table.
Regards,
Mdi.Deeba Najam.
02-11-2009 5:37 AM
Hi,
firstly you can define internal table and work area as below:-
internal tables
************************************************************************
DATA : I_ZTESTBAR TYPE TABLE OF ZTEST_BAR.
************************************************************************
work areas
************************************************************************
DATA : I_ZTESTBAR_LINE LIKE LINE OF I_ZTESTBAR .
************************************************************************
here internal table having the same structure as that of ztable which include MANDT.
Then to update field, you can use add following code:-
*Update Ztable
************************************************************************
INSERT INTO ZTEST_BAR VALUES I_ZTESTBAR_LINE.
COMMIT WORK.
************************************************************************
Hope this works for you.
Thanks..........
02-11-2009 9:13 AM
hi,
Declare teh internal table as
i_ztable type standard table of ztable.
and then try to modify, this will definately work.
Thank You
02-11-2009 9:14 AM
hi,
Declare teh internal table as
i_ztable type standard table of ztable.
and then try to modify, this will definately work.
Thank You
02-12-2009 8:48 AM
First check that the if the same record is abvailable in table or not ? if the record is available with this data then it will not update it only modify the existing record...