SQL QUERY IN ABAP
Dear ABAP Experts,
Is there any possibility to see the SQL statement for the query which are designed by the SQVI queries.?
Like SQL Server, we design the query in query designer and sql statements are also shown in it .
Regards,
Aneel
Yes we can design but to get the sql query we have to generate the report and then get the sql statement from that report.
But I want to get only sql statement immediately. If you have used the MS sql server , It gives sql statements under the query designer in the same window. I mean you can design the quuery and as well as write the sql statements in the same window.
Similar Messages
-
How to execute this SQL Query in ABAP Program.
Hi,
I have a string which is the SQL Query.
How to execute this sql Query (SQL_STR) in ABAP Program.
Code:-
DATA: SQL_STR type string.
SQL_STR = 'select * from spfli.'.
Thanks in Advance,
VinayHi Vinay
Here is a sample to dynamically generate a subroutine-pool having your SQL and calling it.
REPORT dynamic_sql_example .
DATA: BEGIN OF gt_itab OCCURS 1 ,
line(80) TYPE c ,
END OF gt_itab .
DATA gt_restab TYPE .... .
DATA gv_name(30) TYPE c .
DATA gv_err(120) TYPE c .
START-OF-SELECTION .
gt_itab-line = 'REPORT generated_sql .' .
APPEND gt_itab .
gt_itab-line = 'FORM exec_sql CHANGING et_table . ' .
APPEND gt_itab .
gt_itab-line = SQL_STR .
APPEND gt_itab .
gt_itab-line = 'ENDFORM.' .
APPEND gt_itab .
GENERATE SUBROUTINE POOL gt_itab NAME gv_name MESSAGE gv_err .
PERFORM exec_sql IN PROGRAM (gv_name) CHANGING gt_restab
IF FOUND .
WRITE:/ gv_err .
LOOP AT gt_result .
WRITE:/ .... .
ENDLOOP .
*--Serdar -
Normal SQL Query othern than Native
Can we use normal SQL query in ABAP?
if yes what are the various statements we have..Hi,
Refer the select statement ..
*Code to demonstrate select command
*Code to demonstrate select into internal table command
TYPES: BEGIN OF t_bkpf,
include structure bkpf.
bukrs LIKE bkpf-bukrs,
belnr LIKE bkpf-belnr,
gjahr LIKE bkpf-gjahr,
bldat LIKE bkpf-bldat,
monat LIKE bkpf-monat,
budat LIKE bkpf-budat,
xblnr LIKE bkpf-xblnr,
awtyp LIKE bkpf-awtyp,
awkey LIKE bkpf-awkey,
END OF t_bkpf.
DATA: it_bkpf TYPE STANDARD TABLE OF t_bkpf INITIAL SIZE 0,
wa_bkpf TYPE t_bkpf.
TYPES: BEGIN OF t_bseg,
*include structure bseg.
bukrs LIKE bseg-bukrs,
belnr LIKE bseg-belnr,
gjahr LIKE bseg-gjahr,
buzei LIKE bseg-buzei,
mwskz LIKE bseg-mwskz, "Tax code
umsks LIKE bseg-umsks, "Special G/L transaction type
prctr LIKE bseg-prctr, "Profit Centre
hkont LIKE bseg-hkont, "G/L account
xauto LIKE bseg-xauto,
koart LIKE bseg-koart,
dmbtr LIKE bseg-dmbtr,
mwart LIKE bseg-mwart,
hwbas LIKE bseg-hwbas,
aufnr LIKE bseg-aufnr,
projk LIKE bseg-projk,
shkzg LIKE bseg-shkzg,
kokrs LIKE bseg-kokrs,
END OF t_bseg.
DATA: it_bseg TYPE STANDARD TABLE OF t_bseg INITIAL SIZE 0,
wa_bseg TYPE t_bseg.
*Select directly into an internal table
SELECT bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart
dmbtr mwart hwbas aufnr projk shkzg kokrs
FROM bseg
INTO TABLE it_bseg.
Select directly into an internal table where fields are in a
different order or not all fields are specified
SELECT bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart
dmbtr mwart hwbas aufnr projk shkzg kokrs
FROM bseg
INTO CORRESPONDING FIELDS OF TABLE it_bseg.
*Select... endselect command
SELECT bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart
dmbtr mwart hwbas aufnr projk shkzg kokrs
FROM bseg
INTO wa_bseg.
APPEND wa_bseg TO it_bseg.
ENDSELECT.
*Select FOR ALL ENTRIES command
SELECT bukrs belnr gjahr bldat monat budat xblnr awtyp awkey
UP TO 100 ROWS
FROM bkpf
INTO TABLE it_bkpf.
IF sy-subrc EQ 0.
The FOR ALL ENTRIES comand only retrieves data which matches
entries within a particular internal table.
SELECT bukrs belnr gjahr buzei mwskz umsks prctr hkont xauto koart
dmbtr mwart hwbas aufnr projk shkzg kokrs
FROM bseg
INTO TABLE it_bseg
FOR ALL ENTRIES IN it_bkpf
WHERE bukrs EQ it_bkpf-bukrs AND
belnr EQ it_bkpf-belnr AND
gjahr EQ it_bkpf-gjahr.
ENDIF.
Regards,
Saran -
How to execute an SQL query present in a string inside an ABAP program?
hello,
How to execute an SQL query present in a string inside an ABAP programRaut,
You can execute Native SQl statements.
Ex: 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.
There is no period after Native SQL statements. Furthermore, using inverted commas (") or an asterisk (*) at the beginning of a line in a native SQL statement does not introduce a comment as it would in normal ABAP syntax. You need to know whether table and field names are case-sensitive in your chosen database.
In Native SQL statements, the data is transported between the database table and the ABAP program using host variables. These are declared in the ABAP program, and preceded in the Native SQL statement by a colon (:). You can use elementary structures as host variables. Exceptionally, structures in an INTO clause are treated as though all of their fields were listed individually.
If the selection in a Native SQL SELECT statement is a table, you can pass it to ABAP line by line using the PERFORMING addition. The program calls a subroutine <form> for each line read. You can process the data further within the subroutine.
As in Open SQL, after the ENDEXEC statement, SY-DBCNT contains the number of lines processed. In nearly all cases, SY-SUBRC contains the value 0 after the ENDEXEC statement. Cursor operations form an exception: After FETCH, SY-SUBRC is 4 if no more records could be read. This also applies when you read a result set using EXEC SQL PERFORMING.
EXEC SQL PERFORMING loop_output.
SELECT connid, cityfrom, cityto
INTO :wa
FROM spfli
WHERE carrid = :c1
ENDEXEC.
Pls. Mark If useful -
SQ01 DIsplay Problem (Can v write abap code ) Sql Query
Hi
Need help in SQL Query
I generated one sql query which has the following output in general .
Customer name description amount
asrq1 sharekhan Amount payed 10
asrq1 sharekhan Amount Advance 20
asrq1 sharekhan Amount due 30
but i need the output in the following way
Customer name AMount payed Amount Advance Amount Due
asrq1 sharekhan 10 20 30
and iam new this sql query but came to know we can write code ..but iam unable to initiliaze to write
a peace of code as i dont know what are the select-options defined ..i saw in the include but didnt got it
% comes prefix of select-options,and iam unable to get he internal table which is displayed in the query .
can anyone help me in this answers will be awarded points.First, I will suggest to go for ABAP report for this kinda requirement.
If you really want to go for it through SQ01, even then you will have to write some ABAP to display the records in one row. You will need to create three custom fields.
I will give Psudo for one field:
Field Name := ZAmountPayed
Select Amount_Payed into varAmountPayed from Table Where Emp# = '12345'
ZAmountPayed := varAmountPayed
Convert the above into relative ABAP code and create 2 more similar fields, and you should be all set.
You have to know the table names and any other calculations to get the right data. -
Is it possible to write an abap code be SAP SQL query.(ECC 6)
hello guys,
Is it possible to write an abap code be SAP SQL query.
Scenario : table A has a field say f1 of length 10 and table B has a field say s1 of lenght 20. in sap sql i am able to link all the other tables but i am not able to link
table Af1 --->Table Bs1. as the length doesnot match. so is it possibel that using abap code I can pick 10 characters from table A field f1 adjust it to 20 characters using abap and map it to field s1 of table B.
Please let me know how to accomplish this if possible.
thanks in advance!!Herm,
Adding code is done in the infoset.
Please do following:
> Goto SQ02
> Type in the infoset that the basis for your query, <change>
> Press <code> OR <shift><f8>
> Tou'll see 4 tabs: Extras, Selections, Code, Enhancements.
> GoTo tab Code
> Choose the coding section (<f4> gives you an overview)
> Enter the code.
You may set a breakpoint to see what the query in SQ01 will do with it.
Succes!
Frank -
SQL query execution in DB02 hangs if record set is more than 50000
Hi,
We are facing issue in a report performance. The return is using native SQL query.
There are custom views created ar database level for pricing/maetrial and stock. The native sql query is written on these views. The report takes around 15 mins to run in background .
We are trying to analyse the native SQL query through DB02. I tried fetching records for one particular
custom view to make out if its indexing issue or something else.When i using TOP 35000 records with select query runs fine with this dataset or less than this . If i increase it to 40000 system doesn;t show anything in SQL ouptut. And above one lakh records system gives timeout.
The count in this view gives some 10 lakh records which I don't feel is v.v.huge that query that too native sql takes so much time.
Any help on this will be highly appreciated.
Regards
Madhuwhat do you expect from that poor information.
do you change data or onyl select.
If you use SAP and ABAP, then you should also use Open SQL.
Otherwise it is possible to run the SQL Trace with Native SQL, it is anyway only Native SQL, what the trace sees.
Use package size and it will probably work fine.
Siegfried -
Need to send success or failure message to BAPI of SQL query action block
Hi All,
I need to send success or failure message(i.e. 1 or 0) to BAPI which has been called below sql query action block in transaction
Here in SAP, i have created on BAPI with one import parameter and one export parameter.
In the sql query action block, it insert records in the database table. If it fail or success, that message(numeric value 1 or 0) has to send to SAP program through BAPI.
I have created a SAP ABAP program which sends message to MII Message listener through RFC then in the process rule message it will call transaction, in transaction, sql query will insert records into database table. if it success or fail, it will pass to BAPI. And i calling that BAPI in the same SAP ABAP Program to show in the output screen.
Here the issues, i am not getting the value from BAPI which has send by the transaction in MII.
SAP Jco, I have mapped in conf. links --> BAPI input with sql query sucess
Thanks,
Kind Regards,
Praveen Reddy MDear All,
I am facing problem regarding completion notifications in Oraclr r12, when user click the upon completion generated notifications it can only be viewd once, second time user cannot view the notifications.
I have find that fnd_file_temp table store this information and deleted it.
Plz help me how to view this URL again.
thanks
regards,
Zubyr -
Hi,
somebody knows how to sum two columns of a table as a result of an abap sql query. I know that is possible to do it in a native sql like
select f.seatmax max, f.seatfree free, f.seatmax - f.seatfree seatoccu from flights
Tks
Roberto FalkHi Roberto ,
Here is a sample code which does some thing similar
Data : v_LABST type LABST ,
v_umlme type umlme.
start-of-selection.
select sum( labst ) sum( umlme )
into (v_labst , v_umlme)
from mard.
write:/ v_labst , v_umlme.
Regards
Arun -
Performance of native sql query detoriates
Dear Experts,
The performance of my native SQL query is bad. On the database the query takes less than 5 seconds to process. From my abap program I get a session timeout dump after 10 minutes. What might be the possible reason.
Warm Regards,
AbdullahI am not a DBA, but this is a wild guess.
I have a native SQL query. It was running fine all morning(transported it to production today). By afternoon the report was not giving any output.
I went to the MS SQL query analyzer and executed the query, it returned the results in less than 5 seconds. The same query when I was executing from SAP using native SQL took more than 10 minutes and gave a dump(time exceeded).
My database guy asked me to execute the following on the database. Dbcc dbreindex('tablename')
The report is running fine since then. I am still not satisfied if this is the reason the performance is back on track, but yeah the report is running fine again. There seems to be some problem with the indexes.
I am using standard classes provided by SAP to execute my query and after execution the resultset reference object is being closed, I am closing the connection.
the code is as below.
PERFORM:
connect USING con_name con_ref,
select_into_table USING con_ref,
disconnect USING con_ref.
* FORM connect
* Connects to the database specified by the logical connection name
* P_CON_NAME which is expected to be specified in table DBCON. In case
* of success the form returns in P_CON_REF a reference to a connection
* object of class CL_SQL_CONNECTION.
* --> P_CON_NAME logical connection name
* <-- P_CON_REF reference to a CL_SQL_CONNECTION object
FORM connect USING p_con_name TYPE dbcon-con_name
p_con_ref TYPE REF TO cl_sql_connection
RAISING cx_sql_exception.
* if CON_NAME is not initial then try to open the connection, otherwise
* create a connection object representing the default connection.
IF p_con_name IS INITIAL.
CREATE OBJECT p_con_ref.
ELSE.
p_con_ref = cl_sql_connection=>get_connection( p_con_name ).
ENDIF.
ENDFORM. " connect
* FORM select_into_table
* Selects some rows from the test table and fetches the result rows
* into an internal table whose row structure corresponds to the
* queries select list columns.
FORM select_into_table
USING p_con_ref TYPE REF TO cl_sql_connection
RAISING cx_sql_exception.
DATA:
l_stmt TYPE string,
l_stmt_ref TYPE REF TO cl_sql_statement,
l_dref TYPE REF TO data,
l_res_ref TYPE REF TO cl_sql_result_set,
*Data related query
l_itab TYPE TABLE OF t_pricing_report,
l_row_cnt TYPE i.
* create the query string
CONCATENATE
'select A.SEQ,A.CONDTABLE,A.CONDNAME,A.VKORG,A.VTWEG,A.MATKL,A.MATNR,B.MTEXT,A.VKGRP,A.SGRPNAME,'
'A.VKBUR,A.SOFFNAME,A.ZSALES,A.SCNTNAME,A.KUNNR,A.SCSTNAME,A.PRBATCH,A.INCO1,'
'A.INCO2,A.DATAB,A.DATBI,A.KBETR,A.KONWA,A.KOSRT,B.MTART,B.GROES,B.VOLUM,B.EXTWG,B.WRKST,'
'A.MXWRT,A.GKWRT,'
'B.PATTERN,B.RIM,B.SERIES,B.SPDINDEX,B.LDINDX,B.MGROUP,B.APPLN,B.SDWALL,B.MGRPTXT'
'FROM Z_PRICELIST A,Z_MATERIALVIEW B'
'WHERE A.MANDT = ? AND'
'B.MANDT = A.MANDT AND'
'A.MATNR = B.MATNR AND'
'A.KSCHL = ? AND'
'A.CONDTABLE LIKE ? AND'
'A.VKORG LIKE ? AND'
'A.VTWEG LIKE ? AND'
'A.MATKL >= ? AND A.MATKL <= ? AND'
'A.MATNR >= ? AND A.MATNR <= ? AND'
'A.INCO1 LIKE ? AND'
'A.INCO2 LIKE ? AND'
'A.ZSALES >= ? AND A.ZSALES <= ? AND'
'A.KUNNR >= ? AND A.KUNNR <= ? AND'
'A.PRBATCH >= ? AND A.PRBATCH <= ? AND'
'A.VKBUR >= ? AND A.VKBUR <= ? AND'
'A.VKGRP >= ? AND A.VKGRP <= ? AND'
'B.WRKST >= ? AND B.WRKST <= ? AND'
'B.MTART >= ? AND B.MTART <= ? AND'
'? BETWEEN A.DATAB AND A.DATBI AND'
'B.GROES LIKE ? AND'
'B.LDINDX LIKE ? AND'
'B.SPDINDEX LIKE ? AND'
'B.RIM LIKE ? AND'
'B.SERIES LIKE ? AND'
'B.PATTERN LIKE ? AND'
'B.MGROUP LIKE ?'
'order by A.MATNR'
INTO l_stmt SEPARATED BY space. "#EC NOTEXT
* create a statement object
l_stmt_ref = p_con_ref->create_statement( ).
* bind input variables
GET REFERENCE OF l_col1 INTO l_dref.
l_stmt_ref->set_param( l_dref ).
*binding other references here
GET REFERENCE OF l_col33 INTO l_dref.
l_stmt_ref->set_param( l_dref ).
* set the input values and execute the query
l_col1 = sy-mandt.
*..Assigning values here
l_col33 = p_mgroup.
* PERFORM trace_2 USING 'EXECUTE_QUERY' l_stmt l_col1 l_col2.
l_res_ref = l_stmt_ref->execute_query( l_stmt ).
* set output table
GET REFERENCE OF l_itab INTO l_dref.
l_res_ref->set_param_table( l_dref ).
* get the complete result set
l_row_cnt = l_res_ref->next_package( ).
* display the contents of the output table
* PERFORM trace_next_package USING l_itab.
* PERFORM trace_result USING l_row_cnt 'rows fetched'.
pricing_report[] = l_itab[].
free l_itab.
* don't forget to close the result set object in order to free
* resources on the database
l_res_ref->close( ).
ENDFORM. "select_into_table
* FORM disconnect
* Disconnect from the given connection. In case of the default
* connection this can be omitted.
FORM disconnect
USING p_con_ref TYPE REF TO cl_sql_connection
RAISING cx_sql_exception.
DATA: l_con_name TYPE dbcon-con_name.
l_con_name = p_con_ref->get_con_name( ).
CHECK l_con_name <> cl_sql_connection=>c_default_connection.
* PERFORM trace_0 USING 'CLOSE CONNECTION' l_con_name.
p_con_ref->close( ).
* PERFORM trace_result USING l_con_name 'closed'.
ENDFORM. "disconnect
* FORM handle_sql_exception
* Write appropriate error messages when a SQL exception has occured
* --> P_SQLERR_REF reference to a CX_SQL_EXCEPTION object
FORM handle_sql_exception
USING p_sqlerr_ref TYPE REF TO cx_sql_exception.
FORMAT COLOR COL_NEGATIVE.
IF p_sqlerr_ref->db_error = 'X'.
WRITE: / 'SQL error occured:', p_sqlerr_ref->sql_code,
/ p_sqlerr_ref->sql_message. "#EC NOTEXT
ELSE.
WRITE:
/ 'Error from DBI (details in dev-trace):',
p_sqlerr_ref->internal_error. "#EC NOTEXT
ENDIF.
ENDFORM. "handle_sql_exception -
Diff between sap query and abap query
diff between sap query and abap query
Hi,
ABAP query is mostly used by functional consultants.
SAP Query :
Purpose
The SAP Query application is used to create lists not already contained in the SAP standard system. It has been designed for users with little or no knowledge of the SAP programming language ABAP. SAP Query offers users a broad range of ways to define reporting programs and create different types of reports such as basic lists, statistics, and ranked lists.
Features
SAP Query's range of functions corresponds to the classical reporting functions available in the system. Requirements in this area such as list, statistic, or ranked list creation can be met using queries.
All the data required by users for their lists can be selected from any SAP table created by the customer.
To define a report, you first have to enter individual texts, such as titles, and select the fields and options which determine the report layout. Then you can edit list display in WYSIWYG mode whenever you want using drag and drop and the other toolbox functions available.
ABAP Query,:
As far as I Believe, is the use of select statements in the ABAP Programming. This needs a knowledge of Open SQL commands like Select,UPdtae, Modify etc. This has to be done only by someone who has a little bit of ABAP experience.
To sum up, SAP queries are readymade programs given by SAP, which the user can use making slight modification like the slection texts, the tables from which the data is to be retrieved and the format in which the data is to be displayed.ABAP queries become imperative when there is no such SAP query existing and also when there is a lot of customizing involved to use a SAP Query directly
use either SQ02 ans SQ01
or SQVI tr code
for more information please go thru this url:
http://www.thespot4sap.com/Articles/SAP_ABAP_Queries_Create_The_Query.asp
http://goldenink.com/abap/sap_query.html
Please check this PDF document (starting page 352) perhaps it will help u.
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVQUE/BCSRVQUE.pdf
check the below link will be helpful for u
Tutorial on SQVI
once you create query system generates a report starting with AQZZ/SAPQUERY/ABAGENCY2======= assing this report to tr code for the same
regards,
vasavi.
reward if it is helpful. -
MultiProvider: How to decipher the underlying SQL query
Hello Guys,
I have joined 2 cubes using MultiProvider. I created a query which takes Key Figure values from both cubes. When I go to "Display SQl Query", I see 2 separare queries for each cube separately. I don't see a join between them.
If I have to write the same query directly in ABAP, then how should I go about it?
Also any idea what does the statement below means..I see this in every MultiProvider query
STAR_TRANSFORMATION FACT( &TABLE& ) &SUBSTITUTE LITERALS&Hello:
- You could never write a BI query in ABAP - that is not a real possibility, don't bother trying this, it's not reasonable (sorry).
- MultiProvider is a Union operation, not a Join. Queries against to a MultiProvider are split into sub-queries, where joins are performed on the tables of a cube, then the subqueries are merged in a Union operation.
- You can see more information about the SQL in RSRT (including a MultiProvider explain)
- STAR_TRANSFORMATION is a feature of the Oracle RDBMS, where the optimizer recognizes that the join operation against the tables in a star schema (InfoCube) can be more efficiently performed using a special technique, as opposed to ordinary join operations (like you might see in an OLTP system). The optimizer automatically uses STAR_TRANSFORMATION to ensure that efficient joins are executed.
Thanks for any points you choose to assign (the way of saying thanks in SDN).
Best Regards -
Ron Silberstein
SAP -
Dear all,
what is meant by SQL Query?
I have a report which is directly in production and not in development.its a user created program.
some one said that it is SQL query.
What is meant by it ?
Is there any name for that SQL query?
If yes,how can I find it?Hi,
SQL Query means select statement u r getting the data from the database table.
Standard SQL
SQL (Structured Query Language) is a largely standardized language for accessing relational databases. It can be divided into three areas:
· Data Manipulation Language (DML)
Statements for reading and changing data in database tables.
· Data Definition Language (DDL)
Statements for creating and administering database tables.
· Data Control Language (DCL)
Statements for authorization and consistency checks.
Each database has a programming interface that allows you to access the database tables using SQL statements. The SQL statements in these programming interfaces are not fully standardized. To access a specific database system, you must refer to the documentation of that system for a list of the SQL statements available and their correct syntax.
The Database Interface
To make the R/3 System independent of the database system with which you use it despite the differences in the SQL syntax between various databases, each work process on an application server has a database interface. The R/3 System communicates with the database by means of this interface. The database interface converts all of the database requests from the R/3 System into the correct Standard SQL statements for the database system. To do this, it uses a database-specific component that shields the differences between database systems from the rest of the database interface. You choose the appropriate layer when you install the R/3 System.
There are two ways of accessing the database from a program - with Open SQL or Native SQL.
Open SQL
Open SQL statements are a subset of Standard SQL that is fully integrated in ABAP. They allow you to access data irrespective of the database system that the R/3 installation is using. Open SQL consists of the Data Manipulation Language (DML) part of Standard SQL; in other words, it allows you to read (SELECT) and change (INSERT, UPDATE, DELETE) data.
Open SQL also goes beyond Standard SQL to provide statements that, in conjunction with other ABAP constructions, can simplify or speed up database access. It also allows you to buffer certain tables on the application server, saving excessive database access. In this case, the database interface is responsible for comparing the buffer with the database. Buffers are partly stored in the working memory of the current work process, and partly in the shared memory for all work processes on an application server. Where an R/3 System is distributed across more than one application server, the data in the various buffers is synchronized at set intervals by the buffer management. When buffering the database, you must remember that data in the buffer is not always up to date. For this reason, you should only use the buffer for data which does not often change. You specify whether a table can be buffered in its definition in the ABAP Dictionary.
Native SQL
Native SQL is only loosely integrated into ABAP, and allows access to all of the functions contained in the programming interface of the respective database system. Unlike Open SQL statements, Native SQL statements are not checked and converted, but instead are sent directly to the database system. When you use Native SQL, the function of the database-dependent layer is minimal. Programs that use Native SQL are specific to the database system for which they were written. When writing R/3 applications, you should avoid using Native SQL wherever possible. It is used, however, in some parts of the R/3 Basis System - for example, for creating or changing table definitions in the ABAP Dictionary.
The ABAP Dictionary
The ABAP Dictionary, part of the ABAP Workbench, allows you to create and administer database tables. Open SQL contains no statements from the DDL part of Standard SQL. Normal application programs should not create or change their own database tables.
The ABAP Dictionary uses the DDL part of Open SQL to create and change database tables. It also administers the ABAP Dictionary in the database. The ABAP Dictionary contains metadescriptions of all database tables in the R/3 System. Only database tables that you create using the ABAP Dictionary appear in the Dictionary. Open SQL statements can only access tables that exist in the ABAP Dictionary.
Authorization and Consistency Checks
The DCL part of Standard SQL is not used in R/3 programs. The work processes within the R/3 System are logged onto the database system as users with full rights. The authorizations of programs or users to read or change database tables is administered within the R/3 System using the R/3 authorization concept. Equally, transactions must ensure their own data consistency using the R/3 locking concept. For more information, refer to Authorization Concept and Programming Database Updates.
Plzz reward points if it helps.
Edited by: manjari kotta on Dec 18, 2007 7:29 AM -
Hi All,
How can i view result of SQL query in SAP-ABAP. Actually I want to see result of following query :
select * from ZMSTKCALC where werks_d <> werks_main.
I am new to SAP territory.
Thanks in advance for your help.Hi Yogesh,
Welcome to the SDN world!!!
You have to use WRITE statement to see the result of the SQL query.
The result of the SQL query need to be stored in a work area.
For example:
data: T_ZMSTKCALC LIKE ZMSTKCALC occurs 0 with header line.
select * from ZMSTKCALC into table T_ZMSTKCALC where werks <> werks_main.
loop at T_ZMSTKCALC.
write:/ T_ZMSTKCALC-FIELD1,
T_ZMSTKCALC-FIELD2.
endloop.
Thanks
Ramakrishna -
Convert this query to ABAP and display the results
Hi Everyone,
I have a sql query in native sql (oracle). I want execute it in ABAP editor and display the results.
I need to get this to an internal table and display the results. How do i write the script any help will be great use to me.
Here is the query:
<i> select (select decode(extent_management,'LOCAL','*',' ') ||
decode(segment_space_management,'AUTO','a ','m ')
from dba_tablespaces where tablespace_name = b.tablespace_name) || nvl(b.tablespace_name,
nvl(a.tablespace_name,'UNKOWN')) name,
kbytes_alloc kbytes,
kbytes_alloc-nvl(kbytes_free,0) used,
nvl(kbytes_free,0) free,
((kbytes_alloc-nvl(kbytes_free,0))/
kbytes_alloc)*100 pct_used,
nvl(largest,0) largest,
nvl(kbytes_max,kbytes_alloc) Max_Size,
decode( kbytes_max, 0, 0, (kbytes_alloc/kbytes_max)*100) pct_max_used from ( select sum(bytes)/1024 Kbytes_free,
max(bytes)/1024 largest,
tablespace_name
from sys.dba_free_space
group by tablespace_name ) a,
( select sum(bytes)/1024 Kbytes_alloc,
sum(maxbytes)/1024 Kbytes_max,
tablespace_name
from sys.dba_data_files
group by tablespace_name
union all
select sum(bytes)/1024 Kbytes_alloc,
sum(maxbytes)/1024 Kbytes_max,
tablespace_name
from sys.dba_temp_files
group by tablespace_name )b
where a.tablespace_name = b.tablespace_name order by 1;
</i>
Thanks,
Prashant.Hi Prashant,
Native SQL commands in ABAP are placed between EXEC SQL and ENDEXEC. You can place all your statements in between these EXEC SQL and ENDEXEC in a report.
EXEC SQL [PERFORMING <form>].
<Native SQL statement>
ENDEXEC.
Check this link to know about Native SQL
http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3b8b358411d1829f0000e829fbfe/frameset.htm
Thanks,
Vinay
Maybe you are looking for
-
Não tenho problema com uma restrição para simples, mais gostaria de saber de uma solução no aboutconfig, pois conheço todos os sites que uso e 95% deles uso Flash ou outros programas como o java, a restrição está tornando o mozila um navegador irrita
-
Bootcamp problem when booting win vista
hello guys i have one small problem while booting with windows vist. i make a clean install with vista. first i created bootcamp partition and then i boot with vista dvd and i formated the ''bootcamp'' partition and install vista. after restart and p
-
Can I change the order or rotate pages in acrobat reader?
This may be a silly question... I actually own & use Pro, so I don't use Reader. But my grandmother has the reader and wants to know if she can change the order of pages (and rotate pages) in acrobat reader. Or does she need to buy acrobat standard?
-
Getting rid of PSE7 trial, how can I get rid of all the files?
I'm trying to get an older version of PSE on my pc, but since Ihad the trail of PSE7 on it, there's still some files around on my computer that is stopping me from getting my old one back, and since the trial has long-since expired I'm stuck without
-
Conditional Formatting of a Direct Database Request Columns in OBIEE 11g
Hi All, I need to do the conditional formatting like changing the column color based of some condition, but i can do to the conditional formatting in the normal answers in the column properties. But i want to do it in the rows of Direct Database Requ