Error: dynamic SELECT command in abap Opensql

Hi!
When I try to run this program, the session terminates, the work process restarts:
DATA:
  string1 TYPE STRING,
  string2 TYPE STRING,
  string3 TYPE STRING,
  lt_trkorr TYPE TABLE OF E070-TRKORR.
string1 = 'TRKORR'.
string2 = 'E070'.
string3 = 'TRKORR IN ( SELECT TRKORR FROM e071 )'.
SELECT (string1)
INTO TABLE lt_trkorr
FROM (string2)
WHERE (string3).
However, if I use the static command, it runs fine:
select trkorr
from e070
into table lt_trkorr
where TRKORR IN ( SELECT TRKORR FROM e071 ).
I'm using WAS 6.10.
Thanks and Best Regards,
Tamas

Hi, I'm having the same problem with a dynamic subquery. My query is this:
select PEBELN PEBELP into table i_resultado
from EKPO as P
where (v_wher).
v_wher has the value: EXISTS ( SELECT * FROM EKPO AS P2 WHERE PEBELN = P2EBELN AND P2~EBELP = 30 )
The same query works fine if it is static.
The dump I receive says the following:
"An exception occurred. This exception will be dealt with in more detail       
below. The exception, assigned to the class 'CX_SY_DYNAMIC_OSQL_SEMANTICS', was
not caught, which                                                            
led to a runtime error. The reason for this exception is:                    
<b>The SELECT clause was specified in an internal table at runtime.              
It contains the field name "EXISTS", but this does not occur in any of        
the database tables listed in the FROM clause</b>."
It seems not to recognize the subquery.
Any idea?

Similar Messages

  • Dynamic selection screen with ABAP web dynpro

    Hi all.
        How can I create dynamic selection screen with ABAP web dynpro? Thank you in advance.

    hi yinglak.....
             this is possible........ all the ui elelments has the property called visible and enabled.... just assign an attribute of type wdui_visibility to the visible property....
    in the wddomodify method..... check for the radio button value and pass the value true or false to this attribute and it gets changed automatically.
    ---regards,
       alex b justin

  • Dynamic Selection in SAP ABAP

    Hi Guys,
    I am working on 1 program in which I need the information of dynamic selection value.So can anybody tell me the any FM or Table name in which dynamic selection value saved.
    like FM "RS_VARIANT_CONTENTS" stores the value of normal selection data but not the dynamic selection data (Free Selection). but in my case I need the FM which stores the value of dynamic selection also.
    thanks for your help.
    Lalit Soni

    Hi Suhas,
    Actually in my report user will enter program name & variant name, based on this I need to find out the value for that variant & print that report. so for normal selection I can get the detail using FM: "RS_VARIANT_CONTENTS" but for dynamic selection (Free selection), I am not getting the detail using this FM.
    So I need any FM or Table Name which gives me the value for dynamic selection based on the report & variant.
    Thanks & Regards,
    Lalit Soni

  • How to Debug  ABAP/4 routine in Dynamic Selection?

    Problem:
            I am not able to debug the ABAP/4 routine in data dynamic selection.
    Analysis:
            I typed /H on  transaction command prompt. I entered to ABAP/4 debug mode.
    Then I am not  able to debug my routine. Give me solution for this problem?

    Hi Surya,
    If you want to debug the routines in transformation
    GOTO Transformation you need to debug -- seelct the tranformation id
    To debug these routines we need to go to the generated program of the Transformations in two ways:
    We can get the Program ID for the Transformation ID (6HkDSDsHJNQO0VTU3HK01MH7) from table RSTRAN.
    You can get the program id from the table... append GP to the program id you will get the report program for transformations.
    Now goto Tcode : se38 enter the program name and set the break points.
    On going with display we will be to the ABAP editor of the Report Program.
    The other way of getting to this program is from the Transformations itself.
    Go to Extras -->Display Generated Program. It directly takes us to the ABAP editor of the Report Program.
    Set a break point at the code you want to debug, i.e. at your selections at start routine and at your update
    routine.
    Now after setting the Break points run the DTP in the debug mode.(Select the Processing Mode Serially in the Dialog process (for Debugging)).
    If you are on BW 3.x
    /people/pavan.bayyapu/blog/2006/09/06/debugging-data-upload-in-bw
    Regards
    KP
    Edited by: prashanthk on Jul 25, 2010 10:05 AM

  • CX_SY_DYNAMIC_OSQL_SEMANTICS error with dynamic SELECT statement

    Hello Gurus,
    We have a dynamic SELECT statement in our BW Update Rules where the the Selection Fields are populated at run-time and so are the look-up target and also the WHERE clause. The code basically looks like below:
              SELECT (lt_select_flds)
                FROM (lf_tab_name)
                INTO CORRESPONDING FIELDS OF TABLE <lt_data_tab>
                FOR ALL ENTRIES IN <lt_source_data>
                WHERE (lf_where).
    In this instance, we are selecting 5 fields from Customer Master Data and the WHERE condition for this instance of the run is as below:
    WHERE: DIVISION = <lt_source_data>-DIVISION AND DISTR_CHAN = <lt_source_data>-DISTR_CHAN AND SALESORG = <lt_source_data>-SALESORG AND CUST_SALES = <lt_source_data>-SOLD_TO AND OBJVERS = 'A'
    This code was working fine till we were in BW 3.5 and is causing issues after we moved to BW 7.31 recently. Ever since, when we execute our data load, we get the CX_SY_DYNAMIC_OSQL_SEMANTICS. THE ERROR TEXT SAYS 'Unable to interpret '<LT_SOURCE_data>-DOC_NUMBER'.
    Can you pleasesuggest what can we do to this code to get is working correctly ? What has changed in ABAP Objects that has been introduced from BI 7.0 that could be causing this issue?
    Would appreciate any help we can get here.
    Thanks
    Arvind

    Hi,
    Please try this.
    data: lv_where type string.
    concatenate 'vbeln' 'in' 'r_vbeln' into lv_where separated by space.
    select *from table into itab where (lv_where).
    Also please check this sample code.
    REPORT ZDYNAMIC_WHERE .
    TABLES: VBAK.
    DATA: CONDITION TYPE STRING.
    DATA: BEGIN OF ITAB OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    POSNR LIKE VBAP-POSNR,
    END OF ITAB.
    SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
    CONCATENATE 'VBELN' 'IN' 'S_VBELN.'
    INTO CONDITION SEPARATED BY SPACE.
    SELECT VBELN POSNR FROM VBAP INTO TABLE ITAB
    WHERE (CONDITION).
    LOOP AT ITAB.
    WRITE 'hello'.
    ENDLOOP.
    Regards,
    Ferry Lianto

  • Error on a Dynamic Select using Pro*C

    I am a new user on Pro*C and I am facing an error for which I could not find a solution in the Pro*C/C++ Programmer’s Guide. The problem occurs when I do a dynamic SELECT to retrieve sequence of numbers (from 0 to 10) from a very simple table in a database.
    The program is retrieving the following sequence: {705, 961, 1217, 1473, 1729, 1985, 2241, 2497, 2753, 3009} rather than the sequence {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}.
    It’s very interesting to notice that the retrieved sequence, in hexadecimal, is equal to {2C1, 3C1, 4C1, 5C1, 6C1, 7C1, 8C1, 9C1, AC1, BC1}.
    I am quite sure that I'm missing a small detailed here and I would appreciate
    any help. Please find below the code that I am using.
    Thanks a lot!
    #include <string>
    #include <iostream>
    using namespace std;
    #include <sqlca.h>
    #include <sqlcpr.h>
    EXEC SQL BEGIN DECLARE SECTION;
    VARCHAR username[30];
    VARCHAR password[30];
    VARCHAR db_name [30];
    VARCHAR dns_name[30];
    EXEC SQL END DECLARE SECTION;
    void SQL_Error ( void )
    char msg[200];
    size_t buf_len = sizeof ( msg );
    size_t msg_len;
    sqlglm( msg, &buf_len, &msg_len );
    if ( msg_len > buf_len )
    msg_len = buf_len;
    cout << msg << endl;
    bool OpenDBConnection( char uname, char pword, char dns, char dbname )
    // Assign the database identifications to the ORACLE variables
    username.len = (unsigned short) strlen ( strcpy( (char *) username.arr, uname ) );
    password.len = (unsigned short) strlen ( strcpy( (char *) password.arr, pword ) );
    dns_name.len = (unsigned short) strlen ( strcpy( (char *) dns_name.arr, dns ) );
    db_name.len = (unsigned short) strlen ( strcpy( (char *) db_name.arr , dbname ) );
    /* Register sql_error() as the error handler */
    EXEC SQL WHENEVER SQLERROR goto err;
    /* Connect to the non default database */
    EXEC SQL CONNECT :username IDENTIFIED BY :password AT :db_name USING :dns_name;
    return ( true );
    err:
    SQL_Error();
    return ( false );
    ** Select the database using a dynamic method
    long SelectIDRecord ( void )
    EXEC SQL BEGIN DECLARE SECTION;
    // Define the dynamic statement
    char dyn_statement[4000];
    // Define the bind variables
    long db_id = 0;
    long db_id_type = 2; /* NUMBER */
    long db_id_len = 10;
    EXEC SQL END DECLARE SECTION;
    // Initialize the dynamic statement
    memset ( dyn_statement, 0, sizeof( dyn_statement ) );
    strcpy ( dyn_statement, "SELECT ID FROM TEST_DB ORDER BY ID" );
    EXEC SQL AT :db_name PREPARE s1 FROM :dyn_statement;
    // Declare and initialize the output descriptor
    EXEC SQL ALLOCATE DESCRIPTOR 'out';
    EXEC SQL AT :db_name DESCRIBE OUTPUT s1 USING DESCRIPTOR 'out';
    EXEC SQL SET DESCRIPTOR 'out' value 1 TYPE = :db_id_type,
    LENGTH = :db_id_len, DATA = :db_id;
    // Declare and open the cursor
    EXEC SQL AT :db_name DECLARE test_db_cursor CURSOR FOR s1;
    EXEC SQL AT :db_name OPEN test_db_cursor;
    EXEC SQL WHENEVER NOT FOUND DO BREAK;
    long nRec = 0;
    while ( true )
    EXEC SQL AT :db_name FETCH test_db_cursor INTO DESCRIPTOR 'out';
    EXEC SQL GET DESCRIPTOR 'out' VALUE 1 :db_id = DATA;
    nRec++;
    cout << "ID = " << (long) db_id << endl;
    // Close the cursor
    EXEC SQL AT :db_name CLOSE test_db_cursor;
    EXEC SQL DEALLOCATE DESCRIPTOR 'out';
    return ( nRec );
    err:
    SQL_Error();
    return ( 0 );
    int main ()
    char *uname  = "test";
    char *pword  = "test";
    char *dns    = "test_db";
    char *dbname = "test";
    OpenDBConnection ( uname, pword, dns, dbname );
    long nRec = SelectIDRecord ();
    }

    No need to specify the length if the data type is number and pointing to Long.
    You can directly map the values using INTO clause.

  • Dynamic SELECT statement causing CX_SY_DYNAMIC_OSQL_SEMANTICS error.

    Hello Gurus,
    We have a dynamic SELECT statement in our BW Update Rules where the the Selection Fields are populated at run-time and so are the look-up target and also the WHERE clause. The code basically looks like below:
              SELECT (lt_select_flds)
                FROM (lf_tab_name)
                INTO CORRESPONDING FIELDS OF TABLE <lt_data_tab>
                FOR ALL ENTRIES IN <lt_source_data>
                WHERE (lf_where).
    In this instance, we are selecting 5 fields from Customer Master Data and the WHERE condition for this instance of the run is as below:
    WHERE: DIVISION = <lt_source_data>-DIVISION AND DISTR_CHAN = <lt_source_data>-DISTR_CHAN AND SALESORG = <lt_source_data>-SALESORG AND CUST_SALES = <lt_source_data>-SOLD_TO AND OBJVERS = 'A'
    This code was working fine till yesterday when we encountered serious performance problems and the Basis team had to do some changes at the DB level [Oracle]. Ever since, when we execute our data load, we get the CX_SY_DYNAMIC_OSQL_SEMANTICS.
    Is setting changes at the Oracle level cause issues with how the data is being read at the DB. If yes, can you suggest what can we do to this code to get is working correctly [in case Basis can't revert back their changes]?
    Would appreciate any help we can get here.

    You don't understand - this error comes up when we run specific BEx queries.  It was working yesterday, but today it is not.  Our support package did not change from yesterday.  We did not apply any OSSnotes.
    We are however doing pre-prepare on our Prod system.
    The temporary table is used to store SIDs for use in the join.  the table exists in the dictionary, but not at an Oracle level.

  • Using dynamic select (xsl:value-of) in XSLT (ABAP)

    Hi folks,
    I did a quite extensive search in the archive but couldn't find an answer on my question. If it has been answered before please just provide me with the link :).
    I need to make a dynamic select in a xsl-value-of in an ABAP XSLT. I do not know the structure of the input message (can be of any kind) and I want to perform a xpath query on the input message. The result of the transformation should be the value (if any) of the xpath query. As the query is not known in before I want to pass the query at runtime using a parameter in XSLT. If I pass my query as a string parameter the value-of just returns the string and not the value of the xpath query. Creating the parameter as a node-set doesn't work either for me.
    So is there any way to use a parameter as input to an xpath query?
    Or is my last resort using a JAVA XSLT processor. This is running inside a ABAP proxy, so a call to JAVA would be a greater hassle.
    Kind regards
    Joscha

    What DB version?
    The following SQL
    select xmltransform(XMLTYPE('<song>
      <title>Isn''t she lovely?</title>
    </song>'), XMLTYPE('<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output method="xml" encoding="UTF-8"></xsl:output>
      <xsl:template match="//song">
        <out>
          <xsl:value-of select="title" disable-output-escaping="yes"></xsl:value-of>
        </out>
      </xsl:template>
    </xsl:stylesheet>'))
      from dual;produces this on 11.1.0.6
    <?xml version="1.0" encoding="UTF-8"?>
    <out>Isn't she lovely?</out>and this on 10.2.0.4
    <out>Isn&apos;t she lovely?</out>I found a couple of previous discussions regarding this at
    {thread:id=679397}
    {thread:id=879301}
    The last discussion provides a workaround if you need it.

  • Dynamic selection screen for custom ABAP report

    Hi,
    His it possible to create a custom ABAP report with a dynamic selection screen. The report doesnot use a logical database. If possible sample code will be appreciated.
    Regards,
    Chandra Kumar

    hi
    use this link
    Dynamic selection screen
    Cheers
    Snehi

  • Dynamic selections in ABAP HR

    Hi,
    What is meant by dynamic selections in ABAP HR report using a LDB?

    hi,
    use this.
    SELECTION-SCREEN DYNAMIC SELECTIONS FOR NODE|TABLE <node>.
    Also check this.
    [https://forums.sdn.sap.com/click.jspa?searchID=20295165&messageID=5678733]

  • Runtime Error while using Dynamic Selection

    Hi,
      We are getting a runtime error while using a dynamic selection. One of the fields has got an apostrophe in the middle of the text and so the condition is returning an error SAPSQL_WHERE_PARANTHESES.
      Let's say the value in the field is SCV's. So the WHERETAB is filled as 'SCV's' or `SCV's`. An exception is caught in this case as there is no closing apostrophe.
    Let us know if anyone has come across a similar issue and any help is appreciated.
    Regards,
    Sarves

    Hi Sarves,
    as Rob said.
    check also the [ORACLE FAQS|http://www.orafaq.com/faq/how_does_one_escape_special_characters_when_writing_sql_queries] or [SQL SERVER u2013 How to Escape Single Quotes|http://blog.sqlauthority.com/2008/02/17/sql-server-how-to-escape-single-quotes-fix-error-105-unclosed-quotation-mark-after-the-character-string/]
    Honestly: Before posting here and getting a whole lot of more or less useless comments just use your favorite search engine.
    Regards,
    Clemens

  • Problem with MySQL - WLS61:General error: select command denied to user: 'foo@lion.e-pmsi.fr' for table 'finess'

    Hi
    I've been trying to adapt and deploy an enterprise appliaction developped and deployed
    before under JBoss.
    My database is MySQL and I use Together Control Center for development and hot deployment.
    After having modified a lot of things (the seamless protability seems always sor
    far :), now I get some strange error when deploying from withing Together Control
    Center 6.0:
    WLS61:General error: select command denied to user: '[email protected]' for table
    'finess'
    Off course the user foo has all possible and imaginable rights.
    Does anybody have an idea on how to get around it ?
    Thanks
    Alireza

    Found the answer... email that went to junk mail. Hope this helps others!
    Hello Subscription User,
     Thanks for choosing ClearDB for your database needs. We appreciate your business and 
     your interest in our services. Our commitment to all of our customers is that we 
     provide a high quality of service on all of our database systems. Part of that 
     commitment includes the enforcement of database size quotas in order to ensure 
     the highest quality of service for our customers.
     As such, we're sending you this automated message regarding one of your databases:
     Database: wp____
     Tier/Plan: Mercury
     Tier size quota: 20 MB
     This database has either reached or has exceeded its maximum allowed size for the 
     'Mercury' plan/tier that it currently belongs to. As such, our systems were forced to 
     place a read-only lock on it. We kindly encourage you to upgrade your database 
     to a larger tier/plan so that we can restore write privileges and enable complete 
     access to it from your account.
     If you feel that you have received this notification in error, please feel free 
     to contact us by replying to this email along with information that you feel may 
     assist us in assessing the situation with your database.
     Thanks again for choosing ClearDB,
     The ClearDB Team

  • Dynamic Select query is failing with error "Invalid Table Name"

    OPEN rc FOR 'SELECT count(*) from :s' USING tab_name;
    fetch rc into rec_count;
    CLOSE rc;
    my requirement is to build dynamic select query to retrieve the total count of rows in each table ( variable tab_name contains the table_name )
    But I am getting stuck by this errror, not sure if there is any alternative !
    ORA-00903: invalid table name
    ORA-06512: at line 43

    OPEN rc FOR 'SELECT count(*) from '||tab_name;
    fetch rc into rec_count;
    CLOSE rc;
    -- This will work
    1. Create a sql statement.
    2. Open ref cursor for that statement.

  • ABAP Help: Dynamic Selection Screen

    Hi,
    I have a requirement to be able to pick the list of fields in a selection screen. (List processing)
    Similar to SE16 choosing "fields for selection".
    I've debugged SE16 and realized it deletes the report and regenerates a new report with the updated selection screen.
    I could not do the same as it will also delete all the variants users have created in the report.
    Has anyone done something similar before?
    What is the best approach for this scenario?
    Regards,
    Michael Pang

    Hi Michael
    Hoping you have solved your problems with ALVs, I think it may be helpful to inspect FMs <b>"FREE_SELECTIONS_INIT"</b> and <b>"FREE_SELECTIONS_DIALOG"</b> for this issue. They have some <i>Function Module Documentation</i>.
    If you are dealing with logical databases, then only in the INCLUDE program DB<i>ldb</i>SEL of logical database <i>ldb</i>, you can use some selection-screen definition variants as:
    1.SELECTION-SCREEN BEGIN OF VERSION vers TEXT-xxx.
    2.SELECTION-SCREEN END OF VERSION vers.
    3.SELECTION-SCREEN EXCLUDE ... .
    4.SELECTION-SCREEN DYNAMIC SELECTIONS FOR TABLE dbtab.
    5.SELECTION-SCREEN FIELD SELECTION FOR TABLE dbtab.
    6.SELECTION-SCREEN DYNAMIC SELECTIONS FOR NODE node.
    7.SELECTION-SCREEN FIELD SELECTION FOR NODE node.
    You can get more info from SAPHelp for these...
    *--Serdar

  • LX15 Dynamic Selection error

    Hi Gurus,
    We recently went into problem when we are trying to perform annual stock take.
    We executed LX15 to generate the report for annual inventory count. As we have multiple storage types, we input 1 of the storage type and click on dynamic selection to select further storage types. However, upon selecting all the required storage types needed using mulitple selection, whether by single values or ranges, the result of the t-code LX15 only shows the initial storage type that I have input in the initial selection screen.
    Is there any other t-code that could be used beside LX15 ? LX16 can't work as we are not basing our stock take in a continuous inventory model.

    Hi,
    While I was searching for SAP note on this, I did find some OSS notes where dynamic selections were not working and SAP had given some code corrections for S_ALR reports but not this one..
    Any idea whether we can get dynamic selection work for this report?
    Regards,
    SAPFICO

Maybe you are looking for

  • How do I get iWork on OSX 10.8 to sync with iCloud docs created in iOS?

    There's lots of support about accessing docs already stored in iCloud from iOS, but I can't find anything beyond the basic "turn iCloud on" support for the desktop. I have an iPad (uptodate iOS and iWork apps) and lots of docs stored in iCloud. I can

  • How to add link to flash file (using AS 3)?

    Hi all, I have created a Flash banner ad for our company that is to be hosted on another website. This banner ad needs to have a link added to it, within the Flash file. This link will take users straight to our website but is also for the purpose of

  • Hide statement not working

    Hi experts, i am using hide statement but it is not working..The problem with it is that after line selection the variable on which i have used hide is carrying the last value of internal table always..<< Removed >> Regards, Raman Edited by: Rob Burb

  • How to download oracle patch set 10.2.0.5  for Windows server 2008 R2

    I need  download and install oracle patch set 10.2.0.5 and install  for Windows server 2008 R2 (notes 1486772). But I  get message "Download basket request for update has been processed. Unable to add 1 new object(s). The objects are already part of

  • SAP Solman EWA System ABAP error

    Hi, SAP Solman EWA services trows error . The job which refreshes Service sessions (for Early Watch Alerts) in SolMan 4. gets cancelled with the message: Syntax error in program "RDSVASAEA_ROOT_____________061". The following syntax error occurred in