Condition WHERE in LOOP

Good afternoon,
I have the following issue,
I  have that do a LOOP to a table Internal, ie.
Loop at it_tabla where lgart = '0100' or lgart = '0200' or lgart = '0300' or lgart = '0400' or lgart = '0500' or  lgart = '0600' or lgart = '0700' or lgart = '0800' .
Endloop.
The question is, Is there any way , in the which not have that do many or  in the sentence LOOP?
Kind regards.

I think Rob means that it will go through the table once.
It's true for Standard tables.  But as it says in the help on the WHERE clause.
While with standard tables all rows of the internal table are checked for the logical expression of the WHERE- addition, with sorted tables and hash tables (as of Release 7.0) you can achieve optimized access by checking that at least the beginning part of the table key in sorted tables and the entire table key in hash tables is equal in the logical expression through queries linked with AND. Optimization also takes effect if the logical expression contains other queries linked with AND with arbitrary operators
In this case though, the queries are linked with OR - so you still get all rows checked! 
Now, if it_tabla is a sorted table with key lgart, then you could do the following:
PERFORM read_the_table USING: '0100', '0200',...
FORM read_the_table USING i_lgart TYPE ...
  data: l_tabix TYPE sytabix.
  READ TABLE it_table WITH TABLE KEY lgart =i_lgart TRANSPORTING NO FIELDS.
  l_tabix = sy-tabix.
  LOOP AT it_table FROM l_tabix INTO ls_wa.
    IF ls_wa-lgart NE i_lgart.
      EXIT.
    ENDIF.
    " Do stuff
  ENDLOOP.
ENDFORM.
matt

Similar Messages

  • Should the condition in the loop step

    Should the condition in the loop step in the integration process(BPM) be = or not= ?I need to do the following>>perform certain operation only when the container value is less than 3 Else then get out of the loop.
    Regards,
    Mansi

    The loop step in ccBPM implements a while loop.
    So, while count not = 3, it will be executed.
    Once the counter reachs 3, the loop will be terminated.
    Regards,
    Henrique.

  • Conditional where clauses in database adapter

    I am trying to write a query in a database adapter that allows for conditional where clauses. Specifically, I want to include or not include a where clause (and clause) if an input variable is empty or not. Can a prepared statement with lexical parameters be used in a database adapter? Or is there another way to do this?
    Thanks in advance.

    I am afraid that you can only bind parameters to the SQL, you can't bind the SQL itself to the SQL. We do have QueryByExample support, where based on what fields are set in an example object, it will construct a different SQL select.
    If you pass in
    <Address>
    <street/>
    <city>
    <state>CA</state>
    </Address>
    it will return all addresses in California. If you pass in:
    <Address>
    <street/>
    <city>Los Angeles</city>
    <state/>
    </Address>
    it will return all addresses in Los Angeles.
    Thanks
    Steve

  • Where is loop/repeat feature on n8 video player

    hi can someone tell me where the loop/repeat featue is on n8 video player
    thanks

    I have the same problem,
    I liked the real player on my nokia n95.
    wondering if I can download a copy to my n8, it does loop,

  • Rewrite condition WHERE TRUNC (data_operac) = to_date(:1, 'YYYY-MM-DD')

    Hi,
    I've got query with condition
    WHERE TRUNC (data_operac) >= to_date(:1, 'YYYY-MM-DD') there is index b-tree on data_operac but cant be used (because of trunc) .
    Is there any way I can rewrite that condition to make index usage possible ?
    Regards.
    Greg

    Like this?
    WHERE data_operac >= to_date(:1, 'YYYY-MM-DD')because following is always true
    data_operac >= TRUNC (data_operac)

  • How do I make something happen only once on a true condition in a loop

    So I have a way of doing this, but it uses a dreaded local variable, and seems to me that it might be unreliable.
    What I want to happen is to have something happen only once on a condition that will remain true. What I need is to set something after a given amount of time, but I only want to set it once after that time has been reached. Problem is, if I use a range, it could be true more than once, if I use a greater than, it'll be true every time after the set time, and if I use an equal, there's no way to know that the particular millisecond value will even appear in the loop.
    Maybe I'm wrong in even using those comparison functions... Any ideas would be greatly appreciated. See the attached vi for a better look at what I'm trying to do... (v7.0)
    Thanks,
    Geoff
    Attachments:
    Question.vi ‏16 KB

    The "Idle" state that the help file refers to is the "non-running"
    state. The Top Level VI must end execution before any "First Time" VIs will
    return TRUE after being called initially.
    Therefore, if your application calls a subVI at the beginning of the
    Test portion, on the next iteration of the loop it will return FALSE
    from that subVI, since your main VI never stopped running, and received
    a TRUE from the "First Time" on the initial test loop.
    If you have code that you want to execute only on the first run of your
    entire program, "First Time" should work fine. If you have code that
    you only want to execute on the first iteration of just the Test loop,
    the "First Time" VI is not ideal.
    I think that shift registers are going to provide the best solution,
    however you mentioned that for your particular application that is not
    ideal. Could you describe a little bit more why shift registers are
    problematic?
    Thanks Geoff, let us know.
    DWeiland
    Applications Engineer
    National Instruments
    www.ni.com/support
    Dan Weiland

  • About exit condition in a loop

    I have this loop,
    loop
       exit when months_between(sysdate,cur_st)<0;
    end loop;is it possible i can modify the exit condition by adding a OR keyword into it?:
    e.g.exit when months_between(sysdate,cur_st)<0 OR dbms_random.value(0,1)=0thanks in advance

    Moreover, you can use LOOP ... IF... THEN exit; END IF; ... END LOOP or WHILE... LOOP...END LOOP
    A try has never been wrong indeed.
    Nicolas.
    Message was edited by:
    N. Gasparotto

  • Plain SQL Conditional WHERE Clause with two sub-selects

    Hi SQL Experts,
    I need a bit quick of help with a query.
    This is a "select" statement for an OBI repository phyiscal table source object.
    So I cant put PL/SQL or Stored Procedures in it. I just need
    to have two different conditions/selects depending on the user role (this information comes
    from the session).
    The above, does not work:
    --------------ORA00905. 00000 -  "missing keyword"
      SELECT OFFICENO FROM orgunit
      WHERE
      CASE WHEN 'SESSION_VARIABLE' LIKE '%globalmanager%' THEN  
            ASSIGNEDOFFICES =
            SELECT DISTINCT ASSIGNEDOFFICES
            FROM USERSTABLE INNER JOIN orgunit ON
            orgunit.OFFICEKEY = USERSTABLE.OFFICEKEY
            WHERE USERSTABLE.USERNAME ='VALUEOF(NQ_SESSION.USER)'
      ELSE
            OFFICENO =
            SELECT DISTINCT OFFICENO FROM USERSTABLE
            INNER JOIN orgunit ON
            orgunit.OFFICEKEY = USERSTABLE.OFFICEKEY
            WHERE USERSTABLE.USERNAME ='VALUEOF(NQ_SESSION.USER)'
      END;   
    Can anyone help?

    Hi,
    I can't tell what you want to do just by looking at code that doesn't do it. Maybe:
    SELECT  officeno
    FROM    orgunit
    WHERE   (    session_variable  LIKE '%globalmanager%'
            AND  assignedofficies  IN
                     SELECT  assignedoffices
                     FROM    usertable  u1
                     JOIN    orgunit    o1  ON o1.officekey = u1.officekey
                     WHERE   u1.username    = 'VALUEOF(NQ_SESSION.USER)'
    OR      (    NVL ( session_variable
                     )        NOT LIKE '%globalmanager%'
            AND  officeno        IN
                     SELECT  officeno
                     FROM    usertable  u2
                     JOIN    orgunit    o2  ON  o2.officekey = u2.officekey
                     WHERE   u2.username   = 'VALUEOF(NQ_SESSION.USER)'
    There might be some simpler and more efficient way, depending on your tables and your reuirements.
    The condition u2.username   = 'VALUEOF(NQ_SESSION.USER)' is almost certainly not what you really want.
    Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002#9362002

  • Conditional where, or PL/SQL block as source for an interactive report?

    I have this situation: The main screen of my application shows a list of documents. For now, there has to be a quick "security" built in, so administrators can see all documents, but other users can only see the documents they created (login of creator is stored in the documents table). In the future we'll probably use VPD's to enforce some rules, but for now we need a quick solution.
    So i stored the administrators in a seperate table. Now i want the interactive report on the main page act as follows:
    - If an admin is logged in, it has to have this query: select field 1, field 2, field 3 from documents
    - For all other users: select field 1, field 2, field 3 from documents where creator = :app_user
    Is this possible in one interactive report? I could make two reports with the different queries and make them conditional according to who is logged in, but this gives me two interactive reports to maintain. Is it possible to use a PL/SQL block as source for the report? I tried, but I get syntax errors. Is it possible to make the where clause conditional on some way?

    Hi,
    Install Demonstration application to your workspace:
    Home>Create Application and select Demonstration Application.
    Check page 1 interactive report. That should give idea how you do it.
    Br, Jari

  • Is this conditional WHERE clause possible?

    Let's say at the beginning of a stored procedure I do this:  DECLARE @hasActualHours BIT
    I'll then employ logic to set this local variable to either 0 or 1.
    I'm interested to know if I can then use it to either include or exclude entire "AND..." clauses within my WHERE clause?
    For example:
    SELECT ...
    FROM ...
    WHERE
      Clause 1... AND
      Clause 2... AND
    Now, I have a Clause 3 but I
    only want to include it if @hasActualHours = 1.
    Is it possible to do something like that in T-SQL?
    Robert

    >> Let's say at the beginning of a stored procedure I do this:  DECLARE @hasActualHours BIT
    I'll then employ logic to set this local variable to either 0 or 1.
    I'm interested to know if I can then use it to either include or exclude entire "AND..." clauses within my WHERE clause? <<
    No, no, no, no!  Your whole approach is totally wrong. Not a little wrong, but totally wrong. You just heard that from someone who helped write the SQL Standards, has 1200+ articles and 10 books on this topic. Please listen. 
    SQL is a declarative language, not a procedural flow control language. Declarative languages have no flow to control; there is no IF-THEN-ELSE, no loops. 
    SELECT ...
      FROM … 
     WHERE Clause 1... 
       AND Clause 2... 
       AND <expression for actual hour count> > 0.00;
    >> Is it possible to do something like that in T-SQL? <<
    Sure, we can kludge it! But first post a statement for your boss to see that you do not care about maintaining code, performance and professionalism. This would be bad for your career; like saying you eat babies on a parenting forum :) That is what the other
    replies are! 
    right now, you are the kid on a baseball diamond asking by which end do you hold the umpire. You are not thinking in SQL yet. My rule of thumb is you need a full year of SQL with a good mentor (read that last phrase again). It is a different mindset. 
    I wrote a book, THINKING IN SETS, to help with the change. See if that helps. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • What is the best way to loop a sound where the loop is a subsection

    I have a sound file, and I am supposed to loop a middle section of the sound, i don't see any way in soundengine to do this. What is the easiest way to loop an MP3 background sound where the beginning is to played once. if I load two sounds and then play both of them they will overlap, yes? I know the time of the loop point, but wonder if there is a way to make it a really perfect loop, with no pauses, gaps or clicks.

    I'm not at my Mac right now so I can't give specifics but SoundEngine allows you to specify attack and decay components to a looping background track. In your case you would specify the beginning section as the attack component and the middle (looping) section as the primary component.
    Craig

  • Conditional where

    Hi,
    I have a below query.In last condition (ie. AND sb.timezone in )i have to pass 0 when sa.timezone_subject is null
    elae i have to pass (1,2).
    for ex if  sa.timezone_subject is null then
    the last condition should be
    AND sb.timezone in(0)
    else sb.timezone in(1,2)
    query
    select sa.timezone_subject,sb.*
    from subject_availability sa,SUBJECT_BOUNDARIES sb
    where sa.year= sb.year
    and sa.month  = sb.month
    and sa.subject =sb.subject
    and sa.subject_option=sb.subject_option
    and sa.lvl = sb.lvl
    and sa.YEAR = 2011
      AND     sa.MONTH = 'MAY'
      AND     sa.SUBJECT = 'BIOLOGY'
      AND     sa.SUBJECT_OPTION = 'BIOLOGY'
      AND     sa.LVL = 'HL'
      AND     sa.language = 'ENGLISH'
      AND sb.timezone in()and i have tried using case but it does't worked out please advice

    HI,
    select sa.timezone_subject,sb.*
    from subject_availability sa,SUBJECT_BOUNDARIES sb
    where sa.year= sb.year
    and sa.month  = sb.month
    and sa.subject =sb.subject
    and sa.subject_option=sb.subject_option
    and sa.lvl = sb.lvl
    and sa.YEAR = 2011
      AND     sa.MONTH = 'MAY'
      AND     sa.SUBJECT = 'BIOLOGY'
      AND     sa.SUBJECT_OPTION = 'BIOLOGY'
      AND     sa.LVL = 'HL'
      AND     sa.language = 'ENGLISH'
      AND     (   sa.timezone_subject is null AND sb.timezone in(1)
               OR sb.timezone in(2,3)
    {code}
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How create a conditional "where"?

    Hi,
    I have a form where I put some values and after they are used to do a query when the user click on button "submit". Maybe the user write just one or two fields from many and these fields I want to use on a where clause. So, in the 'where' clause should have just the items who was completed by user and will be used the condition 'AND' not 'OR'. Can someone help me?
    Thanks, sorry my English, but I from Brazil and I speak a lot of this.

    Felipe,
    Read this thread:
    How to retrieve 2 values from a table in a LOV
    and have a look in my Demo Application:
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Where is loop status stored during runtime using "loop on selected steps"

    I am trying to write a custom report that allow a technician to loop on an arbitrary set of steps and receive the results in a csv file or equivalent (without having the techs trying to change parts of the sequence, since that would violate quality controls on manufacturing testers). 
    I was hoping to be able to read a variable in the poststepcallback that shows whether the step was tested using "loop on selected steps" and having a custom output for that case.  If anyone knows how I can detect looping I would appreciate the help.
    Thanks,
    Sean

    Hey s.cooper,
    This may be a bit more tricky than it seems.  Only because the reporting, as you are aware, is, or at least should be, taken care of by the process model.  Therefore you cannot use the default reporting because you have your own process model.  Since the default reporting is part of the Sequential, Batch or Parallel process models that ship with TS then you would have to use one of those process models to get the default reporting. 
    Concerning the looping-
    Will the ops and techs be selecting to loop on a particular set of steps interactively (i.e. Execute>>Loop on selected steps)?  If you used the default sequential model you'll notice that you can Loop on Selected Steps Using the SinglePass entry point.  This does use the process model to loop on the selected steps a certain number of times.  However, Execute>>Loop On Selected Steps...  does not use the process model and just loops on the selected steps.  If you did write your own process model then you can select your entry point to Allow Interactive Execution of Entry Point.  This option is in the entry point sequence properties.  Right click the entry point and select properties.  On the Model tab you will see that option. 
    OR
    Will the ops and techs have the option set forth by your process model to select which steps to loop on?  If so then how would you loop on those steps?  Have a GoTo step that loops back to the beginning?  Have something that sets each step to loop a fixed number of loops?  There is a Step.LoopType API property that returns the Looping property for a given step as a string.  NoLooping means that the step has no looping properties set for it.  This could be used somewhere in a condition to determine which type of reporting to do.
    Hope this helps you some,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • How do terminate a wait condition in a loop?

    I have a while loop that uses a Wait.vi to set the timing. When I terminate the loop, it waits for the next iteration of the "wait" to complete. How can I terminate the wait in the middle of an iteration?

    There is no way to stop a wait function. In order to get the behavior you want you need to make your own wait function, that uses the tick count VI and just checks to see if the total time has passed, or if you have asked it to stop.
    Take a look at the attached VI.
    Attachments:
    lv7_Wait_with_Stop.vi ‏21 KB

Maybe you are looking for

  • ITunes for Windows Vista 64 bit

    Is there any way to get iTunes to work on Windows Vista 64 bit? If not is Apple developing a version that will work in Windows Vista 64 bit? Thanks,

  • Is there any way to incorperate video from the internet into your project?

    I am trying to make a movie for a research project for school on Lions. I've never been to Africa to get the footage I need to make this movie but the Internet has great footage that I would like to incorporate in my film. Is it possible to take some

  • The App Store Search feature appears to be working again.... I hope!

    I had the same issue that many users were reporting earlier today about not being able to use the search feature in the App Store. I have been experimenting for the last 15 minutes or so and it is working for me now. Keep trying ... It may now be com

  • STO return delivery in inbound or outbound monitor

    Hi all, When you create a return for a STO you create the delivery with VL10B. To me it seems logical that the delivery should appear in the inbound delivery monitor VL06I, however it appears in the outbond monitor VL06O. Any way to change this? Rega

  • Open Dialog in oracle forms

    Dear Friends, I am new to this discussion forum and i would like to know how to get the windows open dialog from oracle forms. I want the user to select the text file available in the system using the open dialog. Thanks in advance Mohan