Conditional If-THEN statement in PL/SQL

Hi,
I've got a question here. I looked through some other threads, but didn't really see any discussing what I'm trying to achieve.
I've got a statement:
SELECT DISTINCT AID, ACTIVE, REQUESTOR_NAME, REQUESTOR_EMAIL,BUS_CONTACT ,DEPT,LOCATION,DATE_REQ,BUSVP,VP_PHONE,VP_DATE,BRANCH,PRIORITY,STATUS1,STATUS2 FROM CHANGE_CONTROL_ADMIN a INNER JOIN CHANGE_CONTROL_USER b ON a.CHANGE_CTRL_ID = b.CHANGE_CTRL_ID WHERE UPPER(REQUESTOR_NAME) LIKE ? AND DEPT = ? ORDER BY AID;
So this is in my Java servlet coded like so, but I am pulling the DEPT value from a dropdown menu item list and setting that string value = to the corresponding dept. Works great! Except for when/if someone left the department select menu to the default, which is "" or null.
So I'm wondering, is there a way to tweak the PL/SQL statement so that "AND DEPT = ?" is bypassed if the value is null?
How would that look?
Any help is appreciated!
Thanks!

Hi,
I've got a question here. I looked through some other
threads, but didn't really see any discussing what
I'm trying to achieve.
I've got a statement:
SELECT DISTINCT AID, ACTIVE, REQUESTOR_NAME,
REQUESTOR_EMAIL,BUS_CONTACT
,DEPT,LOCATION,DATE_REQ,BUSVP,VP_PHONE,VP_DATE,BRANCH,
PRIORITY,STATUS1,STATUS2 FROM CHANGE_CONTROL_ADMIN a
INNER JOIN CHANGE_CONTROL_USER b ON a.CHANGE_CTRL_ID
= b.CHANGE_CTRL_ID WHERE UPPER(REQUESTOR_NAME) LIKE ?
AND DEPT = NVL(?, DEPT) --> this will assign the current row value to DEPT if it is null and will achieve what you are looking for
ORDER BY AID;
>
So this is in my Java servlet coded like so, but I am
pulling the DEPT value from a dropdown menu item list
and setting that string value = to the corresponding
dept. Works great! Except for when/if someone left
the department select menu to the default, which is
"" or null.
So I'm wondering, is there a way to tweak the PL/SQL
statement so that "AND DEPT = ?" is bypassed if the
value is null?
How would that look?
Any help is appreciated!
Thanks!

Similar Messages

  • Multiple select statements in PL/SQL

    Hi All
    I am new to PL/SQL and my experience is in writing TSQL. There we can write a SQL statement like this to return 3 result set
    SELECT empname FROM Employee
    SELECT authname FROM Author
    SELECT athname FROM sport
    how can we write the same 3 statements in PL/SQL and attain the 3 resultsets.
    I tried to implement the same using PL/SQL anonymous blocks. But it didn't worked.
    DECLARE
    P_RECORDSET OUT SYS_REFCURSOR
    BEGIN
    OPEN P_RECORDSET FOR
    SELECT empname FROM Employee;
    SELECT authname FROM Author;
    SELECT athname FROM sport;
    END;
    can anybody show how it can be done.
    Thanks in advance
    George
    Edited by: user6290570 on Sep 16, 2009 11:23 PM

    george2009 wrote:
    No i just want to select 3 result sets from 3 select statements, so that it is helpful to compare the resultsets. Compare? How? This is done using the SQL language. Not PL/SQL. Not Java. Not VB. Not anything else.
    You would use these other language for flow control and certain forms of conditional logic - but the actual comparison of data sets is done in SQL.
    Of course, that is if you do want to do it the most optimal way, that will perform well, and scale well.
    SQL is not an I/O API layer - to be used to read() a record and write() a record as if the RDBMS is an ISAM file. That form of row-by-row and slow-by-slow processing dates back to the 80's when we used Cobol.. (or at least for those old farts like me that can actually remember coding in Cobol in the 80's ;-) ).
    You want to design and code database applications that are fast, robust, and can scale? Then learn how to use SQL correctly.

  • If-then statement in formula node

    **Note - The attached file shows the current block diagram.
    I have a formula node inside a for loop. Inside the formula node I am trying to program the if-then statement:
    If T1<2.0E-5 OR T1>5.5E-4 THEN GOTO 3
    U7=U7+V
    I have 4 items I need help with:
    (1) Is 'II' the correct operator for 'OR'?
    (2) Is 'goto' an acceptable operator within LabVIEW?
    (3) 'U7' is building a 1D array. How do I need to define it? Is it simply 'int U7'? Also, I will add an output value named 'U7' on the formula node wall with an indicator wired to it from outside the for loop.
    (4) Is my use of the equal sign appropriate or do I need to use '=='?
    Thanks for the help.
    Philip
    Attachments:
    if-then_in_FN.jpg ‏18 KB

    Thanks for the help. I went ahead and rewrote the program so I could omit the 'goto's. Another problem that I am having is that I want 2 statements for 1 assignment:
    if (T1>=.002004 && T1<=.002584)
    B1=U
    A1=V;
    I want to assign both B1 and A1 values when the above condition is true. I tried a comma between the U and A1 but it doesn't work as well. Should I define A1 and B1 separately? Or would this create problems?
    if (T1>=.002004 && T1<=.002584)
    B1=U;
    if (T1>=.002004 && T1<=.002584)
    A1=V;
    Thanks,
    Philip

  • "If, Then" Statements Driving Selection

    I am creating a price list/order form and need some help with "If, Then" statements and how their result drives a price selection.
    I have a product that is priced differently based on both how many is purchased and how many colors it has. My variables are (a) one, two, three or four colors, and (b) 10 to 500 pieces in six tiers (10-24, 25-49, 50-99, 100-249, 250-499, 500+).
    I want to autopopulate a price field based on the color number and the quantity, making the pricing foolproof and the total order amount automatically calculated.
    Here's my situation:
      - Field A is Number of Colors (let's say 1-color)
      - Field B is Quantity (let's say it's 23, putting us in the 10-24 tier pricing)
      - Field C is Unit Price (1-color @ 23 qty would be $76.63 each)
      - Field D is Total Price (23 x $76.63)
    My statement would look like the following, but I don't know how to structure this in the form fields or where to put the quantity or pricing table for the software to calculate B or C:
    If A is 1-color, and B is 23, then C is $76.63.
    My Field D calculation is pretty straight-forward (Field C x Field D) if I can figure out a way to determine Field C's value.
    Help!

    Have a look at these tutorials:
    http://acrobatusers.com/tutorials/conditional-execution
    http://acrobatusers.com/tutorials/how-to-do-not-so-simple-form-calculations
    If you still need help afterwards, post here again.

  • Case statement in advanced sql

    how to use case statement in advanced sql.Example if quarter=1 i need to select jan,fev,and march months from table

    this is the case statement i am using :
    case when 1=@{quarter} then substring(cast((etxnmis.month_year) as char) from 5 for 2) IN ('03', '04', '05') else null end
    and i get the below error
    : HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27002] Near <IN>: Syntax error [nQSError: 26012] . (HY000)

  • Update Contract conditions in Real State

    Hi,
    I am working with real state moduel, while creating the contract offer user when selecting the conditions wants to select one condition on the basis of which i through some abap code should populate all the conditions.
    The thing is can anyone tell me if there is a BADI or enhancement for this where i can put my code.
    Thanks

    Hi
    I was able to solve the problem by using BADI_RECD_CONDITION,
    I implemented the funtion named as  CHECK_ALL.
    In this function used the following code
    io_object - > method import parameter
    *To get Contract details
      CALL FUNCTION 'API_RE_OF_GET_DETAIL'
        EXPORTING
          io_object    = io_object "Object containing the  
                                   "reference for cont. offer
        IMPORTING
          et_condition = lt_condition
        EXCEPTIONS
          error        = 1
          OTHERS       = 2.
    *Manipulated the conditions and then updated them using
    *   update contracts
        CALL FUNCTION 'API_RE_OF_CHANGE'
          EXPORTING
            io_object    = io_object
            it_condition = lt_condition_change
          EXCEPTIONS
            error        = 1
            OTHERS       = 2.
    These functions provide us with the updated data which the user has entered and not saved, that is the runtime data.
    Regards,
    Khusro Habib

  • DISCOVERER 3.1, IF,THEN STATEMENT

    Dear All,
    I am not an experienced Discoverer user. Please forgive my ignorance.
    I would like to create a column that will "fill in" certain text based on the contents of other columns.
    I have been partially successful by using the DECODE function, but I have only been able to base my result on one column.
    What I need to do is create text statements that will vary based on the contents of 3 different columns. For example IF Fruit=** AND Color=*** AND Date Picked = *** then Statement= MY STATEMENT.
    FRUIT COLOR DATE PICKED STATEMENT
    APPLE RED 30<SYSDATE BAD RED APPLE
    APPLE RED SYSDATE O.K. RED APPLE
    APPLE GREEN SYSDATE BAKING APPLE
    PEACH PINK >SYSDATE GOOD FOR PIES
    Any and all help would be greatly appreciated!
    Thanks
    nancy
    [email protected] or [email protected]

    Dear Andrew,
    Thanks so much for taking the time to reply. I will try this.
    nancy
    Hi Nancy,
    I am not an experienced Discoverer user, but I know SQL. So here is a SQL solution, there might be Discoverer specific ways of doing this I do not know about.
    OK, First try breaking your problem down into parts.
    Outermost: DECODE(fruit,'APPLE', apple_only_section ,
    fruit,'PEACH', peach_only_section ,
    other_fruit_section)
    apple_only_section: DECODE( color , 'RED', apple_red_section ,
    color , 'GREEN', apple_green_section ,
    other_apple_section )
    // Here is where things get 'tricky' to try to determine date ranges.
    apple_red_section: DECODE ( greatest( trunc(sysdate)-30,date_picked) ,
    trunc(sysdate)-30) , 'BAD RED APPLE' ) ,
    'GOOD RED APPLE' )
    The 'greatest' statement above is key to doing date-ranges in a column,
    And you should think about whether the dates should be truncated to remove the time component (as I do for sysdate above).
    And once you have the sections like 'apple_red_section' that you know work, running independently, you start embedding them together to form the higher level statements.
    You end up with hard to understand gobbledegook, but it does work.
    The decode statement is tricky even for a programmer, so work in stages and get each part working before you try to combine them. Better yet get a programmer to write exactly what you want.
    Andrew

  • How to create nested CASE statements in PL/SQL

    Can anyone please tell how to create Nested CASE statements in PL/SQL with proper syntax?
    It would be better if you can help with an example.
    Thank you!

    Something like this:
    SQL> set serveroutput on
    SQL> declare
      2    v1 number := 2;
      3    v2 varchar2(1) := 'C';
      4  begin
      5    case v1
      6      when 1 then dbms_output.put_line('First');
      7      when 2 then begin
      8                    case v2
      9                      when 'A' then dbms_output.put_line('Found A');
    10                      when 'B' then dbms_output.put_line('Found B');
    11                      when 'C' then dbms_output.put_line('Found C');
    12                      else dbms_output.put_line('NONE');
    13                    end case;
    14                  end;
    15      else dbms_output.put_line('Else');
    16    end case;
    17  end;
    18  /
    Found C
    PL/SQL procedure successfully completed
    SQL> If you have further doubts regarding syntax you can read the docs on the Case statement here:
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10472/case_statement.htm

  • Multiple SQL statements in Init SQL in WLS 8.1

    How to seperate multiple SQL statements in Init SQL text box ?
    For example, I want to enter following two SQL statements. How do I seperate them.
    I tested with / and ; as seperator, but did not worked..
    alter session set nls_date_format = 'MM/DD/YYYY'
    set role xxx_role identified by xxxx

    Mahendra wrote:
    Thanks Joe.
    Following worked for Oracle 8.1.7Good news.
    but did not for 8.0.6
    SQL BEGIN EXECUTE IMMEDIATE 'ALTER SESSION SET nls_date_format = ''MM/DD/YYYY''';
    EXECUTE IMMEDIATE 'SET ROLE xxx identified xxx'; end;
    Do you know 8.0.6 syntax ?You might try asking oracle, but note that no one is supporting that old version
    of Oracle any longer...
    Joe
    >
    Mahendra
    Joe Weinstein <[email protected]> wrote:
    Hi.
    I found the syntax, I think. Try this:
    BEGIN EXECUTE IMMEDIATE 'ALTER SESSION SET nls_date_format = 'MM/DD/YYYY'';
    EXECUTE IMMEDIATE 'SET ROLE <<role name>> identified
    by <<pwd>>';END;
    Joe
    Mahendra wrote:
    Still getting following exception.
    <Feb 19, 2004 1:47:58 PM EST>
    <Warning>
    <JDBC> <BEA-001164>
    <Unable to initialize connection in pool "XXXX".
    Initialization
    SQL = "BEGIN alter session set nls_date_format = 'MM/DD/YYYY'; setrole xxxx_role
    identified by
    xxxx; END;".
    Received exception: "java.sql.SQLException: ORA-06550: line 1,column7:
    PLS-00103: Encountered the symbol "ALTER" when expecting one of thefollowing:
    begin declare exit for goto if loop mod null pragma raise
    return select update while <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> <<
    close current delete fetch lock insert open rollback
    savepoint set sql commit <a single-quoted SQL string>
    The symbol "update was inserted before "ALTER" to continue.
    ORA-06550: line 1, column 61:
    PLS-00103: Encountered the symbol "ROLE" when expecting one of thefollowing:
    transaction
    ".>
    <Feb 19, 2004 1:47:59 PM EST> <Notice> <WebLogicServer> <BEA-000355><Thread "Li
    Joe Weinstein <[email protected]> wrote:
    Mahendra wrote:
    Thanks for reply, but that did not worked.
    Get following exception
    Unable to initialize connection pool "POOL_NAME".
    Initialization SQL = "Select count(*) from ""SQL BEGIN alter sessionset nls_date_format
    = 'MM/DD/YYYY'; set role xxx_role identified by xxxx; END;"". Receivedexception:
    "java.sql.SQLException: ORA-00972: identifier is too long
    Since we have not given SQL before that statement, BEA is treating
    statment "SQL Begin ....." as a table name.
    Then I tried by putting SQL out side quotes, like SQL "Begin .....end;" but the
    same error.
    Is there any way around it ?
    MahendraHi. The full string you should enter into the console when you define
    the
    initSQL parameter is:
    SQL BEGIN alter session set nls_date_format = 'MM/DD/YYYY'; set role
    xxx_role identified by xxxx; END;
    Let me know...
    Joe
    Joe Weinstein <[email protected]> wrote:
    Mahendra wrote:
    How to seperate multiple SQL statements in Init SQL text box ?
    For example, I want to enter following two SQL statements. How do
    I
    seperate them.
    I tested with / and ; as seperator, but did not worked..
    alter session set nls_date_format = 'MM/DD/YYYY'
    set role xxx_role identified by xxxxThis will always be DBMS-specific. If this is for oracle, you can
    try:
    "SQL BEGIN alter session set nls_date_format = 'MM/DD/YYYY'; setrole
    xxx_role identified by xxxx; END;"
    Joe

  • Adding more statements to the sql commands window

    Hi, I'm using oracle database express edition10g and I just started using oracle.
    And I'm having a problem adding more then one statement inside the sql commands gui window.
    I write:
    CREATE TABLE "testTable" (
         "field1" VARCHAR2(2),
         "field2" NUMBER(2,0),
         "field3" NUMBER(2,0),
         CONSTRAINT "Test_PK" PRIMARY KEY("field1")
    Oracle reports: table created
    I write
    DROP TABLE testTable;
    CREATE TABLE "testTable" (
         "field1" VARCHAR2(2),
         "field2" NUMBER(2,0),
         "field3" NUMBER(2,0),
         CONSTRAINT "Test_PK" PRIMARY KEY("field1")
    Oracle reports: ORA-00911: invalid character
    I remove the ; char
    ORA-00933: SQL command not properly ended
    I look in the help files and it sais that ; / and nothing is allowed to end a operation.
    I gues ; is a valid char so it's reporting something else?
    I tried pasting my code inside wordpad and even retyping it. Mayby I have a hidden char? =>same error.
    When I run drop and create seperatly it works.
    When I run both sql statements inside sql+ it works
    What m I doing wrong?

    To run multiple SQL in one shot, you need to save them as SQL batch file,
    Save your statements as recreate.sql
    DROP TABLE testTable;
    CREATE TABLE "testTable" (
    "field1" VARCHAR2(2),
    "field2" NUMBER(2,0),
    "field3" NUMBER(2,0),
    CONSTRAINT "Test_PK" PRIMARY KEY("field1")
    );Then call it from SQLPlus,
    @recreate.sql

  • Help! When I try to purchase a song from iTunes and have agreed to the terms and conditions, it then tells me that my session has timed out... but I've only been trying for a few minutes. I can't buy songs if it keeps doing this!

    Help! When I try to purchase a song from iTunes and have agreed to the terms and conditions, it then tells me that my session has timed out... but I've only been trying for a few minutes. I can't buy songs if it keeps doing this! Does anyone know why it's doing this and how to fix it? Thanks!

    Hi mterry1723, one solution that might be worth trying is this:
    - Close iTunes, if it's open
    - Open Safari and got to 'Preferences'
    - Select 'Security' on the top
    - Untick all the security options in the menu
    - Click the 'Show Cookies' button and look for all the 'apple' entries in the left-hand column.
    - Highlight them (select them collectively) and press 'Remove'
    - Now open iTunes and buy the song as usual.
    - You may be asked to do the same security process as before, so do as asked.
    - Hopefully, the security check will now have accepted your answers and start downloading the song as normal.
    Remember to re-tick all the required security options you had just un-ticked in Safari preferences. You don't need to bother about opening the cookies again.
    I hope this has worked for you and my profoundest apologies if it has not. Worth a go, though!
    I did see this thread: https://discussions.apple.com/message/18259935#18259935 which may be of more help, mainly the last entry by 'c2boyd'
    Message was edited by: Bongomal

  • Problem with condition IF THEN in Message MApping

    Hi,
    We are not getting correct ouput when we use condition IF THEN without else in message Mapping .We are sending data from File to XI to R/3.
    We are using file adapter and IDOC adapter to create customer in R/3.
    In message Mapping we are creating Segment E1KNB1M and E1KNBKM based on condition.
    IF THEN Condition used in mapping is as below
    find the length of Compnaycode with LENGTH function.Pass that value as one of the parameter to function GREATER.Pass second parameter to function GREATER a constant (0).Pass the result to If without else function.If this is true pass Item to IF THEN function and Map the result to E1KNB1M.
    Our mapping is not giving desired output in below scenario:
    Source  XML
    <?xml version="1.0" encoding="utf-8" ?>
    <ns:CustomerMaster_Request_MT xmlns:ns="http://mazdausa.com/sapr3/fi/masterdata/customermaster">
    <Idoc>
    <Header>
      <ID>H</ID>
      <ACCTGRP>M002</ACCTGRP>
      <CUSTNO>R51563</CUSTNO>
      <NAME1>WAYNE MAZDA</NAME1>
        </Header>
    <Item>
      <ID>L</ID>
      <COMPCODE>US10</COMPCODE>
      <BANKKEY>0000326</BANKKEY>
      <BANKCNTRY>US</BANKCNTRY>
      <BANKACCT>05893</BANKACCT>
      </Item>
      </Idoc>
    - <Idoc>
    - <Header>
      <ID>H</ID>
      <ACCTGRP>M002</ACCTGRP>
      <CUSTNO>51563</CUSTNO>
      <NAME1>WAYNE MAZDA</NAME1>
      </Header>
      </Idoc>
    - <Idoc>
    - <Header>
      <ID>H</ID>
      <ACCTGRP>M002</ACCTGRP>
      <CUSTNO>V51563</CUSTNO>
      <NAME1>WAYNE MAZDA</NAME1>
        </Header>
    - <Item>
      <ID>L</ID>
      <COMPCODE>US10</COMPCODE>
      <BANKKEY>000326</BANKKEY>
      <BANKCNTRY>US</BANKCNTRY>
      <BANKACCT>0305893</BANKACCT>
      </Item>
      </Idoc>
      </ns:CustomerMaster_Request_MT>
    Here 3 Idoc are created under ZDEBMAS06.
    First IDOC contain segment E1KNB1M and E1KNBKM as desired because first idoc in Source XML contains Item data.
    Second IDOC contain segment E1KNA1M only as desired because second Idoc in Source XML does not contains item data.
    Third IDOC does not contain Segment E1KNBKM and E1KNB1M which is not a desired output. It should contain these segments as third idoc in source XML have item data.
    But we are getting right output in case we also have Item data under second IDOC in source XML.
    Please let me know where I am doing wrong.
    Thanks.
    Rekha.

    Hi Rekha,
    I am getting the same problem while checking display Queue in message mapping??
    <i><b>Source code has syntax error: java.lang.NoClassDefFoundError: com/sun/tools/javac/Main Exception in thread "main"</b></i>
    Any ideas to solve this problem...
    Thanks,
    Sekhar

  • Dynamic where condition in Select statement

    Hi,
    I have 10 fields on selection-screeen. In which ever field the user enters single values or ranges,i should pick that field dynamically and pass that field along with value range to Where condition of Select statement.How can i achieve this? Please help.
    Regards
    K Srinivas

    see the following example:
    data : begin of itab occurs 0,
             matnr like mara-matnr,
    end of itab.
    ypes: begin of ty_s_clause.
    types:   line(72)  type c.
    types: end of ty_s_clause.
    data : begin of gt_condtab occurs 0.
            include structure hrcond.
    data : end   of gt_condtab.
    FIELD-SYMBOLS <fs_wherecond> TYPE ty_s_clause.
    data:
      gt_where_clauses  type standard table of ty_s_clause
                        with default key.
    gt_condtab-field = 'MATNR'.
    gt_condtab-opera = 'EQ'.
    gt_condtab-low = '000000000000000111'.
    append  gt_condtab.
    clear  gt_condtab.
    call function 'RH_DYNAMIC_WHERE_BUILD'
      exporting
        dbtable         = space " can be empty
      tables
        condtab         = gt_condtab
        where_clause    = gt_where_clauses
      exceptions
        empty_condtab   = 01
        no_db_field     = 02
        unknown_db      = 03
        wrong_condition = 04.
    select matnr from mara into table itab where (gt_where_clauses).

  • Run sql statements in PL/Sql Developer without installing Oracle database?

    Hi all,
    I wish to ask is there any possibility to run Run sql statements in PL/Sql Developer without installing Oracle database?
    Regards.

    Hello Jimmy,
    this is the forum for the tool SQL Developer and, as the title says, *(Not for general SQL/PLSQL questions)*.
    PL/Sql Developer is not an Oracle tool, but from allound allroundautomations.
    And you need access to a database to run SQL statements. This does not need to be one installed by yourself.
    Regards
    Marcus

  • Checking conditions in SELECT statement

    Hi All,
    I am relative new to ABAP and I would like to ask a question about checking conditions in SELECT statement in the "WHERE" part.
    There are two checkboxes at the selection screen and each should disable one of  conditions (marked with two stars) in the SELECT mentioned below.
    My question is, whether there exists an option how to solve this problem without using solution like:
    IF checkobx1.
    SELECT (without one condition)
    ELSEIF checkbox2.
    SELECT(without other condition).
    ELSE.
    SELECT (with both conditions)
      SELECT  qprueflos qherkunft qaufnr qsa_aufnr qmatnr qwerkvorg
              qpastrterm  qpaendterm
              qverid qobjnr vobjnr AS objnr_fa vauart
        FROM qals AS q INNER JOIN vkaufk AS v
        ON qaufnr = vaufnr
        INTO CORRESPONDING FIELDS OF TABLE gt_qals
        WHERE q~prueflos IN s_pruefl
          AND q~stat35     EQ space
          AND q~werk       EQ loswk
          AND q~herkunft IN s_herk
          AND q~offennlzmk EQ 0
          AND q~offen_lzmk EQ 0
          AND q~pastrterm IN s_startt
          AND q~paendterm LE s_endt
          AND v~auart IN s_auart.    "('ZCPA', 'ZCPK', 'ZCBA').

    Hi,
    With this, I think u can directly read into WHERE clause
    IF checkbox1.
        v_where = '& BETWEEN ''&'' AND ''&'' '.
        REPLACE '&' WITH key_field INTO v_where.
        REPLACE '&' WITH field_LOW INTO v_where.
        REPLACE '&' WITH field_HIGH INTO v_where.
        CONDENSE v_where.
    ELSEIF  checkbox2.
        v_where = '& BETWEEN ''&'' AND ''&'' '.
        REPLACE '&' WITH key_field INTO v_where.
        REPLACE '&' WITH field_LOW INTO v_where.
        REPLACE '&' WITH field_HIGH INTO v_where.
        CONDENSE v_where.
    ENDIF.
    select * into corresponding fields of table ITAB
                 from (table_name)
                where (v_where).
    In this key_field is your fieldname in the where clause and field_low, field_high are range of values.
    If i write static query it looks like this
    RANGES: MATNR1 FOR MARA-MATNR.
      MATNR1-LOW = MATNR_LOW.
      MATNR1-HIGH = MATNR_HIGH.
      MATNR1-SIGN = 'I'.
      MATNR1-OPTION = 'BT'.
      APPEND MATNR1.
    select * into corresponding fields of table itab
    from mara where matnr BETWEEN 'M100' AND 'M200'.
    Hope it helps u
    thanks\
    Mahesh
    Edited by: Mahesh Reddy on Jan 30, 2009 11:23 AM

Maybe you are looking for

  • InDesign doesn't start on MacBook Pro 15" Mountain Lion

    Hi, Adobe InDesign CS5 is the only program of the Adobe Collection that gives me troubles. I don't manage to open any existing document nor create a new one. Here's what I do: 1. Launch the application Adobe InDesign CS5; 2. Select "Create a New Docu

  • Firefox shows a blinking "edit" cursor in the body of all websites when I click.

    Clicking a button within a webpage puts a blinking text cursor in the body of the site, as if editing a Word document. It's not causing any other problems besides being really annoying and distracting, but it only just started today. I've tried resta

  • Error GR493 report painter/writer with special ledger

    Hi , I am trying to create a report painter using a table of a special ledger. The table is the one for 'real item'. The following error appears: 'Table ZIFRSA is not installed in Report Writer. Message no. GR493 Diagnosis The Report Writer can only

  • (file) diff Illustrator ai files?

    I'm working at a place that dynamically generates "final" ai files from template files based on input (text and photos) received. I was thinking for testing/automation, it could be useful to generate a known good reference sample AI file (as a stored

  • Reports - Urgent

    Hi,     From select options you are giving some vales.Input , assume that matnr and based on that you have generated a report.after generating a report,when you click on matnr field , , if you want to call transaction and change some values means how