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

Native SQL Regarding

jayakummar
Active Participant
0 Likes
621

Hai Experts,

I need To Insert Values Into Sql Server Table Using EXEC And ENDEXEC Commands.

Can Any one Give Some Suggestion.

<REMOVED BY MODERATOR>

Thanks In Adv,

Jai.M

Edited by: Alvaro Tejada Galindo on Feb 22, 2008 4:38 PM

5 REPLIES 5
Read only

Former Member
0 Likes
595

Hi,

EXEC SQl statement does Native SQL .Normally we use OPEN sql statement.

This is not database specific.So datbase convetor converts into database specific sql statements for our sql statements.This is slow fetching compared to Native sql.

Open SQL allows you to access database tables declared in the ABAP Dictionary regardless of the database platform that you R/3 System is using. Native SQL allows you to use database-specific SQL statements in an ABAP program. This means that you can use database tables that are not administered by the ABAP Dictionary, and therefore integrate data that is not part of the R/3 System.

As a rule, an ABAP program containing database-specific SQL statements will not run under different database systems. If your program will be used on more than one database platform, only use Open SQL statements.

Native SQL Statements in ABAP Programs

To use a Native SQL statement, you must precede it with the EXEC SQL statement, and follow it with the ENDEXEC statement as follows:


REPORT demo_native_sql.

DATA: BEGIN OF wa,
connid TYPE spfli-connid,
cityfrom TYPE spfli-cityfrom,
cityto TYPE spfli-cityto,
END OF wa.

DATA c1 TYPE spfli-carrid VALUE 'LH'.

EXEC SQL PERFORMING loop_output.
SELECT connid, cityfrom, cityto
INTO :wa
FROM spfli
WHERE carrid = :c1
ENDEXEC.

FORM loop_output.
WRITE: / wa-connid, wa-cityfrom, wa-cityto.
ENDFORM.

<REMOVED BY MODERATOR>

Cheers,

Chandra Sekhar.

Edited by: Alvaro Tejada Galindo on Feb 22, 2008 4:39 PM

Read only

0 Likes
595

Hai Chandrasekar,

Purchace Order Information Available For Vendor On WEB Page, That WEB Page Gets Values From One SQl Table Which is Handel by java coding........

that SQL Table Updated With Values fetched From SAP Table(oracle ) EKKO, EKPO With Time Duration Of 1 hour .

Is Thare any possibleities To Update PO Details In SQL DB Through ABAP Coding?

Read only

Former Member
0 Likes
595

Hi,

just write like this,

INSERT INTO EXEC VALUES EXEC_wa.

and same statement for table ENDEXEC,

then work area records can insert into these tables.

seshu.

Read only

Former Member
0 Likes
595

Hi,

EXEC SQl statement does Native SQL .Normally we use OPEN sql statement.

This is not database specific.So datbase convetor converts into database specific sql statements for our sql statements.This is slow fetching compared to Native sql.

Open SQL allows you to access database tables declared in the ABAP Dictionary regardless of the database platform that you R/3 System is using. Native SQL allows you to use database-specific SQL statements in an ABAP program. This means that you can use database tables that are not administered by the ABAP Dictionary, and therefore integrate data that is not part of the R/3 System.

As a rule, an ABAP program containing database-specific SQL statements will not run under different database systems. If your program will be used on more than one database platform, only use Open SQL statements.

Native SQL Statements in ABAP Programs

To use a Native SQL statement, you must precede it with the EXEC SQL statement, and follow it with the ENDEXEC statement as follows:


REPORT demo_native_sql.

DATA: BEGIN OF wa,
connid TYPE spfli-connid,
cityfrom TYPE spfli-cityfrom,
cityto TYPE spfli-cityto,
END OF wa.

DATA c1 TYPE spfli-carrid VALUE 'LH'.

EXEC SQL PERFORMING loop_output.
SELECT connid, cityfrom, cityto
INTO :wa
FROM spfli
WHERE carrid = :c1
ENDEXEC.

FORM loop_output.
WRITE: / wa-connid, wa-cityfrom, wa-cityto.
ENDFORM.

<REMOVED BY MODERATOR>

Cheers,

Chandra Sekhar.

Edited by: Alvaro Tejada Galindo on Feb 22, 2008 4:40 PM

Read only

Former Member
0 Likes
595

Of course, u can use Native SQL commands using EXEC and ENDEXEC

But it leades to extra burden in SAP version upgradation. and it may lead to data base inconsistancy.

U bettr update the tables using BDC / BAPI / Transactions

Reward if useful