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.

Similar Messages

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

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

  • 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

  • Single Apostrophe in Where Statement Causing Error

    I am running SQL syntax from MS Access VBA modules. These all work great except for recently I ran into a snag. There is drop-down where the user selects a category and the filter is based off that. All this works fine until they select a category that has
    an apostrophe e.g. O'Reillys. Below is the syntax that I have
    strWhere ="Category IN ('" & Me.cboCategory & "')"
    strSQL = "Select MyTable.* From MyTable Where " & strWhere
    The problem rests with the strWhere statement. As I said, it works fine if there is not an apostrophe in the name but if there is then it does not work. Could someone assist me with the syntax I would need. Thanks.
    P.S. An ID field is not an option in this case.

    Thanks for the response but how would I do that with a variable? I can see how to do it when the value is already known, so with the example I gave, e.g. 
    strWhere="Category
    IN ('" &
    Me.cboCategory
    How would the quotes be set with that?

  • Snapshot too old ORA-01555 from select statement (discoverer)??

    Hi All
    Am I loosing the plot .. but we have a select statement run from discoverer which is causing the famous snapshot too old error.
    My understanding is that undo is generated from select/insert/update.
    So why is the following discoverer Select statement causing the error?
    from alert
    ORA-01555 caused by SQL statement below (SQL ID: gk0wxgqmx66sh, Query Duration=3866 sec, SCN: 0x001e.089cf3f9):
    SELECT  ( ROUND(( TO_DATE(SYSDATE)-o101038.HIRE_DATE )/365,2) ) as
      "  bla bla
    ORDER BY o101020.SUB_ORGANIZATION_NAME ASC
    Thanks in Advance

    simon.9999 wrote:
    Hi All
    Am I loosing the plot .. but we have a select statement run from discoverer which is causing the famous snapshot too old error.
    My understanding is that undo is generated from select/insert/update.
    So why is the following discoverer Select statement causing the error?
    from alert
    ORA-01555 caused by SQL statement below (SQL ID: gk0wxgqmx66sh, Query Duration=3866 sec, SCN: 0x001e.089cf3f9):
    SELECT  ( ROUND(( TO_DATE(SYSDATE)-o101038.HIRE_DATE )/365,2) ) as
      "  bla bla
    ORDER BY o101020.SUB_ORGANIZATION_NAME ASC
    Thanks in Advance
    The SELECT statement is the victim.
    Some session is doing DML against the same table against which the SELECT occurs & is likely doing COMMIT inside a LOOP.

  • Select statement in a function does Full Table Scan

    All,
    I have been coding a stored procedure that writes 38K rows in less than a minute. If I add another column which requires call to a package and 4 functions within that package, it runs for about 4 hours. I have confirmed that due to problems in one of the functions, the code does full table scans. The package and all of its functions were written by other contractors who have been long gone.
    Please note that case_number_in (VARCHAR2) and effective_date_in (DATE) are parameters sent to the problem function and I have verified through TOAD’s debugger that their values are correct.
    Table named ps2_benefit_register has over 40 million rows but case_number is an index for that table.
    Table named ps1_case_fs has more than 20 million rows but also uses case_number as an index.
    Select #1 – causes full table scan runs and writes 38K rows in a couple of hours.
    {case}
    SELECT max(a2.application_date)
    INTO l_app_date
    FROM dwfssd.ps2_benefit_register a1, dwfssd.ps2_case_fs a2
    WHERE a2.case_number = case_number_in and
    a1.case_number = a2.case_number and
    a2.application_date <= effective_date_in and
    a1.DOCUMENT_TYPE = 'F';
    {case}
    Select #2 – runs – hard coding values makes the code to write the same 38K rows in a few minutes.
    {case}
    SELECT max(a2.application_date)
    INTO l_app_date
    FROM dwfssd.ps2_benefit_register a1, dwfssd.ps2_case_fs a2
    WHERE a2.case_number = 'A006438' and
    a1.case_number = a2.case_number and
    a2.application_date <= '01-Apr-2009' and
    a1.DOCUMENT_TYPE = 'F';
    {case}
    Why using the values in the passed parameter in the first select statement causes full table scan?
    Thank you for your help,
    Seyed
    Edited by: user11117178 on Jul 30, 2009 6:22 AM
    Edited by: user11117178 on Jul 30, 2009 6:23 AM
    Edited by: user11117178 on Jul 30, 2009 6:24 AM

    Hello Dan,
    Thank you for your input. The function is not determinsitic, therefore, I am providing you with the explain plan. By version number, if you are refering to the Database version, we are running 10g.
    PLAN_TABLE_OUTPUT
    Plan hash value: 2132048964
    | Id  | Operation                     | Name                    | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT              |                         |   324K|    33M|  3138   (5)| 00:00:38 |       |       |
    |*  1 |  HASH JOIN                    |                         |   324K|    33M|  3138   (5)| 00:00:38 |       |       |
    |   2 |   BITMAP CONVERSION TO ROWIDS |                         |     3 |     9 |     1   (0)| 00:00:01 |       |       |
    |*  3 |    BITMAP INDEX FAST FULL SCAN| IDX_PS2_ACTION_TYPES    |       |       |            |          |       |       |
    |   4 |   PARTITION RANGE ITERATOR    |                         |   866K|    87M|  3121   (4)| 00:00:38 |   154 |   158 |
    |   5 |    TABLE ACCESS FULL          | PS2_FS_TRANSACTION_FACT |   866K|    87M|  3121   (4)| 00:00:38 |   154 |   158 |
    Predicate Information (identified by operation id):
       1 - access("AL1"."ACTION_TYPE_ID"="AL2"."ACTION_TYPE_ID")
       3 - filter("AL2"."ACTION_TYPE"='1' OR "AL2"."ACTION_TYPE"='2' OR "AL2"."ACTION_TYPE"='S')
    Thank you very much,
    Seyed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Not Like in Select Statement

    Hi All,
    My requirement is not to select the entries for the T024 table where the eknam is either starts with 'NOT VALID' or blank.
    For that, I have written the select statement using NOT LIKE,
    Will this negation in the select statement cause extra execution tiem?
    If so, can you give some hint for alternative statement.
    SELECT EKGRP EKNAM FROM T024 INTO TABLE IT_T024
    IT_PURC WHERE EKGRP = S_EKGRP AND EKNAM NOT LIKE 'NOT VALID%' AND EKNAM NOT LIKE ' '.
    Thanks,
    Kal Chand

    Hello,
    For the first condition: not starting with 'NOT VALID' , I don't know other way apart from yours: EKNAM NOT LIKE 'NOT VALID%'.
    For the second one, not starting with blank: EKNAM NOT LIKE ' '. Does it work? I think it compares if EKNAM is different from blank which can be done using:  EKNAM NE ' '.
    I hope it will help you.

  • Sequence error in select statement

    Does anyone know why I get the following error when I run the code below. If so, how can it be fixed.
    Thanks in advance,
    John C
    ORA-02287 sequence number not allowed here
    INSERT INTO PROMO_STAGE.NAC_OFFER (CMPGN_KEY, OFFER_KEY, CREATIVE)
    SELECT DISTINCT A.CREATIVE,
    B.CMPGN_KEY,
    PROMO_STAGE.SEQ_NAC_OFFER_KEY.NEXTVAL@DSTAGE
    FROM PROMO_STAGE.CAMPAIGN@DSTAGE B,
    ROCEONOF.NACQ0211_2_FINAL@OGD A
    WHERE B.CMPGN_ID = 'NAC_'|| to_char(add_months(SYSDATE,-1),'YYYYMM');

    John
    It is the DISTINCT which is causing the trouble. How about:
    INSERT INTO PROMO_STAGE.NAC_OFFER (CMPGN_KEY, OFFER_KEY, CREATIVE)
    SELECT COL1, COL2, PROMO_STAGE.SEQ_NAC_OFFER_KEY.NEXTVAL@DSTAGE
    FROM
    (SELECT DISTINCT A.CREATIVE COL1, B.CMPGN_KEY COL2
    FROM PROMO_STAGE.CAMPAIGN@DSTAGE B,
    ROCEONOF.NACQ0211_2_FINAL@OGD A
    WHERE B.CMPGN_ID = 'NAC_'|| to_char(add_months(SYSDATE,-1),'YYYYMM'));
    Incidentally, judging by the column names, it appears that the columns in your insert statement are not listed in the same order as in the select statement, which of course they should be.

  • Select statement error.

    Hi all,
    I have a select statement which will join 4 tables as shown below. Something is not working right in the select statement and caused the shortdump.
    I really cannot figure out where is not right.
    Please help.
    TYPES:  
      BEGIN OF t_lips,
        matnr TYPE matnr,
        lfimg TYPE lfimg,
        meins TYPE meins,
        vbeln TYPE vbeln_vl,
        lfart TYPE lfart,
        vstel TYPE vstel,
        maktx TYPE maktx,
        werks TYPE werks_d,
        exnum TYPE exnum,
        posnr TYPE posnr_vl,
        uecha TYPE uecha,
        netwr TYPE netwr,
        waerk TYPE waerk,
        vgbel TYPE vgbel,
      END OF t_lips.
    DATA: lt_lips      TYPE TABLE OF t_lips.
    SELECT lips~matnr lfimg lips~vrkme lips~vbeln lfart
        vbap~vstel lips~arktx lips~werks exnum
        vbap~netwr vbap~waerk lips~vgbel
        lips~posnr lips~uecha
      INTO TABLE lt_lips
      FROM lips INNER JOIN vttp
        ON    vttp~vbeln = lips~vbeln
        INNER JOIN likp
        ON    lips~vbeln = likp~vbeln
        INNER JOIN VBAP
        ON lips~vgbel = vbap~vbeln
      WHERE vttp~tknum = ps_vttk-tknum
        AND   lfimg      <> 0.
    Error analysis                                                                               
    An exception occurred that is explained in detail below.                                     
        The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught                
         in                                                                               
    procedure "GET_DATA" "(FORM)", 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:                                                             
        In a SELECT access, the read file could not be placed in the target                          
        field provided.                                                                               
    Either the conversion is not supported for the type of the target field,                     
        the target field is too small to include the value, or the data does not                     
        have the format required for the target field.                                               

    Hi,
    In the below code, where are you picking up value for LFIMG and LFART. Give the alias/table name for them also.
    for ex. lips~lfimg....
    SELECT lips~matnr lfimg lips~vrkme lips~vbeln lfart
        vbap~vstel lips~arktx lips~werks exnum
        vbap~netwr vbap~waerk lips~vgbel
        lips~posnr lips~uecha
      INTO TABLE lt_lips
      FROM lips INNER JOIN vttp
        ON    vttp~vbeln = lips~vbeln
        INNER JOIN likp
        ON    lips~vbeln = likp~vbeln
        INNER JOIN VBAP
        ON lips~vgbel = vbap~vbeln
      WHERE vttp~tknum = ps_vttk-tknum
        AND   lfimg       0.
    Hope this is useful.
    Also selection of records should be same as declared in table lt_lips otherwise use 'INTO CORRESPONDING TABLE LT_LIPS'
    Regards,
    Saba
    Edited by: Saba Sayed on Oct 24, 2008 9:30 AM

  • Performance Tuning 'Runtime Error' on Select statement

    Hi Experts,
    Good Day!
    I would like to ask some help regarding a custom program that will encounter 'Runtime Error' on the below codes on how to perform performance tunning especially number 1.
    1.
    SELECT A~VBELN A~ERDAT A~AUART A~VKORG A~VTWEG A~SPART A~VDATU
             A~KUNNR B~POSNR B~MATNR B~ARKTX B~ABGRU B~KWMENG B~VRKME
             B~WERKS B~VSTEL B~ROUTE
          FROM VBAK AS A INNER JOIN VBAP AS B ON A~VBELN EQ B~VBELN
                         INNER JOIN VBEP AS C ON A~VBELN EQ C~VBELN
                           AND B~POSNR EQ C~POSNR
            INTO CORRESPONDING FIELDS OF TABLE I_DATA_TAB
              WHERE A~VBELN  IN S_VBELN
                AND A~VKORG  IN S_VKORG
                AND A~AUART  IN S_AUART
                AND A~VTWEG  IN S_VTWEG
                AND A~SPART  IN S_SPART
                AND A~VDATU  IN S_VDATU
                AND A~KUNNR  IN S_KUNNRD
                AND B~MATNR  IN S_MATNR
                AND B~KWMENG IN S_KWMENG
                AND B~VRKME  IN S_VRKME
                AND B~WERKS  IN S_WERKS
                AND C~EDATU  IN S_VDATU.
    2.
    SELECT VBELN FROM LIKP INTO LIKP-VBELN
                  WHERE LFDAT IN S_VDATU
                    AND VKORG IN S_VKORG
                    AND LFART EQ 'YSTD'
                    AND KUNNR IN S_KUNNRP
                    AND KUNAG IN S_KUNNRD
        SELECT VBELN POSNR LFIMG MATNR WERKS
           FROM LIPS INTO (LIPS-VBELN, LIPS-POSNR, DISPLAY_TAB-DEL_QTY,
                           LIPS-MATNR, LIPS-WERKS)
                 WHERE VBELN EQ LIKP-VBELN
                   AND MATNR IN S_MATNR
                   AND VTWEG IN S_VTWEG
                   AND SPART IN S_SPART
                   AND WERKS IN S_WERKS.   
         ENDSELECT.
      ENDSELECT.
    4.
    SELECT DELIVERY POSNR MATNR PODLFIMG FROM T9YPODI INTO
        (T9YPODI-DELIVERY, T9YPODI-POSNR, T9YPODI-MATNR, T9YPODI-PODLFIMG)
                           WHERE MATNR   IN S_MATNR
                             AND PODDATE IN S_VDATU.
    Answer's will be a great help.
    ~Thank You,
      Lourd
    Edited by: Lourd06 on Oct 23, 2009 10:32 AM
    Moderator message - Welcome to SCN.
    Moderator message - Please see Please Read before Posting in the Performance and Tuning Forum before posting. You're in the driver's seat here. It's up to you to do some analysis before expecting that people can halp you. - post locked
    And please use code tags.
    Edited by: Rob Burbank on Oct 23, 2009 9:13 AM

    Hi All,
    We've checked the transaction ST22 it is TIME OUT. I really need your help on this the program will dump in number 1 Select statement. Can you help me perform a performance tunning.
    In transaction ST22
    Runtime Errors         TIME_OUT
    Date and Time          21.10.2009 08:51:33
    Short text
         Time limit exceeded.
    What happened?
         The program "ZV0PSR10" has exceeded the maximum permitted runtime without
         interruption and has therefore been terminated.
    What can you do?
         Note down which actions and inputs caused the error.
         To process the problem further, contact you SAP system
         administrator.
         Using Transaction ST22 for ABAP Dump Analysis, you can look
         at and manage termination messages, and you can also
         keep them for a long time.
    Error analysis
         After a specific time, the program is terminated to make the work area
         available to other users who may be waiting.
         This is to prevent a work area being blocked unnecessarily long by, for
         example:
         - Endless loops (DO, WHILE, ...),
         - Database accesses with a large result set
         - Database accesses without a suitable index (full table scan)
         The maximum runtime of a program is limited by the system profile
         parameter "rdisp/max_wprun_time". The current setting is 1200 seconds. If this
          time limit is
         exceeded, the system attempts to cancel any running SQL statement or
         signals the ABAP processor to stop the running program. Then the system
         waits another 60 seconds maximum. If the program is then still active,
         the work process is restarted.
    ~Thank you
    Lourd
    Edited by: Lourd06 on Oct 23, 2009 11:22 AM
    Edited by: Lourd06 on Oct 23, 2009 11:33 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

  • 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

Maybe you are looking for

  • New free/open-source tool to encapsulate the OCI interface

    Hello, Here is a short presentation and a link to a new free tool available on soureceforge.net. This tool is a powerful "wrapper" to encapsulate the OCI interface: Introduction OCILIB is a free, open source and platform independant library, written

  • Cannot open InDesign CC file

    I have some files that have been sent to me (Australia) from Belgium. All open fine except one which displays this message "Cannot open the file 'xxxxxxxx' Adobe InDesign may not support the file format, a plug-in that supports the file may be missin

  • Packages in SAP

    I want to install all the packages that are available in mini sap 6.10 in the option add or remove package of the front end, but it tells me that I need to have jdk 1.1.8 to preparedly install all the packages. Can someone tell me where can I find th

  • Sun One Web Server 6.1 SP4 crashes when filters are built with CC ver. 5.6

    Hi All We are using NSAPI interfaces to develop the filter for Sun ONE 6.1 SP4 Web Server. Filter was working perfectly fine when it was built using Sun WorkShop 6.0, CC Compiler ver 5.2. After we upgarded to Sun WorkShop 9.0, CC Compiler ver. 5.6, i

  • How do I sync all other items when iPhoto library offline?

    I have an iPhoto library which is on an external drive and not always connected to my MacBook Air. Previous to iOS 5.x and the related iTunes 10.5.x, I am fairly certain that I was able to perform a full sync to the iPhone (songs, apps, podcasts, vid