‎2010 Feb 03 10:04 AM
Hi friends,
Iam having a tablecontrol where iam gettting the data from the ztable for a particular key field. When i change certain fields in the table control and when i click save, it should update the changes in the ztable.
module save output.
modify zslip_po1 from table x_po1_slip.
here slpno is the key field. if I change a field for a particular slpno it should update the changes for that slpno value only.
but it is not updating the changes. although iam setting the slpno field dynamically.
Please give me ideas.
thanks and regards
Murali Krishna T
‎2010 Feb 03 10:26 AM
Hi,
Just use
MODIFY ZTAB FROM ITAB " without using TABLE
AND ensure that the structure of internal table ITAB matches exactly with the database table
‎2010 Feb 03 10:26 AM
Hi,
Just use
MODIFY ZTAB FROM ITAB " without using TABLE
AND ensure that the structure of internal table ITAB matches exactly with the database table
‎2010 Feb 03 11:04 AM
Hi Radhika,
I think the response you have given works for inserting new records to the ztable. But this is not the case for my requirement. Iam having already some records. I need to change the data and update in the database ( ztable).
For this iam using a table control which gets the data from ztable. Iam changing already existed data and When i save , it should update in the ztable.
Please provide your suggestions,
thanks
Regards
Murali Krishna T
‎2010 Feb 03 11:24 AM
Hi,
Have you tried debugging?
I think the problem is your changed data are not getting populated into the internal table. It seems to be retaining the data that you pulled initially from the database table.
In the PAI
LOOP AT itab.
MODULE perform_change.
ENDLOOP.
MODULE perform_change INPUT.
"After the changed data has been captured into the work area
MODIFY itab FROM wa_tab INDEX tab_con-CURRENT_LINE.
ENDMODULE.
‎2010 Feb 03 1:56 PM
Hi Nitwick,
I have already used the append module and it is populating the internal table with the changed data.
Please suggest me how to pick one particular record from ztable so that we can modify the changed record in ztable.
My scenario :
I had slpno (Gate Number) as key field. For single slpno, there may be multiple records in the ztable.
So, in tablecontrol iam fetching the records for one particular slpno.
Then, Iam changing one record from tablecontrol. After clicking SAVE button, it should pick the appropriate slpno in the ztable and update the change I did in the tablecontrol.
Thanks for you views,
Murali Krishna T
‎2010 Feb 04 12:06 PM
Hi,
1. Have 2 Internal Tables, the first one must contain the original data(before change ) and the second one contains the update data(after changed ie. table control data).
2. loop the first table and read the data from the second table using index.
3. inside the loop, compare the work area of both the internal table.
if both are same, then no change was made to that particular record, so no need for updation
if both are not same, then some changes were made on that record, so need to update.
4. use modify command to update that particular record from the work area.
i think in performance wise also this logic will be helpful, since we are updating only the changed record.
since this is addon table, so i hope the no of records will also less, so no need to worry about loop.
check with this, it may work out......
thank you,
SenthilPandi C
Edited by: SenthilPandi ChandraSekaran on Feb 4, 2010 5:36 PM