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 data base table

Former Member
0 Likes
755

I have custom table zmm_dscs

vth 5 fields and i want to add the 6th field

the 6th field data is filling in my internal table i_netpr

the field is netwr

i want to update my custom table zmm_dscs vth this field

How to do that

Plz suggest its very urgent

my read statmemt is follows where lwa_newnetpr is referening line type of i_netpr

read table lt_newnetpr into lwa_newnetpr with key domth = i_dscs-zz_dteca+6(2).

if sy-subrc = 0 and lwa_newnetpr-kostl = i_dscs-kostl.

i_detl-netwr = lwa_newnetpr-netwr.

endif.

Thanks in advance

Edited by: sukruthi raj on Mar 6, 2008 10:34 PM

8 REPLIES 8
Read only

Former Member
0 Likes
738

Have you added the field in the data dictionary?

Rob

Read only

0 Likes
738

Hi rob

i added the field in the dictionary zz_netpr but i has to fill it

after the read stmt i added

i_dscs-zz_netpr = lwa_newnetpr-netwr.

data:

begin of i_dscs occurs 0.

include structure zmm_dscs.

in debbugging i am able to see that i_dscs is filled

but i cant able to see the data in the custom table zmm_dscs

Plz suggest me

Read only

0 Likes
738

Modify dbtable from table itab.

DBtable and Itab should be of same type.

Read only

0 Likes
738

Hi naren,

but here the DB table and internal table are not of same type

i would like update netwr filed values that are in i_dscs

into table zmm_dscs

In this table i added zz_netpr field

what i have to do is to fill zz_netpr field vth netwr values

Plz any help is highly appreciated

Read only

0 Likes
738

Sukruthi,

Can you please give me the fields in your database table and fields in your internal table?

I would be more helpful if you can pass on me that info.

Thanks,

Naren

Read only

0 Likes
738

there are so many fields in my custom table but kostl and zz_dteca are primary fields

In my internal table there are kostl,zz_dteca,netpr,netwr

are fields

i have to fill the zz_netpr field vth netwr values that i get in internal table

plz help me

Read only

0 Likes
738

Sukruthi,

Then you should define a work area (wa) of your data base table type.

Then select a record from your data base table using the key fields as below.

Select single * (if there are multiple records then use internal table rather than work area in this select statement and dont use SINGLE) from dbtable into work area (use internal table if there are multiple records) inwhere key1 = itab-key1 ......

then move itab-netwr to wa-zz_netpr .

modify dbtable from wa.

Rgds,

Naren

Read only

0 Likes
738

hi naren

this is my select query

select ekpoebeln ekpoebelp ekpomatkl ekponetpr ekponetwr zmm_dprpokostl zmm_dprpozz_dteca ekpoaedat

into corresponding fields of table i_netpr

from

ekpo inner join zmm_dprpo

on zmm_dprporefbn = ekpoebeln

and zmm_dprporfpos = ekpoebelp

where ekpo~matkl eq c_matkl and

zmm_dprpo~kostl in s_kostl and

ekpo~aedat in r_dteca.

sort i_netpr by matkl ebeln ebelp.

delete adjacent duplicates from i_netpr comparing ebeln ebelp.

refresh lt_newnetpr.

loop at i_netpr where zz_dteca+4(2) = p_month.

at new zz_dteca.

clear lwa_newnetpr.

move-corresponding i_netpr to lwa_newnetpr.

lwa_newnetpr-domth(2) = i_netpr-aedat+6(2).

clear lwa_newnetpr-netwr.

endat.

lwa_newnetpr-netwr = lwa_newnetpr-netwr + i_netpr-netwr.

at end of zz_dteca.

append lwa_newnetpr to lt_newnetpr.

endat.

endloop.

plz give me the piece of code

Edited by: sukruthi raj on Mar 7, 2008 2:46 AM