‎2007 Apr 24 4:34 AM
Hello,
I have a internal table (t_itab) with shipref no and I want to update the database table (z1sd_05) with the statement "UPDATE z1sd_05 from table t_itab."
But in my database table z1sd_05, there are 20+ fields more like date, time, username etc., My question is when I update the shipref no to database table, is date, time, username is also going to update in the database table or not?..
If not, how to achive this functionality?..
Here, date, time, username are all system fields.
Regards,
Shreekant
‎2007 Apr 24 4:37 AM
Hi Shreekant ,
The value will not be updated automatically , you will have to do it.
For this i would suggest you to use an internal table which has all the feilds of the table you want to populate and populate the internal table with value and use the internal table to update the table.
Regards
Arun
‎2007 Apr 24 4:51 AM
Hi Arun,
Actually, I need to append shipref no to to my internal table which is type of my database table. So, I will end up with only shipref no in my internal table so how to populate the values like date, time, username to my internal table.
Please reply me.
Regards,
Shreekant
‎2007 Apr 24 5:00 AM
Hi Shreekant ,
I am sorry i am not clear with your requirement .
My understanding is that you need to add records to the data base table , these records will be in an internal table , now in this internal table , the value which you retreive is shipref , rest of the feilds are to be populated with current system data like data , time , username , if this is the case then you have to define an internal table with all the feilds of you database table , once the value of shipref is populated then modify the internal table with the values of data , time and username , they will be system feilds like sy-uname , check the table SYST for more details .
Hope this helps. In case you have more queries feel free to revert back.
Regards
Arun
‎2007 Apr 24 5:09 AM
Hi Arun,
U understood my requirement, I already populated shipref to my internal table wihich is having all the fields of my database table. Next how do I modify date, time etc. based on my shipref no?... If u have any sample code, please send me..
Actually I am little new to ABAP.
Thanks,
Shreekant
‎2007 Apr 24 4:48 AM
shreekant,
Below are the syntax for Updation.Based on sysntax it will happen.Suppose if you
use first one only those fields will update in database table.If you use third syntax it will update all the fields in database table by internal table fields.
1. UPDATE dbtab SET f1 ... fn.
3. UPDATE dbtab FROM TABLE itab. or
UPDATE (dbtabname) FROM TABLE itab.
So if you want to update all use first syntax
UPDATE z1sd_05 SET shipref_no = itab-shiref_no
date = sy-datum
time = sy-uzeit
username = sy-uname.
Don't forget to reward if useful...