Native SQL Regarding
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
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
Similar Messages
-
Dynamic Update Statement in Native SQL
Hi Experts,
I want to dynamically pass the field in Update statement in Native SQL. For eg.
data: str1 type string.
str1 = 'MARKETS'.
EXEC SQL.
UPDATE PRDT.TBVEHDS4 SET (str1) = :'U'
WHERE VEH_NO = :'K1WK-54520'
AND SEGMENT_NO = :'01'
ENDEXEC.
But this is not taking (str1) as MARKETS field to update as U , its taking STR1 itself, Giving native SQL exception as Invalid Token as we are using DB2 as external DB system.
I checked with field-symbols also, but nothing helped.
Please help, thanks in Advance.
Regards,
AbhishekHi,
Check this demo program in SE38 ADBC_DEMO, take as example to construct your own dynamic native sql
Regards,
Felipe -
Hello Friends,
I am having a requirement to fetch the records from 3 tables( Using inner join)
into an internal table but I am facing a difficulty that I need to fetch the records from this table with entirely different conditions and I need to use ' UNION ALL' Command to fetch the records from the database. For Eg.
I have to write two select statement....
Select <f1> <f2> <f3> <f4>
from <t1> join <t2> join <t3>
into table ITAB
where <Cond. 1>
Select <f1> <f2> <f3> <f4>
from <t1> join <t2> join <t3>
appending table ITAB
where <Cond. 2>
But this is taking two much time... So the user told me to use native SQL to combine this two statement with UNION ALL.. I am using database DB2 Can anyone help me regarding this.
Thanks,
NavneetHI,
Info in help is good to understand better. Below is the
same for you understanding.
... FROM tabref1 [INNER] JOIN tabref2 ON cond
Effect
The data is to be selected from transparent database tables and/or views determined by tabref1 and tabref2. tabref1 and tabref2 each have the same form as in variant 1 or are themselves Join expressions. The keyword INNER does not have to be specified. The database tables or views determined by tabref1 and tabref2 must be recognized by the ABAP Dictionary.
In a relational data structure, it is quite normal for data that belongs together to be split up across several tables to help the process of standardization (see relational databases). To regroup this information into a database query, you can link tables using the join command. This formulates conditions for the columns in the tables involved. The inner join contains all combinations of lines from the database table determined by tabref1 with lines from the table determined by tabref2, whose values together meet the logical condition (join condition) specified using ON>cond.
Inner join between table 1 and table 2, where column D in both tables in the join condition is set the same:
Table 1 Table 2
A
B
C
D
D
E
F
G
H
a1
b1
c1
1
1
e1
f1
g1
h1
a2
b2
c2
1
3
e2
f2
g2
h2
a3
b3
c3
2
4
e3
f3
g3
h3
a4
b4
c4
3
|--|||--|
Inner Join
A
B
C
D
D
E
F
G
H
a1
b1
c1
1
1
e1
f1
g1
h1
a2
b2
c2
1
1
e1
f1
g1
h1
a4
b4
c4
3
3
e2
f2
g2
h2
|--||||||||--|
Example
Output a list of all flights from Frankfurt to New York between September 10th and 20th, 2001 that are not sold out:
DATA: DATE LIKE SFLIGHT-FLDATE,
CARRID LIKE SFLIGHT-CARRID,
CONNID LIKE SFLIGHT-CONNID.
SELECT FCARRID FCONNID F~FLDATE
INTO (CARRID, CONNID, DATE)
FROM SFLIGHT AS F INNER JOIN SPFLI AS P
ON FCARRID = PCARRID AND
FCONNID = PCONNID
WHERE P~CITYFROM = 'FRANKFURT'
AND P~CITYTO = 'NEW YORK'
AND F~FLDATE BETWEEN '20010910' AND '20010920'
AND FSEATSOCC < FSEATSMAX.
WRITE: / DATE, CARRID, CONNID.
ENDSELECT.
If there are columns with the same name in both tables, you must distinguish between them by prefixing the field descriptor with the table name or a table alias.
Note
In order to determine the result of a SELECT command where the FROM clause contains a join, the database system first creates a temporary table containing the lines that meet the ON condition. The WHERE condition is then applied to the temporary table. It does not matter in an inner join whether the condition is in the ON or WHEREclause. The following example returns the same solution as the previous one.
Example
Output of a list of all flights from Frankfurt to New York between September 10th and 20th, 2001 that are not sold out:
DATA: DATE LIKE SFLIGHT-FLDATE,
CARRID LIKE SFLIGHT-CARRID,
CONNID LIKE SFLIGHT-CONNID.
SELECT FCARRID FCONNID F~FLDATE
INTO (CARRID, CONNID, DATE)
FROM SFLIGHT AS F INNER JOIN SPFLI AS P
ON FCARRID = PCARRID
WHERE FCONNID = PCONNID
AND P~CITYFROM = 'FRANKFURT'
AND P~CITYTO = 'NEW YORK'
AND F~FLDATE BETWEEN '20010910' AND '20010920'
AND FSEATSOCC < FSEATSMAX.
WRITE: / DATE, CARRID, CONNID.
ENDSELECT.
Note
Since not all of the database systems supported by SAP use the standard syntax for ON conditions, the syntax has been restricted. It only allows those joins that produce the same results on all of the supported database systems:
Only a table or view may appear to the right of the JOIN operator, not another join expression.
Only AND is possible in the ON condition as a logical operator.
Each comparison in the ON condition must contain a field from the right-hand table.
If an outer join occurs in the FROM clause, all the ON conditions must contain at least one "real" JOIN condition (a condition that contains a field from tabref1 amd a field from tabref2.
Note
In some cases, '*' may be specified in the SELECT clause, and an internal table or work area is entered into the INTO clause (instead of a list of fields). If so, the fields are written to the target area from left to right in the order in which the tables appear in the FROM clause, according to the structure of each table work area. There can then be gaps between table work areas if you use an Alignment Request. For this reason, you should define the target work area with reference to the types of the database tables, not simply by counting the total number of fields. For an example, see below:
Variant 3
... FROM tabref1 LEFT [OUTER] JOIN tabref2 ON cond
Effect
Selects the data from the transparent database tables and/or views specified in tabref1 and tabref2. tabref1 und tabref2 both have either the same form as in variant 1 or are themselves join expressions. The keyword OUTER can be omitted. The database tables or views specified in tabref1 and tabref2 must be recognized by the ABAP-Dictionary.
In order to determine the result of a SELECT command where the FROM clause contains a left outer join, the database system creates a temporary table containing the lines that meet the ON condition. The remaining fields from the left-hand table (tabref1) are then added to this table, and their corresponding fields from the right-hand table are filled with ZERO values. The system then applies the WHERE condition to the table.
Left outer join between table 1 and table 2 where column D in both tables set the join condition:
Table 1 Table 2
A
B
C
D
D
E
F
G
H
a1
b1
c1
1
1
e1
f1
g1
h1
a2
b2
c2
1
3
e2
f2
g2
h2
a3
b3
c3
2
4
e3
f3
g3
h3
a4
b4
c4
3
|--|||--|
Left Outer Join
A
B
C
D
D
E
F
G
H
a1
b1
c1
1
1
e1
f1
g1
h1
a2
b2
c2
1
1
e1
f1
g1
h1
a3
b3
c3
2
NULL
NULL
NULL
NULL
NULL
a4
b4
c4
3
3
e2
f2
g2
h2
|--||||||||--|
Example
Output a list of all custimers with their bookings for October 15th, 2001:
DATA: CUSTOMER TYPE SCUSTOM,
BOOKING TYPE SBOOK.
SELECT SCUSTOMNAME SCUSTOMPOSTCODE SCUSTOM~CITY
SBOOKFLDATE SBOOKCARRID SBOOKCONNID SBOOKBOOKID
INTO (CUSTOMER-NAME, CUSTOMER-POSTCODE, CUSTOMER-CITY,
BOOKING-FLDATE, BOOKING-CARRID, BOOKING-CONNID,
BOOKING-BOOKID)
FROM SCUSTOM LEFT OUTER JOIN SBOOK
ON SCUSTOMID = SBOOKCUSTOMID AND
SBOOK~FLDATE = '20011015'
ORDER BY SCUSTOMNAME SBOOKFLDATE.
WRITE: / CUSTOMER-NAME, CUSTOMER-POSTCODE, CUSTOMER-CITY,
BOOKING-FLDATE, BOOKING-CARRID, BOOKING-CONNID,
BOOKING-BOOKID.
ENDSELECT.
If there are columns with the same name in both tables, you must distinguish between them by prefixing the field descriptor with the table name or using an alias.
Note
For the resulting set of a SELECT command with a left outer join in the FROM clause, it is generally of crucial importance whether a logical condition is in the ON or WHERE condition. Since not all of the database systems supported by SAP themselves support the standard syntax and semantics of the left outer join, the syntax has been restricted to those cases that return the same solution in all database systems:
Only a table or view may come after the JOIN operator, not another join statement.
The only logical operator allowed in the ON condition is AND.
Each comparison in the ON condition must contain a field from the right-hand table.
Comparisons in the WHERE condition must not contain a field from the right-hand table.
The ON condition must contain at least one "real" JOIN condition (a condition in which a field from tabref1 as well as from tabref2 occurs).
Note
In some cases, '*' may be specivied as the field list in the SELECT clause, and an internal table or work area is entered in the INTO clause (instead of a list of fields). If so, the fields are written to the target area from left to right in the order in which the tables appear in the llen in der FROM clause, according to the structure of each table work area. There can be gaps between the table work areas if you use an Alignment Request. For this reason, you should define the target work area with reference to the types of the database tables, as in the following example (not simply by counting the total number of fields).
Example
Example of a JOIN with more than two tables: Select all flights from Frankfurt to New York between September 10th and 20th, 2001 where there are available places, and display the name of the airline.
DATA: BEGIN OF WA,
FLIGHT TYPE SFLIGHT,
PFLI TYPE SPFLI,
CARR TYPE SCARR,
END OF WA.
SELECT * INTO WA
FROM ( SFLIGHT AS F INNER JOIN SPFLI AS P
ON FCARRID = PCARRID AND
FCONNID = PCONNID )
INNER JOIN SCARR AS C
ON FCARRID = CCARRID
WHERE P~CITYFROM = 'FRANKFURT'
AND P~CITYTO = 'NEW YORK'
AND F~FLDATE BETWEEN '20010910' AND '20010920'
AND FSEATSOCC < FSEATSMAX.
WRITE: / WA-CARR-CARRNAME, WA-FLIGHT-FLDATE, WA-FLIGHT-CARRID,
WA-FLIGHT-CONNID.
ENDSELECT.
Kishore. -
Hi guys,
we are planning to go Oracle up next week. so could you please confirm below two points.
1- we need to know what problem will occur if we used Native sql inside the Abap programs(due to Oracle up).
2- Is it true that Native SQl communication passess thru Oracle client. Please confirm
Thanks.
BaashaHi, please refer to the following pages.
Native SQL
Native SQL for Oracle
especially in the first one, you will find your answers.
Now, concerning point 2, have you considered posting the question in the SAP on Oracle forum in SDN ?
Regards,
Stéphan -
Regarding Native SQL to access Oracle Data from SAP
Dear Gurus,
This query is regarding Native SQL.
Our database is Oracle and the client's database is also Oracle.
To access the data directly from the client's database(Oracle), can I use Native SQL commands?
Is there any disadvantage to use Native SQL?
If Native SQL can be used, can any one send me the code to access the data from Oracle?
Points will be rewarded.
Thanks & Regards,
Neeraj K.The problem is always data integrity. Doing things this way you are bypassing any business logic. So for example if you are connecting to a SAP Oracle database. SAP will not support your SAP system as you are doing direct updates to the database. I would suppose that this would be the same for any other product using the Oracle database. If you are only reading data from the database then it should be fine. I would however always using API's to access/update data.
Regards -
Hi guys. I've developed some programs using Native SQL to connect to a SQL Server database. To do so, i configured a connection on DBCO transaction. The develop SAP server runs on Windows platform, but QA and Production runs on UNIX. So, now i need to modify my programs to run on UNIX
I know that in order to use DBCO conection to SQL Server requires the server to be on Windows, but i've been reading some postings and SAP notes, and i've read somewhere that you need at least ONE app server to be on windows...
My question is this: is there a way to specify when connecting to DBCO to use a different app server? is this automatic?
I hope i made miself clear...
JesusSolved it on my own
-
While running the livecache server test a native sql error occures
We are using scm4.1 livecache 7.5.0 And every time we are running the livecache test program he is dumping
whith the following dump
patch level scm & scm_basis is 8
Runtime Errors DBIF_DSQL2_SQL_ERROR
Except. CX_SY_NATIVE_SQL_ERROR
Date and Time 31.10.2005 16:50:55
ShrtText
An SQL error occurred when executing Native SQL.
What happened?
Error 600 occurred in the current database connection "LCA".
What can you do?
Print out the error message (using the "Print" function)
and make a note of the actions and input that caused the
error.
To resolve the problem, contact your SAP system administrator.
You can use transaction ST22 (ABAP Dump Analysis) to view and administer
termination messages, especially those beyond their normal deletion
date.
is especially useful if you want to keep a particular message.
How to correct the error
Database error text........: "Work rolled back: DbpError -28814 in
APS_ORDER_CH"
Database error code .......: 600
Triggering SQL statement...: " ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? or'"
Internal call code.........: "[DBDS/NEW DSQL]"
Please check the entries in the system log (Transaction SM21).
You may able to find an interim solution to the problem
in the SAP note system. If you have access to the note system yourself,
use the following search criteria:
"DBIF_DSQL2_SQL_ERROR" CX_SY_NATIVE_SQL_ERRORC
"/SAPAPO/SAPLOM_PLANNING" or "/SAPAPO/LOM_PLANNINGU08"
"/SAPAPO/OM_ORDER_CHANGE"
If you cannot solve the problem yourself and you wish to send
an error message to SAP, include the following documents:
1. A printout of the problem description (short dump)
To obtain this, select in the current display "System->List->
Save->Local File (unconverted)".
2. A suitable printout of the system log
To obtain this, call the system log through transaction SM21.
Limit the time interval to 10 minutes before and 5 minutes
after the short dump. In the display, then select the function
"System->List->Save->Local File (unconverted)".
3. If the programs are your own programs or modified SAP programs,
supply the source code.
To do this, select the Editor function "Further Utilities->
Upload/Download->Download".
4. Details regarding the conditions under which the error occurred
or which actions and input led to the error.
The exception must either be prevented, caught within the procedure
"/SAPAPO/OM_ORDER_CHANGE"
"(FUNCTION)", or declared in the procedure's RAISING clause.
To prevent the exception, note the following:
System environment
SAP Release.............. "640"
Application server....... "bebruap2"
Network address.......... "195.213.49.227"
Operating system......... "Windows NT"
Release.................. "5.2"
Hardware type............ "4x Intel 801586"
Character length......... 16 Bits
Pointer length........... 32 Bits
Work process number...... 1
Short dump setting....... "full"
Database server.......... "BEBRUAP2"
Database type............ "MSSQL"
Database name............ "APD"
Database owner........... "apd"
Character set............ "C"
SAP kernel............... "640"
Created on............... "Aug 23 2005 00:00:49"
Created in............... "NT 5.0 2195 Service Pack 4 x86 MS VC++ 13.10"
Database version......... "SQL_Server_8.00 "
Patch level.............. "87"
Patch text............... " "
Supported environment....
Database................. "MSSQL 7.00.699 or higher, MSSQL 8.00.194"
SAP database version..... "640"
Operating system......... "Windows NT 5.0, Windows NT 5.1, Windows NT 5.2"
Memory usage.............
Roll..................... 8176
EM....................... 24040336
Heap..................... 0
Page..................... 1687552
MM Used.................. 1516920
MM Free.................. 572032
SAP Release.............. "640"
User and Transaction
Client.............. 000
User................ "CGRAULS"
Language key........ "E"
Transaction......... "/SAPAPO/OM03 "
Program............. "/SAPAPO/SAPLOM_PLANNING"
Screen.............. "SAPMSSY0 1000"
Screen line......... 6
Information on where terminated
The termination occurred in the ABAP program "/SAPAPO/SAPLOM_PLANNING" in
"/SAPAPO/OM_ORDER_CHANGE".
The main program was "/SAPAPO/OM_TB_FLOW_QUANTITY ".
The termination occurred in line 91 of the source code of the (Include)
program "/SAPAPO/LOM_PLANNINGU08"
of the source code of program "/SAPAPO/LOM_PLANNINGU08" (when calling the
editor 910).
Processing was terminated because the exception "CX_SY_NATIVE_SQL_ERROR"
occurred in the
procedure "/SAPAPO/OM_ORDER_CHANGE" "(FUNCTION)" but was not handled locally,
not declared in the
RAISING clause of the procedure.
The procedure is in the program "/SAPAPO/SAPLOM_PLANNING ". Its source code
starts in line 5
of the (Include) program "/SAPAPO/LOM_PLANNING$08 ".
Source Code Extract
Line
SourceCde
61
is_gen_params-simversion
62
is_gen_params-dont_set_netchg_flag
63
space.
64
65
Kontrollstruktur IS_GET_CHANGED_OPTIONS anpassen.
66
IF NOT et_changed_orders IS REQUESTED.
67
is_get_changed_options-send_chg_top_order = gc_false.
68
ENDIF.
69
IF NOT et_changed_cap_reqs IS REQUESTED.
70
is_get_changed_options-send_chg_cap_req = gc_false.
71
ENDIF.
72
IF NOT et_changed_io_nodes IS REQUESTED.
73
is_get_changed_options-send_chg_ionode = gc_false.
74
ENDIF.
75
IF NOT et_changed_io_pp_nodes IS REQUESTED.
76
is_get_changed_options-send_chg_io_pp = gc_false.
77
ENDIF.
78
IF NOT et_changed_pegids IS REQUESTED.
79
is_get_changed_options-send_chg_pegid = gc_false.
80
ENDIF.
81
IF NOT et_deleted_fix_pegging IS REQUESTED.
82
is_get_changed_options-send_del_fix_peg = gc_false.
83
ENDIF.
84
start_function 'OM_ORDER_CHANGE'. "#EC *
85
Verbindung zum liveCache aufbauen
86
check_server.
87
connect_to_livecache.
88
COM-Routine zum Anlegen bzw. Überschreiben eines Zeitstrahls
89
90
EXEC sql.
>>>>>
execute procedure "APS_ORDER_CHANGE" (
92
in :ls_gen_com_params,
93
out :lv_rc,
94
in :et_rc,
95
in :it_order_method,
96
in :it_ordkeys,
97
in :it_ordmaps,
98
in :it_orders,
99
in :it_activities,
100
in :it_mode,
101
in :it_cap_reqs,
102
in :it_positions,
103
in :it_inputs,
104
in :it_outputs,
105
in :it_prodflow,
106
in :it_intern_constraints,
107
in :it_extern_constraints,
108
in :it_charact_val_acts,
109
in :it_charact_req_inpnode,
110
in :it_charact_val_outnode,
Contents of system fields
Name
Val.
SY-SUBRC
0
SY-INDEX
0
SY-TABIX
1
SY-DBCNT
1
SY-FDPOS
0
SY-LSIND
0
SY-PAGNO
0
SY-LINNO
1
SY-COLNO
1
SY-PFKEY
SY-UCOMM
SY-TITLE
Flow Quantity Test
SY-MSGTY
S
SY-MSGID
/SAPAPO/OM_TEST
SY-MSGNO
001
SY-MSGV1
Create transSim
SY-MSGV2
SY-MSGV3
SY-MSGV4
Active Calls/Events
No. Ty. Program Include Line
Name
3 FUNCTION /SAPAPO/SAPLOM_PLANNING /SAPAPO/LOM_PLANNINGU08 91
/SAPAPO/OM_ORDER_CHANGE
2 FORM /SAPAPO/OM_TB_FLOW_QUANTITY /SAPAPO/OM_TB_FLOW_QUANTITY 802
CHANGE_DATA
1 EVENT /SAPAPO/OM_TB_FLOW_QUANTITY /SAPAPO/OM_TB_FLOW_QUANTITY 11
START-OF-SELECTION
Chosen variables
Name
Val.
No. 3 Ty. FUNCTION
Name /SAPAPO/OM_ORDER_CHANGE
IS_ATP_INFO
01ATP0000001~CGRAULSXX##
334553333333744545455500
011400000001E37215C38800
000000000000000000000000
000000000000000000000000
IS_CONTROLPARAMETERS
霁က#ం̂⍱㔒鲔#####
2222222222222222222222001007190000022
0000000000000000000000100221240000100
0000000000000000000000910002390000000
0000000000000000000000700C335C000C000
IS_GEN_PARAMS
01PLV0000001~CGRAULS
3354533333337445454522222
010C60000001E37215C300000
0000000000000000000000000
0000000000000000000000000
IS_GET_CHANGED_OPTIONS
2222222
0000000
0000000
0000000
IT_ACTIVITIES
Table IT_274[1x256]
PROGRAM=/SAPAPO/OM_TB_FLOW_QUANTITYFORM=CHANGE_DATADATA=LT_ACTIVITIES
Table reference: 41
TABH+ 0(20) = 5087FFDF00000000000000002900000012010000
TABH+ 20(20) = 0100000000010000FFFFFFFF0487000000290000
TABH+ 40( 8) = 10000000C1308000
store = 0x5087FFDF
ext1 = 0x00000000
shmId = 0 (0x00000000)
id = 41 (0x29000000)
label = 274 (0x12010000)
fill = 1 (0x01000000)
leng = 256 (0x00010000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000205
occu = 16 (0x10000000)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 8 (cmpManyEq)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = 0x180112E0
pghook = 0x00000000
idxPtr = 0x00000000
refCount = 0 (0x00000000)
tstRefCount = 0 (0x00000000)
lineAdmin = 16 (0x10000000)
lineAlloc = 16 (0x10000000)
store_id = 126 (0x7E000000)
shmIsReadOnly = 0 (0x00000000)
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
IT_CAP_REQS
Table IT_276[1x112]
PROGRAM=/SAPAPO/OM_TB_FLOW_QUANTITYFORM=CHANGE_DATADATA=LT_CAP_REQS
Table reference: 39
TABH+ 0(20) = 48BB06E000000000000000002700000014010000
TABH+ 20(20) = 0100000070000000FFFFFFFF04870000C0290000
TABH+ 40( 8) = 10000000C1308000
store = 0x48BB06E0
ext1 = 0x00000000
shmId = 0 (0x00000000)
id = 39 (0x27000000)
label = 276 (0x14010000)
fill = 1 (0x01000000)
leng = 112 (0x70000000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000209
occu = 16 (0x10000000)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 8 (cmpManyEq)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = 0x188D04E0
pghook = 0x00000000
idxPtr = 0x00000000
refCount = 0 (0x00000000)
tstRefCount = 0 (0x00000000)
lineAdmin = 16 (0x10000000)
lineAlloc = 16 (0x10000000)
store_id = 124 (0x7C000000)
shmIsReadOnly = 0 (0x00000000)
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
IT_CHARACT_REQ_INPNODE
Table IT_418[0x140]
FUNCTION=/SAPAPO/OM_ORDER_CHANGEDATA=IT_CHARACT_REQ_INPNODE
Table reference: 32
TABH+ 0(20) = 00000000000000000000000020000000A2010000
TABH+ 20(20) = 000000008C000000FFFFFFFF04870000301D0000
TABH+ 40( 8) = 10000000C1308000
store = 0x00000000
ext1 = 0x00000000
shmId = 0 (0x00000000)
id = 32 (0x20000000)
label = 418 (0xA2010000)
fill = 0 (0x00000000)
leng = 140 (0x8C000000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000142
occu = 16 (0x10000000)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 8 (cmpManyEq)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = Not allocated
pghook = Not allocated
idxPtr = Not allocated
refCount = Not allocated
tstRefCount = Not allocated
lineAdmin = Not allocated
lineAlloc = Not allocated
store_id = Not allocated
shmIsReadOnly = Not allocated
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
IT_CHARACT_VAL_ACTS
Table IT_417[0x156]
FUNCTION=/SAPAPO/OM_ORDER_CHANGEDATA=IT_CHARACT_VAL_ACTS
Table reference: 50
TABH+ 0(20) = 00000000000000000000000032000000A1010000
TABH+ 20(20) = 000000009C000000FFFFFFFF04870000901D0000
TABH+ 40( 8) = 10000000C1308000
store = 0x00000000
ext1 = 0x00000000
shmId = 0 (0x00000000)
id = 50 (0x32000000)
label = 417 (0xA1010000)
fill = 0 (0x00000000)
leng = 156 (0x9C000000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000144
occu = 16 (0x10000000)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 8 (cmpManyEq)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = Not allocated
pghook = Not allocated
idxPtr = Not allocated
refCount = Not allocated
tstRefCount = Not allocated
lineAdmin = Not allocated
lineAlloc = Not allocated
store_id = Not allocated
shmIsReadOnly = Not allocated
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
IT_CHARACT_VAL_OUTNODE
Table IT_419[0x156]
FUNCTION=/SAPAPO/OM_ORDER_CHANGEDATA=IT_CHARACT_VAL_OUTNODE
Table reference: 60
TABH+ 0(20) = 0000000000000000000000003C000000A3010000
TABH+ 20(20) = 000000009C000000FFFFFFFF04870000901D0000
TABH+ 40( 8) = 10000000C1308000
store = 0x00000000
ext1 = 0x00000000
shmId = 0 (0x00000000)
id = 60 (0x3C000000)
label = 419 (0xA3010000)
fill = 0 (0x00000000)
leng = 156 (0x9C000000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000144
occu = 16 (0x10000000)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 8 (cmpManyEq)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = Not allocated
pghook = Not allocated
idxPtr = Not allocated
refCount = Not allocated
tstRefCount = Not allocated
lineAdmin = Not allocated
lineAlloc = Not allocated
store_id = Not allocated
shmIsReadOnly = Not allocated
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
IT_EXTERN_CONSTRAINTS
Table IT_416[0x124]
FUNCTION=/SAPAPO/OM_ORDER_CHANGEDATA=IT_EXTERN_CONSTRAINTS
Table reference: 71
TABH+ 0(20) = 00000000000000000000000047000000A0010000
TABH+ 20(20) = 000000007C000000FFFFFFFF04870000E02A0000
TABH+ 40( 8) = 10000000C1308000
store = 0x00000000
ext1 = 0x00000000
shmId = 0 (0x00000000)
id = 71 (0x47000000)
label = 416 (0xA0010000)
fill = 0 (0x00000000)
leng = 124 (0x7C000000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000215
occu = 16 (0x10000000)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 8 (cmpManyEq)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = Not allocated
pghook = Not allocated
idxPtr = Not allocated
refCount = Not allocated
tstRefCount = Not allocated
lineAdmin = Not allocated
lineAlloc = Not allocated
store_id = Not allocated
shmIsReadOnly = Not allocated
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
IT_INPUTS
Table IT_278[1x420]
PROGRAM=/SAPAPO/OM_TB_FLOW_QUANTITYFORM=CHANGE_DATADATA=LT_INPUTS
Table reference: 63
TABH+ 0(20) = 087400E0C0E303E0000000003F00000016010000
TABH+ 20(20) = 01000000A4010000FFFFFFFF04870000202A0000
TABH+ 40( 8) = 10000000C1308000
store = 0x087400E0
ext1 = 0xC0E303E0
shmId = 0 (0x00000000)
id = 63 (0x3F000000)
label = 278 (0x16010000)
fill = 1 (0x01000000)
leng = 420 (0xA4010000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000211
occu = 16 (0x10000000)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 8 (cmpManyEq)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = 0x78DC11E0
pghook = 0x00000000
idxPtr = 0x00000000
refCount = 0 (0x00000000)
tstRefCount = 0 (0x00000000)
lineAdmin = 16 (0x10000000)
lineAlloc = 16 (0x10000000)
store_id = 123 (0x7B000000)
shmIsReadOnly = 0 (0x00000000)
>>>>> 1st level extension part <<<<<
regHook = 0x2029FFDF
hsdir = 0x00000000
ext2 = 0x00000000
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
IT_INTERN_CONSTRAINTS
Table IT_415[0x124]
FUNCTION=/SAPAPO/OM_ORDER_CHANGEDATA=IT_INTERN_CONSTRAINTS
Table reference: 49
TABH+ 0(20) = 000000000000000000000000310000009F010000
TABH+ 20(20) = 000000007C000000FFFFFFFF04870000E02A0000
TABH+ 40( 8) = 10000000C1308000
store = 0x00000000
ext1 = 0x00000000
shmId = 0 (0x00000000)
id = 49 (0x31000000)
label = 415 (0x9F010000)
fill = 0 (0x00000000)
leng = 124 (0x7C000000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000215
occu = 16 (0x10000000)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 8 (cmpManyEq)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = Not allocated
pghook = Not allocated
idxPtr = Not allocated
refCount = Not allocated
tstRefCount = Not allocated
lineAdmin = Not allocated
lineAlloc = Not allocated
store_id = Not allocated
shmIsReadOnly = Not allocated
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
IT_MODE
Table IT_275[1x164]
PROGRAM=/SAPAPO/OM_TB_FLOW_QUANTITYFORM=CHANGE_DATADATA=LT_MODES
Table reference: 52
TABH+ 0(20) = A03C00E000000000000000003400000013010000
TABH+ 20(20) = 01000000A4000000FFFFFFFF0487000060290000
TABH+ 40( 8) = 10000000C1308000
store = 0xA03C00E0
ext1 = 0x00000000
shmId = 0 (0x00000000)
id = 52 (0x34000000)
label = 275 (0x13010000)
fill = 1 (0x01000000)
leng = 164 (0xA4000000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000207
occu = 16 (0x10000000)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 8 (cmpManyEq)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = 0xC8F611E0
pghook = 0x00000000
idxPtr = 0x00000000
refCount = 0 (0x00000000)
tstRefCount = 0 (0x00000000)
lineAdmin = 16 (0x10000000)
lineAlloc = 16 (0x10000000)
store_id = 125 (0x7D000000)
shmIsReadOnly = 0 (0x00000000)
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
IT_ORDERS
Table IT_293[1x320]
PROGRAM=/SAPAPO/OM_TB_FLOW_QUANTITYFORM=CHANGE_DATADATA=LT_ORDERS1
Table reference: 47
TABH+ 0(20) = 20B403E000000000000000002F00000025010000
TABH+ 20(20) = 0100000040010000FFFFFFFF0400000030380000
TABH+ 40( 8) = 01000000C1308000
store = 0x20B403E0
ext1 = 0x00000000
shmId = 0 (0x00000000)
id = 47 (0x2F000000)
label = 293 (0x25010000)
fill = 1 (0x01000000)
leng = 320 (0x40010000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000286
occu = 1 (0x01000000)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 8 (cmpManyEq)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = 0x9080FFDF
pghook = 0x00000000
idxPtr = 0x00000000
refCount = 0 (0x00000000)
tstRefCount = 0 (0x00000000)
lineAdmin = 1 (0x01000000)
lineAlloc = 1 (0x01000000)
store_id = 130 (0x82000000)
shmIsReadOnly = 0 (0x00000000)
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
IT_ORDER_METHOD
Table IT_268[2x62]
PROGRAM=/SAPAPO/OM_TB_FLOW_QUANTITYFORM=CHANGE_DATADATA=LT_ORDER_METHOD
Table reference: 51
TABH+ 0(20) = 8882FFDF0000000000000000330000000C010000
TABH+ 20(20) = 020000003E000000FFFFFFFF04000000B0360000
TABH+ 40( 8) = 10000000C1248000
store = 0x8882FFDF
ext1 = 0x00000000
shmId = 0 (0x00000000)
id = 51 (0x33000000)
label = 268 (0x0C010000)
fill = 2 (0x02000000)
leng = 62 (0x3E000000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000278
occu = 16 (0x10000000)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 2 (cmpSingleMcmpR)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
>>>>> Shareable Table Header Data <<<<<
tabi = 0x0868FFDF
pghook = 0x00000000
idxPtr = 0x00000000
refCount = 0 (0x00000000)
tstRefCount = 0 (0x00000000)
lineAdmin = 16 (0x10000000)
lineAlloc = 16 (0x10000000)
store_id = 122 (0x7A000000)
shmIsReadOnly = 0 (0x00000000)
>>>>> 1st level extension part <<<<<
regHook = Not allocated
hsdir = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
IT_ORDKEYS
Table IT_271[1x332]
PROGRAM=/SAPAPO/OM_TB_FLOW_QUANTITYFORM=CHANGE_DATADATA=LT_ORDKEYS
Table reference: 29
TABH+ 0(20) = 80E303E000000000000000001D0000000F010000
TABH+ 20(20) = 010000004C010000FFFFFFFF04870000E0270000
TABH+ 40( 8) = 10000000C1308000
store = 0x80E303E0
ext1 = 0x00000000
shmId = 0 (0x00000000)
id = 29 (0x1D000000)
label = 271 (0x0F010000)
fill = 1 (0x01000000)
leng = 332 (0x4C010000)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000199
occu = 16 (0x10000000)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 8 (cmpManyEq)
occu0 = 1
collHash = 0
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0Hi,
the error DbpError -28814 denotes that an object cannot be found.
Can you maybe tell me your exact liveCache version (incl. Build level) and LCA Build?
Additionally, please copy the relevant error information from the file (/sapdb/data/wrk/<SID>/)knldiag.err into this thread.
Which exact 'liveCache test program' are your referring to (which of the /SAPAPO/... transactions)?
Kind regards,
Roland -
Performance for join 9 custom table with native SQL ?
Hi Expert,
I need your opinion regarding performance to join 9 tables with native sql. Recently i have to tunning some customize extraction cost report. This report extract about 10 million cost of material everyday.
The current program actually, try to populate the condition data and insert into customize table and join all the table to get data using native sql.
SELECT /*+ ordered use_hash(mst,pg,rg,ps,rs,dpg,drg,dps,drs) */
mst.werks, ....................................
FROM
sapsr3.zab_info mst,
sapsr3.zab_pc pg,
sapsr3.zab_rc rg,
sapsr3.zab_pc ps,
sapsr3.zab_rc rs,
sapsr3.zab_g_pc dpg,
sapsr3.zab_g_rc drg,
sapsr3.zab_s_pc dps,
sapsr3.zab_s_rc drs
WHERE mst.zseq_no = :p_rep_run_id
AND mst.werks = :p_werks
AND mst.mandt = rg.mandt(+)
AND mst.ekorg = rg.ekorg(+)
AND mst.lifnr = rg.lifnr(+)
AND mst.matnr = rg.matnr(+)
............................................... unitl all table (9 tables)
AND ps.mandt = dps.mandt(+)
AND ps.knumh = dps.knumh(+)
AND ps.zseq_no = dps.zseq_no(+)
AND COALESCE (dps.kbetr, drs.kbetr, dpg.kbetr, drg.kbetr) <> 0
It seems the query ask for database to using hashed table. would that be it will burden the database ? and impacted to others sap process ?
Please advise
Thank You and Best Regardsyou can only argue coming from measurements and that is not the case.
Coming from the code, I see only that you do not understand it at all, so better leave it as it is. It is not a hash table, but a hash join on these table. -
Performance: Open SQL vs. Native SQL (Oracle)
Hi everybody,
I have an interesting issue here. For a DB selection I use an Open SQL query from a table view into an internal table. It works fine, but the performance is not very well. The SELECT uses LIKE and wildcards (%) to search for customer master data (names and address fields).
Because of the bad performance I made some tests in transaction DB02 with native SQL, but exactly the same SELECT structure. It looks like this:
SELECT *
FROM zzrm_cust_s_hlp
WHERE client = 100
AND mc_name1 LIKE '<name>%'
AND mc_name2 LIKE '<name>%'
AND valid_from <= <timestamp>
AND valid_to >= <timestamp>
Ok, now I tried exactly the same SELECT statement with the same data to search for (<name> and <timestamp) with Open SQL and Native SQL. The Difference is quite suprising, the Native SQL query is about 5-10 times faster (arount 1 sec) than the Open SQL query (around 5-10 sec). Even with the LIKE keywords and the wildcards.
Any ideas what could be the problem with the Open SQL query?
And: what can I do to achive the same performance as with the Native SQL query?
Kind regards and thanks in advance for any help,
MatthiasOk, here is the the SQL explaination from the DB02 query:
SELECT STATEMENT ( Estimated Costs = 194 , Estimated #Rows = 1 )
9 COUNT STOPKEY
Filter Predicates
8 NESTED LOOPS
( Estim. Costs = 193 , Estim. #Rows = 1 )
Estim. CPU-Costs = 1,665,938 Estim. IO-Costs = 193
5 NESTED LOOPS
( Estim. Costs = 144 , Estim. #Rows = 98 )
Estim. CPU-Costs = 1,162,148 Estim. IO-Costs = 144
2 TABLE ACCESS BY INDEX ROWID BUT000
( Estim. Costs = 51 , Estim. #Rows = 93 )
Estim. CPU-Costs = 468,764 Estim. IO-Costs = 51
Filter Predicates
1 INDEX SKIP SCAN BUT000~NAM
( Estim. Costs = 6 , Estim. #Rows = 93 )
Search Columns: 1
Estim. CPU-Costs = 59,542 Estim. IO-Costs = 6
Access Predicates Filter Predicates
4 TABLE ACCESS BY INDEX ROWID BUT020
( Estim. Costs = 1 , Estim. #Rows = 1 )
Estim. CPU-Costs = 7,456 Estim. IO-Costs = 1
Filter Predicates
3 INDEX RANGE SCAN BUT020~0
( Estim. Costs = 1 , Estim. #Rows = 1 )
Search Columns: 2
Estim. CPU-Costs = 3,661 Estim. IO-Costs = 1
Access Predicates
7 TABLE ACCESS BY INDEX ROWID ADRC
( Estim. Costs = 1 , Estim. #Rows = 1 )
Estim. CPU-Costs = 5,141 Estim. IO-Costs = 1
Filter Predicates
6 INDEX UNIQUE SCAN ADRC~0
Search Columns: 4
Estim. CPU-Costs = 525 Estim. IO-Costs = 0
Access Predicates
And this is the one from the Open SQL query in ABAP:
SELECT STATEMENT ( Estimated Costs = 15,711 , Estimated #Rows = 29 )
7 NESTED LOOPS
( Estim. Costs = 15,710 , Estim. #Rows = 29 )
Estim. CPU-Costs = 3,021,708,117 Estim. IO-Costs = 15,482
4 NESTED LOOPS
( Estim. Costs = 15,411 , Estim. #Rows = 598 )
Estim. CPU-Costs = 3,018,711,707 Estim. IO-Costs = 15,183
1 TABLE ACCESS FULL BUT020
( Estim. Costs = 9,431 , Estim. #Rows = 11,951 )
Estim. CPU-Costs = 2,959,067,612 Estim. IO-Costs = 9,207
Filter Predicates
3 TABLE ACCESS BY INDEX ROWID ADRC
( Estim. Costs = 1 , Estim. #Rows = 1 )
Estim. CPU-Costs = 4,991 Estim. IO-Costs = 1
Filter Predicates
2 INDEX UNIQUE SCAN ADRC~0
Search Columns: 4
Estim. CPU-Costs = 525 Estim. IO-Costs = 0
Access Predicates
6 TABLE ACCESS BY INDEX ROWID BUT000
( Estim. Costs = 1 , Estim. #Rows = 1 )
Estim. CPU-Costs = 5,011 Estim. IO-Costs = 1
Filter Predicates
5 INDEX UNIQUE SCAN BUT000~0
Search Columns: 2
Estim. CPU-Costs = 525 Estim. IO-Costs = 0
Access Predicates
Of course I can see the difference.
But since the statements are identical, I don't understand why this difference exists
Thanks for your help!
Kind regards, Matthias -
Possible to do "grant" sql statement in Native SQL?
We have a need to do a grant of access from one of our systems out for various applications. In order for this to work we need to run a grant access command on the table and are trying to put a wrapper around this so we can use an abap. Below is the code I am unit testing. Two questions. First, can a grant be done via native SQL in abap? Second, if it can be done, what is the error with the logic where I am trying to put in the table name via a parameter.
REPORT ZLJTEST2.
tables dd02l.
DATA scarr_carrid TYPE dd02l-tabname.
SELECT-OPTIONS s_carrid for dd02l-tabname no intervals.
DATA s_carrid_wa LIKE LINE OF s_carrid.
DATA name TYPE c LENGTH 20.
TRY.
EXEC SQL.
CREATE FUNCTION selfunc( input CHAR(20) )
RETURNING char(20);
DEFINE output char(20);
set schema sapr3;
grant select on table input to group infouser;
RETURN output;
END FUNCTION;
ENDEXEC.
LOOP AT s_carrid INTO s_carrid_wa
WHERE sign = 'I' AND option = 'EQ'.
TRY.
EXEC SQL.
EXECUTE PROCEDURE selfunc( IN :s_carrid_wa-low,
OUT :name )
ENDEXEC.
WRITE: / s_carrid_wa-low, name.
CATCH cx_sy_native_sql_error.
MESSAGE `Error in procedure execution` TYPE 'I'.
ENDTRY.
ENDLOOP.
EXEC SQL.
DROP FUNCTION selfunc;
ENDEXEC.
CATCH cx_sy_native_sql_error.
MESSAGE `Error in procedure handling` TYPE 'I'.
ENDTRY.Hi,
Yes it is posible.
I made one program like you want. But it need very long code.
Here I explain the idea:
1. Create Screen with input TEXT EDIT CONTROL.
This is for input SQL Statement.
2. Get SQL Statement from Text Edit Control using method <b>get_text_as_r3table</b>.
3. Now we need to separate SQL Statement into different table.
We Separate SELECT, FROM, WHERE, GROUP, HAVING, ORDER, etc.
4. We need dynamic internal table to store the data.
5. Select the data according SQL statement.
SELECT (IT_SELECT)
into corresponding fields of table <dyn_table>
FROM (IT_FROM)
WHERE (IT_WHERE)
GROUP BY (IT_GROUP)
HAVING (IT_HAVING)
ORDER BY (IT_ORDER).
6. Display our data using ALV GRID
Hopefully it will help you.
Regards, -
Invalid column Index error - While consuming Calculation view via Native SQL
Hi Experts,
I am trying to consume a Calculation view (sql script one) , which has input parameters, via Native SQL in a ABAP program .
Code snippet for the same would be as follows , Upon execution, it throws an error "Invalid Column Index (8) error " . Can anyone help what could be the issue here ?
Thanks in Advance,
Suma
REPORT ZTEST_HANA2.
*Report to consume Calculation view (script based) from ABAP
PARAMETERS: ip_docnr type BELNR_D,
ip_gjahr type GJAHR,
ip_bukrs type BUKRS,
ip_blgr type FAGL_RLDNR.
DATA: LO_SQL_STMT TYPE REF TO CL_SQL_STATEMENT,
LO_CONN TYPE REF TO CL_SQL_CONNECTION,
LO_RESULT TYPE REF TO CL_SQL_RESULT_SET,
LV_SQL TYPE STRING,
LR_DATA TYPE REF TO DATA.
DATA: LX_SQL_EXC TYPE REF TO CX_SQL_EXCEPTION,
LT_SEPMAPPS_CLSDINV TYPE TABLE OF SEPMAPPS_CLSDINV,
LV_TEXT TYPE STRING.
TRY.
lv_sql = |SELECT * FROM "_SYS_BIC"."DEMO-ABAP/CA_GET_FI_DATA" | &&
|WITH PARAMETERS ('placeholder'= ('$$p_DOCNR$$','{ ip_docnr }'),| &&
|'placeholder'=('$$p_GJAHR$$','{ ip_gjahr }')| &&
|,'placeholder'= ('$$S_BUKRS$$','{ ip_bukrs }')| &&
|,'placeholder'= ('$$p_base_ledger$$','{ ip_blgr }') )| .
LO_CONN = CL_SQL_CONNECTION=>GET_CONNECTION( ).
"Create an SQL statement to be executed via the connection
LO_SQL_STMT = LO_CONN->CREATE_STATEMENT( ).
"Execute the native SQL query
LO_RESULT = LO_SQL_STMT->EXECUTE_QUERY( LV_SQL ).
"Read the result into the internal table lt_sepmapps_clsdinv
GET REFERENCE OF LT_SEPMAPPS_CLSDINV INTO LR_DATA.
LO_RESULT->SET_PARAM_TABLE( LR_DATA ).
LO_RESULT->NEXT_PACKAGE( ).
LO_RESULT->CLOSE( ).
LO_CONN->CLOSE( ).
CATCH CX_SQL_EXCEPTION INTO LX_SQL_EXC.
LV_TEXT = LX_SQL_EXC->GET_TEXT( ).
MESSAGE LV_TEXT TYPE 'E'.
ENDTRY.Hi Suma,
Post the SQL you success run directly on Studio together with error message (even if is the Invalid column index error).
Check there if the parameters case is working properly... Is it really this confusing options:
p_GJAHR
S_BUKRS
p_base_ledger
Why not all lower or all upper? Anyhow you must test and find which option works according your modeling
Regards, Fernando Da Rós -
Executing Native SQL query for oracle
Hi,
I want to run following native sql query but it is giving me error ora:933,
DATA: BEGIN OF WA,
TSP_NAME(255) TYPE C,
PER_USAGE(10) TYPE C,
END OF WA.
EXEC SQL PERFORMING loop_output.
select t.tablespace_name,'(' || TO_CHAR(ROUND(100*(NVL(b.bytes,0)/NVL(a
.bytes,0)))) || '%)' "TSUsed%" from dba_tablespaces t,
( select tablespace_name, sum(bytes)/1024/1024 bytes
from dba_data_files group by tablespace_name) a,
( select e.tablespace_name, sum(e.bytes)/1024/1024 bytes
from dba_extents e group by e.tablespace_name ) b,
( select f.tablespace_name, sum(f.bytes)/1024/1024 bytes
from dba_free_space f group by f.tablespace_name ) c
where t.tablespace_name = a.tablespace_name(+) and
t.tablespace_name = b.tablespace_name(+) and
t.tablespace_name = c.tablespace_name(+) into :wa.
ENDEXEC.
Please provide me the soln
Regards,
Bharat MistryORA-00933: SQL command not properly ended.
Try:
EXEC SQL PERFORMING loop_output.
select
into :wa
ENDEXEC.
(No "." at the end). If that doesn't work, try ending it with a ";"
Rob -
Native sql not populating correct data in ECC6.0 unicode system
Hi,
I am working in an upgrade upgrade project from 4.6c to ECC6.0.
4.6c is non-unicode system. ECC6 is Unicode system.
I am facing Native SQL problem in custom developed programe in ECC6.That means programe reading the data from oracle datbase and stored into internal table.
But data not stored as normal character format that means its stored as different character format.
I am suspecting this is due to unicode system. IF that is issue then please provide
what syntax I have to use for Native SQL statment in unicode system.
I have provided the code which we are using in programe.
data:
i_locn type table of t_locn,
v_locn like line of i_locn.
field-symbols:
<f_005t> type t_005t.
Get existing EIS_VIDEO_LOCN_CONV records
EXEC SQL.
OPEN C FOR
SELECT EIS_LOCN
FROM VIDADMIN.EIS_VIDEO_LOCN_CONV
ENDEXEC.
do.
EXEC SQL.
FETCH NEXT C
INTO :V_LOCN-EIS_LOCN
ENDEXEC.
if sy-subrc ne 0.
exit.
endif.
append v_locn to i_locn.
enddo.
EXEC SQL.
CLOSE C
ENDEXEC.
sort i_locn.
I am facing the problem in i_locn internal table. Please give me your input to solve this issue.
- Anandakumar KHi,
We have resolved this issue with BASIS team help.
We modified the data charcater set as UTF8 in Oracle data base in unicode system ECC6.0 then the programme returns the
exact character format
Regards
K.Anandakumar -
Error handling in Native SQL for ORACLE
Hi,
I have the next code:
DATA instr TYPE char4.
EXEC SQL.
SELECT INSTRUMENTO INTO instr FROM DATOSMAESTROS
END EXEC.
And I want to control if the select has no results. Is it possible with the statement EXCEPTION inside EXEC SQL? Something like that:
DATA instr TYPE char4.
EXEC SQL.
SELECT INSTRUMENTO INTO instr FROM DATOSMAESTROS WHERE id_inst = '01'
EXCEPTION
WHEN NO_DATA_FOUND THEN
:err = SQLCODE
INSERT INTO error( field, code_err) VALUES ( 'instrumento',:err)
END EXEC.
Is this a correct code? If not, how can I do it?
Thank you all,
Cris.Hello,
Take a look on this: http://help.sap.com/saphelp_nw04s/helpdata/en/fc/eb3b8b358411d1829f0000e829fbfe/frameset.htm
Try this:
DATA instr TYPE char4.
EXEC SQL.
SELECT INSTRUMENTO INTO :instr FROM DATOSMAESTROS
ENDEXEC.
Look that I put : inside the native SQL before the intr.
To catch if no data was recovered try this:
DATA instr TYPE char4.
EXEC SQL PERFORMING no_data.
SELECT INSTRUMENTO INTO :instr FROM DATOSMAESTROS
ENDEXEC.
FORM no_data.
IF instr IS INITIAL.
MESSAGE ...
ENDIF.
ENDFORM.
Regards. -
Hi all,
How do i use Native SQL String in the Reciver JDBC Adapter.
Do i need to change the message format could u suggest me some blogs on the same.
Also please can anyone let me knw if i can use this for stored procedure.hi aditya,
there shud be no format as such. for sql xml format there are specific structure. but for native sql there shudnt be any specific structure.
as pointed in sap documentaion:
Instead of an XML document format, a text is expected that represents any valid SQL statement.
When inserting a line into a table the corresponding document looks as follows:
INSERT INTO tableName (column-name1, column-name2, column-name3) VALUES(column-value1, column-value2, column-value3)
so jus make sure that u give a valid sql statement becoz if will be passed as it is to the database and try ur scenario.
regards,
latika.
Maybe you are looking for
-
Following 455398.1 Using Oracle RAC and ASM with EBS 11i and 11g Finished step 3.6 Post-Oracle RAC Migration Steps Now ASM listener will not come ONLINE. When started manually, it terminates, no error message displayed. Questions: 1- Is there a log f
-
Can't connect after reformat due to virus
Toshiba Satellite P105 Model: PSPA0U-1x001N Windows XP I was infected with "anti-virus live" I cleared it with a Malware program that was recommended on "bleepingcomputer" but a day or so later could no longer connect to the internet. I wiped
-
Creative suite preview update not working
I went to creative tools on the adobe site and downloaded the creative suite preview. My application manager opened but with no option to update.Am I doing anything wrong ? My current version is 1.0.223.0. thanks.
-
when i am using th eloopology how would i construct my own drum progressions using the single drum shots and turning the into an actual drum track all the while keeping them in time and tempo any info would be greatly appreciated thanks
-
Hi, dbassist gives this error while creating a database: ORA-01012: not logged on while in 2nd state: "Create database file" (orig. German: "Datenbankdateien erstellen"). What did we do wrong? Forgot to start any server forgot to free any file, somet