BW Transformation formula using If in list statement

Hi there, I am trying to create some logic with a transformation formula and nested if statements.  I believe that it does not like the IN context.  Can someone tell me how to properly state in list as part of below formula?
IF( SUBSTRING( PRDHA, 9, 4 ) IN ( '5004', '5089', '5097', '5119', '5013', '5094', '5099', '5114', '5116', '5125', '5136', '5164', '5171', '5183' ), 'S','B')

Thanks for the responses.
I ended up utilizing an ABAP routine:
IF lv_brand = '5004' OR
       lv_brand = '5089' OR
       lv_brand = '5097' OR
       lv_brand = '5119'
RESULT = 'S'.
ELSEIF ( lv_brand = '5001' OR
             lv_brand = '5010' OR
             lv_brand = '5052') OR
              ( lv_matnr = '6919' OR
             lv_matnr = '6939').
      RESULT = 'C'.
If you want to check if field is empty use IS INITIAL as statement
    ELSEIF lv_brand IS INITIAL.
      RESULT = 'N'.
    ELSE.
      RESULT = 'O'.
    ENDIF.

Similar Messages

  • Creating a formula using a alphabetic drop down list?

    I am creating a work sheet using formulas and drop down list. I have one drop down list that has a list of name and the second list is a list of letter that correspond to those names. (ex: column "J" on line "4 - 29" there is the letter
    "A-Z" and then continues , in column "K" line "4" starts the list of names. In Cell B4 is the drop down list of names in column "K" to choose from, I would like the letter that corresponds to that name automatically
    be put into cell A4, how do I create the formula in cell A4?

    Hi Tina,
    According to your description, please following these steps:
    With your sample as shown in the following figure, select range “J4:K29”, and click
    FORMULAS-Defined Names-Create from Selection, and check
    Right column.
    Then, use the enter formula in A4 “=INDIRECT(B4)”.
    And I upload a TEXT.xlsx file on OneDrive, you can download this file via this link:
    https://microsoft-my.sharepoint.com/personal/v-lzng_microsoft_com/Documents/Shared with Everyone
    Hope it’s helpful.
    Regards,
    Emi

  • In which cases can the ABAP statement CALL TRANSFORMATION be used?

    Hi friends,
    here is my questions with options below.
    In which cases can the ABAP statement CALL TRANSFORMATION be used? (T/F)
    -To transform as iXML document object into and ABAP data structure using
    XSLT.
    - To transform an XML document contained in a string into another XML
    document
    using and XSLT program.
    - To get canonic XML display of an ABAP data structure.
    - To transform an XML document contained in an xstring into another XLM
    document using an ST program (Simple Transformation).
    - To transform and ABAP data structure into an SML document using ST.
    Kindly give me the expalnation to each statement with either True or False.

    CALL TRANSFORMATION is a new language element in ABAP that we can use to <b>call up the transformation</b>.
    The type of transformation:
    XML to XML
    XML to ABAP
    ABAP to XML or
    ABAP to ABAP is already determined by the two additions SOURCE and RESULT in CALL TRANSFORMATION.
    Check this link for more details.
    http://help.sap.com/saphelp_nw04/helpdata/en/a8/824c3c66177414e10000000a114084/content.htm
    Regards,
    Maha

  • How to extract list of object and formula used in variables as Excel for a particular Webi Report

    Hi,
    Is it possible to get the list of variables and objects, and variable formula used in a webi report extracted in excel or PDF in BO XI R3.1?
    Thanks In Advance,
    Shenbu

    Hi Shenbaga,
    You can try to get this information using the report engine sdks of BusinessObjects which is specific to webi reports.
    Please refer to the link to download the dev guide and api referrence for XI 3.1
    SAP BusinessObjects BI 3.x and Lower - Developer SDK Library
    Refer to the Report Engine Java SDK dev guide and api referrence.
    Go through the dev guide in detail and you would be able to use the report engine sdks as per your needs.
    Additional Note: There have been changes in report engine sdks from XI 3.1 to BI 4.0 and you would not be able to get all the features available in XI 3.1 report engine sdks in BI 4.0.
    Hope this helps.
    Regards,
    Chandrahas

  • How to make an index in InDesign CC 2014.1 using a topics list?

    Hi all,
    I have read the long help document on how to make an index in InDesign CC 2014.1 using a topics list, and still can't work out what to do.
    I have done a 548 page book, using a document for each chapter, and a book file to put them all together in the right order.
    I now need to make an index at the back, as the author has many quotes throughout the book at the start of each chapter and section.
    I have a list of those people quoted and want to upload this list and get the index feature in InDesign to find all instances of the name occurring in the entire book.
    After reading the help document I still cannot work out how to do this.
    My questions are:
    1. Do you have to use an InDesign document as a source for the list of topics? If so, should the document be added to the book file or outside it?
    It seems a bit recursive to have the list of topics in an ID document that is in the book file.
    2. Once you have uploaded the topics into the Index feature, how do you get it to look for all instances of that 'topic' througout the entire book? I can't figure that out from the help documents. What do I select? Do I do it from the Index panel? Do I highlight the text in the source document? Not sure how to do this...
    3. I need the names to list surname first of the quoted authors in the index. This command seems to be different between various editions of ID. For ID CC 2014.1 is it ctrl+alt+shift+]
    4. To make the surname show first, what do I highlight? The topic? and then do ctrl+alt+shift+] and select find all as well? Or do I have to just go through the text and manually do this and ditch the idea of uploading topics first?
    I am confused as you can see and any help with this is appreciated.

    Sorry 007, I really thought you were posting a trick question as on the OCP tests.
    Anyway, as Justin mentioned, if you have an index on ename, it may be used when doing a comparison predicate statement with the ename value.
    What it depends on are several other things: stats, how many rows in the table, use of an index hint, etc.
    Rather than questioning the group on this, why not just turn on autotrace and run the query for the different scenarios.
    The output will show you if it used the index, number of rows returned, blocks read, etc.
    SQL> create table emp (ename  varchar2(40));
    Table created.
    SQL> insert into emp select username from sys.dba_users;
    25 rows created.
    SQL> commit;
    Commit complete.
    SQL> set autotrace on
    SQL> select * from emp where ename != 'SYSTEM';
    Execution Plan
    Plan hash value: 2951343571
    | Id  | Operation        | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT |           |    24 |   528 |     1   (0)| 00:00:01 |
    |*  1 |  INDEX FULL SCAN | ENAME_IDX |    24 |   528 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("ENAME"<>'SYSTEM')As you can see, the above used an index, even though there were only 25 rows in the table.
    You can test each of your scenarios, one by one, including use of a hint.

  • RE: Using Drop-Down List in Express Application

    The easiest way to do this is to define a domain for Gender that maps to
    a droplist widget. ForteExpress will then automatically display the
    widget in any ArrayWindow or FormWindow in which Gender appears. (I
    don't think outlinefields support this widget.) There is a documented
    customization for adding SQL to the domain to automatically fill it, but
    we've found this to be a performance drag. What we usually do is cache
    this type of list information on the client, usually by loading it into
    arrays of listelement in a service object at user logon. The list is
    then ready to go whenever a window needs it, and you can set the element
    list of the droplist in PostOpenInit or wherever it seems appropriate.
    From: David Wilbur[SMTP:[email protected]]
    Sent: Wednesday, February 26, 1997 2:21 PM
    To: [email protected]
    Subject: Using Drop-Down List in Express Application
    To: [email protected]
    cc:
    Subject: Using Drop-Down List in Express Application
    On an Express generated Form window I want to use a drop-down list to
    define the list of valid values for a database field. The underlying
    database field could have a datatype of either integer or character.
    For example, on the database we have a Gender column defined. I want to
    use a drop-down list that displays descriptions of "Male" and "Female" for
    allowed database values of "M" and "F". The Gender column is updateable on
    the window.
    Any suggestions on the best way to do this? Would we need to do anything
    different on Array windows?
    David Wilbur email: [email protected]
    University of Windsor phone: 519-253-4232 ext. 2779
    Windsor, Ontario Canada

    Hai Please try the following code
    You have to make some changes according to your system i am using
    MSSqlserver Driver change the class name and the connection string
    for your need
    <HTML>
    <HEAD>
    <%@ page language="java" import="java.sql.*"%>
    <LINK href="../theme/Master.css" rel="stylesheet" type="text/css">
    <TITLE>ListDrop.jsp</TITLE>
    <%!Connection con;
         %>
    </HEAD>
    <BODY>
    <select>
         <%
              try {
                   Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");\\Here you specify the Class Nale
                   con = DriverManager
                             .getConnection(
                                       "jdbc:microsoft:sqlserver://javaserver:1433;DatabaseName=karthi",
                                       "sa", "sa");\\here Connection string
                   ResultSet rs;
                   Statement st = con.createStatement();
                   rs = st.executeQuery("select SerialNo,Food from Foods");
                   while (rs.next()) {
    %>
         <option value='<%= rs.getString("SerialNo") %>'><%= rs.getString("Food")%></option>
         <%
              } catch (Exception e) {
                   e.printStackTrace();
    %>
    </select>
    </BODY>
    </HTML>

  • Using Drop-Down List in Express Application

    To: [email protected]
    cc:
    Subject: Using Drop-Down List in Express Application
    On an Express generated Form window I want to use a drop-down list to
    define the list of valid values for a database field. The underlying
    database field could have a datatype of either integer or character.
    For example, on the database we have a Gender column defined. I want to
    use a drop-down list that displays descriptions of "Male" and "Female" for
    allowed database values of "M" and "F". The Gender column is updateable on
    the window.
    Any suggestions on the best way to do this? Would we need to do anything
    different on Array windows?
    David Wilbur email: [email protected]
    University of Windsor phone: 519-253-4232 ext. 2779
    Windsor, Ontario Canada
    -----------------------------------------------

    Hai Please try the following code
    You have to make some changes according to your system i am using
    MSSqlserver Driver change the class name and the connection string
    for your need
    <HTML>
    <HEAD>
    <%@ page language="java" import="java.sql.*"%>
    <LINK href="../theme/Master.css" rel="stylesheet" type="text/css">
    <TITLE>ListDrop.jsp</TITLE>
    <%!Connection con;
         %>
    </HEAD>
    <BODY>
    <select>
         <%
              try {
                   Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");\\Here you specify the Class Nale
                   con = DriverManager
                             .getConnection(
                                       "jdbc:microsoft:sqlserver://javaserver:1433;DatabaseName=karthi",
                                       "sa", "sa");\\here Connection string
                   ResultSet rs;
                   Statement st = con.createStatement();
                   rs = st.executeQuery("select SerialNo,Food from Foods");
                   while (rs.next()) {
    %>
         <option value='<%= rs.getString("SerialNo") %>'><%= rs.getString("Food")%></option>
         <%
              } catch (Exception e) {
                   e.printStackTrace();
    %>
    </select>
    </BODY>
    </HTML>

  • How do I enable the button to use the tree list in excel? (Enable the list type: Tree enabled in Office 2013 - VSTF 2013)

    Hi, I was looking to see if anyone knows how I can troubleshoot my connection problem with TFS view in excel. I'm trying to  produce a tree view in Office 2013 as described in the following KB -
    https://msdn.microsoft.com/en-us/library/dd286627.aspx
    I have followed the instructions on the KB all the way up to : 'Add backlog items and tasks and their parent-child links using a tree list' and at this point I can't seem to get it to work as the button is greyed out.
    Note that I have completed steps 1-6 for the previous procedure... all 6 steps work just fine. However on step 2 of the second procedure - the instructions state I should be able to 'Add Tree Level' - However the button is greyed out.
    Anyone know what I need to do to enable the button to use the tree list in excel? 
    Frank

    Frank,
    I believe your issue is that you have opened a Flat query and are trying to add tree levels. A flat query is just that and you cannot change the query type from Excel.
    The second process is managing a backlog (which is a tree). TFS web access has a link on the backlog view to create a query. That query will be a "tree of work items" query that returns the items in the backlog including their parent-child relationships.
    This type of query supports the Add Tree Level and Add Child functionality as does a new Input List (not bound to an existing query).
    "You will find a fortune, though it will not be the one you seek." -
    Blind Seer, O Brother Where Art Thou
    Please Mark posts as answers or helpful so that others may find the fortune they seek.

  • Using a Select list with Submit

    I am trying to use the select list with Submit on my page.
    I have 3 select lists.
    On the first one,I am showing the list of all jacks.
    When the user selects a jack from the first list, I want to show all the jacks except the one which was selected.
    When the user selects a jack from the second list, I want to show all the jacks except the ones selected in the first list and the second list.
    I have created the select lists with submit and then I have put the query for getting the jacks. I created an unconditional branch. I am also passing the variables so that I can set the values of the items on submit.
    I also created a computation as mentioned in one of the OTN discussions, and have mentioned the value of second list to be calculated from the first and 3rd from first and second.
    But after clicking the first select list, I am losing all the existing values on the first page. I wonder what I am missing here. Can anyone hellp?
    Thanks,
    Gargi

    Gargi,
    In this case using 'select list with redirect' makes more sense rather than with SUBMIT. So change all the select lists to 'select list with redirect' (it redirects to same page inserting 'select list' value session state).
    Now for the 2nd select list query add a condition in where clause like
    WHERE sl_col != :P1_SL1And for the 3rd select list query add a condition in where clause like
    WHERE sl_col NOT IN (:P1_SL1, :P1_SL2)Hope it helps :-)
    Cheers,
    Hari

  • How to create fourier transform properties using labview

    Hi everyone
    i am a new user to Labview and i only have 2 weeks left to complete an assignment.
    This assignment involves the implementation of the various types of fourier transform properties using Labview. These properties include linearity, time shifting, frequency shifting, time scaling,
    I do not really know how to implement them using Labview
    PLS HELP!!!
    Thanks

    i am refering to the fourier transform properties listed below:
    A) time shifting
    x(t-a) ------- >  exp (-jwa) X(w) 
    For the time shifting property above, i have problem creating the exponential term using labview
    B) time scaling
    x(at)-----------> 1/a X (w/a)
    C) Time convolution
    Y(w) = F[h(t) * x(t)] = H(w)X(w)
    where * stands for the convolution operation and F stands for fourier transform
    Please provide diagrams if possible. Thank you
    PLEASE HELP!!!!!!!!  THANKS!!!!!!!

  • A suggestion : use "loop array list" instead of ArrayList / LinkedList

    ArrayList is good at:
    get / set by index : O(1)
    appending : O(log(n))
    remove last : O(1)
    and very bad at:
    add middle : O(n)
    remove from middle : O(n)
    LinkedList is good at:
    fast remove from middle, if your iteraror already goes there : O(1)
    convenient methods : addFirst, addLast, removeFirst, removeLast : O(1)
    and very bad at :
    get / set by index : O(n)
    here I want to make a suggestion : use "loop array list" instead of the ArrayList and LinkedList.
    a "loop array list" is based on array, just like ArrayList. But it has 2 member-variables : the start position, and the real size. the start position can be anywhere within array.length. an element of index "i" is stored in array[ start + i ], and when (start + i > array.length), loop to the beginning of the array; when (start + i < 0), loop to the end of the array.
    this "loop array list" has all the good sides:
    get / set by index : O(1)
    add first / last : O(log(n))
    remove first / last : O(log(n))
    add / remove from middle : O(n)
    (note : because we shrink the backup-array when the real size is too small, add / remove operation take O(log(n)) now.)
    the only problem is : add / remove from middle. let's take a look at it.
    1. the LinkedList does NOT really add/remove from middle in O(1), you has to locate the element, which is O(n).
    2. O(n) is acceptable, O(n^2) is not acceptable. try this : keep removing first element from an very big ArrayList ( size>10^6 ) until it's empty.
    the fact is, any list can perform batch-remove / batch-add operation in O(n) instead of O(n^2). it's easy : allocate a new list, iterate the original list, copy the element into the new list if condition is satisfied.
    so, instead of "remove from middle", what we need is a new methods : removeAllByCondition( Condition condition ), and now the batch-remove operation can be done in O(n)
    here is an implementation of mine. I've tested it on my computer( 512mem + 2G cpu, win2k + jdk1.5 ), it's amazing, just a little slower then ArrayList when add last, and a liitle slower then LinkedList when batch-remove. in all other cases, it's far more better then those 2 kinds of List.
    // source code : List2
    import java.util.AbstractList;
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.Collection;
    import java.util.Collections;
    import java.util.Comparator;
    import java.util.HashSet;
    import java.util.Iterator;
    import java.util.List;
    import java.util.NoSuchElementException;
    import java.util.Set;
    public final class List2<T> extends AbstractList<T> {
    private static int initialArrayLength = 4;
    private T[] array;
    private int start;
    private int size;
    private void init( T[] newArray, int start_a, int size_a ) {
    array = newArray;
    start = start_a;
    size = size_a;
    @SuppressWarnings("unchecked")
    private void init() {
    init( (T[]) new Object[ initialArrayLength ], 0, 0 );
    public List2() {
         init();
    @SuppressWarnings("unchecked")
    public List2( Collection<? extends T> collection ) {
         init(
              collection.toArray( (T[]) new Object[ collection.size() * 11 / 10 + 1 ] ),
              0,
              collection.size()
    private List2( T[] array_a, int start_a, int size_a ) {
         init( array_a, start_a, size_a );
    @SuppressWarnings("unchecked")
    public static <TT> List2<TT> createV( TT... elements ) {
         TT[] array = (TT[]) new Object[ elements.length * 11 / 10 + 1 ];
         System.arraycopy( elements, 0, array, 0, elements.length );
         return new List2<TT>( array, 0, elements.length );
    public static List2<Double> create( double... elements ) {
         Double[] array = new Double[ elements.length * 11 / 10 + 1 ];
         for( int i=0; i < elements.length; i++ )
              array[i] = elements;
         return new List2<Double>( array, 0, elements.length );
    public static List2<Integer> create( int... elements ) {
         Integer[] array2 = new Integer[ elements.length * 11 / 10 + 1 ];
         for( int i=0; i < elements.length; i++ )
              array2[i] = elements[i];
         return new List2<Integer>( array2, 0, elements.length );
    public static List2<Character> create( char... elements ) {
         Character[] array2 = new Character[ elements.length * 11 / 10 + 1 ];
         for( int i=0; i < elements.length; i++ )
              array2[i] = elements[i];
         return new List2<Character>( array2, 0, elements.length );
    public static List2<Character> create( String s ) {
         return create( s.toCharArray() );
    public List2<T> clone() {
         return new List2<T>( this );
    // basic
    public int size() {
         return size;
    private int index( int index ) {
         int i = start + index;
         if( i >= array.length )
              i -= array.length;
         return i;
    public T get( int d ) {
         if( d < 0 || d >= size )
              throw new IndexOutOfBoundsException();
         if( size == 0 )
              throw new NoSuchElementException();
         return array[ index( d ) ];
    public T set( int index, T element ) {
         if( index < 0 || index >= size )
              throw new IndexOutOfBoundsException();
         int i = index( index );
         T oldElement = array[i];
         array[i] = element;
         return oldElement;
    @SuppressWarnings("unchecked")
    private void copyAndSetToNewArray( int newArrayLength ) {
         T[] newArray = (T[]) new Object[ newArrayLength ];
         for( int i=0; i<size; i++ )
              newArray[i] = array[ index( i ) ];
         init( newArray, 0, size );
    public void addFirst( T element ) {
         if( size == array.length )
              copyAndSetToNewArray( size * 3 / 2 + 1 );
         int i = index( array.length - 1 );
         array[ i ] = element;
         start = i;
         size++;
    public void addLast( T element ) {
         if( size == array.length )
              copyAndSetToNewArray( size * 3 / 2 + 1 );
         array[ index( size ) ] = element;
         size++;
    public T removeFirst() {
         if( size == 0 )
              throw new NoSuchElementException();
         T oldElement = array[ start ];
         array[ start ] = null;
         start = index( 1 );
         size--;
         if( array.length > size * 2 + 1 )
              copyAndSetToNewArray( size * 11 / 10 + 1 );
         return oldElement;
    public T removeLast() {
         if( size == 0 )
              throw new NoSuchElementException();
         int i = index( size - 1 );
         T oldElement = array[i];
         array[i] = null;
         size--;
         if( array.length > size * 2 + 1 )
              copyAndSetToNewArray( size * 11 / 10 + 1 );
         return oldElement;
    @SuppressWarnings("unchecked")
    public int removeAll( ListCondition<T> condition ) {
         T[] newArray = (T[]) new Object[ array.length ];
         int iNew = 0;
         for( int i=0; i < size; i++ ) {
              T element = get( i );
              if( ! condition.isConditionSatisfied( this, i, element ) )
                   newArray[ iNew++ ] = element;
         int oldSize = size;
         init( newArray, 0, iNew );
         if( array.length > size * 2 + 1 )
              copyAndSetToNewArray( size * 11 / 10 + 1 );
         return size - oldSize;
    // aux
    public boolean equals(Object obj) {
         if( obj == this )
         return true;
         if( obj instanceof List2 ) {
              List2 that = (List2) obj;
              if( this.size != that.size )
                   return false;
              for( int i=0; i < size; i++ )
                   if( ! Tools.equals( this.array[ this.index(i) ], that.array[ that.index(i) ] ) )
                        return false;
              return true;
         if( obj instanceof List ) {
              List that = (List) obj;
              if( this.size != that.size() )
                   return false;
              Iterator thatIter = that.iterator();
              for( int i=0; i < size; i++ )
                   if( ! Tools.equals( this.array[ this.index(i) ], thatIter.next() ) )
                        return false;
              return true;
         return true;
    public int hashCode() {
         int hashCode = 1;
         for( int i=0; i < size; i++ ) {
              T element = array[ index( i ) ];
         hashCode = 31*hashCode + ( element==null ? 0 : element.hashCode() );
         return hashCode;
    public boolean isEmpty() {
         return size == 0;
    public T getFirst() {
         return get( 0 );
    public T getLast() {
         return get( size() - 1 );
    public T getRandom() {
         return get( (int) (Math.random() * size) );
    public int indexOf( Object element ) {
         for( int i=0; i < size; i++ )
              if( Tools.equals( array[ index( i ) ], element ) )
                   return i;
         return -1;
    public int lastIndexOf( Object element ) {
         for( int i=size-1; i >= 0; i-- )
              if( Tools.equals( array[ index( i ) ], element ) )
                   return i;
         return -1;
    public boolean contains( Object element ) {
         return indexOf( element ) != -1;
    public boolean add( T element ) {
         addLast( element );
         return true;
    @Deprecated
    public void add( int index, T element ) {
         throw new UnsupportedOperationException();
    public T remove() {
         return removeFirst();
    @Deprecated
    public boolean remove( Object element ) {
         throw new UnsupportedOperationException( "use removeAll( Condition ) instead" );
    @Deprecated
    public T remove( int index ) {
         throw new UnsupportedOperationException( "use removeAll( Condition ) instead" );
    public void clear() {
         init();
    public Object[] toArray() {
         Object[] result = new Object[ size ];
         for( int i=0; i < size; i++ )
         result[i] = array[ index( i ) ];
         return result;
    @SuppressWarnings("unchecked")
    public <TT> TT[] toArray( TT[] a ) {
    if( a.length < size )
    a = (TT[]) java.lang.reflect.Array.newInstance( a.getClass().getComponentType(), size );
    for( int i=0; i < size; i++ )
    a[i] = (TT) array[ index( i ) ];
    if( a.length > size )
         a[size] = null;
    return a;
    @SuppressWarnings("unchecked")
    public void sort() {
         Object[] a = toArray();
         Arrays.sort( a );
         for( int i=0; i < size; i++ )
              array[ i ] = (T) a[ i ];
         start = 0;
    @SuppressWarnings("unchecked")
    public void sortDesc() {
         Object[] a = toArray();
         Arrays.sort( a );
         for( int i=0, j=size-1; i < size; i++, j-- )
              array[ i ] = (T) a[ j ];
         start = 0;
    @SuppressWarnings("unchecked")
    public void sort( Comparator<T> comparator ) {
         T[] a = (T[]) toArray();
         Arrays.sort( a, comparator );
         for( int i=0; i < size; i++ )
              array[ i ] = a[ i ];
         start = 0;
    @SuppressWarnings("unchecked")
    public void sortDesc( Comparator<T> comparator ) {
         T[] a = (T[]) toArray();
         Arrays.sort( a, comparator );
         for( int i=0, j=size-1; i < size; i++, j-- )
              array[ i ] = a[ j ];
         start = 0;
    public String toString( String delimiter ) {
         return toString( "", delimiter, "", size() );
    public String toString( String prefix, String delimiter, String suffix, int max ) {
         StringBuffer stringBuffer = new StringBuffer( prefix );
         int dest = Math.min( max, size );
         for( int i=0; i < dest; i++ ) {
              stringBuffer.append( get(i) );
              if( i < dest - 1 )
                   stringBuffer.append( delimiter );
         if( size > max )
              stringBuffer.append( "...(" ).append( size() - max ).append( " more)" );
         stringBuffer.append( suffix );
         return stringBuffer.toString();
    // batch operation
    public boolean containsAll( Collection<?> that ) {
         Set<Object> thisSet = new HashSet<Object>( this );
         for( Object element : that )
              if( ! thisSet.contains( element ) )
                   return false;
         return true;
    @SuppressWarnings("unchecked")
    public List2<T> subList( int fromIndex, int toIndex ) {
         if( fromIndex < 0 || toIndex > size || toIndex < fromIndex )
              throw new IndexOutOfBoundsException();
         int newSize = toIndex - fromIndex;
         T[] newArray = (T[]) new Object[ newSize * 11 / 10 + 1 ];
         for( int i=fromIndex, iNew=0; i < toIndex; i++, iNew++ )
              newArray[ iNew ] = array[ index( i ) ];
         return new List2<T>( newArray, 0, newSize );
    public void addV( T... that ) {
         for( T element : that )
              addLast( element );
    public boolean addAll( Collection<? extends T> that ) {
         for( T element : that )
              addLast( element );
         return ! that.isEmpty();
    @Deprecated
    public boolean addAll( int index, Collection<? extends T> c ) {
         throw new UnsupportedOperationException();
    public void removeRest( T element ) {
         int position = lastIndexOf( element );
         if( position == -1 )
              return;
         while( ! Tools.equals( element, removeLast() ) );
    public void removeAllEquals( final T element ) {
         removeAll( new ListCondition<T>() { public boolean isConditionSatisfied(List2 list, int index, T currentElement) {
              return currentElement.equals( element );
    public void removeAllBetween( final T from, final T to ) {
         removeAll( new ListCondition<T>() {
              @SuppressWarnings("unchecked")
              public boolean isConditionSatisfied(List2 list, int index, T element) {
                   if( from != null && ((Comparable) from).compareTo( element ) > 0 )
                        return false;
                   if( to != null && ((Comparable) to).compareTo( element ) <= 0 )
                        return false;
                   return true;
    public boolean retainAll( Collection<?> that ) {
         final Set<Object> thatSet = new HashSet<Object>( that );
         int removeCount = removeAll( new ListCondition<T>() { public boolean isConditionSatisfied(List2 list, int index, T element) {
              return ! thatSet.contains( element );
         return removeCount > 0;
    public boolean removeAll( Collection<?> that ) {
         final Set<Object> thatSet = new HashSet<Object>( that );
         int removeCount = removeAll( new ListCondition<T>() { public boolean isConditionSatisfied(List2 list, int index, T element) {
              return thatSet.contains( element );
         return removeCount > 0;
    // unit test
    private static int maxTestCount = 1000 * 1000;
    public static void unitTest() throws Exception {
         // thest thoese methods for one time
         Tools.ensureEquals( new List2(), new ArrayList() );
         Tools.ensureNotEquals( List2.create( "abcde" ), new ArrayList() );
         Tools.ensureNotEquals( List2.create( "abcde" ), List2.create( "abcdef" ) );
         final List<Double> list1 = new ArrayList<Double>();
         final List2<Double> list2 = new List2<Double>();
         Runnable[] tasks = new Runnable[] {
              // test those methods that do NOT change the list
              new Runnable() { public void run() {
                   Tools.ensureEquals( new List2<Double>( list1 ), list1 );
                   Tools.ensureEquals( List2.createV( list1.toArray() ), list1 );
                   Tools.ensureEquals( List2.createV( list1.toArray( new Double[0] ) ), list1 );
                   double[] doubles = new double[ list1.size() ];
                   int i = 0;
                   for( double d : list1 )
                        doubles[i++] = d;
                   Tools.ensureEquals( List2.create( doubles ), list1 );
                   Tools.ensure( list1.isEmpty() == list2.isEmpty() );
                   Arrays.equals( list1.toArray(), list2.toArray() );
                   Tools.ensureEquals( list1, list2.clone() );
                   Double notExistElement = -2.0;
                   Tools.ensure( list1.indexOf( notExistElement ) == -1 );
                   Tools.ensure( list1.lastIndexOf( notExistElement ) == -1 );
                   Tools.ensure( list1.contains( notExistElement ) == false );
                   Tools.ensureEquals( list1.toString(), list2.toString() );
                   Tools.ensureEquals( list1.toString(), list2.toString() );
                   Tools.ensureEquals( list1.hashCode(), list2.hashCode() );
                   if( list1.isEmpty() )
                        return;
                   Tools.ensure( list1.get(0).equals( list2.getFirst() ) );
                   Tools.ensure( list1.get(list1.size()-1).equals( list2.getLast() ) );
                   Double existRandomElement = list2.getRandom();
                   Tools.ensure( list1.contains( existRandomElement ) );
                   Tools.ensure( list2.contains( existRandomElement ) );
                   Tools.ensure( list1.indexOf( existRandomElement ) == list2.indexOf( existRandomElement ) );
                   Tools.ensure( list1.indexOf( existRandomElement ) == list2.indexOf( existRandomElement ) );
                   int from = (int) (Math.random() * list1.size());
                   int to = (int) (Math.random() * (list1.size()+1));
                   if( from > to ) {
                        int t = from;
                        from = to;
                        to = t;
                   Tools.ensureEquals( list1.subList( from, to ), list2.subList( from, to ) );
              // test those methods that change the list
              new Runnable() { public void run() {
                   if( list1.isEmpty() )
                        return;
                   int i = (int) (Math.random() * list1.size());
                   double d = Math.random();
                   list1.set( i, d );
                   list2.set( i, d );
              new Runnable() { public void run() {
                   if( list1.isEmpty() )
                        return;
                   int i = (int) (Math.random() * list1.size());
                   Tools.ensure( list1.get( i ).equals( list2.get( i ) ) );
              new Runnable() { public void run() {
                   double d = Math.random();
                   list1.add( 0, d );
                   list2.addFirst( d );
              new Runnable() { public void run() {
                   double d = Math.random();
                   list1.add( d );
                   list2.addLast( d );
              new Runnable() { public void run() {
                   double d = Math.random();
                   list1.add( d );
                   list2.addLast( d );
              new Runnable() { public void run() {
                   if( list1.isEmpty() )
                        return;
                   Tools.ensure( list1.remove( 0 ).equals( list2.removeFirst() ) );
              new Runnable() { public void run() {
                   if( list1.isEmpty() )
                        return;
                   Tools.ensure( list1.remove( list1.size() - 1 ).equals( list2.removeLast() ) );
              new Runnable() { public void run() {
                   if( list1.isEmpty() )
                        return;
                   int i = 0;
                   for( Iterator<Double> iter=list1.iterator(); iter.hasNext(); i++ ) {
                        iter.next();
                        if( i % 3 == 0 )
                             iter.remove();
                   list2.removeAll( new ListCondition<Double>() { public boolean isConditionSatisfied(List2 list, int index, Double element) {
                        return index % 3 == 0;
              new Runnable() { public void run() {
                   double d = Math.random();
                   list1.add( d );
                   list2.add( d );
              new Runnable() { public void run() {
                   if( list1.isEmpty() )
                        return;
                   Tools.ensure( list1.remove(0).equals( list2.remove() ) );
              new Runnable() { public void run() {
                   if( list1.isEmpty() )
                        return;
                   int r = (int) (Math.random() * list1.size());
                   Double element = list1.get( r );
                   int index = list1.lastIndexOf( element );
                   for( int i=list1.size()-1; i>=index; i-- )
                        list1.remove( i );
                   list2.removeRest( element );
              new Runnable() { public void run() {
                   list2.removeRest( Math.random() - 2 );
              new Runnable() { public void run() {
                   list1.clear();
                   list2.clear();
              new Runnable() { public void run() {
                   Collections.sort( list1 );
                   list2.sort();
              new Runnable() { public void run() {
                   Collections.sort( list1 );
                   Collections.reverse( list1 );
                   list2.sortDesc();
              new Runnable() { public void run() {
                   Comparator<Double> comparator = new Comparator<Double>() { public int compare(Double o1, Double o2) {
                        return o1.toString().substring(2).compareTo( o2.toString().substring(2) );
                   Collections.sort( list1, comparator );
                   list2.sort( comparator );
              new Runnable() { public void run() {
                   Comparator<Double> comparator = new Comparator<Double>() { public int compare(Double o1, Double o2) {
                        return o1.toString().substring(2).compareTo( o2.toString().substring(2) );
                   Collections.sort( list1, comparator );
                   Collections.reverse( list1 );
                   list2.sortDesc( comparator );
              new Runnable() { public void run() {
                   Double notExistElement = -2.0;
                   list2.removeAllEquals( notExistElement );
                   Tools.ensureEquals( list1, list2 );
                   list2.removeAllBetween( 0.5, 0.6 );
                   for( Iterator<Double> iter=list1.iterator(); iter.hasNext(); ) {
                        double d = iter.next();
                        if( d >= 0.5 && d < 0.6 )
                             iter.remove();
                   Tools.ensureEquals( list1, list2 );
         System.out.print( "test List2 " );
         for( int i=0; i < maxTestCount; i++ ) {
              tasks[ (int) (Math.random() * tasks.length) ].run();
              Tools.ensureEquals( list1, list2 );
              if( i % (maxTestCount/10) == 0 )
                   System.out.print( "." );
         System.out.println( " ok" );
    // source code : ListCondition
    public interface ListCondition<T> {
    boolean isConditionSatisfied( List2 list, int index, T element );

    Hi,
    I have the following statement:
    private List list = new ArrayList();
    why not use private ArrayList list = new
    ArrayList()?
    I know ArrayList implements List, so list has a wide
    scope, right? What's the benefit?
    Thanks,
    JieBy using the interface you are not tied to a specific implementation.
    Later, you may determine that using a LinkedList is more efficient to your specific code and then all you need to do is change the statement to:
    private List list = new LinkedList();As long as you are not casting the list reference to ArrayList (or something along those lines) you would not need to change anything else.

  • What is the use of at new statement?

    What is the use of at new statement?

    Hi,
    AT - itab
    Syntax
    LOOP AT itab result ...
      [AT FIRST.
       ENDAT.]
        [AT NEW comp1.
         ENDAT.
           [AT NEW comp2.
           ENDAT.
           AT END OF comp2.
           ENDAT.]
         AT END OF comp1.
         ENDAT.]
      [AT LAST.
      ENDAT.]
    ENDLOOP.
    Extras:
    1. ...  FIRST
    2. ... |{END OF} compi
    3. ...  LAST
    Effect
    The statement block of a LOOP loop can contain control structures for control level processing. The respective control statement is AT. The statements AT and ENDAT define statement blocks that are executed at control breaks, that is, when the control structure is changed. The additions to the AT statements determine the control break at which their statement blocks are executed. Within these statement blocks, the statement SUM can be specified to add together the numeric components of a control level. For the output behavior result, the same applies as for LOOP AT.
    The prerequisite for control level processing is that the internal table is sorted in exactly the same sequence as the component of its line type - that is, first in accordance with the first component, then in accordance with the second component, and so on. The line structure and the corresponding sorting sequence gives a group structure of the content of the internal table, whose levels can be evaluated using AT statements. The AT- ENDAT control structures must be aligned one after the other, in accordance with the group structure.
    The statement blocks within the AT- ENDAT control structures are listed if an appropriate control break is made in the current table line. Statements in the LOOP- ENDLOOP control structure that are not executed within an AT- ENDAT control structure are executed in each pass of the loop.
    In order that control level processing is carried out properly, the following rules must be observed:
    After LOOP, a restricting condition cond can only be specified if this selects a consecutive line block of the internal table. Otherwise, the behavior of control level processing is undefined.
    The internal table cannot be modified within the LOOP loop.
    A work area wa specified in the LOOP statement after the addition INTO must be compatible with the line type of the table.
    The content of a work area wa specified after the addition INTO in the LOOP statement must not be modified.
    If the INTO addition is used in the LOOP statement to assign the content of the current line to a work area wa, its content is changed upon entry into the AT-ENDAT control structure as follows:
    The components of the current control key remain unchanged.
    All components with a character-type, flat data type to the right of the current control key are set to character "*" in every position.
    All the other components to the right of the current control key are set to their initial value.
    When the AT-ENDAT control structure is exited, the content of the current table line is assigned to the entire work area wa.
    Addition 1
    ... FIRST
    Effect
    The control level is defined by the first line of the internal table. The control break takes place when this line is read.
    Note
    In the group level AT FIRST, the current group key contains no components and all character-type components of the work area wa are filled with "*" and all remaining components are set to their initial value.
    Addition 2
    ... |{END OF} compi/>
    Effect
    : Control levels are defined by the beginning or end of a group of lines with the same content in the component compi (where i = 1, 2, and so on) and in the components to the left of compi. The control breaks take place when the content of the component compi or another component to the left of compi changes.
    The compi components can be specified as described in Specification of Components, with the limitation that access to object attributes is not possible here.
    Note
    If the INTO or ASSIGNING additions are used in the LOOP statement, a field symbol can be entered after AT |{END OF} outside classes, to which the corresponding component of the work area wa or the field symbol <fs> is assigned. This form of dynamic component specification is obsolete and has been replaced by specification in the format (name).
    Addition 3
    ... LAST
    Effect
    : The control level is defined by the last line of the internal table. The control break takes place when this line is read.
    Note
    In the group level AT LAST, the current group key contains no components and all character-type components of the work area wa are filled with "*" and all remaining components are set to their initial value.
    Regards,
    Prashant

  • Transformation Formula

    Hi,
    I have written a transformation formula given below.
    E_ntovl=/BIC/E_SAL_VAL + ( /BIC/E_SERVICE / 100 ) * /BIC/E_SAL_VAL
    Steps
    I have defined the rule between them in transformation,after double clicking the E_ntovl field.
    BIC/E_SAL_VAL and BIC/E_SERVICE
    But my problems are i am not able to save it and when i check syntax it gives no error and i am not getting data in infocube also.
    Please help

    After defining the formula, just use the back button. It will allow you to save.

  • Copying formula using different sheet but same cells

    How can I copy this incredibly long formula into different cells but change the sheet that it's referencing without typing in the sheet name in every instance it occurs (at least 28 times right now).
    Is this something I'm going to have to use an outside editor (ie text edit, pages) to find & replace?

    I don't know which is the "incredibly long formula" but I know that Jerrold described the required scheme in the late 48 hours !
    In one fixed cell of your table (A1 is a good choice), store the name of the sheet to address.
    Then, in the formulas, use the function INDIRECT to compute the cell's reference grabbing the sheet name from the cell A1 (with an absolute reference : $A$1)
    This way, when you will paste the formula in an other table, it will grab the sheet name from the cell A1 of this new table.
    Yvan KOENIG (VALLAURIS, France) mardi 24 mai 2011 22:18:11
    Please :
    Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • Use of LINE OF statement

    Hi all,
    what is the use of LINE OF statement?
    DATA:       itab_iv_item TYPE TABLE OF   bapi_incinv_create_item,
                     itab_return TYPE TABLE OF bapiret2.
    DATA:       wa_iv_item LIKE LINE OF itab_iv_item,
                     wa_return LIKE LINE OF itab_return.
    what these statements do
    DATA:       wa_iv_item LIKE LINE OF itab_iv_item,
                     wa_return LIKE LINE OF itab_return.
    Thanks in advance
    krupali.

    Hi KR.,
    1.
    types: begin of st1,
              <fields>
              end of st1.
    data: wa type st1.
    Here we are declaring the wa by using the syntax TYPE. because here we know the structre.
    2.
    data: wa type vbak.
    Here we are declaring the wa wrt Database Table so here we can use TYPE syntax again.
    3.
    data: begin of itab occurs 0,
                <fields>
                end of itab.
        data: wa like line of itab.
    Here we are declaring the wa wrt internal table which is having header line and body, so we can't use TYPE here, we must go for LIKE LINE OF syntax.
    4.
    data: itab like vbak occurs 0 with header line.
        data: wa like line of itab
           (or)
         data: wa type vbak.
    Hope it clear?
    Thanks,
    Naveen.I

Maybe you are looking for

  • Select Sorting at prompt level

    Hi,    How to select sorting parameter from prompt level?  I have followed the thread [Select Sorting in prompt level  |Re: Select Sorting in prompt level;. I got struck while creating " Prompt - Sort Order" object. How to do this? Regards, Malini.V

  • Error -while updating stock in MB1C for make to order (561-E)

    Hi all, I have created a sales order with reference to quotation. Stock is updating for Quotation number. But i stock should be updated to the sales order number. When i am updating the stock for this sales order number, its not accepting. Its asking

  • Windows 7 Beta 1 with MiniDisplay to VGA adapter

    I am using a MacBook Pro (Late 2008) which has the MiniDisplay port. At work I use a MiniDisplay to VGA adapter for my external screen. At home I use a MiniDisplay to DVI adapter for my external screen. In Windows Vista, both cables work and display

  • K7N2G VGA issues...

    I have two similar HK with AMD XP2100 and 256mb RAM. I get bluescreen when installing WinXP. If I try with another VGA card the installation goes OK, util I restart with the onboard VGA, and installing the drivers for it. Then it crashes again. I hav

  • No NetWeaver 2004s Java Trial anymore? How to test AdobeDocumentServices?

    Hello, in former times SAP offered a NetWeaver 2004s Java Trial Edition for Windows that also included the Adobe Document Services. But when I have look at the download section today, I can't find this trial edition anymore. The only thing that I can