Using a loop end loop

I have the following code and it doens't like my loop statement.  it says it can be converted to line of  t_ord_data
DATA: BEGIN OF TY_ORD_TYPE_DATA,
      SALES_ORDER LIKE /BIC/AZOS_O5900-DOC_NUMBER,
      SALES_ITEM LIKE /BIC/AZOS_O5900-S_ORD_ITEM,
      SCHED_LINE LIKE /BIC/AZOS_O5900-SCHED_LINE,
      SALE_DOC_TYPE LIKE /BIC/AZOS_O5900-DOC_TYPE,
      REF_DOC LIKE /BIC/AZOS_O5900-REFER_DOC,
      REF_ITEM LIKE /BIC/AZOS_O5900-REFER_ITM,
      REQ_DATE LIKE /BIC/AZOS_O5900-REQ_DATE,
      ZRELSDQTY LIKE /BIC/AZOS_O5900-/BIC/ZRELSDQTY,
      ZSHIPQTY LIKE /BIC/AZOS_O5900-/BIC/ZSHIPQTY,
      ZAVAILQTY LIKE /BIC/AZOS_O5900-/BIC/ZAVAILQTY,
      ZTLTVALUE LIKE /BIC/AZOS_O5900-/BIC/ZTLTVALUE,
      ZSHIPNOS LIKE /BIC/AZOS_O5900-/BIC/ZSHIPNOS,
      END OF TY_ORD_TYPE_DATA.
DATA: T_ORD_DATA LIKE STANDARD TABLE OF TY_ORD_TYPE_DATA,
LS_DATA like line of T_ORD_DATA.
DATA: T_ZTAM_DATA LIKE STANDARD TABLE OF TY_ORD_TYPE_DATA,
LS_ZTAM_DATA like line of T_ZTAM_DATA .
LOOP AT T_ORD_DATA INTO T_ZTAM_DATA.
DELETE T_ORD_DATA WHERE DOC_TYPE NE 'ZLZM'.
END LOOP.

Hi Immich,
If you want to delete the records from the internal table TY_ORD_TYPE_DATA which does not have doctype zzlm, then you dont need to use the loop statement.
You can directly write the code as,
DELETE TY_ORD_TYPE_DATA where doctype NE zzlm.
If you want to move the records (which doesnot have doctype zzlm) from TY_ORD_TYPE_DATA into T_ZTAM_DATA, then you need to write the code like below,
<b>TYPES</b>: BEGIN OF TY_ORD_TYPE_DATA,
" fields declared here
END OF TY_ORD_TYPE_DATA.
DATA: T_ORD_DATA <b>TYPE STANDARD TABLE OF</b> TY_ORD_TYPE_DATA,
           LS_DATA <b>TYPE TY_ORD_TYPE_DATA</b>.
DATA: T_ZTAM_DATA <b>TYPE STANDARD TABLE OF</b> TY_ORD_TYPE_DATA,
           LS_ZTAM_DATA <b>TYPE TY_ORD_TYPE_DATA</b> .
LOOP at TY_ORD_TYPE_DATA into LS_DATA WHERE doctyp NE zzlm.
LS_ZTAM_DATA = LS_DATA.
APPEND LS_ZTAM_DATA to T_ZTAM_DATA.
ENDLOOP.
<i><b>Reward points for helpful answers.</b></i>
Best Regards,
Ram.

Similar Messages

  • How to use a loop for a object

    Hi, All
    I have a procedure that needs a collection to pass in. The pass_in collection has multiple records with multiple fields, so I guess I need a loop for each record.
    How to assign each record of multiple fields to each corresponding local variables?
    Thanks In advance
    T_Object is a table object
    T_ProfileInfo is a collection
    procedure P_Updateprofile(UserId in number, NewProfileInfo in T_ProfileInfo) as
    V_B_ID number;
    V_A_ID number;
    V_Profile      T_ProfileInfo;     
    begin
         V_Profile := NewProfileInfo;
         --use the loop for each records
    FORALL i IN V_Profile.FIRST..V_Profile.LAST
    -- assign each value to the local variables
    -- I got error here. ideally I want to assign each record to the local variables
         select B_ID, A_ID
         into V_B_ID, V_A_ID
         from table(V_Profile(i));
         -- insert the record into the table
         INSERT INTO PROFILE
         VALUES (UserId, V_B_ID, V_A_ID);
         commit;
    end;

    You don't say which version of the database you are using. Oracle extended the collections functionality in 9.2....
    Cheers, APC
    SQL> CREATE OR REPLACE PACKAGE t1_utl AS
      2      TYPE rt_t1 IS TABLE OF t1%ROWTYPE;
      3      FUNCTION gen_t1 (p1 IN NUMBER) RETURN rt_t1;
      4      PROCEDURE pop_t1 (t1rows IN rt_t1);
      5  END t1_utl;
      6  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY t1_utl AS
      2      FUNCTION gen_t1 (p1 IN NUMBER) RETURN rt_t1
      3      IS 
      4          CURSOR cur (pn NUMBER) IS
      5              SELECT a12.NEXTVAL, col1, col2, rownum AS rn, substr(col3,30), sysdate
      6              FROM t2
      7              WHERE rownum <= pn;
      8          return_value rt_t1;
      9      BEGIN
    10          OPEN cur(p1);
    11          LOOP
    12              FETCH cur BULK COLLECT INTO return_value LIMIT 100;
    13              EXIT WHEN cur%NOTFOUND;
    14          END LOOP;
    15          RETURN return_value;
    16      END gen_t1;
    17      PROCEDURE pop_t1 (t1rows IN rt_t1) IS
    18      BEGIN
    19          FORALL indx IN t1rows.FIRST .. t1rows.LAST
    20              INSERT INTO t1
    21                VALUES t1rows (indx);
    22      END pop_t1;
    23  END t1_utl;
    24  /
    Package body created.
    SQL> SELECT * FROM t1
      2  /
    no rows selected
    SQL> DECLARE
      2      x t1_utl.rt_t1;
      3  BEGIN
      4      x := t1_utl.gen_t1(2);
      5      t1_utl.pop_t1(x);
      6  END;
      7  /
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM t1
      2  /
          COL1       COL2       COL3       COL4 COLA
    COLD
            56     165765      87979          1
    11-AUG-04
            57       3128    8217220          2
    11-AUG-04
    SQL>

  • Will using for loop decrease the performance

    Hi,
    Will using for loop with a query decrease the performance.
    for r_row in (select * from table) Loop
    end loop.
    This is done inside another for loop, most of the cases it returns only one value.
    will it decrease the peformance of the procedure.
    kindly advice.......
    Regards,
    Balu

    user575682 wrote:
    Will using for loop with a query decrease the performance.
    for r_row in (select * from table) Loop
    end loop.
    This is done inside another for loop, most of the cases it returns only one value.
    will it decrease the peformance of the procedure.Perhaps it is better to understand just what this PL/SQL loop construct does.
    PL/SQL is two languages. It is PL (programming logic code) like Pascal or C or Java. You can use a 2nd language inside it called SQL. The PL engine is clever enough to recognise when the 2nd language is used. And it compiles all the stuff that is needed for the PL engine to call the SQL engine, pass data to the SQL engine and get data back, etc. (compare this with the complexity of using the SQL language in Pascal or C or Java).
    So what does that loop do? The PL engine recognises the SQL SELECT statement. It creates an implicit cursor by calling the SQL engine to parse it (hopefully a soft parse) and then execute it.
    As part of the PL loop, the PL engine now calls the SQL engine to fetch the data (rows) from the cursor. With 10g and later, the PL engine is smart enough to use implicit bulk processing.
    Prior to 10g it used to fetch a row from the SQL engine, do the loop, fetch the next row, do the loop, etc. This means if there is a 1000 rows to fetch, it will call the SQL engine a 1000 times.
    With 10g and later it will fetch a 100 rows, store that in an internal buffer and then do the loop a 100 times. With a 1000 rows to fetch, it now only requires 10 bulk fetches instead of a 1000 single row fetches.
    These fetches require a context switch - as the PL engine has to step out and into the SQL engine and back, to fetch a row. This is an overhead and thus can become slow the more context switching there is.
    And this is the basics for this loop (and most other cursor loops) construct in PL/SQL.
    The ideal is to reduce the number of context switches. This is an overhead that can impact on performance.
    What about using a loop within a loop. Also "bad". This uses the outer loop to fetch data. This data is then used to drive the fetch in the inner or nested loop. So the outside loop pulls data from the SQL engine into PL variables. The inside loop pushes that very same data back to the SQL engine.
    Why? It would have been a lot faster no to pull and push that data between the loops using PL.
    It will be a lot faster doing it via SQL only. Write both loops as a single SQL statement and have the SQL engine directly drive these loops itself. This is called a JOIN in SQL. And the SQL engine can do it not only faster, but it has some froody algorithms that can be used that are even faster than a nested loop process (called merge joins, hash joins, etc).
    Bottom line. Maximise SQL. Minimise PL.*
    Do as much of your data crunching in SQL as possible. SQL is the best and fastest "place" to process data. Not PL (or Pascal/C/Java).

  • Repeating nodes using FOR loop but when concating XML string then concating only last iteration of FOr loop ??

    I stuck with a problem that I am using FOR loop for generating repeating nodes. 
    Now when I concat the generated node in the main node then I got only last iteration of that FOR loop.
    can anybody suggest me a way to handle this error....
    FOR i IN 1..pl_phone_tab.Count
    LOOP
    SELECT xmlelement("Phone"     
                                        ,xmlelement("PHONETYPE",xmlattributes('01' AS "dmnADRP_PHONETYPE"),pl_phone_tab(i).p_phtype_tab)
                         ,xmlelement("PHONENUM",pl_phone_tab(i).p_phnum_tab)
                         ,xmlelement("PRIMARY_CONTACT",pl_phone_tab(i).p_prcon_tab)
    INTO p_phone_xml
    FROM dual; END LOOP;
    SELECT xmlelement("PhoneInfo"
                           ,xmlconcat(p_phone_xml))
    INTO p_phone_info_xml
    FROM dual;
    here I am getting only one node but there has to be two nodes for PHONE node

    Not that I'm encouraging you but here are two standalone examples explaining how to do what you want :
    1) Loop through the input collection and append each node to its target container :
    SQL> declare
      2 
      3    type t_emp_tab is table of scott.emp%rowtype;
      4 
      5    emp_tab       t_emp_tab;
      6    emp_info_xml  xmltype;
      7    emp_xml       xmltype;
      8 
      9  begin
    10 
    11    -- filling emp_tab with data
    12    select e.*
    13    bulk collect into emp_tab
    14    from scott.emp e
    15    where e.deptno = 10;
    16 
    17    emp_info_xml := xmltype('<EmpInfo/>');
    18 
    19    -- looping through emp collection and appending to EmpInfo element
    20    for i in 1 .. emp_tab.count loop
    21      select appendchildxml(
    22               emp_info_xml
    23             , '/*'
    24             , xmlelement("Emp"
    25               , xmlattributes(emp_tab(i).empno as "id")
    26               , xmlforest(
    27                   emp_tab(i).ename as "Name"
    28                 , emp_tab(i).job as "Job"
    29                 )
    30               )
    31             )
    32      into emp_info_xml
    33      from dual;
    34    end loop;
    35 
    36    dbms_output.put_line(emp_info_xml.getclobval(1,2));
    37 
    38  end;
    39  /
    <EmpInfo>
      <Emp id="7782">
        <Name>CLARK</Name>
        <Job>MANAGER</Job>
      </Emp>
      <Emp id="7839">
        <Name>KING</Name>
        <Job>PRESIDENT</Job>
      </Emp>
      <Emp id="7934">
        <Name>MILLER</Name>
        <Job>CLERK</Job>
      </Emp>
    </EmpInfo>
    PL/SQL procedure successfully completed
    2) Build a secondary collection of XML nodes and use XMLAgg to aggregate them in one go :
    SQL> declare
      2 
      3    type t_emp_tab is table of scott.emp%rowtype;
      4 
      5    emp_tab       t_emp_tab;
      6    emp_info_xml  xmltype;
      7    emp_xml_tab   xmlsequencetype := xmlsequencetype();
      8 
      9  begin
    10 
    11    -- filling emp_tab with data
    12    select e.*
    13    bulk collect into emp_tab
    14    from scott.emp e
    15    where e.deptno = 10;
    16 
    17    -- looping through emp collection and appending to the collection of Emp nodes
    18    for i in 1 .. emp_tab.count loop
    19 
    20      emp_xml_tab.extend;
    21 
    22      select xmlelement("Emp"
    23             , xmlattributes(emp_tab(i).empno as "id")
    24             , xmlforest(
    25                 emp_tab(i).ename as "Name"
    26               , emp_tab(i).job as "Job"
    27               )
    28             )
    29      into emp_xml_tab(i)
    30      from dual;
    31 
    32    end loop;
    33 
    34    select xmlelement("EmpInfo", xmlagg(t.column_value))
    35    into emp_info_xml
    36    from table(emp_xml_tab) t ;
    37 
    38    dbms_output.put_line(emp_info_xml.getclobval(1,2));
    39 
    40  end;
    41  /
    <EmpInfo>
      <Emp id="7782">
        <Name>CLARK</Name>
        <Job>MANAGER</Job>
      </Emp>
      <Emp id="7839">
        <Name>KING</Name>
        <Job>PRESIDENT</Job>
      </Emp>
      <Emp id="7934">
        <Name>MILLER</Name>
        <Job>CLERK</Job>
      </Emp>
    </EmpInfo>
    PL/SQL procedure successfully completed
    Both solutions give the same output.
    Test them both and see which one fits better into your scenario.

  • Procedure to insert same record for 30 times in a table using for loop

    Hi,
    I need to insert a record in a table which has to be iterated using for loop

    I think you are in the wrong forum. You can do that like this:
    CREATE TABLE my_table (my_column NUMBER);
    BEGIN
       FOR i IN 1 .. 30
       LOOP
          INSERT INTO my_table
                      (my_column
               VALUES (i
       END LOOP;
    END;
    /Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • Can't we use while loop inside a fn

    i am using a while loop inside a fn
    it is showing error
    the code is
    while (a=1) loop
    some condition
    end loop;
    the error is
    PLS-00103: Encountered the symbol "WHILE" when expecting one of
    the following:
    * & = - + < / > at in is mod not rem then <an exponent (**)>
    <> or != or ~= >= <= <> and or like between overlaps || year
    DAY_
    The symbol "*" was substituted for "WHILE" to continue.
    PLS-00103: Encountered the symbol "LOOP" when expecting one of
    the following:
    . ( * % & = - + < / > at in is mod not rem then
    <an exponent (**)> <> or != or ~= >= <= <> and or like
    between ||
    what is the error

    It looks like the OP misskeyed the assignment operator and got compilations errors, and from that assumed that you can't use WHILE loops in functions on a Tuesday.
    Message was edited by:
    William Robertson
    I was thinking of his is it possible to increment a value in a function, though I suspect the problem is similar.

  • Incrementing var_(x) to var_(y) using FOR loop

    How can i keep incrementing var_(x) to var(y) using FOR loop.
    I want variables var_1 to var_3 displayed. So I tried the below mentioned method. But i got error.
    SQL> set serveroutput on
      declare
         var_1 number;
         var_2 number;
         var_3 number;
        begin
          var_1:=884;
          var_2:=646;
          var_3:=213;
          for i in 1..3 loop
          dbms_output.put_line(var_(i));
          end loop;
       end;
    SQL> /
         dbms_output.put_line(var_(i));
    ERROR at line 10:
    ORA-06550: line 10, column 26:
    PLS-00201: identifier 'VAR_' must be declared
    ORA-06550: line 10, column 5:
    PL/SQL: Statement ignored

    Thank you Padders. I have a complex requirement involving an UPDATE. To avoid unnecessary lines/repeat of UPDATE statements i somehow have to increase the variable number from var_(x) to var_(y)

  • Sir i am using datasocket read ,i am communicating with java but my problem is that bcz im using while loop to see if value has changed my labview consumes all the processors time ,sir i want a event like thing so that while loop is not in continuous loop

    sir i have given lot of effort but i am not able to solve my problem either with notifiers or with occurence fn,probably i do not know how to use these synchronisation tools.

    sir i am using datasocket read ,i am communicating with java but my problem is that bcz im using while loop to see if value has changed my labview consumes all the processors time ,sir i want a event like thing so that while loop is not in continuous loopHi Sam,
    I want to pass along a couple of tips that will get you more and better response on this list.
    1) There is an un-written rule that says more "stars" is better than just one star. Giving a one star rating will probably eliminate that responder from individuals that are willing to anser your question.
    2) If someone gives you an answer that meets your needs, reply to that answer and say that it worked.
    3) If someone suggests that you look at an example, DO IT! LV comes with a wonderful set of examples that demonstate almost all of the core functionality of LV. Familiarity with all of the LV examples will get you through about 80% of the Certified LabVIEW Developer exam.
    4) If you have a question first search the examples for something tha
    t may help you. If you can not find an example that is exactly what you want, find one that is close and post a question along the lines of "I want to do something similar to example X, how can I modify it to do Y".
    5) Some of the greatest LabVIEW minds offer there services and advice for free on this exchange. If you treat them good, they can get you through almost every challenge that can be encountered in LV.
    6) If English is not your native language, post your question in the language you favor. There is probably someone around that can help. "We're big, we're bad, we're international!"
    Trying to help,
    Welcome to the forum!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Does anyone use MIDI loops in Logic Pro to compose music?

    Seriously, if anyone out there uses the MIDI loops to compose music in Logic, how the heck do you do it? Especially if you are also using audio loops, it seems almost impossible to me. The chord transpositions that you get from the chord track are not even to the right pitch, and the transposition behavior is different according to whether you drag the loops into the arrange area before or after putting the changes in the Chord track. The signature track is no better, as it doesn't seem to affect audio loops. So how do you get the bass loops etc. to play in the keys you want them to without going through extraordinary contortions? I looked at one of the Logic Pro books, and it said to transpose by using the transpose function in the inspector, but that only lets you transpose by octaves! Do you really go in and edit the loops by hand to transpose each note?
    Any pointers on this would be greatly appreciated.

    kent swearingen wrote:
    I looked at one of the Logic Pro books, and it said to transpose by using the transpose function in the inspector, but that only lets you transpose by octaves!
    Put the mouse pointer on top of the transpose number, which is zero, hold down the left mouse button and drag up or down to transpose by steps. At the beginning of either the getting started or Logic manual there's an explanation of the different types of mouse/key behavior, if you're not used to using Logic it's a good idea to go over these.
    Also, Logic does not always use simplified Mac conventions (thank the stars for that), as a result you have a lot more variety of data input, it varies according to the task at hand.

  • GB won't open- This is what I get... Path does not exist: /Library/Audio/Apple Loops Index  st: /Library/Audio/Apple Loops Index w/out this directory you cannot use the Loop Browser

    Path does not exist: /Library/Audio/Apple Loops Index  st: /Library/Audio/Apple Loops Index w/out this directory you cannot use the Loop Browser.  Then I get this message...
    Instrument Library Invalid
    GarageBand Ecpects a valid instrument foledr in /Libraty/Application Support/GarageBand
    Please choose a valid instrument Library folder or quit and re-install GB
    Any solutions?

    Is this a new installation of GarageBand or has it worked before on the same computer?
    Or have you transferrred your GarageBand from a different computer?
    The error message is saying, that your GarageBand installation is incomplete. There are essential foldrs missing in your system library. 
    Check, if indeed both folders are missing or if only the permissions are set incorrectly.
    Your system library (the folder "System" directly on your system drive) should have the following folders inside the folder "Audio", and they need to be readable by the system and by administrators.
    And in the folder /Library/Application Support there should be the Instrument Library.
    If these folders do not exist (or no longer exist), restore them from your backup-  If your GarageBand version is a new installation, the application may not hve been downloaded or installed completely, then reinstall GarageBand.
    What is your GarageBAnd version, and how did you install it originally?
    Regards
    Léonie

  • How do i sweep two voltage at the same time by using for loop ?

    Hello, Can anyone help me on this topic ?
    My problem is to sweep Vds and Vgs as same time vs Id in MOSFET by using for loop. I also use the Agilent power supply source. Let me tell a litle bit about what i'm doing. For different value of Vds, i will get Vgs vs Id curve. (The x axis is Vgs, the y-axis is Id).
    I started to create two for-loop, the inner to sweep Vgs, and the outer one to sweep Vds. My problem is don't know how to connect all the wire in  the for loop.
    In the for loop i saw N, i icon. Suppose I have the two variable for Vgs such as Vgs start and Vgs_stop. Should the Vgs_start( or Vgs_stop) be connected to N or leave it in the for_loop ?
     for example: I want to sweep Vgs from 0(for Vgs_start)  to  5(Vgs_strop) V, and the step increment is .5V how do i connect these variables in the for loop ?
    Thank you for your time
    Ti Nguyen

    It is easier to use a while loop.  Dennis beat me to the punch.  Here is my solution:
    You can remove the flat sequence structure if you use Error In and Error Out to ensure the execution flow will occur in the proper order.  Be sure to include the delay time in the loop so that your vi doesn't hog all the CPU time.
    Message Edited by tbob on 10-17-2005 01:00 PM
    - tbob
    Inventor of the WORM Global
    Attachments:
    RampVoltage.PNG ‏8 KB

  • How do I get an XY Chart to display properly while using embedded loop

    s to periodically read multiple channels of similar data? (multi-Y versus specified time) The plot just becomes a point or a single plot of all values taken at one scanning of all channels. I want multiple plots over time updated at the time of scanning.I have also stored my data in a daily text file that is tab delimited. The text files consists of a row of text column headers, a blank row and then rows of data. The data rows are mixed data types. The first column is a date/time such as Mar 1, 2002 12:01 pm. The remaining columns are numeric data. I can't seem to get my data to plot properly in an XY chart from memory and am having problems parsing the data with mixed data types in the data r
    ows. The format I am using works great for viewing the history files in Excel.
    When I plot the data, I either get a single point or a a series of points for a single reading of all channels or I get a line connecting all data for that single scan reading. What am I doing wrong? At this point, I don't care if I read the data from the file to plot it or if I can just get Labview to plot correctly as the data is gathered without going to the history file.
    As noted in the summary question, I have embedded loops in my applicaiton. I have a while-loop that determines the scan rate and keeps the program running until it is turned off. Inside of that, I have a for-loop (in a subVI) which scans all my data channels.
    Thanks for your help.

    s to periodically read multiple channels of similar data? (multi-Y versus specified time) The plot just becomes a point or a single plot of all values taken at one scanning of all channels. I want multiple plots over time updated at the time of scanning.XY plots expect a cluster containing two 1D arrays for the X and Y
    coordinates of the individual points. If you want multiple plots you can
    supply an array of these clusters but you have to resupply the "x" array
    for each of them.
    Hope that helps,
    Rudolf
    Adrien wrote:
    : How do I get an XY Chart to display properly while using embedded
    : loops to periodically read multiple channels of similar data? (multi-Y
    : versus specified time) The plot just becomes a point or a single plot
    : of all values taken at one scanning of all channels. I want multiple
    : plots over time updated at the time of scanning.
    : I have also stored my data in a daily text file that is tab delimited.
    : The text files consists of a row of text column headers, a blan
    k row
    : and then rows of data. The data rows are mixed data types. The first
    : column is a date/time such as Mar 1, 2002 12:01 pm. The remaining
    : columns are numeric data. I can't seem to get my data to plot
    : properly in an XY chart from memory and am having problems parsing the
    : data with mixed data types in the data rows. The format I am using
    : works great for viewing the history files in Excel.
    : When I plot the data, I either get a single point or a a series of
    : points for a single reading of all channels or I get a line connecting
    : all data for that single scan reading. What am I doing wrong? At
    : this point, I don't care if I read the data from the file to plot it
    : or if I can just get Labview to plot correctly as the data is gathered
    : without going to the history file.
    : As noted in the summary question, I have embedded loops in my
    : applicaiton. I have a while-loop that determines the scan rate and
    : keeps the program running until it is turned off. Inside of
    that, I
    : have a for-loop (in a subVI) which scans all my data channels.
    : Thanks for your help.

  • Building Tree hierarchy Using nested loops and class cl_gui_column_tree

    Hello gurus,
    I want to create a tree report using custom container and class cl_gui_column_tree. I have read and understood the standard demo report which SAP has provided i.e. SAPCOLUMN_TREE_CONTROL_DEMO. But in this report all the levels nodes are created as constants and hardcoded. I want to create hierarchy using nested loops. For this i took one example of a hierarchy of VBAK-VBELN->VBAP-POSNR Like One sales order has many line items and each line item can have number of line items in billing plan.
    I have done some coding for it.
    FORM build_tree USING node_table TYPE treev_ntab
                                           item_table TYPE zitem_table.              " i created the zitem_table table type of mtreeitm in SE11.
      DATA: node TYPE treev_node,
                 item TYPE mtreeitm.
      node-node_key = root.
      CLEAR node-relatkey.
      CLEAR node-relatship.
      node-hidden = ' '.
      node-disabled = ' '.
      CLEAR node-n_image.
      CLEAR node-exp_image.
      node-isfolder = 'X'.
      node-expander = 'X'.
      APPEND node TO node_table.
      item-node_key = root.
      item-item_name = colm1.
      item-class = cl_gui_column_tree=>item_class_text.
      item-text = 'Root'.
      APPEND item TO item_table.
      item-node_key = root.
      item-item_name = colm2.
      item-class = cl_gui_column_tree=>item_class_text.
      item-text = 'Amount'.
      APPEND item TO item_table.
      LOOP AT it_vbeln INTO wa_vbeln.
        node-node_key = wa_vbeln-vbeln.
        node-relatkey = root.
        node-relatship = cl_gui_column_tree=>relat_last_child.
        node-hidden = ' '.
        node-disabled = ' '.
        CLEAR node-n_image.
        CLEAR node-exp_image.
        node-isfolder = 'X'.
        node-expander = 'X'.
        APPEND node TO node_table.
        item-node_key = wa_vbeln-vbeln.
        item-item_name = colm1.
        item-class = cl_gui_column_tree=>item_class_text.
        item-text = wa_vbeln-vbeln.
        APPEND item TO item_table.
        item-node_key = wa_vbeln-vbeln.
        item-item_name = colm2.
        item-class = cl_gui_column_tree=>item_class_text.
        item-text = wa_vbeln-netwr.
        APPEND item TO item_table.
        LOOP AT it_posnr INTO wa_posnr.
        node-node_key = wa_posnr-posnr.
        node-relatkey = wa_vbeln-vbeln.
        node-relatship = cl_gui_column_tree=>relat_last_child.
        node-hidden = ' '.
        node-disabled = ' '.
        CLEAR node-n_image.
        CLEAR node-exp_image.
        node-isfolder = ' '.
        node-expander = ' '.
        APPEND node TO node_table.
        item-node_key = wa_posnr-posnr.
        item-item_name = colm1.
        item-class = cl_gui_column_tree=>item_class_text.
        item-text = wa_posnr-posnr.
        APPEND item TO item_table.
        item-node_key = wa_posnr-posnr.
        item-item_name = colm2.
        item-class = cl_gui_column_tree=>item_class_text.
        item-text = wa_posnr-netpr.
        APPEND item TO item_table.
        ENDLOOP.
      ENDLOOP.
    ENDFORM.
    Now this program compiles fine and runs till there is only one level. That is root->vbeln. But when i add one more loop of it_posnr it gives me runtime error of message type 'X'. The problem i found was uniqueness of item-item_name as all the sales order have posnr = 0010. What could be done? I tried giving item_name unique hierarchy level using counters just like stufe field in prps eg. 10.10.10, 10.10.20,10.20.10,10.20.20,20.10.10 etc.. etc.. but still i am getting runtime error when i add one more hierarchy using nested loop. Plz guide.
    Edited by: Yayati6260 on Jul 14, 2011 7:25 AM

    Hello all,
    Thanks the issue is solved. The node key was not getting a unique identification as nodekey. I resolved the issue by generating unique identification for each level. Thanks all,
    Regards
    Yayati Ekbote

  • How to use a loop with tokenizer

    I am working on an assignment where I need to use a loop to read input from a text file that contains grades. I'll use tokenizer (somehow) to read each line from the grade.txt file and then I need to output each test score, and calculate the average. So far this is my code:
    import java.io.*;
    import java.util.StringTokenizer;
      public class TestGrader
         public static void main (String[] args) throws FileNotFoundException,
                                                                     IOException
         BufferedReader keyboard = new
         BufferedReader(new InputStreamReader(System.in));
         BufferedReader inFile = new
         BufferedReader (new FileReader("c:java/homework/Assignment3/grades.txt"));
    /*******************Declare variables******************/
         int numOfTest, lowestScore, higestScore, avgScore;
         StringTokenizer tokenizer;
         tokenizer = new StringTokenizer(inFile.readLine());
         System.out.println("Enter the number of test you would like to grade: ");
         numOfTest = Integer.parseInt(keyboard.readLine());
         System.out.println("Press enter to continue...");
         keyboard.readLine();
         // Retrieve the test scores from the file grades.txtI'm stuck at the point where I need to create the loop to read the grades from the grades.txt file. Any help with the loop and tokenizer to read any number of grades would be appreciated.

    well i hope i am not too late to answer this.
    do u have any control on how to write the grades.txt file. If yes then follow:
    write the grades in following format:
    subject : marks separator(say ;) subject : marks separator(say ;)...... marksEOF(some new symbol)
    then try to process it using the following code
    while(!file.EOF()){
    StringTokenizer nk=new StringTokenizer(file.readLine(),separator);
    while(nk.hasMoreTokens()){
    //write code to display as nicely as you want...below is raw printing only....
    System.out.println(nk.nextToken());

  • I'm wondering about using Apple loops in music. Is it ok to do so to make music for people to hear, without it being sold. And how do you get permission to use them in music to sell?

    I'm wondering about using Apple loops in music. Is it ok to do so to make music for people to hear,like on soundcloud or other websites, without it being sold. And how do you get permission to use them in music to sell?

    From the LOGIC STUDIO SOFTWARE LICENSE AGREEMENT   :
    C. Except as otherwise indicated, you may use the Apple and third party audio file content (including, but not limited to, the Apple Loops, built-insound files, samples and impulse responses) (collectively the “Audio Content”), contained in or otherwise included with the Apple Software, on aroyalty-free basis, to create your own original soundtracks for your film, video and audio projects. You may broadcast and/or distribute your ownsoundtracks that were created using the Audio Content, however, individual Apple loops, audio files, sound settings, samples and impulse responsesmay not be commercially or otherwise distributed on a standalone basis, nor may they be repackaged in whole or in part as audio samples, soundfiles, sound effects or music beds.
    This means, you can use all Apple Loops in your music, they're royality-free.
    Best,
    DaCaptain

Maybe you are looking for