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

Insert values from FM into a DB table

Former Member
0 Likes
1,129

Hi ,

I have an issue.

I have a screen field which stores data into a database table for the screen guid .the problem is s stores only one value .Every time it is saved with a new value…it should add the new value to the old one and replace the field value with it.

Example if the

field_val = 10 and is saved with 20 again It shows only 20.but I have to code it like it shows 30 and this must be saved into the DB table.

Anyone help me out.

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
999

Hi

what i understand is u have to add ur old value to new value then u want to save it.

if i m right then,

select single <oldvalue> from <tab1> into v_oldvalue where......

v_newvalue = v_newvalue+v_oldvalue.

update .......with v_newvalue......

like this u have to code

Regs

Manas Ranjan Panda

7 REPLIES 7
Read only

Former Member
0 Likes
999

You will have to take care of that in your code to get the old value and add that to the new value.

Have you written any code?

Regards,

Ravi

note - Please mark all the helpful answers

Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
999

Hi,

U can fetch the old value from DB table and try like this:

select single value from into l_value dbtab where = .

L_value = l_value + field_val.

so it will store value as 30.

Modify dbtab .

clear l_value.

Hope this helps.

Read only

Former Member
0 Likes
999

hi Bharat,

1.read the value into your program using a select statement from DB

2. add the value with the value coming from screen field

3.modify the database table.

if you are dealing with multiple records:

1.select the value into internal table from the DB

2. loop the tbale and add the screen field value to the internal table field value

3.modify the database table using internal table.

Hope this helps.

Sajan.

Read only

Former Member
0 Likes
999

Hi,

I think you can do some thing like this

Initially fetch the value form the db table and then assign the value to the variable and add the new screen value to it

ur table value will be stored in itab-x

ur screen value will be stored in y

itab-x = itab-x+ y

modify itab transporting x

Regards

Yamini

Read only

Former Member
0 Likes
1,000

Hi

what i understand is u have to add ur old value to new value then u want to save it.

if i m right then,

select single <oldvalue> from <tab1> into v_oldvalue where......

v_newvalue = v_newvalue+v_oldvalue.

update .......with v_newvalue......

like this u have to code

Regs

Manas Ranjan Panda

Read only

0 Likes
999

How do I modify the DB table.What is the syntax for that?

Message was edited by:

bharat pkm

Read only

0 Likes
999

Hi

Update <tab1> set <fieldname> with v_newvalue where <primary_keyfield> = <fieldvalue> and <fieldname> = v_oldvalue.

Regs

Manas Ranjan Panda

Message was edited by:

MANAS PANDA

Message was edited by:

MANAS PANDA