Dynamic select-statement with ranges

Good morning experts,
I just wanted to know if this is possible:
I had a report with a selection-screen where I can enter a table-name and one ore more filed-names (separated by ;).
After that, I create a table like my entered (for example MARA)
CREATE DATA gt_table TYPE TABLE OF (p_tab).
ASSIGN gt_table->* TO <gt_table>.
Then I split my entered fields (at and for each filed I made a selection (with function COMPLEX_SELECTIONS_DIALOG).
Result of this is for each field a range-tab which I write in a new table - first column is the name of the field, second column is a range-tab:
TYPES: BEGIN OF t_ranges,
          sign TYPE tkeppllevs-sign,
          opt  TYPE tkeppllevs-opt,
          low  TYPE rsdslow,
          high TYPE rsdslow,
        END OF t_ranges.
DATA: BEGIN OF gs_conditions,
        fieldname TYPE string,
        ranges    TYPE TABLE OF t_ranges.
DATA: END OF gs_conditions.
DATA: gt_conditions LIKE TABLE OF gs_conditions.
Now I want to make a select on the entered table (MARA).
So I make a loop on my gt_conditions:
LOOP AT gt_conditions INTO gs_conditions.
  l_index = sy-tabix.
CONCATENATE 'gt_conditions[' l_index ']-ranges' INTO l_condition.
  CONDENSE l_condition NO-GAPS.
  CONCATENATE gs_conditions-fieldname 'IN' l_condition INTO lt_condition SEPARATED BY space.
  IF sy-tabix > 1.
    CONCATENATE 'AND' lt_condition INTO lt_condition SEPARATED BY space.
  ENDIF.
  APPEND lt_condition.
ENDLOOP.
If I look at it after the loop, it looks correct:
MATNR IN gt_conditions[1]-ranges
AND ERSDA IN gt_conditions[2]-ranges
But this wont work because of "gt_conditions[1]-ranges". I know, i can work with the "table in table", because gs_conditions-ranges works (I already tested this).
Has anybody any idea how to make my idea work?

@Hymavathi:
Error is the following:
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SEMANTICS', was
not caught and
therefore caused a runtime error.
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
"GT_CONDITIONS[1]-RANGES".
@Hymavathi, second time:
This is the whole code for the select:
LOOP AT gt_conditions INTO gs_conditions.
  l_index = sy-tabix.
  CONCATENATE 'gt_conditions[' l_index ']-ranges' INTO l_condition.
  CONDENSE l_condition NO-GAPS.
  CONCATENATE gs_conditions-fieldname 'IN' l_condition INTO lt_condition SEPARATED BY space.
  IF sy-tabix > 1.
    CONCATENATE 'AND' lt_condition INTO lt_condition SEPARATED BY space.
  ENDIF.
  APPEND lt_condition.
ENDLOOP.
SELECT * FROM (p_tab)
   INTO TABLE <gt_table>
        WHERE (lt_condition).
You can see, the select is after the loop. So gs_conditions-ranges wouldn't be right, then the where statement would only use the last range-tab from my table gt_conditions. (loop at...endloop => gs-conditions-range = last gt_conditions-range).

Similar Messages

  • 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

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

  • Dynamic select list with display,return val & join condition issue.

    hello,
    I am having a dynamic select list with display, return value
    say for example my select statement is
    select distinct dname d, deptno r
    from dept dt
    right join emp e on (e.deptno=dt.deptno)
    where (condition)
    when i tried this query for my select list, it is not working. It saying that
    " 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. "
    I am not able to understand the problem. Can anyone help me out with this issue?
    thanks.

    Shouldn't your join have dept as the driving table?
    select distinct dname d, deptno r
    from dept dt
    right join emp e on (dt.deptno = e.deptno)
    where (condition)
    Or using older Oracle standard join
    select distinct dname d, deptno r
    from dept dt, emp e
    where (dt.deptno (+) = e.deptno) AND (OTHER WHERE condition)
    OR
    (Since a right join is just getting the values from the driving table that are NOT in the associated table)
    select distinct dname d, deptno r
    from dept dt
    WHERE dt deptno NOT IN (SELECT deptno FROM emp) AND (OTHER where condition)
    Thank you,
    Tony Miller
    Webster, TX

  • Need to wite pl sql procedure for dynamic select statement

    Need pl sql procedure for a Dynamic select statement which will drop tables older than 45 days
    select 'Drop table'||' ' ||STG_TBL_NAME||'_DTL_STG;' from IG_SESSION_LOG where substr(DTTM_STAMP, 1, 9) < current_date - 45 and INTF_STATUS=0 order by DTTM_STAMP desc;

    I used this to subtract any data older than 2 years, adjustments can be made so that it fits for forty five days, you can see how I changed it from the originaln dd-mon-yyyy to a "monyy", this way it doesn't become confused with the Static data in the in Oracle, and call back to the previous year when unnecessary:
    TO_NUMBER(TO_CHAR(A.MV_DATE,'YYMM')) >= TO_NUMBER(TO_CHAR(SYSDATE - 365, 'YYMM'))

  • Select statement with LIMIT

    I m trying to find if LIMIT is a part of the select statement and if works like
    set rowcount 1 in sybase....if anyone can post the generic select statement with LIMIT in it that would be great!
    any help or input will be greatly appreciated
    Thanks!

    Hallo,
    i don't know sybase, but it is probably rownum
    select * from scott.emp
    where rownum < 3
    Regards
    Dmytro

  • A Select statement with Appending table statement in it.

    Hi,
      How can I use a select statement with a <Appening table> statement in it.
    SELECT DISTINCT <field Name>
                    FROM <DB table name>
                    APPENDING TABLE <itab>
                    WHERE <fieldname> EQ <Itab1-fieldname>
                      AND <fieldname> EQ <itab2-fieldname>.
    Can I use the above select statement.If I'm using this...how this works?
    Regards
    Dharmaraju

    Hi, Dharma Raju Kondeti.
    I found this in the SAP online help, hope this can help you.
    Specifying Internal Tables
    When you read several lines of a database table, you can place them in an internal table. To do this, use the following in the INTO clause:
    SELECT ... INTO|APPENDING [CORRESPONDING FIELDS OF] TABLE <itab>
                              [PACKAGE SIZE <n>] ...
    The same applies to the line type of <itab>, the way in which the data for a line of the database table are assigned to a table line, and the CORRESPONDING FIELDS addition as for flat work areas (see above).
    The internal table is filled with all of the lines of the selection. When you use INTO, all existing lines in the table are deleted. When you use APPENDING; the new lines are added to the existing internal table <itab>. With APPENDING, the system adds the lines to the internal table appropriately for the table type. Fields in the internal table not affected by the selection are filled with initial values.
    If you use the PACKAGE SIZE addition, the lines of the selection are not written into the internal table at once, but in packets. You can define packets of <n> lines that are written one after the other into the internal table. If you use INTO, each packet replaces the preceding one. If you use APPENDING, the packets are inserted one after the other. This is only possible in a loop that ends with ENDSELECT. Outside the SELECT loop, the contents of the internal table are undetermined. You must process the selected lines within the loop.
    Regards,
    feng.
    Edited by: feng zhang on Feb 21, 2008 10:20 AM

  • DYnamic select statement in JDBC adapter?

    Hi guys,
                 Is it possible so send dynamic select statement in jdbc adapter?
    XIer

    Aamir,
    The poster did not specify whether this was sender or receiver channel, but it would only make sense that a "dynamic query" must be on the receiver communication channel since if it was on the sender channel, the channel would have to intelligently determine how to do dynamic queries.
    Also, the poster asked if there was a way to "send a dynamic query" to the channel.  This seems to imply that the channel is receiving information from somewhere to determine the query, which could only mean it is a receiver channel.
    If you would like more information on the JDBC sender communication channel, please open a new thread.

  • Absolute dynamic select query with dynamic join and where

    Has anyone ever tried creating an absolutely dynamic SELECT query with dynamic Join and Where conditions.
    I have a requirement of creating such a query in an Utility Class, and i have written the code. But its throwing my sysntax errors.
    Please let me know where am I going wrong OR is it really possible to create such a dynamic Query??
        SELECT (FIELDS) INTO TABLE IT_TABLES
          FROM ( (ME->TABLE1)  inner join ( me->table2 )
          on ( on_condition ) )
          WHERE (me->where_fields).
    Ags.

    It worked for me in a following way:
    select * into corresponding fields of table <result_table>
            from (join_string)
            where (l_where).
    Where the contents of join_string were dynamically build using concatenation. So it will be something like
    concatenate ME->TABLE1 'as a INNER JOIN' me->table2 'as b ON (' into join_string separated by space.
    <...>
    add here matching/reference colums, something like
    concatenate 'a~' me->TABLE1_JOIN_COL into temp1.
    concatenate 'b~' me->TABLE2_JOIN_COL into temp2.
    concatenate join_string temp1 '=' temp2 into join_string separated by space.
    <...>
    concatenate join_string ')' into join_string separated by space.
    And then use similar approach for l_where variable.

  • Dynamic select query with dynamic where condition

    Hi all,
    I want to use the dynamic select query with dynamic where condition. For that I used the below code but I am getting dump when using this code.
    Please advice, if there is any other way to achieve this requirement.
    Thanks,
    Sanket Sethi
    Code***************
    PARAMETERS: p_tabnam      TYPE tabname,
                p_selfl1      TYPE edpline,
                p_value       TYPE edpline,
                p_where1      TYPE edpline .
    DATA: lt_where    TYPE TABLE OF edpline,
          lt_sel_list TYPE TABLE OF edpline,
          l_wa_name   TYPE string,
          ls_where    TYPE edpline,
          l_having    TYPE string,
          dref        TYPE REF TO data,
          itab_type   TYPE REF TO cl_abap_tabledescr,
          struct_type TYPE REF TO cl_abap_structdescr,
          elem_type   TYPE REF TO cl_abap_elemdescr,
          comp_tab    TYPE cl_abap_structdescr=>component_table,
          comp_fld    TYPE cl_abap_structdescr=>component.
    TYPES: f_count TYPE i.
    FIELD-SYMBOLS : <lt_outtab> TYPE ANY TABLE,
    *                <ls_outtab> TYPE ANY,
                    <l_fld> TYPE ANY.
    struct_type ?= cl_abap_typedescr=>describe_by_name( p_tabnam ).
    elem_type   ?= cl_abap_elemdescr=>describe_by_name( 'F_COUNT' ).
    comp_tab = struct_type->get_components( ).
    comp_fld-name = 'F_COUNT'.
    comp_fld-type = elem_type.
    APPEND comp_fld TO comp_tab.
    struct_type = cl_abap_structdescr=>create( comp_tab ).
    itab_type   = cl_abap_tabledescr=>create( struct_type ).
    l_wa_name = 'l_WA'.
    CREATE DATA dref TYPE HANDLE itab_type.
    ASSIGN dref->* TO <lt_outtab>.
    *CREATE DATA dref TYPE HANDLE struct_type.
    *ASSIGN dref->* TO <ls_outtab>.
    * Creation of the selection fields
    APPEND p_selfl1 TO lt_sel_list.
    APPEND 'COUNT(*) AS F_COUNT' TO lt_sel_list.
    ** Creation of the "where" clause
    *CONCATENATE p_selfl1 '= '' p_value ''.'
    *            INTO ls_where
    *            SEPARATED BY space.
    *APPEND ls_where TO lt_where.
    * Creation of the "where" clause
    APPEND p_where1 TO lt_where.
    * Creation of the "having" clause
    l_having = 'count(*) >= 1'.
    * THE dynamic select
    SELECT          (lt_sel_list)
           FROM     (p_tabnam)
           INTO CORRESPONDING FIELDS OF TABLE <lt_outtab>.
    *       WHERE    (lt_where).

    Hi Sanket,
    The above given logic of mine works for you, put the code in the If condition and try-
    just like below:
    IF NOT P_EBELN IS INITIAL.
    lt_where = '& = ''&'' '.
    REPLACE '&' WITH p_ebeln INTO lt_where.
    REPLACE '&' WITH field_value INTO lt_where.
    SELECT (lt_sel_list) INTO CORRESPONDING FIELDS OF TABLE <lt_outtab>
    FROM (p_tabnam)
    WHERE (lt_where).
    ENDIF.
    thanks\
    Mahesh

  • 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

  • Autonumbers through dynamic SELECT statement

    Trying to get an autonumber from an order table. The order_id I need from the table is only uniquely identified by the customer_id and the date/time. I've been advised that you cannot get an autonumber back from access without going via a select statement.
    I've tried to do a dynamic select statement by getting the date (short i.e.DD/MM/YY) from the server using a JSP custom tag and then putting this value into a hidden form field on the previous web page.
    However, when I load the next page the data gets input into the order table okay but the web page displayed is blank i.e. it doesn't display the order_id or the form to input credit card details. There are no error messages
    Code below, any ideas?
    <%@ page language="java" contentType="text/html"
    import="ShoppingBasket,Product,java.util.*"
    errorPage="errorpage.jsp"%>
    <jsp:useBean id="basket" class="ShoppingBasket" scope="session"/>
    <html>
    <head>
    <title>Your Order Has Been Received</title>
    </head>
    <body>
    <%
    String customer_id = request.getParameter("customer_id");
    String total_value = request.getParameter("total_value");
    String order_date = request.getParameter("order_date");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    java.sql.Connection connection = java.sql.DriverManager.getConnection("jdbc:odbc:Novbase","","");
    java.sql.Statement Stmt = connection.createStatement();
    String query = ("INSERT INTO Orders (customer_id, total_value) VALUES ("+customer_id+", "+total_value+")");
    Stmt.executeUpdate(query);
    java.sql.Statement Stmt2 = connection.createStatement();
    java.sql.ResultSet RS = Stmt2.executeQuery("SELECT order_id FROM Orders WHERE customer_id = "+customer_id+" AND time_date LIKE '"+order_date+"%'" );
    while(RS.next())
    String order_id = RS.getString("order_id");
    %>
    your order id is <%=order_id %>. Please input your credit card details in the form below:
    <form name="form1" method="post" action="shop-postorder4.jsp">
    <table width="90%" border="0" cellspacing="1" cellpadding="5">
    <tr>
    <td width="5%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"></font></td>
    <td width="25%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Credit
    Card Type</font></td>
    <td width="70%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
    <select name="card_type">
    <option value="AMERICAN EXPRESS">American Express</option>
    <option value="MASTER CARD">Master Card</option>
    <option value="SWITCH">Switch</option>
    <option value="VISA">Visa</option>
    </select>
    *</font></td>
    </tr>
    <tr>
    <td width="5%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"></font></td>
    <td width="25%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Credit
    Card No.</font></td>
    <td width="70%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
    <input type="text" name="card_number" size=18 maxlength="18">
    *</font></td>
    </tr>
    <tr>
    <td width="5%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"></font></td>
    <td width="25%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Issue
    No. <font size="1"><br>
    (Switch card holders<br>
    only)</font></font></td>
    <td width="70%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
    <input type="text" name="issue_no" size="2" maxlength="2">
    </font></td>
    </tr>
    <tr>
    <td width="5%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"></font></td>
    <td width="25%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Valid
    From</font></td>
    <td width="70%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
    <input type="text" name="valid_from" size="4" maxlength="4">
    e.g. 0502</font></td>
    </tr>
    <tr>
    <td width="5%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"></font></td>
    <td width="25%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Validy
    To</font></td>
    <td width="70%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
    <input type="text" name="valid_to" size="4" maxlength="4">
    * e.g. 0105</font></td>
    </tr>
    </table>
    <input type="submit" name="Submit" value="Submit">
    <input type="hidden" name="order_id" value="<%=order_id %>">
    </form>
    <a href=" <%= response.encodeURL(shop-products.jsp") %">">
    <img src="images\toshop.gif" border="0" alt="Return to the Shop"></a>
    <%
    RS.close();
    Stmt.close();
    Stmt2.close();
    connection.close();
    %>
    </body>
    </html>
    </a>

    String query = ("INSERT INTO Orders (customer_id, total_value) VALUES ("+customer_id+", "+total_value+")");
    the data gets input into the order table okay
    java.sql.ResultSet RS = Stmt2.executeQuery("SELECT order_id FROM Orders WHERE customer_id = "+customer_id+" AND time_date LIKE '"+order_date+"%'" );It is a field name as <B>time_date </B>in Orders table? And should you insert some value ?
    It seems your select return nothing.
    When your RS.next() is false, so you get blank. Add some HTNL code or just <HR> after while {} block so your would see it.

  • Dynamic select list with one static 'not_listed" option

    Hi guys,
    I want to create a dynamic select list with one static 'not_listed' option.
    One possible alternative is to add the 'not_listed' record into database, but I really dont want to go that way unless there is no other way around.
    Can anyone shed some lights on this?
    Many thanks,
    William

    As usual : "It depends"...
    If you have a foreign key defined on that field, Scott's reply won't work - unless you define '0 - Not listed' in the database. You can use selec 'not listed' d, to_number(null) r from dual though...
    Another - more declarative way - is in the on 'Edit Page Item' page, in the 'List of Values' region set 'Display Null' to 'Yes' and 'Null Display Value' to ' - Not listed - '.
    Roel

  • How to avoid data repetation when using select statements with innerjoin

    how to avoid data repetation when using select statements with innerjoin.
    thanks in advance,
    satheesh

    you can use a query like this...
      SELECT DISTINCT
             frg~prc_group1                  "Product Group 1
             frg~prc_group2                  "Product Group 2
             frg~prc_group3                  "Product Group 3
             frg~prc_group4                  "Product Group 4
             frg~prc_group5                  "Product Group 5
             prc~product_id                  "Product ID
             txt~short_text                  "Product Description
    UP TO 10 ROWS
    INTO TABLE l_i_data
    FROM
    Joining CRMM_PR_SALESG and
    COMM_PR_FRG_ROD
    crmm_pr_salesg AS frg
    INNER JOIN comm_pr_frg_rod AS prd
    ON frgfrg_guid = prdfragment_guid
    Joining COMM_PRODUCT and
    COMM_PR_FRG_ROD
    INNER JOIN comm_product AS prc
    ON prdproduct_guid = prcproduct_guid
    Joining COMM_PRSHTEXT and
    COMM_PR_FRG_ROD
    INNER JOIN comm_prshtext AS txt
    ON prdproduct_guid = txtproduct_guid
    WHERE frg~prc_group1 IN r_zprc_group1
       AND frg~prc_group2 IN r_zprc_group2
       AND frg~prc_group3 IN r_zprc_group3
       AND frg~prc_group4 IN r_zprc_group4
       AND frg~prc_group5 IN r_zprc_group5.
    reward it it helps
    Edited by: Apan Kumar Motilal on Jun 24, 2008 1:57 PM

  • Problem with select statement using Ranges

    Hi Guys,
                   I have used Ranges and used a select statement for selecting those ranges but I am facing a problem.
    RANGES: r_doctyp for EDIDC-DOCTYP.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'DEBMAS'.
    append r_doctyp.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'MATMAS'.
    append r_doctyp.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'PRICAT'.
    append r_doctyp.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'ORDERS'.
    append r_doctyp.
    r_doctyp-sign = 'I'.
    r_doctyp-option = 'EQ'.
    r_doctyp-low  = 'INVOIC'.
    append r_doctyp.
    Select DOCNUM                                " IDoc number
           DOCTYP                                " IDoc Type
                 from  EDIDC into table IT_ZEDIDC
                 where CREDAT EQ s_credat-low
                 and   DOCTYP EQ r_doctyp        " IDOC Types
                 and   DIRECT EQ '1'.
    Here my select statement is only taking INVOIC.
    But my statement should take any document type.
    Thanks,
    Prasad.

    Hi...,
    Your following select statement is correct.
    Select DOCNUM                                " IDoc number
                DOCTYP                                " IDoc Type
                from  EDIDC into table IT_ZEDIDC
                where CREDAT IN s_credat
                and   DOCTYP IN r_doctyp        " IDOC Types
                and   DIRECT EQ '1'.
    Why you are not getting result..
    1. structure of the IT_ZEDIDC is having two fields DOCNUM , DOCTYP  with same data lengths. If not it should be...
    2. Order in the database table is must be similer to the order you maintained in the select statement.
    3. As you are hard coding the input ranges make sure about every letter.
    4. take a look at other where condition fields too.
    5. check the table of the ranges in debugging mode.
    6. why can't you declare separate work area and table for ranges...?
      like .... data: r_tab type range of <field>
                 data: wa_tab like line of r_tab.
    7. Use clear work area statement after the append statment.
    --Naveen Inuganti.

Maybe you are looking for

  • New to Java. Want to write a simple applet for a mobile phone.

    Hello, I want to write a simple java applet for a mobile phone. currently I am in the stage of thinking about whether this is possible in a timeframe of about a month. I have very little java experience from a while back so I'm pretty much starting f

  • How to modify the memory quota of jvm???

    hello how can i modify the memory size of jvm within the weblogic platform?

  • Why can't I just contact Apple?

    I looked everywhere on the website for an e-mail address, but couldn't find one. I have to send my iPod in for service because it has consumed itself in destruction, and because I bought it in Canada, Canada is the only place they will return it, eve

  • Voice Over - Done Button issue in Safari

    I am using the iPhone 4S safari browser's voice over, i browsed a site and there i selected option in dropdown using swipe and then i click the done button, after that instead of taking me to the next input field, it is taking me to the nearest field

  • Creative SB Live 5.1 (n

    I have a SB Li've 5. on order from Creative (70SB006003007). Will the software Disk contain Keytar and Rythmania along with the sb li've installation. Years ago I bought a sb li've value and it did have these on its disk. I was and still am using Win