Native sql DBCO, CONNECT statement short dump

Hi ALL ,
I am facing the  problem here.  please help me out in this.
i am trying to connce to the external database MSS, i made all the entries in the DBCO t-code and writing the follwoing native sql statement.
EXEC SQL.
CONNECT TO 'AAJ' AS 'V'
ENDEXEC.
EXEC SQL.
SET CONNECTION 'V'
ENDEXEC.
The above statement is not giving any error  when i activate it but when i execute it is giving me shortdump error .
I already maintan   entries in DBCON table or DBCO t-code
And also tel me once it is connect how can i access the data from MSS (Microsoft sql server)i mean what kind of statement.
helpfull answer will be rewarded.
Anees
9886358645
Message was edited by:
        anees jawad

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:
EXEC SQL [PERFORMING  )
The parameters are separated by commas. You must also specify whether the parameter is for input (IN), output (OUT) or input and output (INOUT). For further information, refer to SAP Note 44977.
EXEC SQL
   EXECUTE PROCEDURE proc1 ( IN , OUT :y )
ENDEXEC.
Cursor Processing
Cursor processing in Native SQL is similar to that in Open SQL:
OPEN
  ENDIF.
ENDDO.
EXEC SQL.
  CLOSE c1
ENDEXEC.
This example opens a cursor, reads data line by line, and closes the cursor again. As in Open SQL, SY-SUBRC indicates whether a line could be read.
Data Types and Conversions
Using Native SQL, you can
Transfer values from ABAP fields to the database
Read data from the database and process it in ABAP programs.
Native SQL works without the administrative data about database tables stored in the ABAP Dictionary. Consequently, it cannot perform all of the consistency checks used in Open SQL. This places a larger degree of responsibility on application developers to work with ABAP fields of the correct type. You should always ensure that the ABAP data type and the type of the database column are identical.
If the database table is not defined in the ABAP Dictionary, you cannot refer directly to its data type. In this case, you should create a uniform type description in the ABAP Dictionary, which can then be used by all application programs.
If the table is defined in the ABAP Dictionary, you should remember that the sequence of fields in the ABAP Dictionary definition may not be the same as the actual sequence of fields in the database. Using the asterisk (*) in the SELECT clause to read all columns into a corresponding work area would lead to meaningless results. In the worst case, it would cause an error.
The Native SQL module of the database interface passes a description of the type, size, and memory location of the ABAP fields used to the database system. The relevant database system operations are usually used to access and convert the data. You can find details of these operations in the manuals for the programming interface of the relevant database system. In some cases, Native SQL also performs other compatibility checks.
The documentation from the various database manufacturers provides detailed lists of combinations of ABAP data types and database column types, both for storing ABAP field values in database tables (INSERT, UPDATE) and for reading database contents into ABAP fields (SELECT). You can also apply these descriptions for the input and output parameters of database procedures. Any combinations not listed there are undefined, and should not be used.
The following sections provide details of the data types and conversions for individual databases. Although they are database-specific, there are also some common features.
Recommended type combinations are underlined. Only for these combinations is behavior guaranteed from release to release. For any other combinations, you should assume that the description only applies to the specified release.
The results of conversions are listed in a results column:
"OK": The conversion can be performed without loss of data.
Operations that fail are indicated by their SQL error code. Errors of this kind always lead to program termination and an ABAP short dump.
In some cases, data is transferred without an SQL error occurring. However, the data is truncated, rounded, or otherwise unusable:
Right truncation.
"Left" or "right" applies to the normal way of writing a value. So, for example, if a number is truncated, its decimal places are affected.
: Left truncation
: Number is rounded up or down during conversion
: A number that was "too small" is rounded to 0 (underflow)
: The conversion result is undefined.
There are several possible results. The concrete result is either not known at all, or can only be described using a set of rules that is too complicated for practical use.
: The conversion returns the SQL value NULL.
: The conversion is performed without fields and unchecked.
The original data is converted, but without its format being checked. The result may therefore be a value invalid for the result type, which cannot be processed further. An example of this is a date field containing the value "99999999" or "abcdefgh" after conversion.
Combinations of ABAP data type and database column type can be divided into finer subcategories. Here, for example, using the transfer direction ABAP ® database (INSERT, UPDATE):
If the width of the ABAP field is greater than that of the database column, the ABAP field may contain values for which there is not enough space in the database column. This can produce other cases: The concrete data value in ABAP finds space in the database column, or not.
If the ABAP field is at most as long as the database column, there is always space for the ABAP value in the database column.
Some types, such as numeric columns, expect values in a particular format. This is particularly important in connection with character types, for example, when you want to write an ABAP character field (type C) into an integer column.
Native SQL for Oracle
Native SQL for Informix
Native SQL for DB2 Common Server
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3b8b358411d1829f0000e829fbfe/content.htm

Similar Messages

  • Problem with Native SQL DB connection.

    Hi Gurus,
    Depending on the value of a  parameter (a or b)
    I create 2 connections.
    In both the cases connection is made as follows.
    EXEC SQL.
    CONNECT TO :CONNECTIONNAME AS :SY-UNAME.
    ENDEXEC.
    (Where connection name is different in both the cases & accessing DB table is also different).
    Now it gives me following dump when both the cases are executed one by one.
    EXSQL_ILLEGAL_CONNECTION
    How to avoid this dump ?
    Thanks in Advance,
    deepanadhi.

    You can't use SY-UNAME in the Native Sql, So give the DB connection name

  • Short dump in DB13 backup

    Hi,
    we got a short dump during the backup of the local HANA DB in Tx DB13.
    SAP Netweaver 7.30 SP08
    SAP HANA 1.00.70.00
    Category          
    ABAP Programming Error
    Runtime Errors    
    EXSQL_ILLEGAL_DISCONNECTION
    ABAP Program      
    CL_HDB_UTILITIES_DB13=========CP
    |Short text                                                                                        |
    |    DISCONNECT is not possible for the DEFAULT connection.                                        |
    |What happened?                                                                                    |
    |    Error in the ABAP application program.                                                        |
    |                                                                                                  |
    |    The current ABAP program "CL_HDB_UTILITIES_DB13=========CP" had to be                         |
    |     interrupted because it contains                                                              |
    |    a statement that cannot be executed.                                                          |
    |Error analysis                                                                                    |
    |    In a DISCONNECT command in Native SQL the connection "DEFAULT" was                            |
    |    specified. This connection cannot be broken with DISCONNECT.                                  |
    There are no note or other informations about this issue. Any ideas?
    Thanks
    Patrick

    Hi Patrick Gutheil,
    Could you please check and let me know if NOTE 1640741 has any relevance to the issue that you are facing!
    BR
    Prabhith

  • Regarding Native SQL and UNIX

    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...
    Jesus

    Solved it on my own

  • Short dump in SAP R/3: SQL statement buffer overflow?

    Hello,
    I hope someone can help us with the following problem:
    A short dump in SAP R/3 (DBIF_RSQL_INVALID_RSQL, CX_SY_OPEN_SQL_DB)
    occurred during a delta load, which worked fine for several month.
    The custom code crashes at a FETCH NEXT CURSOR statement.
    I assume, it might be a SQL statement buffer overflow in SAP R/3?
    The problem can be reproduced by RSA3, and is therefore not time-dependent.
    The problem did not occur before or on the quality assurance system.
    Cursor code:
          Read all entries since last transfer (delta mechanism)
            OPEN CURSOR WITH HOLD s_cursor FOR
              SELECT * FROM ekko
                WHERE ebeln IN t_selopt_ekko.
    t_selopt_ekko has up to 60.000 data sets, which worked fine in the past.
    It is very likely that the amount of data during the first crash did not exceed this.
    SQL-Trace of RSA3 call:
    It seems that 25150 data set can be processed via fetch before the short dump occurs
    After that object SNAP is written:
    "...DBIF_RSQL_INVALID_RSQL...dynpen00 + 0xab0 at dymain.c:1645 dw.sapP82_D82
    Thdyn...Report für den Extraktoraufruf...I_T_FIELDS...Table IT_43[16x60]TH058FUNCTION=
    RSA3_GET_DATA_SIMPLEDATA=S_S_IF_SIMPLE-T_FIELDSTH100...shmRefCount  = 1...
    ...> 1st level extension part <...isUsed       = 1...isCtfyAble   = 1...> Shareable Table Header Data
    <...tabi         = Not allo......S_CURSORL...SAPLRSA3...LRSA3U06...SAPLRSA3...
    During dump creation the following occurs:
    "...SAPLSPIAGENTCW...CX_DYNAMIC_CHECK=...CRSFH...BALMSGHNDL...
    DBIF_RSQL_INVALID_RSQL...DBIF_RSQL_INVALID_RSQL...DB_ERR_RSQL_00013...
    INCL_ABAP_ERROR...DBIF_INCL_INTERNAL_ERROR...INCL_INTERNAL_ERROR...
    GENERAL_EXC_WITHOUT_RAISING...INCL_SEND_TO_ABAP...INCL_SEARCH_HINTS...
    INCL_SEND_TO_SAP...GENERAL_EXC_WITHOUT_RAISING...GENERAL_ENVIRONMENT...
    GENERAL_TRANSACTION...GENERAL_INFO...GENERAL_INFO_INTERNAL...
    DBIF_INCL_INTERNAL_CALL_CODE..."
    Basis says, that the Oracle data base works fine. The problem seems to be a SAP R/3 buffer.
    Does anyone had a similar problem or knows where such a buffer might be or how it can be enlarged?
    Best regards
    Thomas
    P.S.
    Found a thread that contains part of the dump message "dynpen00 + 0xab0 at dymain.c:1645":
    Thread: dump giving by std prg contains -> seems not to be helpful
    Found a similar thread:
    Thread: Short dump in RSA3 --Z Data Source -> table space or somting else?
    Edited by: Thomas Köpp on Apr 1, 2009 11:39 AM

    Hi Thomas,
          Its due to different field length.
    Just check it out in code after FETCH NEXT CURSOR what internal table you have mention.
    that internal table shoul deffined by taking refrence of ekko, because your code is
    OPEN CURSOR WITH HOLD s_cursor FOR
    SELECT * FROM ekko
    WHERE ebeln IN t_selopt_ekko.
    hope you got solution.
    Regards,

  • Not able to get the connection to mssql server thro native sql

    Dear Experts,
               I have created a database connection to mssql server thro DBCO t.code.Am not able to get the connection when i am executing Native SQl for geting connection of mssql server.
    DATA: CON_NAME LIKE DBCON-CON_NAME VALUE 'BIW'.
    EXEC SQL.
      CONNECT TO :con_name AS 'C1'
    ENDEXEC.
    Am always getting sy-subrc = 4. The user name and password i have given in dbcon table having full authorization to access mssql database. I am working SAP ecc 5.0. Also both servers are running in windows.
    could anyone hlep me on this issue.
    Thanks in advance.

    Hello, the submitted error must be analyzed according to the Syntaxis and characteristics of the MSSQL database. See explanation of error.
    http://doc.ddart.net/mssql/sql2000/html/trblsql/tr_reslsyserr_1_1o1i.htm
    Error 156
    Severity Level 15
    Message Text
    Incorrect syntax near the keyword '%.*ls'.
    Explanation
    This error indicates that the syntax of a Transact-SQL statement is incorrect and that the syntax error was detected near the keyword specified in the error message. The most frequent causes for syntax errors are misspellings of Transact-SQL keywords or operators, and specifying the syntax of a Transact-SQL statement in the wrong order.
    One of the more complicated causes for this error may be a compatibility level mismatch for the current database. If the current database has a compatibility level other than 70, Microsoft® SQL Serveru2122 will not recognize any of the keywords that a database with a compatibility level of 70 would recognize.
    Action
    First, check the Transact-SQL statement syntax near the keyword specified in the error message. Because Transact-SQL language syntax can be very complex, SQL Server may incorrectly report the position of the syntax error as later in the Transact-SQL statement than it actually occurred. Second, reexamine the entire Transact-SQL statement that generated the error. Verify the syntax order of the statement.
    Ensure that the database does not have a compatibility level of 65 and has a compatibility level of 70.

  • ERROR When coonecting to SQL via DBCO Connections

    Hi,
    Error when connecting to SQL using DBCO connections. I am getting an dump as "Set up of a secondary connection to the database system failed. It is possible that the data required for setting up the connection via EXEC SQL (Native SQL)is faulty."
    plaese help.
    Thanks

    Hi
    Checking the dbsl_w<NN> as it is explained in point 3 of the 'Troubleshooting' section of [SAP Note 738371|https://service.sap.com/sap/support/notes/738371] would help a lot to know the reason of the failure.
    It is most likely that, the information provided in DBCO are not complete/accurate
    Regards
    Raj

  • Short Dump while acessing external tables using DB Connect

    Hello SDN'rs,
    I am getting Short dump (below) when i am trying to look into the table contents using DB Connect.
    Please let me know how to resolve this problem. Is there any OSS Note on this??
    External Database is Oracle; i can look into other tables.
    ShrtText
    Syntax error in program "GP_CREATE_STRUCTURE_DBCON_026 "
    |What happened?                                                                                |
    |    Error in ABAP application program.                                                            |
    |                                                                                |
    |    The current ABAP program "CL_RS_STRUC===================CP" had to be                         |
    |     terminated because one of the                                                                |
    |    statements could not be executed.                                                             |
    |                                                                                |
    |    This is probably due to an error in the ABAP program.                                         |
    |                                                                                |
    |    In program "GP_CREATE_STRUCTURE_DBCON_026 ", the following syntax error                       |
    |     occurred                                                                                |
    |    in the Include "GP_CREATE_STRUCTURE_DBCON_026 " in line 5:                                    |
    |    "Type "D" can only have the length specification "8" or no length speci"                      |
    |    "fication at all."                                                                            |
    |    " "                                                                                |
    |    " "                                                                                |
    |                                                                                |
    |    Author and last person to change the Include are:                                             |
    |    Author "XYZ "                                                                            |
    |    Last changed by "XYZ
    |Error analysis                                                                                |
    |    In program "GP_CREATE_STRUCTURE_DBCON_026 ", the following syntax error                       |
    |     occurred:                                                                                |
    |    "Type "D" can only have the length specification "8" or no length speci"                      |
    |    "fication at all."                                                                            |
    |    " "                                                                                |
    |    " "                                                                                |
    Trigger Location of Runtime Error                                                                 |
    |    Program                                 CL_RS_STRUC===================CP                      |
    |    Include                                 CL_RS_STRUC===================CM002                   |
    |    Row                                     108                                                   |
    |    Module type                             (METHOD)                                              |
    |    Module Name                             CREATE    
    Thanks,
    Faizee B

    When i tried today for the same table i am getting the shortdump description(below), I have noticed that the number have changed from 026 to 055, any thoughts why it happen and how it can be resolved?
    In program "GP_CREATE_STRUCTURE_DBCON_055 ", the following syntax error                      
    occurred in the Include "GP_CREATE_STRUCTURE_DBCON_055 " in line 5:                                   
        "Type "D" can only have the length specification "8" or no length specification at all."                                                                               
    Thanks,
    Faizee B

  • Native SQL Statement help!

    Hi guys,
    I need some help here.
    I have a requirement to select from Microsoft SQL database
    Question
    How do I select with RANGE internal tables? As you can see, I have 4 range tables for this.
    BElow are my codes
    EXEC SQL.
        CONNECT TO 'CONNECTION_NAME'
      ENDEXEC.
      IF sy-subrc <> 0.
        MESSAGE 'Unable to connect to CONNECTION_NAME' TYPE 'E' DISPLAY LIKE 'I'.
        RETURN.
      ENDIF.
    * Define database cursor
      EXEC SQL.
        OPEN dbcur FOR
                SELECT name1, zvctk, kunnr, yyear, mmonth, matnr,
                       qty, zopcd, bstnk, wekunnr
                  FROM <TABLE_NAME>
                 WHERE month IN i_month
                   AND yyear IN i_year
                   AND kunnr IN i_kunnr
                   AND bstnk IN i_bstnk
      ENDEXEC.
    * Fill itab
      DO.
        EXEC SQL.
          FETCH NEXT dbcur INTO :l_dest-name1,
                                :l_dest-zvctk,
                                :l_dest-kunnr,
                                :l_dest-yyear,
                                :l_dest-mmonth,
                                :l_dest-matnr,
                                :l_dest-qty,
                                :l_dest-zopcd,
                                :l_dest-bstnk,
                                :l_dest-wekunnr
        ENDEXEC.
        IF sy-subrc <> 0.
          EXIT.
        ELSE.
          APPEND l_dest TO it_dest.
        ENDIF.
      ENDDO.
    its giving me a shortdump
    >>>>>     OPEN dbcur FOR
       35             SELECT name1, zvctk, kunnr, yyear, mmonth, matnr,
       36                    qty, zopcd, bstnk, wekunnr
       37               FROM v_promise_sa
       38              WHERE month IN i_month[]
       39                AND yyear IN i_year[]
       40                AND kunnr IN i_kunnr[]
       41                AND bstnk IN i_bstnk[]
    Error message:
    Database error text........: "[Microsoft][SQL Server Native Client 10.0][SQL
    Server]Incorrect syntax near 'i_month'."
    Database error code........: 102
    Triggering SQL statement...: "SELECT name1, zvctk, kunnr, yyear, mmonth, matnr,
    qty, zopcd, bstnk, wekunnr FROM <TABLE_NAME> WHERE month IN i_month[] AND
    yyear IN i_year[] AND kunnr IN i_kunnr[] AND bstnk IN i_bstnk[]"
    Internal call code.........: "[DBDS/NEW DSQL]"
    Please check the entries in the system log (Transaction SM21).
    Can anyone guide me? If I do not enter the where clause, it is selecting fine.
    Appreciate it guys! Thanks in advance!

    lol, Come guys, don't judge me by just my forum nick man. It was just something random during registration a few years back...was indeed new in ABAP language :P
    But anyway, the table v_promimse_sa is not in the DDIC, its some microsoft MYSQL database or something.
    anyway what I did now:
    EXEC SQL.
        CONNECT TO 'MSSQL_PROMISE'
      ENDEXEC.
      IF sy-subrc <> 0.
        MESSAGE 'Unable to connect to MSSQL_PROMISE' TYPE 'E' DISPLAY LIKE 'I'.
        RETURN.
      ENDIF.
    * Define database cursor
      EXEC SQL.
        OPEN dbcur FOR
                SELECT name1, zvctk, kunnr, yyear, mmonth, matnr,
                       qty, zopcd, bstnk, wekunnr
                  FROM v_promise_sa
                 WHERE mmonth = :i_month
                   AND yyear  = :i_year
    *               AND ( kunnr BETWEEN :i_kunnr-low AND :i_kunnr-high )
    *               AND ( bstnk BETWEEN :i_bstnk-low AND :i_bstnk-high )
      ENDEXEC.
    * Fill itab
      DO.
        EXEC SQL.
          FETCH NEXT dbcur INTO :l_dest-name1,
                                :l_dest-zvctk,
                                :l_dest-kunnr,
                                :l_dest-yyear,
                                :l_dest-mmonth,
                                :l_dest-matnr,
                                :l_dest-qty,
                                :l_dest-zopcd,
                                :l_dest-bstnk,
                                :l_dest-wekunnr
        ENDEXEC.
        IF sy-subrc <> 0.
          EXIT.
        ELSE.
          APPEND l_dest TO it_dest.
        ENDIF.
      ENDDO.
    *    EXEC SQL.
    *      CLOSE dbcur
    *    ENDEXEC.
      DELETE it_dest WHERE kunnr NOT IN i_kunnr
                       AND bstnk NOT IN i_bstnk.
    Well, after checking with the functional person, there are only 3 records so I guess the selection + filtering is working.

  • Native sql connect to sql server

    hello everyone!
    my r/3 application server is unix os,versio is 620,I want to connect outer sql server,how can I make it?
    thanks in advance!
    if the suggest is helpfull,point will be rewarded.

    hi Bruce,
    in R3 we can use SQL statements which are native to particular RDBMS (ie that too execute as it like on their  SQL server) we enclose them with
    EXEC SQL [PERFORMING subr].
    ENDEXEC.
    Effect
    These statements define an area in an ABAP program in which one or more Native SQL statements are to be carried out. The area between EXEC and ENDEXEC is not completely checked by the syntax check. The statements entered there are passed to the Native SQL interface and processed there as follows:
    Almost all SQL statements that are valid for the addressed database system can be included between EXEC and ENDEXEC, in particular the DDL statements. These SQL statements are passed from the Native SQL interface to the database system largely unchanged. The syntax rules are specified by the database system, in particular the case sensitivity rules for database objects. If the syntax allows a separator character between individual statements, you can include several Native SQL statements between EXEC and ENDEXEC. Generally, the semicolon ( is used as the separator character.
    You can also include SAP-specific Native SQL language elements between EXEC and ENDEXEC. These statements are not passed directly from the Native SQL interface to the database, but are converted appropriately. These SAP-specific language elements are::
    Host variables
    Statements for cursor processing
    Database procedure calls
    Statements for establishing database connections
    All Native SQL statements bypass SAP buffering. Automatic client handling is not performed.
    System fields
    The statement ENDEXEC sets the system fields sy-subrc and sy-dbcnt. When using the addition PERFORMING, note that implicit cursor processing is carried out and the system fields are set for every read process.
    sy-subrc Meaning
    0 The statements between EXEC and ENDEXEC were executed successfully.
    4 The statements between EXEC and ENDEXEC were not executed. After implicit cursor processing with PERFORMING, sy-subrc always contains the value 4.
    The ENDEXEC statement sets sy-dbcnt to the number of table rows processed in the last Native SQL statement. After implicit cursor processing with PERFORMING, sy-dbcnt contains the total number of lines read.
    Note
    Programs with Native SQL statements are generally dependent on the database system used, so that they cannot be executed in all ABAP systems. This is especially true for the examples in this section, which was written for Informix database systems.
    Example
    Inserting two rows in the database table SCARR. If neither of these rows exists, sy-subrc is set to 0 by ENDEXEC and sy-dbcnt to 1. Otherwise, an exception is raised and handled.
    DATA: exc_ref    TYPE REF TO cx_sy_native_sql_error,
          error_text TYPE string.
    TRY.
        EXEC SQL.
          INSERT INTO scarr
                      (MANDT, CARRID, CARRNAME, CURRCODE, URL)
            VALUES ('000', 'FF', 'Funny Flyers', 'EUR',
                    'http://www.ff.com');
          INSERT INTO scarr
                     (MANDT, CARRID, CARRNAME, CURRCODE, URL)
            VALUES ('000', 'EF', 'Easy Flyers', 'EUR',
                    'http://www.ef.com');
        ENDEXEC.
      CATCH cx_sy_native_sql_error INTO exc_ref.
        error_text = exc_ref->get_text( ).
        MESSAGE error_text TYPE 'I'.
    ENDTRY.
    Regards
    Raju Mummidi

  • DBCO: Connection from sap R/3 oracle to SQL

    Hi,
    I am trying to carry out a connection with SQL through SAP, I carried out it based on the notes: 738371, 323151 and 178949, where my <b>CONNECTION</b> is: 
    DB Connection SQL_DESARROLLO
    DBMS                 MSS
    User name fiSBS
    password
    Conn. info
    MSSQL_SERVER=tcp:XXX.XX.XXX.XXX MSSQL_DBNAME=DB_fisap   
    I carried out a <b>PROGRAM</b> with the following code:
    EXEC SQL.
        SET CONNECTION:SQL_DESARROLLO.
    ENDEXEC.
    IF SY-SUBRC NE '0'.
        EXIT.
    ENDIF.
    However when executing the program it originates me a dump, where it marks the following <b>ERROR</b>:
    Runtime Errors         DBIF_DSQL2_SQL_ERROR                                   
    Exception              CX_SY_NATIVE_SQL_ERROR                                 
    SQL error 922 occurred when executing EXEC SQL.                               
    The error occurred in the current database connection "DEFAULT".              
    An exception occurred. This exception is dealt with in more detail below      
    . The exception, which is assigned to the class 'CX_SY_NATIVE_SQL_ERROR', was 
    neither caught nor passed along using a RAISING clause, in the procedure  "CONECTA_SQL_DES" "(FORM)" Since the caller of the procedure could not have expected this exception to occur, the running program was terminated. 
    could somebody help me?
    Thanks,
    Ruth Gomez

    Ruth,
    you have to open the db connection:
        exec sql.
          set connection : 'SQL_DESARROLLO'
        endexec.
        if sy-subrc <> 0.
          exec sql.
            connect to :'SQL_DESARROLLO'
          endexec.
          if sy-subrc <> 0.
          endif.
        endif.
    Regards
    paolo divjanovic

  • 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,

  • Short dump with a select statement

    I have the following select statement (I have also inluded my data statement(s)) and I get a short dump.  The error is as follows:
    <b>What happened?                                                                 
        Error in ABAP application program.                                                                               
    The current ABAP program "ZPARTNER" had to be terminated because one of the
        statements could not be executed.                                                                               
    This is probably due to an error in the ABAP program.                                                                               
    Following a SELECT statement, the data read could not be placed in AN      
        the output area.                                                           
        A conversion may have been intended that is not supported by the           
        system, or the output area may be too small.                                                                               
    Error analysis                                                                 
        An exception occurred. This exception will be dealt with in more detail    
        below. The exception, assigned to the class 'CX_SY_OPEN_SQL_DB', was not   
         caught, which                                                             
         led to a runtime error. The reason for this exception is:                 
        The data read during a SELECT access could not be inserted into the        
        target field.                                                              
        Either conversion is not supported for the target field's type or the      
        target field is too short to accept the value or the data are not in a     
        form that the target field can accept          </b>                            
    it_adrc TYPE TABLE OF adrc,
          wa_adrc LIKE LINE OF it_adrc,
    SELECT addrnumber name1 street city1 region post_code1 tel_number
      FROM adrc INTO TABLE it_adrc
      FOR ALL ENTRIES IN it_detail
      WHERE addrnumber = it_detail-adrnr.
    Regards,
    Davis

    If you only need the fields mentioned in the select query, then follow this:
    TYPES: BEGIN OF ADRC_TYPE,
         ADDRNUMBER LIKE ADRC-ADDRNUMBER,
         NAME1        LIKE ADRC-NAME1,
         STREET        LIKE ADRC-STREET,
         CITY        LIKE ADRC-CITY,
         REGION        LIKE ADRC-REGION,
         POST_CODE1 LIKE ADRC-POST_CODE1,
         TEL_NUMBER LIKE ADRC-TEL_NUMBER,
           END OF ADRC_TYPE,
           ADRC_T_TYPE TYPE TABLE OF ADRC_TYPE.
    DATA: IT_ADRC TYPE ADRC_T_TYPE WITH HEADER LINE.
    IF NOT IT_DETAIL[] IS INITIAL.
    SELECT addrnumber name1 street city1 region post_code1 tel_number
      FROM adrc INTO TABLE it_adrc
      FOR ALL ENTRIES IN it_detail
      WHERE addrnumber = it_detail-adrnr.
    ENDIF.
    Thanks,
    SKJ

  • How to use Native SQL statement in JDBC receiver interface

    Dear All,
    Can any one please help us in using Native SQL statement in a JDBC receiver channel. The reason why I need to use Native SQL statement instead of standard XML structure is that I need to execute a dynamic SQL query in third party database system lke:-
    Select Field1 Field2 from TABLE Where Field3 like "%Name'
    I expect the the response in the form of XML file which I can pick up using synchornous interface as mentioned on help.sap.com:-
    http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
    The value for %Name can change dynamically according to the transaction and hence cannot be inluded as a KEY element in standard XLM structure,
    Hence I need to know:-
    1. What message mapping I should use in case if I have to use Native SQL statement.
    2.What operation mapping I should use in case if I have to use Native SQL statement.
    If guess correclty I may have to use Java mapping to do the above activities. Hence I want to know
    3 .How do to go about it to do the Java mapping.
    Thanks
    Ameet

    >
    Ameet Deshpande wrote:
    > Dear All,
    >
    > Can any one please help us in using Native SQL statement in a JDBC receiver channel. The reason why I need to use Native SQL statement instead of standard XML structure is that I need to execute a dynamic SQL query in third party database system lke:-
    >
    > "
    > Select Field1 Field2 from TABLE Where Field3 like "%Name'
    > "
    > I expect the the response in the form of XML file which I can pick up using synchornous interface as mentioned on help.sap.com:-
    >
    > http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
    > http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
    >
    > The value for %Name can change dynamically according to the transaction and hence cannot be inluded as a KEY element in standard XLM structure,
    >
    > Hence I need to know:-
    >
    > 1. What message mapping I should use in case if I have to use Native SQL statement.
    > 2.What operation mapping I should use in case if I have to use Native SQL statement.
    > If guess correclty I may have to use Java mapping to do the above activities. Hence I want to know
    > 3 .How do to go about it to do the Java mapping.
    >
    > Thanks
    > Ameet
    You can use a stored procedure, and call it from jdbc receiver adapter.
    I also solve this issue, with a DBLookup in message mapping. You can refer to my blog, and this usefull 3d:
    http://simonlesflex.wordpress.com/2010/12/07/pi-oracle-dblookup/
    /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler

  • Regarding Short Dump While loading data from DB Connect

    Dear All,
    We are having an issue of getting short dump while loading data from DB Connect to BW. We were able to load the data into BW Dev using the same data source without any problem. Whereas in Production, I am getting the following error:
    Runtime Error          PERFORM_CONFLICT_TAB_TYPE  
    Except.                   CX_SY_DYN_CALL_ILLEGAL_TYPE
    What could be the reason for the error that I am getting

    hi,
    Refer Note 707986 - Writing in trans. InfoCubes: PERFORM_CONFLICT_TAB_TYPE
    Summary
    Symptom
    When data is written to a transactional InfoCube, the termination PERFORM_CONFLICT_TAB_TYPE occurs. The short dump lists the following reasons for the termination:
    ("X") The row types of the two tables are incompatible.
    ("X") The table keys of the two tables do not correspond.
    Other terms
    transactional InfoCube, SEM, BPS, BPS0, APO
    Reason and Prerequisites
    The error is caused by an intensified type check in the ABAP runtime environment.
    Solution
    Workaround for BW 3.0B (SP16-19), BW 3.1 (SP10-13)
    Apply the attached correction instructions.
    BW 3.0B
    Import Support Package 20 for 3.0B (BW3.0B Patch20 or SAPKW30B20) into your BW system. The Support Package is available oncenote 0647752 with the short text "SAPBWNews BW3.0B Support Package 20", which describes this Support Package in more detail, has been released for customers.
    BW 3.10 Content
    Import Support Package 14 for 3.10 (BW3. 10 Patch14 or SAPKW31014) into your BW system. The Support Package is available once note 0601051 with the short text "SAPBWNews BW 3.1 Content Support Package 14" has been released for customers.
    BW3.50
    Import Support Package 03 for 3.5 (BW3.50 Patch03 or SAPKW35003) into your BW system. The Support Package is available once note 0693363 with the short text "SAPBWNews BW 3.5 Support Package 03", which describes this Support Package in more detail, has been released for customers.
    The notes specified may already be available to provide advance information before the Support Package is released. However, in this case, the short text still contains the term "Preliminary version" in this case.
    Header Data
    Release Status: Released for Customer
    Released on: 18.02.2004 08:11:39
    Priority: Correction with medium priority
    Category: Program error
    Primary Component: BW-BEX-OT-DBIF Interface to Database
    Secondary Components: FIN-SEM-BPS Business Planning and Simulation
    Releases
    Software
    Component Release From
    Release To
    Release And
    subsequent
    SAP_BW 30 30B 30B
    SAP_BW 310 310 310
    SAP_BW 35 350 350
    Support Packages
    Support
    Packages Release Package
    Name
    SAP_BW_VIRTUAL_COMP 30B SAPK-30B20INVCBWTECH
    Related Notes
    693363 - SAPBWNews BW SP03 NW'04 Stack 03 RIN
    647752 - SAPBWNews BW 3.0B Support Package 20
    601051 - SAPBWNews BW 3.1 Content Support Package 14
    Corrections Instructions
    Correction
    Instruction Valid
    from Valid
    to Software
    Component Ref.
    Correction Last
    Modifcation
    301776 30B 350 SAP_BW J19K013852 18.02.2004 08:03:33
    Attributes
    Attribute Value
    weitere Komponenten 0000031199
    Thanks
    (Activate ODS/Cube and Transfer rules again..)

Maybe you are looking for