SELECT statement throwing error in Pro*C

Hi All,
I have a Pro*C report that I am creating and the selmacro in the report has a SQL statement like
EXEC SQL DECLARE cursor_000 CURSOR FOR
SELECT (select 'Y' from dual)
FROM spriden
WHERE spriden_change_ind IS NULL;
Now this throws me an error saying :
Syntax error at line 538, column 16, file tzrages.pc:
Error at line 538, column 16 in file tzrages.pc
SELECT (select 'Y' from dual)
...............1
PCC-S-02201, Encountered the symbol "'Y'" when expecting one of the following:
( ) * + - / . @ | at, day, hour, minute, month, second, year,
Syntax error at line 1954, column 16, file tzrages.pc:
Error at line 1954, column 16 in file tzrages.pc
FROM DUAL;
My Observation is that when I put a "select" statement in the select clause of the SQL, it throws the error. However if I write the query with out the "SELECT" in the select clause, it works just fine.
Any clues on this. I need to have multiple "Select" statements in the SELECT clause, and cannot do without it.

Thanks Satrap and Billy for replying to the post. Appreciate it.
What the query actually looks like is
SELECT college_name
,college_location
,student_category
,sum(30_day_balance)
,sum(60_day_balance)
,sum(90_day_balance)
FROM ( SELECT college_name
,college_location
, NVL ( (SELECT DECODE (substr(A.company_id,1,1)
,'V','Bad Debt'
,'D','Active SAC'
FROM company_table A
,collections_table C
WHERE C.student_id = B.student_id
AND C.collector_id = A.collector_id
), 'Active'
) STUDENT_CATEGORY
, ( SELECT NVL ( SUM ( D.balance),0)
FROM balance_table D
WHERE D.balance_date BETWEEN to_date(:report_run_date) - 30 AND to_date (:report_run_date)
AND D.collection_code = :collection_code
AND D.student_id = B.student_id
) 30_DAY_BALANCE
, ( SELECT NVL ( SUM ( D.balance),0)
FROM balance_table D
     WHERE D.balance_date BETWEEN to_date(:report_run_date) - 60 AND ( to_date (:report_run_date) - 30 + 1)
AND D.collection_code = :collection_code
     AND D.student_id = B.student_id
     ) 60_DAY_BALANCE
     , ( SELECT NVL ( SUM ( D.balance),0)
FROM balance_table D
     WHERE D.balance_date BETWEEN to_date(:report_run_date) - 90 AND ( to_date (:report_run_date) - 60 + 1)
AND D.collection_code = :collection_code
     AND D.student_id = B.student_id
     ) 90_DAY_BALANCE
     FROM student_table B
     WHERE B.student_id IN ( SELECT E.student_id
     FROM collections_table E
     WHERE E.collection_code = :collection_code
     GROUP BY E.student_id
     HAVIN SUM(E.balance) BETWEEN :min_balance AND :max_balance
GROUP BY college_name,college_location,student_category
Please note that anything with a ':' as a prefix (:collection_code,:max_balance) is a parameter for the Query
When I run the query in toad, it works fine, but when I compile it in Pro*C it throws an error as mentioned in the previous post.

Similar Messages

  • Select statement FATAL ERROR

    Hi All,
    I am working on JDBC receiver which is select statement to fetch the data from SQL server base on the Primary key.
    But i am getting this type of error
    Error while parsing or executing XML-SQL document: Error processing request in sax parser: Error when executing statement for table/stored proc. 'DOM_CREDIT_CHECK  ' (structure 'CheckCustomer'): java.sql.SQLException: FATAL ERROR document format: structure 'CheckCustomer', no key element found
    Error processing request in sax parser: Error when executing statement for table/stored proc. 'DOM_CREDIT_CHECK  ' (structure 'CheckCustomer'): java.sql.SQLException: FATAL ERROR document format: structure 'CheckCustomer', no key element found
    Error processing request in sax parser: Error when executing statement for table/stored proc. 'DOM_CREDIT_CHECK  ' (structure 'CheckCustomer'): java.sql.SQLException: FATAL ERROR document format: structure 'CheckCustomer', no key element found
    Please help me to solve this error.
    Thanks in advance,
    Azeez.

    please view similar thread
    JDBC: How  to select only those records which contains col1 is NULL

  • Select statement showing error

    Hi,
    Please view below select statement and give your feedback:
    SELECT   vbrk~vkorg
             vbrk~vtweg
             vbrk~kunrg
             vbrk~kunag
             vbrk~knumv          " Number of document cindition.
             vbrk~fksto          " Cancelled Invoice
             vbrk~vbtyp          " SD Document Category
             vbrk~vbeln
             vbrk~fkart
             vbrk~inco1
             vbrk~erdat
             vbrk~ernam
             vbrk~fkdat
             vbrp~spart
             vbrp~werks
             vbrp~matnr
             vbrp~arktx
             vbrp~fkimg
             vbrp~ntgew
             vbrp~mwsbp
             vbrp~posnr
    INTO  (IT_INV-vkorg,
           IT_INV-VTWEG,
           IT_INV-KUNRG,
           IT_INV-KUNAG,
           IT_INV-KNUMV,
           IT_INV-FKSTO,
           IT_INV-VBTYP,
           IT_INV-VBELN,
           IT_INV-FKART,
           IT_INV-INCO1,
           IT_INV-ERDAT,
           IT_INV-ERNAM,
           IT_INV-FKDAT,
           IT_INV-SPART,
           IT_INV-WERKS,
           IT_INV-MATNR,
           IT_INV-ARKTX,
           IT_INV-FKIMG,
           IT_INV-NTGEW,
           IT_INV-MWSBP,
           IT_INV-POSNR)
    *INTO CORRESPONDING FIELDS OF TABLE IT_INV
    FROM   VBRK INNER JOIN VBRP
    ON VBRKVBELN = VBRPVBELN
    WHERE  VBRK~VBELN IN S_VBELN
    AND    FKART IN S_FKART
    AND    FKDAT IN S_FKDAT
    AND    WERKS IN S_WERKS
    AND    FKART NOT IN ('S1','S2','S3')
    AND    FKSTO NE 'X'.

    As you are moving the fields to variables, use enselect as the last statement and append the internal table before it.
    If you uncomment the the line "into corresponding fields of table internal table" and comment the individual destination fields you can avoid the syntax error. or else use SELECT SINGLE statement if you are selecting a single record.
    * (IT_INV-vkorg, IT_INV-VTWEG, IT_INV-KUNRG, IT_INV-KUNAG, IT_INV-KNUMV, IT_INV-FKSTO,
    *IT_INV-VBTYP, IT_INV-VBELN, IT_INV-FKART, IT_INV-INCO1, IT_INV-ERDAT,IT_INV-ERNAM,
    *IT_INV-FKDAT, IT_INV-SPART, IT_INV-WERKS, IT_INV-MATNR, IT_INV-ARKTX, IT_INV-FKIMG,
    *IT_INV-NTGEW, IT_INV-MWSBP, IT_INV-POSNR)
    INTO CORRESPONDING FIELDS OF TABLE IT_INV

  • SELECT statement causing error

    Hi all, a particular errors keeps on popping up when i try to activate my program. Error message is as follows:
    The field "C~NAME1" from the SELECT list is missing in the GROUP BY clause. addition INTO wa or into (g1,...,gn) is required. fields of type "" or "A~MANDT".
    Any ideas on what this syntax error message means?
    Look at the SELECT statement that is causing the error:
      SELECT A~MATNR A~WERKS MAX( A~EBELN ) MAX( A~EBELP ) A~BUKRS A~MENGE A~NETPR A~PEINH B~LIFNR B~BEDAT C~NAME1
        INTO (WTAB-MATNR, WTAB-WERKS, WTAB-EBELN, WTAB-EBELP, WTAB-BUKRS, WTAB-MENGE, WTAB-NETPR, WTAB-PEINH, WTAB-LIFNR,WTAB-BEDAT, WTAB-NAME1)
        FROM EKPO AS A
          INNER JOIN EKKO AS B
            ON A~EBELN = B~EBELN AND
               A~BUKRS = B~BUKRS
          INNER JOIN LFA1 AS C
            ON B~LIFNR = C~LIFNR
    *    FOR ALL ENTRIES IN ITAB
        WHERE A~WERKS = I_WERKS AND
              A~BUKRS = I_BUKRS AND
              B~BSTYP = 'F' AND
              B~SPRAS = 'EN'.

    I've got another thing to ask. Ask you all know, i am suppose to complete (or ammend) the program that i am doing now. Look at parts of the original coding that i have yet to make changes to, i would like to know what is it suppose to do and output. Perhaps you guys could explain it better than my consultant:
    TYPES: BEGIN OF TYP_MATTXT,
             MATNR LIKE MARA-MATNR,  "Material Number
             CTRT TYPE I,
             MAT_TXT(80) TYPE C,
             PO_TXT(80) TYPE C,
           END OF TYP_MATTXT.
    DATA: MATTXT TYPE TYP_MATTXT OCCURS 0 WITH HEADER LINE.
    DATA: WA_STXH TYPE STXH,
          TXT LIKE TLINE OCCURS 0 WITH HEADER LINE,
          TXT_KEY LIKE STXH-TDNAME.  "Name
    *&    FORM SELECT_DATA                                                 *
    FORM SELECT_DATA.
      SELECT A~MATNR A~MATKL B~MAKTX A~MTART A~EXTWG C~WERKS
        INTO CORRESPONDING FIELDS OF TABLE ITAB
        FROM MARA AS A
          INNER JOIN MAKT AS B
            ON A~MATNR = B~MATNR AND
               B~SPRAS = 'EN'
          INNER JOIN MARD AS C
            ON A~MATNR = C~MATNR
        WHERE A~MATNR IN I_MATNR AND
              A~MATKL IN I_MATKL AND
              A~MTART IN I_MTART AND
              A~EXTWG IN I_EXTWG AND
              C~WERKS = I_WERKS.
      SORT ITAB BY MATNR MATKL MTART EXTWG WERKS MAKTX.
      CHECK NOT ITAB[] IS INITIAL.
      SELECT A~MATNR A~MATKL A~WERKS MAX( A~EBELN ) MAX( A~EBELP ) A~BUKRS
    A~MENGE A~NETPR A~PEINH A~MTART B~LIFNR B~BEDAT C~NAME1
      INTO TABLE WTAB
    *    INTO (WTAB-MATNR, WTAB-WERKS, WTAB-EBELN, WTAB-EBELP, WTAB-BUKRS,
    *WTAB-MENGE, WTAB-NETPR, WTAB-PEINH, WTAB-LIFNR,WTAB-BEDAT, WTAB-NAME1)
        FROM EKPO AS A
          INNER JOIN EKKO AS B
            ON A~EBELN = B~EBELN AND
               A~BUKRS = B~BUKRS AND
               B~BSTYP = 'F'
          INNER JOIN LFA1 AS C
            ON B~LIFNR = C~LIFNR
        WHERE A~MATNR IN I_MATNR AND
              A~MATKL IN I_MATKL AND
              A~WERKS = I_WERKS AND
              A~BUKRS = I_BUKRS AND
              A~MTART IN I_MTART AND
              A~LOEKZ = ' '
        GROUP BY A~MATNR A~MATKL A~WERKS A~EBELN A~EBELP A~BUKRS A~MENGE
    A~NETPR A~PEINH A~MTART B~LIFNR B~BEDAT C~NAME1.
      SORT WTAB BY MATNR MATKL MTART WERKS EBELN EBELP MENGE NETPR PEINH
    LIFNR BEDAT NAME1.
      LOOP AT WTAB.
        MOVE: WTAB-EBELN TO ITAB-EBELN,
              WTAB-EBELP TO ITAB-EBELP,
              WTAB-BUKRS TO ITAB-BUKRS,
              WTAB-MENGE TO ITAB-MENGE,
              WTAB-NETPR TO ITAB-NETPR,
              WTAB-PEINH TO ITAB-PEINH,
    *          WTAB-MTART TO ITAB-MTART,
              WTAB-LIFNR TO ITAB-LIFNR,
              WTAB-BEDAT TO ITAB-BEDAT,
              WTAB-NAME1 TO ITAB-NAME1.
       MOVE ITAB-MATNR TO TXT_KEY.
       PERFORM READ_TXT USING 'BEST' TXT_KEY 'MATERIAL'.
       CONCATENATE ITAB-EBELN ITAB-EBELP INTO TXT_KEY.
       PERFORM READ_TXT USING 'F01' TXT_KEY 'EKPO'.
        MODIFY ITAB TRANSPORTING EBELN EBELP BUKRS MENGE NETPR PEINH LIFNR
    BEDAT NAME1
          WHERE MATNR = WTAB-MATNR.
      ENDLOOP.
      SORT ITAB BY MATNR MATKL MTART.
      DELETE ADJACENT DUPLICATES FROM ITAB COMPARING ALL FIELDS.
      LINE_CHECK = 0.
    ENDFORM.
    *&    FORM READ_TXT                                                    *
    FORM READ_TXT USING ID XNAME OBJ.
    DATA: CTR TYPE I,
          PO_CTR TYPE I.
    CLEAR: TXT.
      SELECT SINGLE * FROM STXH CLIENT SPECIFIED
      INTO WA_STXH
      WHERE MANDT = SY-MANDT AND
            TDOBJECT = OBJ AND
            TDNAME = XNAME AND
            TDID = ID AND
            TDSPRAS  = SY-LANGU.
      IF SY-SUBRC = 0.
        REFRESH TXT.
        CTR = 1.
        CALL FUNCTION 'READ_TEXT'
             EXPORTING
                  CLIENT   = SY-MANDT
                  ID       = ID
                  NAME     = XNAME
                  OBJECT   = OBJ
                  LANGUAGE = SY-LANGU
             TABLES
                  LINES    = TXT.
        LOOP AT TXT.
          IF ID = 'BEST'.
            MOVE XNAME TO MATTXT-MATNR.
            MOVE CTR TO MATTXT-CTRT.
            MOVE TXT-TDLINE TO MATTXT-MAT_TXT.
            APPEND MATTXT.
          ELSEIF ID = 'F01'.
            READ TABLE MATTXT WITH KEY MATNR = ITAB-MATNR CTRT = CTR.
            IF SY-SUBRC = 0.
              MOVE TXT-TDLINE TO MATTXT-PO_TXT.
              MODIFY MATTXT TRANSPORTING PO_TXT
              WHERE MATNR = ITAB-MATNR.
            ELSE.
              MOVE ITAB-MATNR TO MATTXT-MATNR.
              MOVE CTR TO MATTXT-CTRT.
              MOVE TXT-TDLINE TO MATTXT-PO_TXT.
              APPEND MATTXT.
            ENDIF.
          ENDIF.
          CTR = CTR + 1.
        ENDLOOP.
      ENDIF.
    ENDFORM.

  • SELECT LIST throws error for WHERE CLAUSE

    Hi All
    I am struck with, what looking like a trivial error, but I don't know how to settle it down. I am new to Apex (3.1). I am experimenting with. I have Oracle 10g running on Windows.
    I have a dropdown item in one of my pages (SELECT list). I am trying to display few items there dynamically (depends on the user who logged in). I set it as SELECT LIST and entered the following query in "List of Values".
    select enrolled_course display_value, course_id return_value
    from COMP_LIST
    where stu_id = :APP_USER
    order by 1I got the following error.
    1 error has occurred
    LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.Then, I tried the step by step instruction from "Oracle® Application Express - Advanced Tutorials -Release 3.1.2 -E10497-02". Using creating list of values creation as seperately. That too, I got the same error.
    I am doing it wrong I suppose. Please correct me. Thanks in advance
    With Regards
    Guru
    Edited by: guru paran on Oct 16, 2008 5:12 PM

    Thanks Andy
    When I hardcoded, it worked.
    select enrolled_course display_value, course_id return_value
    from COMP_LIST
    --where-- --emp_id-- = --100--
    where stu_id = 100
    order by 1
    {code}
    :APP_USER is not working then, Now, I should be using v('APP_USER')? When I tried v('APP_USER'), I got the same error back! The COMP_LIST is a view. Is there some problem with the view then?
    But again, I am able to select from it without WHERE (now with hardcoded value also)....
    Edited by: guru paran on Oct 16, 2008 6:26 PM
    Added [code] tags
    Edited by: guru paran on Oct 16, 2008 6:42 PM
    It is STU_ID and not EMP_ID
    Edited by: guru paran on Oct 16, 2008 6:43 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Runtime error for SELECT statement

    Hi All,
    I have written a SELECT statement as follows in my code.
    select budat pernr aufnr vornr from AFRU
    into corresponding fields of table it_vornr
    for all entries in it_cats_tmp
    where budat = it_cats_tmp-workdate
    and pernr = it_cats_tmp-pernr
    and aufnr = it_cats_tmp-rnplnr.
    The table IT-CATS_TMP is having around 3000+ lines.
    When control moves to this statement, the system is throwing Runtime error or its taking around 30 minutes time to execute.
    If i query the same table (AFRU) in SE11 for the same set of conditions, the table displays relevent data immediately.
    What might be the reason for this delay/Runtime Error?
    Shall i need to change the syntax for better performance?
    Your guidelines are highly appreciated......
    Regards
    Pavan

    Hi
    1. Try to put WHERE conditions for KEY FIELDS.
    Solution: Create a RANGE for the key fields & put that in SELECT Query.
    DATA: gr_rueck TYPE RANGES OF afru-rueck.
    SELECT .. WHERE rueck IN gr_rueck.
    2. Avoid using CORRESPONDING FIELDS OF TABLE in SELECT.
    Solution: Change internal table fields ORDER.
    TYPES:
    BEGIN OF TY_VORNR,
      budat TYPE ..
      pernr TYPE ..
      aufnr TYPE ..
      vornr TYPE ..
      ... " Other fields
    END OF TY_VORNR.
    SELECT .. INTO TABLE IT_VORNR ...

  • Oracle Error while execute the Select statement

    Hi all,
    I have two database, from one databse to another datadase, i am not able get value. while i am generating the select statement in one database, it throws an
    error ORA-00942: table or view does not exist.
    For this, what i have to do.can anyone post more detail on this.
    Any idea?

    Please do not create duplicate threads.
    ORA-00942: table or view does not exist

  • Why below MERGE sql statement is throwing error  on 10g?

    Version: Ora 10g R2
    Why below MERGE sql statement is throwing error on 10g?
    SQL> merge into sess_stats
    using
    select a.name, b.value from v$statname a, v$sesstat b where a.statistic#=b.statistic# and b.sid=:sid  and (a.name like '%ga %' or a.name like '%direct temp%')
    ) curr_stats
    on (sess_stats.name=curr_stats.name)
    when matched then
         update set diff=curr_stats.value-sess_stats.value, value=curr_stats.value
    when not matched then
         insert (name, value, diff) values (curr_stats.name, curr_stats.value, null)  2    3    4    5    6    7    8  SQL> SP2-0734: unknown command beginning "on (sess_s..." - rest of line ignored.
    SQL> SP2-0734: unknown command beginning "when match..." - rest of line ignored.
    SQL>   2    3

    First of all, thank you all for your feedback!
    first, I try remove the blank lines at those two places ( before curr_stats and after on) and it works.
    then, again I try to set sqlblanklines on, and it works as well!
    Edited by: PhoenixBai on Nov 10, 2009 10:54 PM

  • Tree Table Error : Missing from in a select statement

    Created a view link
    Created a view criteria on source vo which has attribute of destination vo
    Dragged the source view criteria to form a tree table.
    But upon invoke of jspx page even if tree table is appearing Error : Missing from in a select statement is shown. Log shows no specific file/line number. Search is also throwing same error
    If i remove attribute of destination vo from view criteria error is not appearing. Any pointers?

    Hi,
    Well, If the user always enter a list as selection (no range, exclusion, ...), I can understand the need.. otherwise this is indeed a bit strange... In case they only need to use single element list in SO, you could restrict all other SO features with the FM SELECT_OPTIONS_RESTRICT and then loop on values and select each single vendor...
    E.g under your INITIALIZATION event:
    * Only option 'EQ' and sign 'I' are allowed
      lt_opt_list-name        = 'ONLY_EQ'.
      lt_opt_list-options-eq  = 'X'.
      APPEND lt_opt_list TO ls_restriction-opt_list_tab.
      lt_***-kind             = 'S'.        "select-option
      lt_***-name             = 'S_LIFNR'.  "name of select-option
      lt_***-sg_main          = 'I'.        "only inclusive
      lt_***-sg_addy          = space.
      lt_***-op_main          = 'ONLY_EQ'.
      lt_***-op_addy          = space.
      APPEND lt_*** TO ls_restriction-***_tab.
      CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
        EXPORTING
          restriction            = ls_restriction
        EXCEPTIONS
          too_late               = 1
          repeated               = 2
          selopt_without_options = 3
          selopt_without_signs   = 4
          invalid_sign           = 5
          empty_option_list      = 6
          invalid_kind           = 7
          repeated_kind_a        = 8
          OTHERS                 = 9.
    Then just loop on SO table, select single and check subrc...
    Kr,
    Manu.

  • Getting error while executing this select statement

    Hi All,
    I am new to this community.
    I am getting error whie compiling the below code. Its telling 'Text' is invalid identifier. Also i want to know how can we obtain 'parseable' version of the below query?
    my basic intention is to create a trigger header through a select statement and show it the complete text as a single column..
    select text from
    (select 'CREATE OR REPLACE TRIGGER '||SUBSTR(column_name,2,4)||'aud
    AFTER INSERT
    OR UPDATE
    OF '||column_name||',
    OR DELETE ON '||table_name||'
    FOR EACH ROW'
    FROM(SELECT lower(REPLACE(column_name,'O_','')) column_name , /*changing O to O_*/
    lower(replace(t.table_name,'_A_','_')) table_name,
    lower(t.table_name) table_name1,
    c.column_id
    FROM all_tab_columns c,
    (SELECT object_name table_name
    FROM all_objects
    WHERE object_name LIKE '%/_A/_%' ESCAPE '/') t
    WHERE c.table_name(+) = t.table_name
    AND SUBSTR(column_name(+),1,2) = 'O_'))

    thanks prathamesh. it solved the problem. i have one more question.
    as of now it creates single create trigger statement for each column on a table.
    example:
    CREATE OR REPLACE TRIGGER ust_aud
    AFTER INSERT
    OR UPDATE
    OF cust_id,
    OR DELETE ON characteristic_t
    FOR EACH ROW
    however, i want to create trigger for all columns in a single statement. can you please help me how to do it?
    basically want to 'CREATE TRIGGER' for all columns in a table. i am finding difficult how to change my query to suit this!!
    i am pasting my original query again for your reference. pls advise...
    example:
    CREATE OR REPLACE TRIGGER ust_aud
    AFTER INSERT
    OR UPDATE
    OF cust_id,
    fixed_item_val,
    copy_item_val,
    rgn_id,
    txn_id,
    OR DELETE ON characteristic_t
    FOR EACH ROW
    ORIGINAL QUERY
    select text from
    (select 'CREATE OR REPLACE TRIGGER '||SUBSTR(column_name,2,4)||'aud
    AFTER INSERT
    OR UPDATE
    OF '||column_name||',
    OR DELETE ON '||table_name||'
    FOR EACH ROW' text
    FROM(SELECT lower(REPLACE(column_name,'O_','')) column_name , /*changing O to O_*/
    lower(replace(t.table_name,'_A_','_')) table_name,
    lower(t.table_name) table_name1,
    c.column_id
    FROM all_tab_columns c,
    (SELECT object_name table_name
    FROM all_objects
    WHERE object_name LIKE '%/_A/_%' ESCAPE '/') t
    WHERE c.table_name(+) = t.table_name
    AND SUBSTR(column_name(+),1,2) = 'O_'))

  • Runtime error at select statement in RFC_READ TABLE FM

    Dear All,
       I have copied the standard FM RFC_READ_TABLE to incorporate the customer needs. Below is the select query which I have written in this FM.
    SELECT (po_search_text-column_text) INTO <wa> FROM ekko
          INNER JOIN ekpo ON ekko~ebeln = ekpo~ebeln
          INNER JOIN eket ON ekpo~ebeln = eket~ebeln AND ekpo~ebelp = eket~ebelp
          INNER JOIN lfa1 ON ekko~lifnr = lfa1~lifnr
          INNER JOIN lfm1 ON ekko~lifnr = lfm1~lifnr AND ekko~ekorg = lfm1~ekorg
          INNER JOIN lfb1 ON ekko~lifnr = lfb1~lifnr AND ekko~bukrs = lfb1~bukrs
          INNER JOIN t024 ON ekko~ekgrp = t024~ekgrp
          INNER JOIN zatscsng_status ON eket~ebeln = zatscsng_status~po_number
          AND   eket~ebelp = zatscsng_status~po_line
          AND   eket~etenr = zatscsng_status~po_sched_line
          INNER JOIN adrc ON zatscsng_status~delivery_addr = adrc~addrnumber
          WHERE (po_search_text-cond_text)
          ORDER BY (po_search_text-sort_text).
    Here, posearch_text-column_text_ will have the fields to be selected at runtime and posearch_text-cond_text_ is the where condition. It is running fine in this case.
    But when I try to select Item Category ( EKPO-PSTYP), if data is present for this category, it is returning the values but if data is not there for the particular item category in the where clause, it is giving a RUNTIME ERROR at the select statement.
    Here is the ERROR ANALYSIS:
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SEMANTICS', was
      not caught in
    procedure "ZATSCSNG_RFC_READ_TABLE" "(FUNCTION)", nor was it propagated by a
      RAISING clause.
    Since the caller of the procedure could not have anticipated that the
    exception would occur, the current program is terminated.
    The reason for the exception is:
    The current ABAP program has tried to execute an Open SQL statement
    which contains a WHERE, ON or HAVING condition with a dynamic part.
    The part of the WHERE, ON or HAVING condition specified at runtime in
    a field or an internal table, contains the invalid value "<L_LINE>-PSTYP".
    Edited by: Rob Burbank on Mar 17, 2010 5:09 PM

    Now that's what I call a join statement...
    You probably have a bug in how you build po_search_text-cond_text, the content must be a syntactically correct where clause. It seems that in your example there is just "<L_LINE>-PSTYP" without a condition, so try omitting it altogether.
    Debug the content of po_search_text-cond_text before it hits the select statement.
    Thomas

  • Error in select statement in CMOD

    Hi Friends
    I am enhancing a data source with some fields and in the CMOD i am writing the code.
    My delcaration is as follows
    begin of  ty_dfkkzp,
                    SELW2       type  dfkkzp-SELW2,
                    BLART       type  dfkkzp-BLART ,
                    BUDAT       type  dfkkzp-BUDAT ,
                    BLDAT       type  dfkkzp-BLDAT ,
                    TBETR       type  dfkkzp-TBETR  ,
                    ZZRECEIPT   type  dfkkzp-ZZRECEIPT ,
                    ZZPAYCAT  type  dfkkzp-ZZPAYCAT ,
                    ZZPAYSRC  type  dfkkzp-ZZPAYSRC ,
                    ZZPAYTYPE   type  dfkkzp-ZZPAYTYPE ,
                    ZZTENDER  type  dfkkzp-ZZTENDER ,
                end of  ty_dfkkzp.
    Following is my SELECT statement.
    select
            SELW2
            BLART
            BUDAT
            BLDAT
            TBETR
            ZZRECEIPT
            ZZPAYCAT
            ZZPAYSRC
            ZZPAYTYPE
            ZZTENDER
            into corresponding fields of table lt_dfkkzp
            from dfkkzp
            for all entries in it_data
           where SELW2 = it_data-VTREF.
    I am getting an error in the where clause. This is becuase VTERF ( Contract) is of type CHAR and length 20, where as SELW2 is of type CHAR but Length 35. I know the length and type should be the same. But this table DFKKZP strangely has SELW2(Contract) has length 35.
    Can someone please suggest me how to handle this inorder for me to get this correct?.
    Thanks in adv.
    Regards
    BN

    Hi,
    try this and let me know if it works.
    Declare another internal table and work area like it_data1 type it_data as shown below.
    Begin of it_data1_wa,
    ......... type........,
    ......... type .......,
    SELW2 type dfkkzp-SELW2,
    end if it_data_wa1.
    data: it_data1 like standard table of it_data_wa.
    data: it_data_wa type it_data
    include all the fields inside the table.
    loop at it_data into it_data_wa.
    move corresponding lt_data_wa to it_data1_wa.
    it_data1_wa-SELW2 = it_data_wa-VTREF.
    append it_data1_wa to it_data1.
    end loop.
    now write the same select statement for all entries in it_data1 instead of it_data.
    Regards,
    Anusha

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

  • Urgent, SELECT statement results in error

    hi all, this is very urgent, could you guys have a look at my SELECT statement?
      SELECT vk~kunnr         "customer no
              vk~vbeln         "sales order no
              vk~audat         "date
              vk~vbtyp         "SD DOCUMENT CATEGORY
              vk~knumv         "lwk
              vp~kwmeng        "qty
              vp~matnr         "material no
              vp~posnr         "LINE ITEM
              vd~bstkd         "PURCHASE ORDER NO
    *          kv~kwert         "lwk
              FROM  vbak AS vk
              INNER JOIN vbap AS vp
              ON vk~vbeln = vp~vbeln
              INNER JOIN vbkd AS vd
              ON vk~vbeln = vd~vbeln
    *          INNER JOIN konv AS kv
    *          ON kv~knumv = vk~knumv
              INTO CORRESPONDING FIELDS OF TABLE it_so
              WHERE vk~vkorg IN s_vkorg
              AND vk~audat IN s_date
              AND vk~kunnr IN s_kunnr
              AND vp~matnr IN s_matnr
              AND vd~bstkd IN s_bstkd
              AND vk~vbeln IN s_vbeln
    *          AND kv~kschl = 'ZP00'
              AND vk~vbtyp = 'C'.
    The commented lines are the new additions that i want to add to the SELECT statement. But when i un-comment them, i get an error while activating my program. Error is as follows:
    For pooled tables, cluster tables, and project views, JOIN is not allowed: "KONV".
    Is there a way i can go around it?

    Hi,
    look at this SAP note : 550043
    Symptom
    KEPM: dump 'MESSAGE_TYPE_X' during automatic planning method execution.
    Other terms
    KEPM MESSAGE_TYPE_X transform characteristic value
    Reason and Prerequisites
    This note is related only to cases, if dump 'MESSAGE_TYPE_X' is raising
    during execution of planning method, for which is possible to define
    transformation of characteristics values i.e. Copy, Forecast, Top-Down
    distribution, Ratios and Customer Enhancement.
    Dump is raising in case, if there was defined transformation of char.
    values in parameter set definition for some characteristic. Later on,
    this characteristic was removed from planning level definition but
    characteristic wasn't removed from relevant customizing of transform
    characteristic values before.
    Solution
    Please apply attached program correction.
    Regards,
    GSR.

  • Error by using database procedure in select statement

    hi ,
    I have built a database procedure having one parameter with in out varchar type. that return value with some addition.
    i am using it with some column in select statement only for display purpuses but i am facing error by doing that in select statement. that procedure is working well with bind variable but not with select statement.
    plz help me how i can use a procedure in select statement. or can i do it or not.

    plz help me how i can use a procedure in select statement. or can i do it or not.A workaround could be to create a wrapper function for your procedure. One that only passes the input parameters and returns the output parameter.
    The simply call this function in your select which internally calls the procedure.

Maybe you are looking for

  • MSI K7N2 DELTA -L (601-6570-020) nFORCE 2 DUAL 400 , RANDOM RESTART PROBLEM (WinXP,Win98)

    Machine Specs: - AMD Athlon XP 2600+ With L2 512 KB (Model 10) - MSI K7N2 Delta -L nFORCE 2 Ultra 400 (601-670-020) (My AwardBios is updated to v5.7, Using nVIDIA`s O/B Audio and Ethernet Controllers) - TwinMOS PC3200(CL2.5) 512 MB DDR400 RAM (Deskto

  • I can now renew my contract, can i upgrade to YOU...

    i am nearly up on my 12 month contract for BT VISION, INFINITY OP 2 and a phone package etc with the the new YOU VIEW box now finally with us is there any deals that i can upgrade to that box with no extra charge ? does the box allow Sports Channels

  • Cannot change internal graph color in Conky

    Hey everyone, I have run into a problem when configuring my Conky widget for my fresh Arch install.  I installed Conky and am using a modified configuration that I found here on the forums.  The contents of my conky.conf file are found below: backgro

  • Question: Which XML parser is built into JDK14.2?

    Is it Crimson, Xerces ? Do you know which version ? When using inbuilt XML parser with JDK 1.4.2 which API shoudl I look at ? Is it only the standard JDK API at http://java.sun.com/j2se/1.4.2/docs/api ?

  • HTTPS/Bluetooth/Proximity

    Instead of the ultrasonic token having the proximity app use htttps could we have it use Bluetooth? That way users that are non-employees (can not get on the network) that are part of the meeting can connect the app to the TP endpoint?