SELECT on TIMESTAMP field from ABAP with EXEC SQL
Hello,
I'm trying to get a field of one table which is defined as TIMESTAMP. MaxDB parameter DATE_TIME_FORMAT is set to INTERNAL. When I do the SELECT in SQL Studio I get ISO format 'YYYY-MM-DD HH:MM:SS.MMMMMM' back. So I tried a SELECT with ISO in WHERE clause, but I'm always getting a shortdump with this error:
Database error text........: "POS(82) Invalid date input value"
Database error code........: "-3065"
Then I did a SELECT without a WHERE clause in ABAP and got value '06-FEB-09' back from this field. So I tried with this ABAP statement and got no shortdump, but I also need to add time and not only the date.
EXEC SQL.
SELECT recv_time INTO :l_time FROM ztest WHERE sent_recv_time = '06-FEB-09'
ENDEXEC.
I'm using Native SQL because the SELECT is on a table which is not located in SAP Schema User. "SELECT recv_time FROM ztest WHERE recv_time = '2009-02-24 10:02:55.888000'" works in SQL studio, but not from ABAP.
Does anyone know which format I need to specify in the WHERE clause?
Regards
Markus Karsch
Edited by: Markus Karsch on Feb 26, 2009 4:22 PM
>
Thomas Theodor Koetter wrote:
> Hello Markus
>
> I don't know whether this will work from ABAP, but at least MaxDB can internally handle the ODBC literals for time, date and timestamp.
>
> Therefore literals like
>
> "{d'0001-02-03'}"
> "{t'01:02:03'}"
> "{ts'0001-02-03 04:05:06'}"
>
> might work. See [http://msdn.microsoft.com/de-de/library/ms190234(SQL.90).aspx]
>
>
> HTH & regards Thomas
Hi Thomas,
Thanks for your help. Unfortunately doesn't seem to work, I get following shortdumps (tried with 3 different notations):
Database error text........: " "
Database error code........: "-4005"
Triggering SQL statement...: "SELECT xxxxxx, status, sent_xxxx_time FROM
xxx_xxxxxxxxx WHERE sent_recv_time = "{ts'2009-02-06 04:05:06'}""
Database error text........: "POS(87) Invalid keyword or missing delimiter"
Database error code........: "-3008"
Triggering SQL statement...: "SELECT xxxxxx, status, sent_xxxx_time FROM
xxx_xxxxxxxxx WHERE sent_recv_time = '{ts' 2009-02-06 04:05:06 '}'"
Database error text........: "POS(81) Missing value specification"
Database error code........: "-5010"
Triggering SQL statement...: "SELECT xxxxxx, status, sent_xxxx_time FROM
xxx_xxxxxxxxx WHERE sent_recv_time = { ts '2009-02-06 04:05:06.000' }"
Regards
Markus
Similar Messages
-
Use Of "#EC CI_EXECSQL in ABAP with EXEC SQL. Statement giving Syntax Error
Dear Gurus,
I have encountered an issue while trying to remove warning for using Native SQL statement using pseudo comment "#EC CI_EXECSQL
The thing is like this -- i have used follwing native sql command in abap.
EXEC SQL.
CONNECT TO 'SURROUND_DB'
ENDEXEC.
Now when i am checking this code in code inspector it is showing a warning with information below
CA CL_CI_TEST_CRITICAL_STATEMENTS0006
Code Inspector
Critical Statements
Use of Native SQL
Authorization checks cannot be appropriately run using EXEC SQL and should be carried out at program level.
The message can be hidden using the pseudo-comment "#EC CI_EXECSQL
Use of exceptin handling section for that warning showing me to use :
The message can be hidden using pseudo
comment "#EC CI_EXECSQL
Now when I am using "#EC CI_EXECSQL in the abap like below :
EXEC SQL. "#EC CI_EXECSQL
CONNECT TO 'SURROUND_DB'
ENDEXEC.
It is giving syntax error
The text literal ""#EC CI_EXECSQL " is longer than 255
characters.Check whether it ends correctly.
Please provide the guideline to resolve this issue.
Thanks & regards
Saifur Rahaman.Hi Saifur,
You can remove the warning using the following syntax:
EXEC "#EC CI_EXECSQL
SQL.
CONNECT TO 'SURROUND_DB'
ENDEXEC.
At least, it worked fine for me when using OPEN CURSOR, SELECT, FETCH and so on statements.
The way to use the pseudo comment is not very intuitive, but at least for my examples worked fine.
I hope this may help you.
Best regards,
Edgardo G. König -
Converting a timestamp field from GMT to EST
Hi
I have to convert the timestamp field coming from the source from GMT to EST.
CREATE TABLE X
TS_FIELD TIMESTAMP(6)
INSERT INTO X VALUES('07-JAN-13 02.00.06.597000 PM');
INSERT INTO X VALUES('07-FEB-13 02.00.06.676000 PM');
INSERT INTO X VALUES('07-MAR-13 12.36.14.260000 PM');
INSERT INTO X VALUES('07-APR-13 12.36.56.713000 PM');
INSERT INTO X VALUES('07-MAY-13 03.46.48.800000 AM');
I need to convert the above timestamp field from GMT to EST in 24hour format.
I tried it doing,but I am getting hours conflict with the day error.
I have tried the below one and milliseconds being set to zero's
select X,
TO_timestamp(TO_CHAR(CAST(FROM_TZ(CAST(TO_DATE(TO_CHAR(X,'YYYY-MM-DD HH24:MI:SS.SSSSS')
,'YYYY-MM-DD HH24:MI:SS.SSSSS')
AS TIMESTAMP),'GMT') AT TIME ZONE 'US/EASTERN' AS DATE),'YYYY-MM-DD HH24:MI:SS.SSSSS'),'YYYY-MM-DD HH24:MI:SS.SSSSS')
FROM X
Please help me in this regard.I am trying in parallel as well.
Thanks in advance
KVBNot clear what are you trying to achieve..Why are you casting as DATE?
SQL> select ts_field,
2 cast(from_tz(ts_field,'GMT') AT TIME ZONE 'EST' as timestamp) t
3 FROM X;
TS_FIELD T
07-JAN-13 02.00.06.597000 PM 07-JAN-13 09.00.06.597000 AM
07-FEB-13 02.00.06.676000 PM 07-FEB-13 09.00.06.676000 AM
07-MAR-13 12.36.14.260000 PM 07-MAR-13 07.36.14.260000 AM
07-APR-13 12.36.56.713000 PM 07-APR-13 07.36.56.713000 AM
07-MAY-13 03.46.48.800000 AM 06-MAY-13 10.46.48.800000 PM -
Create XML file from ABAP with SOAP Details
Hi,
I am new to XML and I am not familiar with JAVA or Web Service. I have searched in SDN and googled for a sample program for creating XML document from ABAP with SOAP details. Unfortunately I couldn't find anything.
I have a requirement for creating an XML file from ABAP with SOAP details. I have the data in the internal table. There is a Schema which the client provided and the file generated from SAP should be validating against that Schema. Schema contains SOAP details like Envelope, Header & Body.
My question is can I generate the XML file using CALL TRANSFORMATION in SAP with the SOAP details?
I have tried to create Transformation (Transaction XSLT_TOOL) in SAP with below code. Also in CALL transformation I am not able to change the encoding to UTF-8. It's always show UTF-16.
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
<xsl:template match="/">
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Header>
<CUNS:HeaderInfo>
<CUNS:InterfaceTypeId>10006</InterfaceTypeId>
<CUNS:BusinessPartnerID>11223344</BusinessPartnerID>
<CUNS:SchemaVersion>1.0</SchemaVersion>
<CUNS:DateTime>sy-datum</DateTime>
</CUNS:HeaderInfo>
</SOAP:Header>
<SOAP:Body>
<xsl:copy-of select="*"/>
</SOAP:Body>
</SOAP:Envelope>
</xsl:template>
</xsl:transform>
In ABAP program, I have written below code for calling above Transformation.
call transformation ('Z_ID')
source tab = im_t_output[]
result xml xml_out.
call function 'SCMS_STRING_TO_FTEXT'
exporting
text = xml_out
tables
ftext_tab = ex_t_xml_data.
Please help me how to generate XML file with SOAP details from ABAP. If anybody have a sample program, please share with me.
Is there any easy way to create the XML file in CALL Transformation. Please help.
ThanksTry ABAP forum, as it seems not to be PI related.
-
Create data base table with EXEC SQL
Hello,
I nead to create o data base table with EXEC SQL in an Abap program.
My code is :
TRY.
EXEC SQL.
CREATE table zt_hello ( mandt char(4) NOT NULL,
kunnr char(10) NOT NULL,
PRIMARY KEY (mandt, kunnr) )
ENDEXEC.
CATCH cx_sy_native_sql_error INTO exc_ref.
error_text = exc_ref->get_text( ).
ENDTRY.
IF sy-subrc = 0.
COMMIT WORK.
ENDIF.
But it still not working.
Can you help me please.
Thanks.
Edited by: widad soubhi on Jul 14, 2010 5:26 PMPlease refer this code
REPORT z_struct_create .
DATA: my_row(500) TYPE c,
my_file_1 LIKE my_row OCCURS 0 WITH HEADER LINE.
DATA: dd02v TYPE dd02v.
DATA: my_file_tab1 LIKE dd03p OCCURS 0 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text
NO INTERVALS.
PARAMETERS:
name TYPE ddobjname,
testo TYPE text40,
file_1 LIKE rlgrap-filename.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK blk.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file_1.
PERFORM file_selection USING file_1.
INITIALIZATION.
text = text-001.
START-OF-SELECTION.
IF file_1 IS INITIAL.
MESSAGE ID 'Z0017_BDI' TYPE 'I' NUMBER 001.
EXIT.
ENDIF.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = file_1
filetype = 'ASC'
TABLES
data_tab = my_file_1.
IF sy-subrc 0.
MESSAGE ID 'Z0017_BDI' TYPE 'I' NUMBER 002.
EXIT.
ENDIF.
LOOP AT my_file_1.
IF sy-tabix > 1.
CLEAR my_file_tab1.
SPLIT my_file_1 AT ';' INTO
my_file_tab1-fieldname
my_file_tab1-datatype
my_file_tab1-leng
my_file_tab1-decimals
my_file_tab1-ddtext
my_file_tab1-inttype = 'C'.
my_file_tab1-INTLEN = my_file_tab1-leng.
my_file_tab1-tabname = name.
my_file_tab1-position = sy-tabix - 1.
my_file_tab1-ddlanguage = sy-langu.
my_file_tab1-OUTPUTLEN = my_file_tab1-leng.
APPEND my_file_tab1.
ENDIF.
ENDLOOP.
dd02v-tabname = name.
dd02v-ddlanguage = sy-langu.
dd02v-tabclass = 'INTTAB'.
dd02v-DDTEXT = testo.
dd02v-MASTERLANG = sy-langu.
IF NOT my_file_tab1[] IS INITIAL.
CALL FUNCTION 'DDIF_TABL_PUT'
EXPORTING
name = name
dd02v_wa = dd02v
TABLES
dd03p_tab = my_file_tab1
EXCEPTIONS
tabl_not_found = 1
name_inconsistent = 2
tabl_inconsistent = 3
put_failure = 4
put_refused = 5
OTHERS = 6
IF sy-subrc 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSE.
MESSAGE ID 'Z0017_BDI' TYPE 'I' NUMBER 003.
EXIT.
ENDIF.
*& Form file_selection
-->P_FILE_1 text
FORM file_selection USING p_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = ''
def_path = 'c:\'
mask = ',.,..'
mode = '0'
title = 'Selezione file'
IMPORTING
filename = p_file
RC = RCODE
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
ENDFORM. " file_selection
File Template:
Fieldname;Data Type;Lentgh;Dec.;Descr.
FIELD1;CHAR;000020;000000;my field 1
FIELD2;CHAR;000008;000000;my field 2
FIELD3;CHAR;000007;000000;my field 3
FIELD4;CHAR;000006;000000;my field 4 -
Creating User Table, User Field ... with Script SQL in C#
Hi every body,
I wonder if we could create a user table, user field ... with script SQL in C#.
Should I use the reference Microsoft.SqlServer.ScriptTask ??
Thank you for your HelpHaifa,
I am not sure where your question is directed. The forum that you have posted your question in is for questions related to the SAP Business One SDK. Are you looking to create new user tables/fields in SAP Business One? If so you can do this either through the SAP Business One SDK interface using Tools > User Defined Fields and/or Tools > User Defined tables.
You can also create metadata objects in Business One programatically using the UserTablesMD and/or UserFields objects.
SAP does not support direct SQL writes to the SAP Business One Db.
HTH,
Eddy -
Problems with TIMESTAMP Field from SQL Server
OBIEE 11g
Hi All,
I want to convert data into OBIEE that is coming from a TIMESTAMP field in SQL Server Database. So in SQL Server field has data like '9/20/2012 12:05:08 AM'. I have first changed the datatype in physical layer to DATETIME and then in BMM I do a CAST(<DATE_FIELD> AS DATE). On the frontend when I use this column the error I get back is [nQSError: 59030] Illegal data type conversion from source type: VARBINARY to target type: TIMESTAMP. (HY000). Does anyone know a workaround or solution.
Thanks in Advance!Hi Guys,
None of the solutions you mentioned have worked unfortunately. I have a date column and another column that holds user id. I basically want to do a count of all the user id's where that particular date column is NULL. I have checked in the physical layer and the date column in question is coming from SQL Server as a TIMESTAMP datatype. So I initially did not change anything and brought the column in as is but that did not work out. I then tried to change the datatype in the physical layer to DATETIME and then also DATE. After changing the datatype in the physical layer in the BMM I would do a CAST(<date column> as DATE) and this still did not work. I then tried to just change the datatype to DATETIME and DATE without doing the CAST in the BMM and this still did not work. Not too sure what to do now. -
How to read data from ABAP with filter?
I know the famous pass which uses RFC_READ_TABLE to get a whole table into IdM. How can I only read a part of it, e.g. The currently locked users from table USR02 having UFLAG NE 0?
Let's have a look to ABAP (with basis release 702):
The function RFC_READ_TABLE offers filters using the input table OPTIONS. OPTIONS is a simple text table with line length 72 which directly is copied into the WHERE clause of the SELECT.
The result is restricted to tables having maximum record length of 512 characters. However, using the input table FIELDS you could list the FIELDNAMES which should be read from the database. This way it would be possible to read larger tables - if you only choose fields which sum up to maximum 5121 characters.
Coding example in ABAP:
data: ls_OPTIONS type RFC_DB_OPT,
lt_OPTIONS type table of RFC_DB_OPT,
ls_FIELDS type RFC_DB_FLD,
lt_FIELDS type table of RFC_DB_FLD,
ls_DATA type TAB512,
lt_DATA type table of TAB512.
ls_FIELDS-FIELDNAME = 'BNAME'.
append ls_FIELDS to lt_FIELDS.
ls_FIELDS-FIELDNAME = 'UFLAG'.
append ls_FIELDS to lt_FIELDS.
ls_FIELDS-FIELDNAME = 'BCODE'.
append ls_FIELDS to lt_FIELDS.
ls_OPTIONS-TEXT = `BNAME LIKE 'J%'`.
ls_OPTIONS-TEXT = `AND`.
ls_OPTIONS-TEXT = `UFLAG NE 0`.
append ls_OPTIONS to lt_OPTIONS.
CALL FUNCTION 'RFC_READ_TABLE'
DESTINATION 'NONE'
EXPORTING
QUERY_TABLE = 'USR02'
* DELIMITER = ' '
* NO_DATA = ' '
* ROWSKIPS = 0
* ROWCOUNT = 0
TABLES
OPTIONS = lt_OPTIONS
FIELDS = lt_FIELDS
DATA = lt_DATA
EXCEPTIONS
TABLE_NOT_AVAILABLE = 1
TABLE_WITHOUT_DATA = 2
OPTION_NOT_VALID = 3
FIELD_NOT_VALID = 4
NOT_AUTHORIZED = 5
DATA_BUFFER_EXCEEDED = 6
system_failure = 8 "MESSAGE l_message
communication_failure = 9 "MESSAGE l_message
OTHERS = 7
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
write: / 'RFC_READ_TABLE', 30 'SY-SUBRC =', sy-subrc.
loop at lt_DATA into ls_DATA.
write: / ls_DATA.
endloop.
How can we create a FromSAP pass in IdM which uses function RFC_READ_TABLE with OPTIONS and FIELDS?
Let's have a look to alternatives:
Function RFC_GET_TABLE_ENTRIES has the same limitation of maximum record length of 512 but does not offer data or field selections. -> Not useful for IdM
Function GET_TABLEBLOCK_RFC is not remote enables but a local starter in ABAP for function GET_TABLEBLOCK_COMPRESSED_RFC, however, this one retrieves compressed results. -> Not useful for IdM
Function TABLE_ENTRIES_GET_VIA_RFC has a maximum line length of 2014 and offers data selection using input table SEL_TAB (no field selection). Limitation: This function can only process table which have character-like fields only, i.e. table USR02 is out of scope. (Function RFC_READ_TABLE does not have this limitation.)
Coding example in ABAP:
data: ls_SEL_TAB type BDSEL_STAT,
lt_SEL_TAB type table of BDSEL_STAT,
ls_NAMETAB type BDI_MFGRP,
lt_NAMETAB type table of BDI_MFGRP,
ls_TABENTRY type BDI_ENTRY,
lt_TABENTRY type table of BDI_ENTRY.
ls_SEL_TAB-ZEILE = `BNAME like 'B%'`.
append ls_SEL_TAB to lt_SEL_TAB.
CALL FUNCTION 'TABLE_ENTRIES_GET_VIA_RFC'
DESTINATION 'NONE'
EXPORTING
* LANGU = SY-LANGU
* ONLY = ' '
TABNAME = 'UST04'
* IMPORTING
* RC =
TABLES
SEL_TAB = lt_SEL_TAB
NAMETAB = lt_NAMETAB
TABENTRY = lt_TABENTRY
EXCEPTIONS
INTERNAL_ERROR = 1
TABLE_HAS_NO_FIELDS = 2
TABLE_NOT_ACTIV = 3
NOT_AUTHORIZED = 4
system_failure = 8 "MESSAGE l_message
communication_failure = 9 "MESSAGE l_message
OTHERS = 5
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
write: / 'TABLE_ENTRIES_GET_VIA_RFC', 30 'SY-SUBRC =', sy-subrc.
loop at lt_TABENTRY into ls_TABENTRY.
write: / ls_TABENTRY.
endloop.
Despite the limitation, how can we create a FromSAP pass in IdM which uses function TABLE_ENTRIES_GET_VIA_RFC?
Kind regards
Frank -
Drop down in the selection for the field from the table
Hi.
i want to put the drop down for the field from the table fo which i dont know the number of entries for the field zregion1 of the table zbwcntry.
please tell me how to use the function module and what could be the line of codes.
the drop down is for the select option on the slection screen of the classical report.
please help .HI,
Check below code..it may help you.
REPORT Zbunu .
TYPES :BEGIN OF STR ,
MATNR TYPE MATNR ,
END OF STR .
DATA : ITAB TYPE TABLE OF STR WITH HEADER LINE,
VAR TYPE MARA-MATNR .
PARAMETERS : S_MATNR TYPE MATNR ,
P_MATNR TYPE MATNR.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_MATNR .
SELECT MATNR FROM MARA INTO
CORRESPONDING FIELDS OF TABLE ITAB UP TO 1000 ROWS.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
retfield = 'MATNR'
PVALKEY = ' '
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNNR
DYNPROFIELD = 'S_MATNR'
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = 'X'
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
tables
value_tab = ITAB
FIELD_TAB =
RETURN_TAB =
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards
Ansumesh -
It is possible select a member "field" editable/moveable with mouse?
I have diferent editable "field" on the stage.
If the "field" are only "editable" I can select every field with the mouse and write inside of it, but if I make them "editable/moveable" I can't select with the mouse any field but I can pass from one to other only with the key "TAB".
Do you know if there is a way to select every "Member field" that I want with mouse and without "Tab" when every field is set to editable/moveable?
Thank.Still not sure about your intention, but maybe:
SQL> create or replace type test_obj as object
(s_name varchar2 (30),
member function test
return varchar2)
Type created.
SQL> create or replace type body test_obj
as
member function test
return varchar2
is
loc_name varchar2 (30);
t_obj test_obj;
begin
execute immediate 'select test_obj(''' ||s_name||''') from dual' into t_obj; -- is it somehow possible to use s_name here - without using clause
return t_obj.s_name;
end;
end;
Type body created.
SQL> declare
o_test test_obj := test_obj ('testText');
begin
dbms_output.put_line ('s_name: ' || o_test.test);
end;
s_name: testText
PL/SQL procedure successfully completed. -
Problem in selecting the different fields from different text fields
hi,
Can anyone help me regarding my query.
i have 3 select list columns separately and what i m trying is that when i select one field from first select list the related fields must only be available for me in the second select list and so on.
Suppose i select EBSO as a product name from the first select list then only those thing should be visible to me in the second select list which is only related to EBSO only...and same wise with the third select list..
If anyone has the clue for this pls help me.
The only clue which i m finding is that to use the java scrpts but how to use is another difficulty for me.
RegardsI will explain this through an example.
In my application I have created two Select Lists.
The first select list is a select list with a submit
P3_X allows selection of 1,2,3
The page branch sets the value of P3_X with &P3_X. so that way the second select list knows what value it will be using.
The second select list P3_Y is a dynamic query that says
Select SCOL d, SCOL r from TEST1 where FCOL=:P3_X
If you were to have a third select list you would make the second Select List also a submit and have the page branch also set P3_Y with &P3_Y.
The third Select list would say select from where item=:P3_Y
Does this answer your question? -
TRY ... CATCH doesn't work with EXEC SQL?
When I created a native SQL statement, I knew before, that it would take a few tries to get it working. I decided to use exception classes to avoid short dumps, but it didn't work.
Following code causes a short dump because of the dot after :xp_stras in the native SQL SELECT statement:
try.
EXEC SQL PERFORMING list.
SELECT LIFNR, NAME1, STRAS
INTO :xsl
FROM LFA1
WHERE UPPER( NAME1 ) LIKE :xp_name1
AND UPPER( STRAS ) LIKE :xp_stras.
ENDEXEC.
catch CX_SY_NATIVE_SQL_ERROR.
write: /1 'CX_SY_NATIVE_SQL_ERROR'.
catch CX_SY_SQL_ERROR.
write: /1 'CX_SY_SQL_ERROR'.
catch CX_DYNAMIC_CHECK.
write: /1 'CX_DYNAMIC_CHECK'.
catch CX_ROOT.
write: /1 'CX_SY_ROOT'.
endtry.
In ST22 you can see
Name of runtime error: DBIF_DSQL2_SQL_ERROR
Exception:
The name of the exception is empty, in other short dumps you can find there the name of the exception class. Maybe that's the reason for CATCH does'nt work, but I don't understand it.
Online help for EXEC SQL says:
Catchable Exceptions
CXSY_NATIVE_SQL_ERROR_
Cause: SQL-Error at the execution of a Native SQL-command.
Runtime Error: DBIF_DSQL2_SQL_ERROR
We have SAP ECC 6.0 with SAP_BASIS rel. 700 lvl. 0013.
If You have an idea why CATCH doesn't work, please tell me!
Regards,
KlausHi Rob,
I tried out Your original code as program ZTEST5 and got a short dump (sorry, some of the short dump symbols are formatting this post in a wrong way ...):
Short text
An SQL error occurred when executing Native SQL.
What happened?
The error 919 occurred in the current database connection "DEFAULT".
What can you do?
Note down which actions and inputs caused the error.
To process the problem further, contact you SAP system
administrator.
Using Transaction ST22 for ABAP Dump Analysis, you can look
at and manage termination messages, and you can also
keep them for a long time.
How to correct the error
Database error text........: "ORA-00919: invalid function"
Database error code........: 919
Triggering SQL statement...: "FETCH NEXT "
Internal call code.........: "[DBDS/NEW DSQL]"
Please check the entries in the system log (Transaction SM21).
If the error occures in a non-modified SAP program, you may be able to
find an interim solution in an SAP Note.
If you have access to SAP Notes, carry out a search with the following
keywords:
"DBIF_DSQL2_SQL_ERROR" " "
"ZTEST5" or "ZTEST5"
"START-OF-SELECTION"
If you cannot solve the problem yourself and want to send an error
notification to SAP, include the following information:
1. The description of the current problem (short dump)
To save the description, choose "System->List->Save->Local File
(Unconverted)".
2. Corresponding system log
Display the system log by calling transaction
Restrict the time interval to 10 minutes befor
after the short dump. Then choose "System->List->
(Unconverted)".
3. If the problem occurs in a problem of your own
program: The source code of the program
In the editor, choose "Utilities->More
Utilities->Upload/Download->Download".
4. Details about the conditions under which the e
actions and input led to the error.
System environment
SAP-Release 700
Application server... "lux01617"
Network address...... "195.217.80.104"
Operating system..... "Linux"
Release.............. "2.6.5-7.283-smp"
Hardware type........ "x86_64"
Character length.... 16 Bits
Pointer length....... 64 Bits
Work process number.. 5
Shortdump setting.... "full"
Database server... "lux09208"
Database type..... "ORACLE"
Database name..... "D10"
Database user ID.. "SAPDAT"
Char.set.... "C"
SAP kernel....... 700
created (date)... "Dec 2 2007 20:18:08"
create on........ "Linux GNU SLES-9 x86_64 cc3.3.3"
Database version. "OCI_102 (10.2.0.2.0) "
Patch level. 138
Patch text.. " "
Database............. "ORACLE 9.2.0.., ORACLE 10.1.0.., ORACLE 1
SAP database version. 700
Operating system..... "Linux 2.6"
Memory consumption
Roll.... 16192
EM...... 16759392
Heap.... 0
Page.... 98304
MM Used. 694160
MM Free. 3493088
User and Transaction
Client.............. 500
User................ "Z0000D2P"
Language key........ "E"
Transaction......... "SE38 "
Transactions ID..... "48FE92EB921F51C3E1000000C3D95068"
Program............. "ZTEST5"
Screen.............. "SAPMSSY0 1000"
Screen line......... 6
Information on where terminated
Termination occurred in the ABAP program "ZTEST5" - in "START-OF-SELECTION".
The main program was "ZTEST5 ".
In the source code you have the termination point in line 16
of the (Include) program "ZTEST5".
Source Code Extract
Line SourceCde
1 REPORT ztest LINE-SIZE 80 MESSAGE-ID 00.
2
3 TABLES: lfa1.
4
5 DATA: BEGIN OF xsl,
6 lifnr TYPE lfa1-lifnr,
7 name1 TYPE lfa1-name1,
8 stras TYPE lfa1-stras,
9 END OF xsl.
10
11 DATA: xp_name1 TYPE lfa1-name1,
12 xp_stras TYPE lfa1-stras.
13
14 TRY.
15 EXEC SQL PERFORMING list.
>>>>> SELECT LIFNR, NAME1, STRAS
17 INTO :xsl
18 FROM LFA1
19 WHERE UPPER( NAME1 ) LIKE :xp_name1
20 AND UPPER( STRAS ) LIKE :xp_stras.
21 ENDEXEC.
22
23 CATCH cx_sy_native_sql_error.
24 WRITE: /1 'CX_SY_NATIVE_SQL_ERROR'.
25 CATCH cx_sy_sql_error.
26 WRITE: /1 'CX_SY_SQL_ERROR'.
27 CATCH cx_dynamic_check.
28 WRITE: /1 'CX_DYNAMIC_CHECK'.
29 CATCH cx_root.
30 WRITE: /1 'CX_SY_ROOT'.
31 ENDTRY.
32
33 &----
34 *& Form LIST
35 &----
Edited by: Klaus Babl on Oct 22, 2008 6:42 AM -
Radio button on a from generated with PL/SQL procedure
Hi,
I have a form generated with PL/SQL procedure. This procedure calls another procedure on 'Submit'. If I select value for the radio button, it works fine. But if no value is given to the radio button on the form, it gives error. Is the radio button mandatory field by nature? or do I need to give default value some how? How do I make the radio button optional? so that I can call the next procedure without passing the param.
Create or Replace PROCEDURE OBM_PROCEDURE
htp.formOpen(OWA_UTIL.GET_OWA_SERVICE_PATH || 'process_obm');
htp.Print('Admin ');
htp.FormRadio('p_access_level','A');
htp.Print('Doc ');
htp.FormRadio('p_access_level','D');
htp.formSubmit(cname=>'p_button', cvalue=> 'Submit');
=================================================================
Create or Replace PROCEDURE PROCESS_OBM
(p_access_level VARCHAR2,
p_button VARCHAR2)
htp.Print('p_access_level ');
Thanks!Hi
The parameters of the called procedure should have defualt values like this
create or Replace PROCEDURE PROCESS_OBM
(p_access_level VARCHAR2 default 1,
p_button VARCHAR2 default null
htp.Print('p_access_level ');
Thanks,
sharmila -
"Select * into table internal_table from database_table" in native SQL
Dear All,
Is it possible to insert into internal table from database table in native sql instead of open sql? Regarding single values it's clear, just to use ":variable_name". But how to map internal table? RDBMS Oracle version > 9. If it's possible and you know how to do it, please, give some code example.
Thank you,
PavelHi ,
Here is the code snippet for the native sql .
select * from zwf_role into table i_wfroles." where role_id ='CAO'.
loop at i_wfroles into wa_wfroles.
EXEC sql.
insert into ROLES_MASTER_SAP
values (:wa_wfroles-ROLE_ID,:wa_wfroles-ROLE_NM,
:wa_wfroles-ROLE_DESC,:wa_wfroles-PAR_ROLE_ID,
:wa_wfroles-WF_ROLE_ORDER,:wa_wfroles-ROLE_TYPE )
ENDEXEC.
if sy-subrc = 0 .
suc_rec_cnt = suc_rec_cnt + 1.
else.
fail_rec_cnt = fail_rec_cnt + 1.
endif.
* ( ROLE_ID,ROLE_NAME, ROLE_DESC,PARENT_ROLE_ID,ROLE_ORDER,
* ROLE_TYPE )
endloop.
zwf_role database table has the same files
Regards
Girish -
Pro*C with Visual C++ - leaks memory with EXEC SQL CONTEXT FREE
Hello,
I am making an aplication with threads, using Visual C++ with Pro*C... and I have a problem when the aplication execute EXEC SQL CONTEXT FREE the memory reserved is not free.
this is my code:
#include <sqlca.h>
EXEC SQL BEGIN DECLARE SECTION;
sql_context ctx;
EXEC SQL END DECLARE SECTION;
EXEC SQL ENABLE THREADS;
EXEC SQL CONTEXT ALLOCATE :ctx;
EXEC SQL CONTEXT USE :ctx;
EXEC SQL COMMIT WORK RELEASE;
EXEC SQL CONTEXT FREE :ctx;
thanks in advanceHi!
I suppose to helping in solve your question is necessary see how your application is working with threads.
Can you print them also?
Maybe you are looking for
-
BEA Portal 7.0 configure to use ActiveDirectoryAuthenticator
Hi Folk: Could anyone have any ideas how or show me the documentation where I can change the Sample Portal Server to use a different Realm in the Portal Server ? I have read the portal server is by default using Database Realm, which config file and
-
CS1-Mac How to make a graduated line (ruler) in ID?
I'm a self-taught ID CS1 amateur. I'm laying out a presentation in ID that will be projected page by page from a multi-page PDF file. I need to make a diagram for one page that shows three separated, long vertical lines where each line is cross-hat
-
Anamorphic and 4:3 in same sequence
I am working on a reel where there will be anamorphic SD, 4:3, and possible DVCPRO HD in the same timelime- how do I tell FCP that the anamorphic clips are such. Will it letterbox them automatically if I create an SD 4:3 sequence? Thanks!
-
Hi, I have a cluster with 500 boolean controls (week-calender). I want to detect some events on these boolean controls : - mouse enter - mouse leave I could create an 'enter'-event case and a 'leave'-event case, and then assign the enter- or leave- e
-
(261718088) Q: Can you use xm:multiple with Objects other than String?
Q: Can you use xm:multiple with Objects other than Strings? <br> A: You bet. Attached find a text file with some code from the example I showed today, a version of the multipleSayHiTo() method that has a parameter of an Array of Person objects rather