Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

update ztable

Former Member
0 Likes
799

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
772

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

6 REPLIES 6
Read only

Former Member
0 Likes
773

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

Read only

0 Likes
772

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

Read only

0 Likes
772

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

Read only

0 Likes
772

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

Read only

Former Member
0 Likes
772

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.

Read only

Former Member
0 Likes
772

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