‎2008 Jul 08 6:32 AM
Hi Experts,
EXEC SQL.
select APID_SEQ.NEXTVAL INTO :v_apid FROM DUAL
ENDEXEC.
I could not understand that pgm!
How is prepared for it?
Plz reply me soon,
Thx,
S.Suresh.
‎2008 Jul 08 6:45 AM
EXEC SQL [PERFORMING subr].
...
ENDEXEC.
These statements define an area in an ABAP program in which one or more Native SQL statements are to be carried out. The area between EXEC and ENDEXEC is not completely checked by the syntax check. The statements entered there are passed to the Native SQL interface and processed there as follows:
Almost all SQL statements that are valid for the addressed database system can be included between EXEC and ENDEXEC, in particular the DDL statements. These SQL statements are passed from the Native SQL interface to the database system largely unchanged. The syntax rules are specified by the database system, in particular the case sensitivity rules for database objects. If the syntax allows a separator character between individual statements, you can include several Native SQL statements between EXEC and ENDEXEC. Generally, the semicolon ( is used as the separator character.
You can also include SAP-specific Native SQL language elements between EXEC and ENDEXEC. These statements are not passed directly from the Native SQL interface to the database, but are converted appropriately. These SAP-specific language elements are::
EXCEC SQL PERFORMING subr.
SELECT ... INTO :wa1 :wa2 ...
ENDEXEC.
Effect
If the PERFORMING addition that is forbidden in classes is specified after EXEC SQL, the native SQL interface performs an implicit cusor edit.
Only a SELECT statement can be used as a native SQL statement. The native SQL interface starts a cursor for the SELECT statement and reads the appropriate data, row by row. After each successful read of a row, the subr subroutine is called. The subr subroutine must be defined in the same ABAP program and must not have any parameter interface.
When the host variables specified in the SELECT statement after INTO are global data objects of the ABAP program, they can be evaluated in the subroutine. In the subroutine, sy-dbcnt gets the number of rows read so far and sy-subrc is set to the value 0. After the ENDEXEC statement, sy-dbcnt contains the number of rows read altogether so far and sy-subrc is set to value 4 since no more lines could be read using the implicit cursor.
‎2008 Jul 08 6:34 AM
Hi
To use a Native SQL statement, you must precede it with the EXEC SQL statement, and follow it with the ENDEXEC statement as follows:
EXEC SQL PERFORMING <form>
<Native SQL statement>
ENDEXEC.
check out this link it helps you a lot
http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3b8b358411d1829f0000e829fbfe/content.htm
Regards
Pavan
Edited by: Pavan Bhamidipati on Jul 8, 2008 7:34 AM
‎2008 Jul 08 6:37 AM
hi,
Here you are placing the next value of APID_SEQ into v_apid.
FROM DUAL is for using DUAL table which to provide a table for joining in internal views.
To read more about Dual Tables refer to this link.
[http://en.wikipedia.org/wiki/DUAL_table]
Hope this will Help.
Regards
Sumit Agarwal
‎2008 Jul 08 6:43 AM
Hi Sumit Agarwal,
I could not get output that program!!
Plz how is change configure that?
Reply me soon,
S.Suresh.
‎2008 Jul 08 7:00 AM
‎2008 Jul 08 6:39 AM
Hello suresh,
The given code is a combination of native sql & dual table concept in sap .Check this out for that.
NATIVE SQL
http://help.sap.com/saphelp_46c/helpdata/en/fc/eb3b8b358411d1829f0000e829fbfe/content.htm
DUAL TABLES
ftp://mirrors.ircam.fr/pub/mysql/doc/maxdb/en/10/a80342ed386824e10000000a1550b0/content.htm
Regards,
Bhumika
‎2008 Jul 08 6:39 AM
It is a Native SQL statement.
Refer the Documentation..
http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3b8b358411d1829f0000e829fbfe/content.htm
‎2008 Jul 08 6:41 AM
‎2008 Jul 08 6:45 AM
EXEC SQL [PERFORMING subr].
...
ENDEXEC.
These statements define an area in an ABAP program in which one or more Native SQL statements are to be carried out. The area between EXEC and ENDEXEC is not completely checked by the syntax check. The statements entered there are passed to the Native SQL interface and processed there as follows:
Almost all SQL statements that are valid for the addressed database system can be included between EXEC and ENDEXEC, in particular the DDL statements. These SQL statements are passed from the Native SQL interface to the database system largely unchanged. The syntax rules are specified by the database system, in particular the case sensitivity rules for database objects. If the syntax allows a separator character between individual statements, you can include several Native SQL statements between EXEC and ENDEXEC. Generally, the semicolon ( is used as the separator character.
You can also include SAP-specific Native SQL language elements between EXEC and ENDEXEC. These statements are not passed directly from the Native SQL interface to the database, but are converted appropriately. These SAP-specific language elements are::
EXCEC SQL PERFORMING subr.
SELECT ... INTO :wa1 :wa2 ...
ENDEXEC.
Effect
If the PERFORMING addition that is forbidden in classes is specified after EXEC SQL, the native SQL interface performs an implicit cusor edit.
Only a SELECT statement can be used as a native SQL statement. The native SQL interface starts a cursor for the SELECT statement and reads the appropriate data, row by row. After each successful read of a row, the subr subroutine is called. The subr subroutine must be defined in the same ABAP program and must not have any parameter interface.
When the host variables specified in the SELECT statement after INTO are global data objects of the ABAP program, they can be evaluated in the subroutine. In the subroutine, sy-dbcnt gets the number of rows read so far and sy-subrc is set to the value 0. After the ENDEXEC statement, sy-dbcnt contains the number of rows read altogether so far and sy-subrc is set to value 4 since no more lines could be read using the implicit cursor.
‎2008 Jul 08 6:45 AM
‎2008 Jul 08 7:06 AM
hi,
plz send me ur mail ID.
i will send u with that file.
Regards,
S.Suresh.
‎2008 Jul 08 6:52 AM
Hi,
We can retrieve data from Database using OPEN SQL and NATIVE SQL .
Generally the SQL statements which we use in our ABAP programs are OPEN SQL statements.
If you want to use NATIVE SQL statements then write between
EXEC SQL. and ENDEXEC.
Database understands only SQL commands. But what ever we write in OPEN SQL are internally SQL statements only.
The DATABASE UTILITY is the interface between the ABAP Dictionary and the relational database underlying the R/3 System.
Regards,
Rajitha.
Edited by: Rajitha Muthineni on Jul 8, 2008 11:37 AM