Dynamic component in WHERE-condition for LOOP AT ?

i want to make
loop at itab where  (dynamic field) > 0
how i can make it...
Edited by: Thomas Zloch on Mar 2, 2010 2:47 PM

I thought it's funny.
And the problem can maybe be solved by using a completely dynamic where-condition, not just a dynamic component.
http://help.sap.com/abapdocu_70/en/ABAPLOOP_AT_ITAB_COND.htm#!ABAP_ADDITION_4@4@
Thomas
P.S. meaningless subject enhanced, and please take the time to say hi and please when asking for help. Thanks.

Similar Messages

  • Dynamic query in where clause while looping in an internal table.

    Hi,
    Had a small question : How can i make a dynamic query for the WHERE clause while looping at an internal table.
    i want to implement a dynamic where clause query for the below example.
    it_cfx_col is an internal table and wa_cfx_col is a work area for it_cfx_col
      DATA :
      i_cfx_col TYPE TABLE OF cfx_col,
      wa_cfx_col LIKE LINE OF i_cfx_col.
    DATA : count TYPE i VALUE 0.
    DATA : l_where_clause TYPE string,
             l_where_clause2 TYPE string,
             l_name type string.
    l_name = 'NANDANOM'.
    l_scenario = 'collaboration'.
    LOOP AT it_cfx_col INTO wa_cfx_col
    WHERE CREATED_BY = l_name
    AND SCENARIO = l_scenario.
    count = count + 1.
    some business logic implemented using the work area wa_cfx_col
    endloop.
    Now i want to write a dynamic query for the where clause.
    DATA : count TYPE i VALUE 0.
      DATA : l_where_clause TYPE string,
             l_where_clause2 TYPE string,
             l_name type string.
    l_name = 'NANDANOM'.
    l_scenario = 'collaboration'.
      l_where_clause = 'CREATED_BY = l_name'.
      l_where_clause2 = 'AND SCENARIO = l_scenario'.
    if l_scenario is not initial.
      CONCATENATE  l_where_clause l_where_clause2
      INTO l_where_clause SEPARATED BY space.
    endif.
    LOOP AT i_cfx_col INTO wa_cfx_col
    WHERE (l_where_clause).
    count = count + 1.
    some business logic implemented using the work area wa_cfx_col
    endloop.
    when i compile this i get an error message as { Statement concluding with "...(l_where_clause)" ended unexpectedly}
    Even i changed the initilization of the variable  l_where_clause2 to [ l_where_clause2 = 'AND SCENARIO = l_scenario.'. ]
    added the end of line demarkation ".", but still i got the same error message.
    Is it a limtation in ABAP that i cannot write a dynamic query for the where clause while looping at an internal table?
    Regards,
    om

    Hi savita,
    there in no such 1 limitaion in abap for dynamic query .. i think the  error meassge is only beacuse of your synatx delcartaion.
    >> LOOP AT i_cfx_col INTO wa_cfx_col
       WHERE (l_where_clause).
       count = count + 1.
    some business logic implemented using the work     area    wa_cfx_col
       endloop.
    afted delclarataion also , in the where statement you should specify both the field name and value bname
       LOOP AT i_cfx_col INTO wa_cfx_col
       WHERE l_where_clause = 'CREATED_BY = l_name' .
       count = count + 1.
    hope it helps.
    regads
    priya.

  • About condition for loop in BPM

    I design a loop, condition is counter<>3.
    It seems only receives 3 messages when I send more than 3.
    for example, I send 105 messages, for every 10 messages it will generate a file. and I totally have 11 files.
    What is the best way to end the loop?

    Hey,
           you need to have two loops in this.
           Have your send step(for the file) in the inner loop.
            The condition for this loop will be te number of messages that you need per file.
          The outer loop should terminate when all the messages are recieved.(recieve step will be in the outer loop)
       This is not possible with the no. of messages
    You can do one thing, provide a stop message as an input along with the other messages.
    And set the condition for the outer loop for the stop message.
    This will terminate the outer loop.
    regards,
            Milan

  • Where condition for a column in BMM

    Hi Gurus,
    I have a requirement where in the BMM(The LTS for this logical table is say 'Fact'), I need a logical column with the following definition.
    count(Dim.status) where Dim.status = ' Accepted' (I didnt add the Dim table to the LTS yet, should I?)
    I know that we can do a count(Dim.status) in the column source . but for the where Dim.status = ' Accepted' part im not sure what to do.
    Should I bring the Dim table as a LTS and define the 'where' condition in the content tab? will that work?
    but what if I have another logical column where I need dim.Status = 'Declined'( we have many more status)
    Plz help

    The suggest statement as Filter(count(Fact.Dollars) Using("dim.status = 'accepted'))
    is based on Answers, this would care about the column is available in Subject Area or not thats it.
    The same kind of functionality can get the using rpd.
    There you might need to map/add (fact source properties and then map using pencil icon on 11g add button in 10g) the dim table to the fact
    so that you can get the expression based on physical columns as
    case when dim.status = 'accepted' then Fact.Dollars else 0 end
    use Aggregate tab for sum;
    Since you are using Fact.Dollars it suppose to be sum, ROW_WIDs go by counts
    Hope this helps :) for more Qs send email
    If helps mark

  • Where condition for reading infotype while using ldb

    hi
    i want to read info from infotype p0000
    using where condition eg: for pernr = ' '.
    i am using LDB pnp.
    how can i put the where condition while using macro
    rp-provide-from-last.
    regards
    cs

    in fact you don't have to get the values, you only need to tell to the program to take them into account :
    GET PRPS.
      CHECK SELECT-OPTIONS.

  • Dynamic LOV with where conditions

    Hi all! I have a question regarding Dynamic LOVs. I have a List of values that can be used from three pages, the query is something like this:
    SELECT a.CODE CODE_DISPLAY,
    a.CODE CODE_RETURN
    FROM OREF_COUNTRIES a,
    OREF_REGIONS b
    WHERE a.REG_ID = b.ID AND
    b.CODE = :P336_LOV_REGION;
    The thing is I don't want to hardcode the name of the item ":P336_LOV_REGION" because this is the name of 1 item of one page, and I'd like to use this LOV from another two pages, so the name of the item won't be ":P336_LOV_REGION". How can I create a reusable dynamic LOV with a where condition depending on one item of the page?
    Thanks!!

    hi! anyone has any information about this?
    Daniela.

  • Bug in conditional for loop with an empty array

    There appears to be a bug in the for loop with a conditional terminal.
    If an empty array is wired to an auto-indexed array input tunnel, an output array tunnel has one element instead of zero.
    The array constant on the left is empty.
    Top loop without the conditional terminal produces an empty array.
    The bottom loop with a never true conditional terminal produces an array with one element
    Using LabVIEW version 8.5
    Message Edited by TrevMrgn on 05-05-2009 02:01 PM
    Solved!
    Go to Solution.
    Attachments:
    For loop bug.png ‏3 KB

    Creating the example from scratch, I do not see the error.
    Neither do I.
    If I add one or more elements to the array (constant or control), then delete them all (using 'Delete Element') the bottom array has one element.
    Nup. Still empty.
    If I empty the array (using 'Empty Array') both are empty.
    Yep.
    Also if I create an empty array using 'initialise array' with zero elements, I get one element.
    Nup. Still empty.
    'Show constant folding' does not appear to change the behaviour, but including a random operation in the loop does.
    Agreed that constant folding doesn't cause any odd behaviour. Introducing a random operation (adding two constants) in the loop doesn't either.
    I've tried all your methods here Trevor, but I can't replicate this behaviour in 8.5.1 under WinXP SP3. Sorry!
     Maybe somebody else will be able to help, or find a useable workaround.
    Thoric (CLA, CLED, CTD and LabVIEW Champion)

  • Dynamic length-input in a where condition for a itab-attribut

    Hi,
    i want to loop from a itab in a dynamic way:
    NOT Dynmaic:
    loop at itab into wa where attribute1(5) = attribute2.
    endloop.
    Dynamic:
    loop at itab into wa where attribute1(p_parameter) = attribute2.
    endloop.
    Unfortunately the syntaxcheck send me the following message if i try to use that code:
      'The lengthinput 'p_parameter' ist not a numeric literal nor a numeric constant.'
    What can i do?

    Hi,
    Now i understood your problem.
    You can try this work around
    DATA:it TYPE TABLE OF mara,
         wa TYPE mara.
    DATA:r TYPE RANGE OF matnr.
    DATA:w LIKE LINE OF r.
    PARAMETERS:p_i TYPE i.
    w-sign = 'I'.
    w-option = 'CP'.
    w-low+p_i(*) = '*'.
    w-low+0(p_i) = 'ABC'.  "Pass you attribute2 here
    APPEND w TO r.
    START-OF-SELECTION.
      SELECT * FROM mara INTO TABLE it UP TO 10 ROWS.
      LOOP AT it INTO wa WHERE matnr IN r.
      ENDLOOP.

  • Only key fields of table-cluster in where-condition for better performance?

    Hi,
    Say my cluster table is having following key fields: KEY1, KEY2, KEY3, KEY4.
    And, my table-cluster is having following key fields: KEY1, KEY2, PAGENO .. [PAGENO is always there in a table-cluster].
    Now, I have two versions of my (Open SQL) SELECT-WHERE clause:
    a) SELECT *
        WHERE KEY1 EQ LV_KEY1
             AND KEY2 EQ LV_KEY2
             AND KEY3 EQ LV_KEY3.
    b) SELECT *
        WHERE KEY1 EQ LV_KEY1
             AND KEY2 EQ LV_KEY2.
    Please guide me whether version (a) or version (b) will be executed faster? In case of version (b), I will have to filter data using ABAP code corresponding to KEY3.
    Regards,
    Kamlesh Dhera H. R.

    I think most experienced ABAPrs would tell you to try both, compare runtimes, and use the one that's more efficient.  SAP provides "get run time field <fieldname of type i>.  Get run time at start, get run time at end, and subtract start from end to get the time in microseconds (1 second / 1,000,000 ).
    Run several times to minimize effect of buffering and system load activity, and you'll see which method produces lower run time.

  • Am unable to get the data from Sys.databases when i use where condition for column owner_sid

     
    Hi all,
    Help me here when i try am unable to get a data,Can some one help me with a query to get.
    If it cant be done can i know why..
     select * from Sys.databases
      where owner_sid='0x01'
    What am trying is to get a login
    names from syslogin
    table with respect to Sid.
    Select a.name,b.name,a.owner_sid from Sys.databases a
      Join Syslogins b
      on a.owner_sid = b.sid
      where owner_sid like '0x01'
    Thanks all in Advance.....

    Below are a couple of examples of how to accomplish the task.  Note that SID is varbinary so the literal should not be enclosed in quotes.
    SELECT
    a.name AS DatabaseName
    ,b.name AS OwnerName
    ,a.owner_sid AS OwnerSID
    FROM sys.databases a
    JOIN sys.server_principals b ON
    a.owner_sid = b.sid
    WHERE owner_sid = 0x01;
    SELECT
    a.name AS DatabaseName
    ,SUSER_SNAME(owner_sid) AS OwnerName
    ,a.owner_sid AS OwnerSID
    FROM sys.databases a
    WHERE a.owner_sid = 0x01;
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • Using where condition with dynamic internal table

    Hi Friends.
    How to use where condition with dynamic internal table ?
    Regards,
    Amit Raut

    Hai Amit
    REPORT  ZDYNAMIC_SELECT                         .
    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.
    Thanks & Regards
    Sreenivasulu P

  • While loop and for loop condition terminal

    Hello friends,
    I am using labview 8.6. The condition terminal of the while loop and conditional for loop is behaving in just the opposite way.
    When i wire a true to the condition terminal of my loop, the while loop continues to run when I click on run. when I wire a FALSE, it stops.
    Is there any setting change that I have to make it to get it work properly.
    Please suggest on this.
    Thanks and regards,
    Herok

    Please do NOT attach .bmp images with the extension changed to .jpg to circumvent the forum filters!
    Herok wrote:
    I am sending you the VI. I am not sure if this would help you because only in 2 computers this behaviour is seen. In others, it works as it is supposed to work.
    Whatever you are seeing must be due to some corruption or folding error. It all works fine here.
    To make sure there are no hidden objects, simply press the cleanup button which would reveal any extra stuff (which is obviously not there). Does it fix itself if you click the termination terminal an even number of times? What if you remove the bad loop and create a new one?
    Could it be you have some problems with the graphics card and the icon of the conditional terminal does not update correctly?
    Whay happens if you connect a control instead of a diagram constant?
    What is different on the computers where it acts incorrectly (different CPU (brand, model), #of cores, etc.) 
    LabVIEW Champion . Do more with less code and in less time .

  • How to pass where condition to report for condition

    hello people ,
    i want to pass where condition for the report statement .
    for example ,
    select ename from emp
    i want to pass parameter carry <where deptno=40>
    thanks

    Good Morning oracleuser,
    If we understood correctly, Bind references (or bind variables) should use this issue.
    a>select ename from emp where deptno= :Dept_Number
    If you have any more questions, please post it.
    Otherwise:
    Mark Helpful or Answer accordingly.

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

  • For loop or while loop in process flow

    Hi,
    Is it possible to use a table as driver for a loop ?
    I want to loop (the number of records in my table ) times and use the value of a certain column as parameter in my loop.
    Thanks in advance
    Carolineb

    Carolineb,
    I think this is possible - develop three PL/SQL-procedures
    1) first procedure PR_GET_LAST_VAL - with one OUT parameter for getting ID of last record from your table (for example select max(id) from your_table)
    2) second procedure PR_GET_FIRST_VAL - with one OUT parameter for getting ID of first record
    3) third procedure PR_GET_NEXT_VAL - with one IN/OUT parameter for getting ID of next record (for example select min(id) from your_table where id>P_VALUE , where P_VALUE is a procedure parameter)
    4) define two variable for process - V_CUURENT (loop variable which will be chaned with third procedure) and V_LAST_VALUE
    5) in process flow before LOOP operator insert procedures PR_GET_FIRST_VAL and PR_GET_LAST_VAL and bind parameters to variables V_CUURENT and V_LAST_VALUE respectively
    6) define condition for LOOP operator as V_CUURENT <= V_LAST_VALUE
    7) in body of LOOP operator insert procedure PR_GET_NEXT_VAL and bind parameter to variable V_CUURENT
    Hope my idea is clear.
    Regards
    Oleg

Maybe you are looking for

  • Nano won't update new songs from library

    When I first connected nano, my itunes copied all my songs to the ipod very well. But if I add new song to my library, connect ipod nano to my computer, it says updating, done. But the song isn't in my nano. Whats going on? PC user.

  • How do you reset your Macbook to factory setting?

    WOndering how to reset my Macbook.

  • CQ5.6 SiteCatalyst: mapping of s.contextData missing in framework

    Hi guys, is there any "official" way of adding s.contextData to the mapping table of a SiteCatalyst framework in CQ5.6? It does not show up in the framework setup page so right now my work around is adding it to the mapping table via CRXDELite. /etc/

  • Using Adobe Acrobat to Illustrator

    Art created in Illustrator(AI). Form Text Fields created in Acrobat. Text box fields filled with data and save as PDF. Data does not display in AI.  If I open the PDF and print to generate a PDF, the data displays correctly in AI.  Please advise.

  • Linksys WRT54G setup on Laptop

    Hello All, I just bought Linksys Wireless WRT54G router and I am facing problem while setting up the same on my Laptop. When I connect the wireless router via modem the internet light glows but when I execute setup then It says internet connection is