04-30-2007 12:30 PM
Hi all,
Can any body give me syntax for Native SQL command 'INSERT' with example.
Thanks & Regards,
Seshagiri.
04-30-2007 1:41 PM
Hai sheshgiri,
Here is the complete code( with syntax).
Go through it.
REPORT Z_NATIVE_SQL.
PARAMETERS p_carrid TYPE spfli-carrid.
DATA:
carrid TYPE spfli-carrid,
connid TYPE spfli-connid,
cityfrom TYPE spfli-cityfrom,
cityto TYPE spfli-cityto.
EXEC SQL.
OPEN dbcur FOR
SELECT distinct carrid,connid,cityfrom, cityto
FROM spfli
WHERE carrid = :p_carrid
ENDEXEC.
DO.
EXEC SQL.
FETCH NEXT dbcur INTO :carrid, :connid, :cityfrom, :cityto
ENDEXEC.
IF sy-subrc <> 0.
EXIT.
ELSE.
WRITE:
/ carrid,connid, cityfrom, cityto.
ENDIF.
ENDDO.
EXEC SQL.
CLOSE dbcur
ENDEXEC.
Hope this helps you.
Regds,
Ram chary.Pammi
04-30-2007 4:46 PM
Hi,
Thanks for your quick info.
But i couldn't find any INSERT command in the example code.
I am working in ECC 6.0 version.
I have fetched data using OPEN-SQL statements into my internal table,which is 5 records.
Actually i need to insert the data into a database table of another server of MS-SQL(with VB as front end).
Can you please show me the INSERT command for this scenario?
Thanks & Regards,
Seshagiri.
04-30-2007 5:14 PM
Hi,
Please help.
The scenario i was telling you is as follows:
===================================
My requirement is to transfer some data from SAP(ECC 6.0) to another NON-SAP server (MS-SQL database system) using Native SQL commands.I have the limitation that I should not write code in MS-SQL system.
My code in ABAP is as shown below:
********************************************************
REPORT ZDATA_TEST_GIRI4.
data: begin of it_customer occurs 0,
kunnr like kna1-kunnr, CHAR - 10
name1 like kna1-name1, CHAR - 35
end of it_customer.
select kunnr
name1
up to 5 rows into table it_customer
from kna1.
*--Code for data transfer using Native SQL statements
*--(Yet to be written...)
(Some information):
In the MS-SQL system,the
target table name is : customers
Fields are:
CustomerNo - Data type - LONG
CustomerEName - Data type - TEXT(35)
(1)Can you please,give me the Native SQL statements(preferably the source code),like data declarations,insert commands for data transfer from it_customer to target table customers.
(2)And data retrieval statements to cross check whether data is inserted sucessfully or not?
Note: Also please tell me how to cross check that the connection is correctly established between SAP and MS-SQL servers?
Thanks & Regards,
Seshagiri.M.
04-30-2007 5:43 PM
Hi seshagiri,
1. If you sap server is UNIX/AIX operating system,
then probably this kind of secondary database connection
to MSSQL Server (Microsoft OS)
2. is not possible at present.
3. Bcos the dll/system files required,
are not provided by SAP for such connection.
regards,
amit m.
04-30-2007 2:50 PM
Hi,
Please check this sample code.
*Create new HWID
EXEC SQL.
INSERT INTO CTXTB_PACKDATA
(HWID, CODE, SRS, AM, UCID, STOPLEVEL)
VALUES (:LWA_HWID, :LWA_CODE, :LWA_SRS, :LWA_AM, '0', '0')
ENDEXEC.
Regards,
Ferry Lianto
04-30-2007 4:55 PM
Hi,
Thanks for quick info.
Can you please give me source code with Native SQL commands for following ABAP program:
******************************************************************************************
Hi,
My task is to transfer some data from SAP(ECC 6.0) to another NON-SAP server (MS-SQL database system).I have the limitation that I should not write code in MS-SQL system.
My code in ABAP is as shown below:
********************************************************
REPORT ZDATA_TEST_GIRI4.
data: begin of it_customer occurs 0,
kunnr like kna1-kunnr, CHAR - 10
name1 like kna1-name1, CHAR - 35
end of it_customer.
select kunnr
name1
up to 5 rows into table it_customer
from kna1.
*--Code for data transfer using Native SQL statements
*--(Yet to be written...)
(Some information):
In the MS-SQL system,the
target table name is : customers
Fields are:
CustomerNo - Data type - LONG
CustomerEName - Data type - TEXT(35)
(1)Can you please,give me the Native SQL statements(preferably the source code),like data declarations,insert commands for data transfer from it_customer to target table customers.
(2)And data retrieval statements to cross check whether data is inserted sucessfully or not?
Note: Also please tell me how to cross check that the connection is correctly established between SAP and MS-SQL servers?
Thanks & Regards,
Seshagiri.M.
04-30-2007 3:57 PM
Native SQL syntax depends on your database system. So, what database do you use?
Rob
04-30-2007 4:34 PM
09-12-2007 12:59 AM
I have to insert some 100 records from SAP ECC 6.0 to another legacy system whose database is oracle.
I am able to insert one record, but i am not sure of inserting all the 100 records.
How do i loop etc in between exec sql and endexec.
NOTE: I have the data in sap in internal table and custom table as well.
INSERT INTO KM.CIP_AGREEMENT_DETAILS
( SLC_ID, AGREEMENT_ID, AGREEMENT_TYPE_ID, AGREEMENT_START_DATE, AGREEMENT_END_DATE )
VALUES ( 0000000000955, 0000000033555, 005, '01-JAN-2007', '02-03-2008' )