‎2013 Feb 25 6:08 PM
Hello guys,
Please help. We are using ORACLE DATABASE as backend.
1. I am selecting multiple records from SAP tables and want to insert records using NATIVE SQL, How can I do that any sample code?
2. We have created tables directly in ORACLE therefore using NATIVE SQL. These tables are not part of the SAP instance.
Please help with sample code. Any help will be appreciated.
Thanks,
James
‎2013 Feb 25 6:18 PM
First read some documentation like Native SQL in help.sap.com, also
‎2013 Feb 25 7:47 PM
‎2013 Feb 25 7:05 PM
Hi,
Plesae refer to the below link.Hope its helpful for u.
https://scn.sap.com/thread/1016531
Regards,
Santanu Mohapatra
‎2013 Jul 08 9:12 AM
Hi Jim,
General way inserting data using Native SQL is
EXEC SQL.
INSERT INTO <TABLENAME> (<FIELD1>, <FIELD2>, <FIELD3>)
VALUES (<VALUE1>,<VALUE3><VALUE3>)
ENDEXEC.
Since in your case there is a internal table we require to loop at the table into work area, and the content of the work area is passed to the value.
LOOP it_tab1 into wa_itab1.
INSERT INTO <TABLENAME> (<FIELD1>, <FIELD2>,....<FIELDN>)
VALUES (:wa_itab1-field1,:wa_itab1-field2,.....:wa_itab1-fieldN)
ENDEXEC.
ENDLOOP.
Also refer to below link