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

form routine

Former Member
0 Likes
879

Hi Guys,

FORM vehicle_tab_fill USING p_line LIKE line

CHANGING p_initvehicle LIKE initvehicle.

I have got a form, with the help of using and changing parameters. I need to write a query where in the data from the internal table should be inserted into database table and if any changes done to the database element it should modify it and also update the table in the database. with out re inserting the record again.

Is this query correct, if not please correct it and respond to it immediately.

SELECT SINGLE * FROM zvehicle INTO initvehicle

WHERE vin = zzvin.

IF bukrs = '4010'.

INSERT lines of initvehicle into p_initvehicle

where market = 'mlemarket'.

else

insert lines of p_vehicle into table zvehicle

where market = 'nscmarket'.

ENDIF.

UPDATE table zvehicle.

Awaiting to hear from you on it, reply as soon as possible.

cheers,

CHK

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
844

use modify inplace of update and insert. modify works for both update and insert.

7 REPLIES 7
Read only

Former Member
0 Likes
845

use modify inplace of update and insert. modify works for both update and insert.

Read only

Former Member
0 Likes
844

Hi,

Where do u have the select query, inside the form routine or else you do it prior to that????

If you want to ensure that changes are recorded in the DB Instead of update use modify since it either inserts or changes.

Reward if helpful.

Regards

Read only

0 Likes
844

I need to insert it in the form routine. But i am unable to raed the contents from internal table to database. please check with my sql query will then happen correctly.

Read only

Former Member
0 Likes
844

FORM vehicle_tab_fill USING p_line LIKE line

CHANGING p_initvehicle LIKE initvehicle.

user this:

FORM vehicle_tab_fill TABLES p_initvehicle LIKE initvehicle USING p_line LIKE line

.

Read only

Former Member
0 Likes
844

user this:

FORM vehicle_tab_fill TABLES p_initvehicle LIKE STRUCTURE initvehicle USING p_line LIKE line

.

u will get the values and use the MODIFY statemnet..

may be this will help u

Read only

Former Member
0 Likes
844

Hi,

Modify your query as follows :

SELECT SINGLE * FROM zvehicle INTO initvehicle

WHERE vin = zzvin.

append lines of initvehicle into p_initvehicle.

***here i`ve moved all the values from itab1 to itab2.

***Now read itab1 for bukrs condition and modify value ***of the market name.Now by doing this, you`ll have all

***neessary values in table p_initvehicle.

***Always check for the subrc value and then modify the ***database table, since rather than inserting or ***updating, when you modify existing values are changed

***else new values are inserted.

Reward if helpful.

Regards

Read only

Former Member
0 Likes
844

Thank you, for your valuable suggestion.

Regards,

karthik