‎2006 Aug 18 4:05 PM
hi,
i need to update 5 fields from internal table into single ztable field.
i have 10 fields in file comprising 5 month fields(month1 month2 ....). from that i need to update values to single field in ztable of month.
is there any procedure to do so.
thanks and will be rewarded helfull suggestions.
‎2006 Aug 18 4:07 PM
It is difficult to understand your requirement can you please explain with example so that the forum can suggest a soln.
---
Do you mean that you have 10 fields in the file out of which 5 are month fields and you need to update the 5 month fields into a single ztable field.
It depends on how do you wish to store the field in the ztable but you can use CONCATENATE statement two join fields. So in your case it would be
CONCATENATE MONTH1 MONTH2 MONTH3 MONTH4 MONTH5 INTO ZTABLE-FIELD.
Please note you can use the SEPARATED BY variation if you wish to delimit the above fields.
Regards
Anurag
Message was edited by: Anurag Bankley
‎2006 Aug 18 4:07 PM
It is difficult to understand your requirement can you please explain with example so that the forum can suggest a soln.
---
Do you mean that you have 10 fields in the file out of which 5 are month fields and you need to update the 5 month fields into a single ztable field.
It depends on how do you wish to store the field in the ztable but you can use CONCATENATE statement two join fields. So in your case it would be
CONCATENATE MONTH1 MONTH2 MONTH3 MONTH4 MONTH5 INTO ZTABLE-FIELD.
Please note you can use the SEPARATED BY variation if you wish to delimit the above fields.
Regards
Anurag
Message was edited by: Anurag Bankley
‎2006 Aug 18 4:26 PM
scenario is i have file which i have to update to ztable and display.
in th efile i have fields in the manner of
matnr country ....month1 month2 month3 month4 month5.
i have ztable with five fields matnr country...month.
i need to update the values of all month fields from the file to the month filed of ztable.
any sample code is helpul to me.
thanks
‎2006 Aug 18 4:29 PM
loop at itab.
lmth = month1 + month2 + month3 + month4 + month5.
update ztable set month = lmth
where matnr = itab-matnr and
country = itab-country.
endloop.
--where itab is the internal table having the 10 fields.
Regards
Anurag
‎2006 Aug 18 4:32 PM
Hi,
try this..
concatenate all month values from file into songle local field in program and then use update logic as specified. i hope you might be having data in z table already. if so this logic works.otherwise you have to use insert
regards,
sundaramj
‎2006 Aug 18 4:23 PM
Hi,
You can use this logic...
update <table name>
set <field name> = value
where condition.
ex: to update address1 & address2 fields of zemp table for empid 0001...
update zemp
set address1 = 'test'
address2 = 'test1'
where empid = '0001'.
hope this should work.
regards,
sundar.
‎2006 Aug 18 4:24 PM
Hi,
If you want to add all the months into a single field :
loop at itab into wtab.
l_count = wtab-fiedl1 + wtab-field2 + wtab-field3 + wtab-field4.
wa_new-month = l_count.
append wa_new to it_new.
clear : l_count,
wa_new,
wtab.
endloop.
Best regards,
Prashant