‎2007 Oct 12 11:17 AM
hi all,
can i insert data into database table taking the data from user through select option statements.
‎2007 Oct 12 11:24 AM
Hi
Make use of the following statement in a similar way as shown below,
INSERT <DATABASE TABLE NAME> FROM TABLE <INTERNAL TABLE>.
Note that the internal table has the same structure as the database table.
No need of looping at the internal table.
OR
Check the below process:
First declare one internal table :
data : i_ztreglog like ztreglog occurs 0 with header line." Internal table
data : wa_ztreglog like line of i_ztreglog. " Work area
start-of-selection.
move wa_ztreglog to i_ztreglog.
append i_ztreglog.
MODIFY ztreglog FROM TABLE i_ztreglog.
<b>Reward if usefull</b>
‎2007 Oct 12 11:19 AM
You can do that in case of custom tables if that s ur requirement.
But in case of std tables you have to enter it through a Transaction which will update the table.
‎2007 Oct 12 11:21 AM
take data from select-options into internal table and then use BDC to upload data....as insert statement is risky if u use insert statement...as validations are skipped.....
so use BDC.....
Regards
Vasu
‎2007 Oct 12 11:24 AM
‎2007 Oct 12 12:08 PM
check which transaction code is used to update data in ur database table....
if u find that then goto SHDb...do a recording .....and generate program.....use taht code in ur se38 program......then use call transaction method or session method to upload data into that transaction...which in turn will update database table.....
if u don't find transaction....then just transafer select-options data into internal tabel and use...
insert databasetable from internaltable.
Regards
vasu
‎2007 Oct 12 11:22 AM
Hi Samir,
U can directly insert data in any database table.
Thank you.
‎2007 Oct 12 11:24 AM
Hi
Make use of the following statement in a similar way as shown below,
INSERT <DATABASE TABLE NAME> FROM TABLE <INTERNAL TABLE>.
Note that the internal table has the same structure as the database table.
No need of looping at the internal table.
OR
Check the below process:
First declare one internal table :
data : i_ztreglog like ztreglog occurs 0 with header line." Internal table
data : wa_ztreglog like line of i_ztreglog. " Work area
start-of-selection.
move wa_ztreglog to i_ztreglog.
append i_ztreglog.
MODIFY ztreglog FROM TABLE i_ztreglog.
<b>Reward if usefull</b>
‎2007 Oct 12 11:29 AM
hi
you can make use of
INSERT INTO table VALUES wa
or insert into table FROM wa/ table i tab
you can use the update stattement as well
regards
Gururaj
‎2007 Oct 12 11:41 AM
Hi,
You can insert the data into the tables using the report (SE38). If you are going to insert the data to customized tables it is recommended. But if you want to insert the data to Standard tables it is not recommended because in SAP the data is inserted to tables using transaction codes, using this tcodes the data in one will be simultaneously updated in many different tables. If you try to insert data thru program to standard prg it is not advisable.
If you want to insert data into customized tables use the below code :
DATA: wa TYPE scustom.
wa-id = '12400177'.
wa-name = 'Robinson'.
wa-postcode = '69542'.
wa-city = 'Heidelberg'.
wa-custtype = 'P'.
wa-discount = '003'.
wa-telephone = '06201/44889'.
INSERT INTO scustom VALUES wa.
Thanks,
Sriram Ponna.
‎2007 Oct 12 11:43 AM
hi,
INSERT <DATABASE TABLE NAME> FROM TABLE <INTERNAL TABLE>.
try like this.
data: itab like mara occurs 0 with header line.
itab-matnr = 9393.
itab-maktx = 'aluri'.
append itab.
loop at itab.
modify itab1313 from itab.
endloop.
where itab1313 is a database table.
with out loop u have to mention index as
modify itab1313 from itab index sy-index or 13.
if helpful reward some points.
with regards,
Suresh Aluri.