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

insertion of data in database table using forms

Former Member
0 Likes
567

Hi Guys,

I have tried with the answers provided, but still with this form routine and the query below together. Must see that the database table zvehicle is inserted with data from initvechile which is internal table. if any changes are done to the table it should be modified and updated, with out re-inserting the field once again.

please help me out with this, i have never worked on forms before.

FORM vehicle_tab_fill USING p_line LIKE line

CHANGING p_initvehicle LIKE initvehicle.

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
529

Can you please define the issue in bit more detail and is the below your code or the logic you are using...please cut=paste the particular code even.

Regards

Anurag

3 REPLIES 3
Read only

Former Member
0 Likes
530

Can you please define the issue in bit more detail and is the below your code or the logic you are using...please cut=paste the particular code even.

Regards

Anurag

Read only

Former Member
0 Likes
529

Hi,

you´re confusing us with your terms. You´re not working with forms but with subroutines. Forms are for printing information using either SAPscript or SmartForms.

You cannot work with Where in Insert. There´s also en error in your logic, that´s why your getting more lines than necessary.

SELECT SINGLE * FROM zvehicle INTO

table

initvehicle
WHERE vin = zzvin

and market = 'mlemarket'.



IF bukrs = '4010'.

UPDATE zvehicle from table initvehicle.

endif.

Mass update of several lines in a database table. Here, the primary key for identifying the lines to be updated and the values to be changed are taken from the lines of the internal table itab. The lines of the internal table must satisfy the same conditions as the work area wa in addition 1 to variant 2.

that could be an option if you were really working with many records, but I see that you work with only one (SELECT SINGLE), so you can also do this:


IF bukrs = '4010'.
update zvehicle set field = value
WHERE vin = zzvin
and market = 'mlemarket'.
endif.

You better read the documentation for UPDATE, because it´s a dangerous instruction if applied incorrectly:

update zvehicle set: field1 = value1

field2 = value2

WHERE vin = zzvin

and market = 'mlemarket'.

Read only

Former Member
0 Likes
529

Thank you