Help needed creating a linked list program

I have been trying to create a linked list program that takes in a word and its definition and adds the word to a link list followed by the definition. i.e. java - a simple platform-independent object-oriented programming language.
the thing is that of course words must be added and removed from the list. so i am going to use the compareTo method. Basically there a 2 problems
1: some syntax problem which is causing my add and remove method not to be seen from the WordList class
2: Do I HAVE to use the iterator class to go thru the list? I understand how the iterator works but i see no need for it.
I just need to be pointed in the right direction im a little lost.................
your help would be greatly appreciated i've been working on this over a week i dont like linked list..........
Here are my 4 classes of code........
* Dictionary.java
* Created on November 4, 2007, 10:53 PM
* A class Dictionary that implements the other classes.
* @author Denis
import javax.swing.JOptionPane;
/* testWordList.java
* Created on November 10, 2007, 11:50 AM
* @author Denis
public class Dictionary {
    /** Creates a new instance of testWordList */
    public Dictionary() {
        boolean done=false;
String in="";
while(done!=true)
in = JOptionPane.showInputDialog("Type 1 to add to Dictionary, 2 to remove from Dictionary, 3 to Print Dictionary, and 4 to Quit");
int num = Integer.parseInt(in);
switch (num){
case 1:
String toAdd = JOptionPane.showInputDialog("Please Key in the Word a dash and the definition.");
add(toAdd);
break;
case 2:
String toDelete = JOptionPane.showInputDialog("What would you like to remove?");
remove(toDelete);
break;
case 3:
for(Word e: list)
System.out.println(e);
break;
case 4:
System.out.println("Transaction complete.");
done = true;
break;
default:
done = true;
break;
   }//end switch
  }//end while
}//end Dictionary
}//end main
import java.util.Iterator;
/* WordList.java
* Created on November 4, 2007, 10:40 PM
*A class WordList that creates and maintains a linked list of words and their meanings in lexicographical order.
* @author Denis*/
public class WordList{
    WordNode list;
    //Iterator<WordList> i = list.iterator();
    /*public void main(String [] args)
    while(i.hasNext())
    WordNode w = i.next();
    String s = w.word.getWord();
    void WordList() {
      list = null;
    void add(Word b)
        WordNode temp = new WordNode(b);
        WordNode current,previous = null;
        boolean found = false;
        try{
        if(list == null)
            list=temp;
        else{
            current = list;
            while(current != null && !found)
                if(temp.object.getWord().compareTo(current.object.getWord())<0)
                    found = true;
                else{
                previous=current;
                current=current.next;
            temp.next=current;
            if(previous==null)
                list=temp;
            else
                previous.next=temp;
            }//end else
        }//end try
        catch (NullPointerException e)
            System.out.println("Catch at line 46");
    }//end add
/*WordNode.java
* Created on November 4, 2007, 10:40 PM
*A class WordNode that contains a Word object of information and a link field that will contain the address of the next WordNode.
* @author Denis
public class WordNode {
    Word object;//Word object of information
    WordNode next;//link field that will contain the address of the next WordNode.
    WordNode object2;
    public WordNode (WordNode wrd)
         object2 = wrd;
         next = null;
    WordNode(Word x)
        object = x;
        next = null;
    WordNode list = null;
    //WordNode list = new WordNode("z");
    Word getWord()
        return object;
    WordNode getNode()
        return next;
import javax.swing.JOptionPane;
/* Word.java
* Created on November 4, 2007, 10:39 PM
* A class Word that holds the name of a word and its meaning.
* @author Denis
public class Word {
    private String word = " ";
    /** Creates a new instance of Word with the definition*/
    public Word(String w) {
        word = w;
    String getWord(){
        return word;
}

zoemayne wrote:
java:26: cannot find symbol
symbol  : method add(java.lang.String)
location: class Dictionary
add(toAdd);this is in the dictionary class
generic messageThat's because there is no add(...) method in your Dictionary class: the add(...) method is in your WordList class.
To answer your next question "+how do I add things to my list then?+": Well, you need to create an instance of your WordList class and call the add(...) method on that instance.
Here's an example of instantiating an object and invoking a method on that instance:
Integer i = new Integer(6); // create an instance of Integer
System.out.println(i.toString()); // call it's toString() method and display it on the "stdout"

Similar Messages

  • Need help with creating a linked list

    I need to create a linked list that i can put numbers or an operator into
    class Number_or_op
    boolean flag;
    double number;
    char operator;
    Number_or_op(boolean flag1,double number1,char operator1)
    flag = flag1;
    number = number1;
    operator = operator1;
    class Expr {
    Number_or_op first;
    Expr rest;
    Expr(Number_or_op first1,Expr rest1)
    first = first1;
    rest = rest1;
    how do i make a linked list out of this? im trying
    Expr list1 = new Expr(3, new Expr('*' , new Expr(4 , null)));
    but keep getting an error D:\Documentation\expr.java:14: internal error; cannot instantiate Expr.<init> at Expr to ()
    how do i fix the number_or_op so it can make it into a list?

    Let me reitterate my problem because i am so lost...
    I am used to making linked list using an integers only.. and now my teacher wants me to use both integers and chars, the chars being operators..
    I have no idea how to do that using hte code he provided because it makes no sense at all to me
    class Number_or_op
    boolean flag;
    double number;
    char operator;
    Number_or_op(boolean flag1,double number1,char operator1)
    flag = flag1;
    number = number1;
    operator = operator1;
    class Expr {
    Number_or_op first;
    Expr rest;
    Expr(Number_or_op first1,Expr rest1)
    first = first1;
    rest = rest1;
    I need to make a list that looks like 1 + 3 / 4 each operator or number needs a different node.. i just cant think of how to do it and keep getting an error message everytime i do saying:
    File: D:\Documentation\expr.java [line: 14]
    Error: D:\Documentation\expr.java:14: internal error; cannot instantiate Expr.<init> at Expr to ()
    I just dont know what to do

  • Need help on creating a linked list with array...

    I want to create a linked listed using array method. Any suggestion on how would I start it.
    thanks

    That means I want to implement linked list using an
    array.I believe you mean you want to implement list using an array. Linked list is a very different implementation of a list, which can be combined with arrays for a niche implementation of list, but I don't think this is what you're talking about.
    Do you mind if we ask why you don't want to use ArrayList? It does exactly what you specify, plus it will increase the size of the internal array as necessary to ensure it can store the required elements.
    If you really want to make your own, have a look at the source for ArrayList (in src.jar in your JDK installation folder) - it will answer any questions you have. If you don't understand any of the code, feel free to post the relevant code here and ask for clarification.

  • Help needed creating vertical bullet list using div tag and css

    Hi,
    I think there is something quite fundamental that I'm missing when using div tags - I seem to keep running into problems with them.
    I'm trying to create a vertical bullet list. It works fine when I try the code on its own as follows:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    #techlistcontainer {
        /*list-style-type: square;*/
        position: absolute;
        top: 20px;
        left: 0;
        z-index: 2;
        width: 75%;
        margin-top: 0;
        margin-right: 0;
        margin-bottom: 0;
        margin-left: 30;
        padding-top: 0;
        padding-right: 0;
        padding-bottom: 0;
        padding-left: 30;
    #techlistcontainer ul {
      margin-top: 0;
      margin-left: 0;
      padding-left: 0;
      list-style-type: none;
      font-family: Arial, Helvetica, sans-serif;
    #techlistcontainer li {
        margin-bottom: 8px;
        list-style-type: circle;
        margin-left: 50px;
        padding-right: 30px;
    -->
    </style>
    <head>
    </head>
    <body>
    <div id="techlistcontainer">
    <ul id="techlist">
              <li>Java Messaging Service (JMS)</li>
              <li>Message Driven Beans </li>
              <li>Remote Session EJBs with multi-threading</li>
              <li>Message Oriented Middleware(MOS) such as Websphere MQ series, Mercator with SAP/ERP</li>
              <li>XML messaging</li>
              <li>CORBA (Common Object Request Broker Architecture), RMI (Remote Method Invocation)</li>
        </ul>
    </div>
    </body>
    </html>
    http://www.pa-solutions.co.uk/vertical_list.html
    When I insert that into my site template page, its all over the place:
    http://www.pa-solutions.co.uk/development.html
    I've put the css code into a seperate file http://www.pa-solutions.co.uk/pas.css - I get the same results when its embedded into the html doc.
    Please help before I pull all my hair out.
    Thanks,
    Phil.

    Unless you know what you're doing with absolute positioning, avoid absolute positioning! Absolute positioning actually takes an element out of the normal HTML document flow and positions it absolutely in relationship with it's first parent with a position other than static - for details read the HTML specs at the W3C.
    Ideally you should use the normal HTML document flow. Divs are block level elements meaning that they act like blocks that take up a height (determined by children content) and width (the full width of the page or it's parent container, unless you tell it otherwise).
    For your CSS try this:
    #techlistcontainer {
        width: 75%;
        margin-top: 0;
        margin-right: 0;
        margin-bottom: 0;
        margin-left: 30;
        padding-top: 0;
        padding-right: 0;
        padding-bottom: 0;
        padding-left: 30;
    How does that work with your templates?

  • Help needed: Creating web link in JDialog Box

    I'm in need of this urgently, any help would be much appreciated. I'm currently display some information in a JDialog box when an item is clicked in a JApplet.
    I need to display a weblink within the dialog box.
    Thanks anyone

    I am using JDeveloper 10.1.3.3.0. Thanks Heaps

  • Help needed Displaying ALV  Secondary list without using oops concept

    Hi Experts
    Help needed Displaying ALV  Secondary list without using oops concept.
    its urgent
    regds
    rajasekhar

    hi chk this code
    ******************TABLES DECLARATION*****************
    TABLES : VBAP,MARA.
    *****************TYPE POOLS**************************
    TYPE-POOLS : SLIS.
    ****************INTERNAL TABLES**********************
    DATA : BEGIN OF IT_VBAP OCCURS 0,
    VBELN LIKE VBAP-VBELN, "SALES DOCUMENT
    POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM
    MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER
    END OF IT_VBAP.
    ****************TEMPORARY VARIABLES******************
    DATA : V_VBELN LIKE VBAP-VBELN."SALES DOCUMENT
    DATA : V_MTART LIKE MARA-MTART. "MATERIAL TYPE
    *****************FIELD CATALOG***********************
    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    ****************LAYOUT*******************************
    DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    ***************VARIANT*******************************
    DATA : G_VARIANT LIKE DISVARIANT.
    ****************SAVE*********************************
    DATA : G_SAVE(1) TYPE C.
    *****************EVENTS******************************
    DATA : XS_EVENTS TYPE SLIS_ALV_EVENT,
           G_EVENTS TYPE SLIS_T_EVENT.
    ******************PF STATUS**************************
    DATA : PF_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS'.
    ******************USER COMMAND************************
    DATA : USER_COMMAND TYPE SLIS_FORMNAME VALUE 'SET_USER_COMMAND',
           R_UCOMM LIKE SY-UCOMM.
    ****************SELECTION SCREEN************************
    SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.
    ***************AT SELECTION SCREEN*********************
    AT SELECTION-SCREEN.
      PERFORM VALIDATE.
    **************START-OF-SELECTION**************************
    START-OF-SELECTION.
      PERFORM GET_DETAILS.
      PERFORM FIELDCAT.
      PERFORM LAYOUT.
      PERFORM VARIANT.
      PERFORM SAVE.
      PERFORM EVENTS.
      PERFORM ALV_DISPLAY.
    *********************FORMS*******************************************
    *&      Form  validate
          text
    -->  p1        text
    <--  p2        text
    FORM VALIDATE .
      SELECT SINGLE VBELN
                    FROM VBAP
                    INTO V_VBELN
                    WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'enter valid vbeln'.
      ENDIF.
    ENDFORM.                    " validate
    *&      Form  get_details
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DETAILS .
      SELECT VBELN
             POSNR
             MATNR
             FROM VBAP
             INTO TABLE IT_VBAP
             WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'no details found'.
      ENDIF.
    ENDFORM.                    " get_details
    *&      Form  fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM FIELDCAT .
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'VBELN'.
      WA_FIELDCAT-OUTPUTLEN = 10.
      WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'POSNR'.
      WA_FIELDCAT-OUTPUTLEN = 6.
      WA_FIELDCAT-SELTEXT_L = 'ITEM'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-OUTPUTLEN = 18.
      WA_FIELDCAT-SELTEXT_L = 'MATERIAL NO'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    " fieldcat
    *&      Form  LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM LAYOUT .
      WA_LAYOUT-ZEBRA = 'X'.
    ENDFORM.                    " LAYOUT
    *&      Form  VARIANT
          text
    -->  p1        text
    <--  p2        text
    FORM VARIANT .
      CLEAR G_VARIANT.
      G_VARIANT-REPORT = SY-REPID.
    ENDFORM.                    " VARIANT
    *&      Form  SAVE
          text
    -->  p1        text
    <--  p2        text
    FORM SAVE .
      CLEAR G_SAVE.
      G_SAVE = 'A'.
    ENDFORM.                    " SAVE
    *&      Form  EVENTS
          text
    -->  p1        text
    <--  p2        text
    FORM EVENTS .
      CLEAR XS_EVENTS.
      XS_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
      XS_EVENTS-FORM = 'TOP_OF_PAGE'.
      APPEND XS_EVENTS TO G_EVENTS.
    ENDFORM.                    " EVENTS
    *&      Form  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      WRITE :/ ' INTELLI GROUP'.
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  ALV_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    FORM ALV_DISPLAY .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
         I_CALLBACK_PROGRAM             = SY-REPID
         I_CALLBACK_PF_STATUS_SET       = PF_STATUS
         I_CALLBACK_USER_COMMAND        = USER_COMMAND
      I_STRUCTURE_NAME               =
         IS_LAYOUT                      = WA_LAYOUT
         IT_FIELDCAT                    = IT_FIELDCAT
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
         I_SAVE                         = G_SAVE
         IS_VARIANT                     = G_VARIANT
         IT_EVENTS                      = G_EVENTS
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        TABLES
          T_OUTTAB                       = IT_VBAP
       EXCEPTIONS
         PROGRAM_ERROR                  = 1
         OTHERS                         = 2
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " ALV_DISPLAY
    *&      Form  SET_PF_STATUS
          text
    FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'Z50651_PFSTATUS' EXCLUDING EXTAB.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  SET_USER_COMMAND
          text
    FORM SET_USER_COMMAND USING R_UCOMM
                                RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN 'DC'.
          READ TABLE IT_VBAP INDEX RS_SELFIELD-TABINDEX.
          IF SY-SUBRC = 0.
            SELECT SINGLE MTART
                          FROM MARA
                          INTO V_MTART
                          WHERE MATNR = IT_VBAP-MATNR.
            IF SY-SUBRC <> 0.
       MESSAGE E000 WITH 'NO MATERIAL DESCRIPTION FOR SELECTED MATERIAL NO'.
            ELSE.
              WRITE :/ 'MATERIAL NO :',IT_VBAP-MATNR.
              WRITE :/ 'MATERIAL TYPE :' , V_MTART.
            ENDIF.
          ENDIF.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN 'CLOSE'.
          CALL TRANSACTION 'SE38'.
      ENDCASE.
    REPORT  Z_ALV_INTERACTIVE  MESSAGE-ID ZMSG_50651
                                    LINE-SIZE 100
                                    LINE-COUNT 60
                                    NO STANDARD PAGE HEADING.
    ******************TABLES DECLARATION*****************
    TABLES : VBAP,MARA.
    *****************TYPE POOLS**************************
    TYPE-POOLS : SLIS.
    ****************INTERNAL TABLES**********************
    DATA : BEGIN OF IT_VBAP OCCURS 0,
    VBELN LIKE VBAP-VBELN, "SALES DOCUMENT
    POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM
    MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER
    END OF IT_VBAP.
    ****************TEMPORARY VARIABLES******************
    DATA : V_VBELN LIKE VBAP-VBELN."SALES DOCUMENT
    DATA : V_MTART LIKE MARA-MTART. "MATERIAL TYPE
    *****************FIELD CATALOG***********************
    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    ****************LAYOUT*******************************
    DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    ***************VARIANT*******************************
    DATA : G_VARIANT LIKE DISVARIANT.
    ****************SAVE*********************************
    DATA : G_SAVE(1) TYPE C.
    *****************EVENTS******************************
    DATA : XS_EVENTS TYPE SLIS_ALV_EVENT,
           G_EVENTS TYPE SLIS_T_EVENT.
    ******************PF STATUS**************************
    DATA : PF_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS'.
    ******************USER COMMAND************************
    DATA : USER_COMMAND TYPE SLIS_FORMNAME VALUE 'SET_USER_COMMAND',
           R_UCOMM LIKE SY-UCOMM.
    ****************SELECTION SCREEN************************
    SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.
    ***************AT SELECTION SCREEN*********************
    AT SELECTION-SCREEN.
      PERFORM VALIDATE.
    **************START-OF-SELECTION**************************
    START-OF-SELECTION.
      PERFORM GET_DETAILS.
      PERFORM FIELDCAT.
      PERFORM LAYOUT.
      PERFORM VARIANT.
      PERFORM SAVE.
      PERFORM EVENTS.
      PERFORM ALV_DISPLAY.
    *********************FORMS*******************************************
    *&      Form  validate
          text
    -->  p1        text
    <--  p2        text
    FORM VALIDATE .
      SELECT SINGLE VBELN
                    FROM VBAP
                    INTO V_VBELN
                    WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'enter valid vbeln'.
      ENDIF.
    ENDFORM.                    " validate
    *&      Form  get_details
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DETAILS .
      SELECT VBELN
             POSNR
             MATNR
             FROM VBAP
             INTO TABLE IT_VBAP
             WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'no details found'.
      ENDIF.
    ENDFORM.                    " get_details
    *&      Form  fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM FIELDCAT .
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'VBELN'.
      WA_FIELDCAT-OUTPUTLEN = 10.
      WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'POSNR'.
      WA_FIELDCAT-OUTPUTLEN = 6.
      WA_FIELDCAT-SELTEXT_L = 'ITEM'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-OUTPUTLEN = 18.
      WA_FIELDCAT-SELTEXT_L = 'MATERIAL NO'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    " fieldcat
    *&      Form  LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM LAYOUT .
      WA_LAYOUT-ZEBRA = 'X'.
    ENDFORM.                    " LAYOUT
    *&      Form  VARIANT
          text
    -->  p1        text
    <--  p2        text
    FORM VARIANT .
      CLEAR G_VARIANT.
      G_VARIANT-REPORT = SY-REPID.
    ENDFORM.                    " VARIANT
    *&      Form  SAVE
          text
    -->  p1        text
    <--  p2        text
    FORM SAVE .
      CLEAR G_SAVE.
      G_SAVE = 'A'.
    ENDFORM.                    " SAVE
    *&      Form  EVENTS
          text
    -->  p1        text
    <--  p2        text
    FORM EVENTS .
      CLEAR XS_EVENTS.
      XS_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
      XS_EVENTS-FORM = 'TOP_OF_PAGE'.
      APPEND XS_EVENTS TO G_EVENTS.
    ENDFORM.                    " EVENTS
    *&      Form  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      WRITE :/ ' INTELLI GROUP'.
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  ALV_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    FORM ALV_DISPLAY .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
         I_CALLBACK_PROGRAM             = SY-REPID
       I_CALLBACK_PF_STATUS_SET         = PF_STATUS
         I_CALLBACK_USER_COMMAND        = USER_COMMAND
      I_STRUCTURE_NAME               =
         IS_LAYOUT                      = WA_LAYOUT
         IT_FIELDCAT                    = IT_FIELDCAT
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
         I_SAVE                         = G_SAVE
        IS_VARIANT                      = G_VARIANT
         IT_EVENTS                      = G_EVENTS
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        TABLES
          T_OUTTAB                       = IT_VBAP
       EXCEPTIONS
         PROGRAM_ERROR                  = 1
         OTHERS                         = 2
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " ALV_DISPLAY
    *&      Form  SET_PF_STATUS
          text
    FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STANDARD' EXCLUDING EXTAB.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  SET_USER_COMMAND
          text
    FORM SET_USER_COMMAND USING R_UCOMM
                                RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN 'DC'.
          READ TABLE IT_VBAP INDEX RS_SELFIELD-TABINDEX.
          IF SY-SUBRC = 0.
            SELECT SINGLE MTART
                          FROM MARA
                          INTO V_MTART
                          WHERE MATNR = IT_VBAP-MATNR.
            IF SY-SUBRC <> 0.
       MESSAGE E000 WITH 'NO MATERIAL DESCRIPTION FOR SELECTED MATERIAL NO'.
            ELSE.
              WRITE :/ 'MATERIAL NO :',IT_VBAP-MATNR.
              WRITE :/ 'MATERIAL TYPE :' , V_MTART.
      SUBMIT SLIS_DUMMY WITH P_MATNR EQ IT_VBAP-MATNR
                        WITH P_MTART EQ V_MTART.
            ENDIF.
          ENDIF.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN 'CLOSE'.
          CALL TRANSACTION 'SE38'.
      ENDCASE.
    plz reward if useful

  • Can someone help with splitting a Linked List.??

    Any help would be awesome!!!
    My code just will not work!! Any help would be appreciated! My problem is in the last method SplitAt. These are the conditions set and my code:
    Splitting a Linked List at a Given Node, into Two Sublists
    a. Add the following as an abstract method to the class
    LinkedListClass:
    public void splitAt (LinkedListClass<T> secondList, T item);
    //This method splits the list at the node with the info item into two sublists.
    //Precondition: The list must exist.
    //Postcondition: first and last point to the first and last nodes of the first sublist,
    // respectively. secondList.first and secondList.last point to the first
    // and last nodes of the second sublist.
    Consider the following statements:
    UnorderedLinkedList<Integer> myList;
    UnorderedLinkedList<Integer> otherList;
    Suppose myList points to the list with the elements 34, 65, 18, 39, 27, 89, and 12 (in this order). The statement
    myList.splitAt(otherList, 18);
    splits myList into two sublists: myList points to the list with elements 34 and 65, and otherList points to the sublist with elements 18, 39, 27, 89, and 12.
    b. Provide the definition of the method splitAt in the class UnorderedLinkedList. Also write a program to test your method.
    public class UnorderedLinkedList<T> extends LinkedListClass<T>
           //Default constructor
        public UnorderedLinkedList()
            super();
            //Method to determine whether searchItem is in
            //the list.
            //Postcondition: Returns true if searchItem is found
            //               in the list; false otherwise.
        public boolean search(T searchItem)
            LinkedListNode<T> current; //variable to traverse
                                       //the list
            boolean found;
            current = first;  //set current to point to the first
                              //node in the list
            found = false;    //set found to false
            while (current != null && !found) //search the list
                if (current.info.equals(searchItem)) //item is found
                    found = true;
                else
                   current = current.link; //make current point to
                                           //the next node
            return found;
            //Method to insert newItem in the list.
            //Postcondition: first points to the new list
            //               and newItem is inserted at the
            //               beginning of the list. Also,
            //               last points to the last node and
            //               count is incremented by 1.
        public void insertFirst(T newItem)
            LinkedListNode<T> newNode;     //variable to create the
                                        //new node
            newNode =
               new LinkedListNode<T>(newItem, first); //create and
                                           //insert newNode before
                                           //first
            first = newNode;   //make first point to the
                               //actual first node
            if (last == null)   //if the list was empty, newNode is
                                //also the last node in the list
                last = newNode;
            count++;     //increment count
            //Method to insert newItem at the end of the list.
            //Postcondition: first points to the new list and
            //               newItem is inserted at the end
            //               of the list. Also, last points to
            //               the last node and
            //               count is incremented by 1.
        public void insertLast(T newItem)
            LinkedListNode newNode; //variable to create the
                                    //new node
            newNode =
               new LinkedListNode(newItem, null);  //create newNode
            if (first == null)  //if the list is empty, newNode is
                                //both the first and last node
                first = newNode;
                last = newNode;
            else     //if the list is not empty, insert
                     //newNode after last
                last.link = newNode; //insert newNode after last
                last = newNode;      //set last to point to the
                                     //actual last node
            count++;
        }//end insertLast
            //Method to delete deleteItem from the list.
            //Postcondition: If found, the node containing
            //               deleteItem is deleted from the
            //               list. Also, first points to the first
            //               node, last points to the last
            //               node of the updated list, and count
            //               is decremented by 1.
        public void deleteNode(T deleteItem)
            LinkedListNode<T> current; //variable to traverse
                                       //the list
            LinkedListNode<T> trailCurrent; //variable just
                                            //before current
            boolean found;
            if ( first == null)    //Case 1; the list is empty
                System.err.println("Cannot delete from an empty "
                                 + "list.");
            else
                if (first.info.equals(deleteItem)) //Case 2
                    first = first.link;
                       if (first == null)  //the list had only one node
                          last = null;
                       count--;
                else  //search the list for the given info
                    found = false;
                    trailCurrent = first; //set trailCurrent to
                                          //point to the first node
                    current = first.link; //set current to point to
                                          //the second node
                    while (current != null && !found)
                        if (current.info.equals(deleteItem))
                            found = true;
                        else
                            trailCurrent = current;
                            current = current.link;
                    }//end while
                    if (found) //Case 3; if found, delete the node
                        count--;
                        trailCurrent.link = current.link;
                        if (last == current)  //node to be deleted
                                              //was the last node
                           last = trailCurrent;  //update the value
                                                 //of last
                    else
                       System.out.println("Item to be deleted is "
                                        + "not in the list.");
                }//end else
            }//end else
        }//end deleteNode
        public void splitAt(LinkedListClass<T> secondList, T item)
         LinkedListNode<T> current;
         LinkedListNode<T> trailCurrent;
         int i;
         boolean found;
         if (first==null)
        System.out.println("Empty.");
        first=null;
        last=null;
        count--;
         else
              current=first;
              found=false;
              i=1;
              while(current !=null &&!found)
                   if(current.info.equals(secondList))
                       found= true;
                       else
                            trailCurrent=current;
                            i++;
              if(found)
                   if(first==current)
                        first=first;
                        last=last;
                        count=count;
                        count=0;
                   else
                        first=current;
                        last=last;
                        last=null;
                        count = count- i+1;
                        count = i-1;
                   else
                        System.out.println("Item to be split at is "
                             + "not in the list.");
                   first=null;
                   last=null;
                   count=0;
        }Edited by: romeAbides on Oct 10, 2008 1:24 PM

    I dont have a test program at all. The program is supposed to prompt for user input of numbers. (it does) Take the input and end at input of -999 (it does). Then it asks user where it wants to split list (it does). When I enter a number it does nothing after that. I am going to post updated code and see if that helps along with all the classes. Thanks!
    This is the class to prompt:
    import java.util.*;
    public class Ch16_ProgEx6
        static Scanner console = new Scanner(System.in);
         public static void main(String[] args)
             UnorderedLinkedList<Integer> list
                              = new UnorderedLinkedList<Integer>();
            UnorderedLinkedList<Integer> subList =
                              new UnorderedLinkedList<Integer>();
             Integer num;
             System.out.println("Enter integers ending with -999.");
             num = console.nextInt();
             while (num != -999)
                 list.insertLast(num);
                 num = console.nextInt();
            System.out.println();
            System.out.println("list: ");
            list.print();
            System.out.println();
            System.out.println("Length of list: " + list.length());
            System.out.print("Enter the number at which to split list: ");
            num = console.nextInt();
            list.splitAt(subList, num);
            System.out.println("Lists after splitting list");
            System.out.print("list: ");
            list.print();
            System.out.println();
            System.out.println("Length of list: " + list.length());
            System.out.print("sublist: ");
            subList.print();
            System.out.println();
            System.out.println("Length of sublist: " + subList.length());
    }This is the ADT:
    public interface LinkedListADT<T> extends Cloneable
        public Object clone();
           //Returns a copy of objects data in store.
           //This method clones only the references stored in
           //each node of the list. The objects that the
           //list nodes point to are not cloned.
        public boolean isEmptyList();
           //Method to determine whether the list is empty.
           //Postcondition: Returns true if the list is empty;
           //               false otherwise.
        public void initializeList();
           //Method to initialize the list to an empty state.
           //Postcondition: The list is initialized to an empty
           //               state.
        public void print();
           //Method to output the data contained in each node.
        public int length();
           //Method to return the number of nodes in the list.
           //Postcondition: The number of nodes in the list is
           //               returned.
        public T front();
           //Method to return a reference of the object containing
           //the data of the first node of the list.
           //Precondition: The list must exist and must not be empty.
           //Postcondition: The reference of the object that
           //               contains the info of the first node
           //               is returned.
        public T back();
           //Method to return a reference of object containing
           //the data of the last node of the list.
           //Precondition: The list must exist and must not be empty.
           //Postcondition: The reference of the object that
           //               contains the info of the last node
           //               is returned.
        public boolean search(T searchItem);
           //Method to determine whether searchItem is in the list.
           //Postcondition: Returns true if searchItem is found
           //               in the list; false otherwise.
        public void insertFirst(T newItem);
           //Method to insert newItem in the list.
           //Postcondition: newItem is inserted at the
           //               beginning of the list.
        public void insertLast(T newItem);
           //Method to insert newItem at the end of the list.
           //Postcondition: newItem is inserted at the end
           //               of the list.
        public void deleteNode(T deleteItem);
           //Method to delete deleteItem from the list.
           //Postcondition: If found, the node containing
           //               deleteItem is deleted from the
           //               list.
        public void splitAt(LinkedListClass<T> secondList, T item);
    }This is the linked list class:
    import java.util.NoSuchElementException;
    public abstract class LinkedListClass<T> implements LinkedListADT<T>
        protected class LinkedListNode<T> implements Cloneable
            public T info;
            public LinkedListNode<T> link;
               //Default constructor
               //Postcondition: info = null; link = null;
            public LinkedListNode()
                info = null;
                link = null;
               //Constructor with parameters
               //This method sets info pointing to the object to
               //which elem points to and link is set to point to
               //the object to which ptr points to.
               //Postcondition:  info = elem; link = ptr;
            public LinkedListNode(T elem, LinkedListNode<T> ptr)
                info = elem;
                link = ptr;
               //Returns a copy of objects data in store.
               //This method clones only the references stored in
               //the node. The objects that the nodes point to
               //are not cloned.
            public Object clone()
                LinkedListNode<T> copy = null;
                try
                    copy = (LinkedListNode<T>) super.clone();
                catch (CloneNotSupportedException e)
                    return null;
                return copy;
               //Method to return the info as a string.
               //Postcondition: info as a String object is
               //               returned.
            public String toString()
                return info.toString();
        } //end class LinkedListNode
        public class LinkedListIterator<T>
            protected LinkedListNode<T> current;  //variable to
                                                  //point to the
                                                  //current node in
                                                  //list
            protected LinkedListNode<T> previous; //variable to
                                                  //point to the
                                                  //node before the
                                                  //current node
               //Default constructor
               //Sets current to point to the first node in the
               //list and sets previous to null.
               //Postcondition: current = first; previous = null;
            public LinkedListIterator()
                current = (LinkedListNode<T>) first;
                previous = null;
               //Method to reset the iterator to the first node
               //in the list.
               //Postcondition: current = first; previous = null;
            public void reset()
                current = (LinkedListNode<T>) first;
                previous = null;
               //Method to return a reference of the info of the
               //current node in the list and to advance iterator
               //to the next node.
               //Postcondition: previous = current;
               //               current = current.link;
               //               A refrence of the current node
               //               is returned.
            public T next()
                if (!hasNext())
                    throw new NoSuchElementException();
                LinkedListNode<T> temp = current;
                previous = current;
                current = current.link;
                return temp.info;
                //Method to determine whether there is a next
                //element in the list.
                //Postcondition: Returns true if there is a next
                //               node in the list; otherwise
                //               returns false.
            public boolean hasNext()
                return (current != null);
               //Method to remove the node currently pointed to
               //by the iterator.
               //Postcondition: If iterator is not null, then the
               //               node that the iterator points to
               //               is removed. Otherwise the method
               //               throws NoSuchElementException.
            public void remove()
                if (current == null)
                    throw new NoSuchElementException();
                if (current == first)
                    first = first.link;
                    current = (LinkedListNode<T>) first;
                    previous = null;
                    if (first == null)
                        last = null;
                else
                    previous.link = current.link;
                    if (current == last)
                        last = first;
                        while (last.link != null)
                            last = last.link;
                    current = current.link;
                count--;
               //Method to return the info as a string.
               //Postcondition: info as a String object is returned.
            public String toString()
                return current.info.toString();
        } //end class LinkedListIterator
           //Instance variables of the class LinkedListClass
        protected LinkedListNode<T> first; //variable to store the
                                           //address of the first
                                           //node of the list
        protected LinkedListNode<T> last;  //variable to store the
                                           //address of the last
                                           //node of the list
        protected int count;  //variable to store the number of
                              //nodes in the list
           //Default constructor
           //Initializes the list to an empty state.
           //Postcondition: first = null, last = null,
           //               count = 0
        public LinkedListClass()
            first = null;
            last = null;
            count = 0;
           //Method to determine whether the list is empty.
           //Postcondition: Returns true if the list is empty;
           //               false otherwise.
        public boolean isEmptyList()
            return (first == null);
           //Method to initialize the list to an empty state.
           //Postcondition: first = null, last = null,
           //               count = 0
        public void initializeList()
            first = null;
            last = null;
            count = 0;
           //Method to output the data contained in each node.
        public void print()
            LinkedListNode<T> current; //variable to traverse
                                       //the list
            current = first;    //set current so that it points to
                                //the first node
            while (current != null) //while more data to print
                System.out.print(current.info + " ");
                current = current.link;
        }//end print
           //Method to return the number of nodes in the list.
           //Postcondition: The value of count is returned.
        public int length()
            return count;
           //Method to return a reference of the object containing
           //the data of the first node of the list.
           //Precondition: The list must exist and must not be empty.
           //Postcondition: The reference of the object that
           //               contains the info of the first node
           //               is returned.
        public T front()
            return first.info;
            //Method to return a reference of object containing
            //the data of the last node of the list.
            //Precondition: The list must exist and must not be empty.
            //Postcondition: The reference of the object that
            //               contains the info of the last node
            //               is returned.
        public T back()
            return last.info;
           //Returns a copy of objects data in store.
           //This method clones only the references stored in
           //each node of the list. The objects that the
           //list nodes point to are not cloned.
        public Object clone()
            LinkedListClass<T> copy = null;
            try
                copy = (LinkedListClass<T>) super.clone();
            catch (CloneNotSupportedException e)
                return null;
                //If the list is not empty clone each node of
                //the list.
            if (first != null)
                   //Clone the first node
                copy.first = (LinkedListNode<T>) first.clone();
                copy.last = copy.first;
                LinkedListNode<T> current;
                if (first != null)
                    current = first.link;
                else
                    current = null;
                   //Clone the remaining nodes of the list
                while (current != null)
                    copy.last.link =
                            (LinkedListNode<T>) current.clone();
                    copy.last = copy.last.link;
                    current = current.link;
            return copy;
           //Method to return an iterator of the list.
           //Postcondition: An iterator is instantiated and
           //               returned.
        public LinkedListIterator<T> iterator()
            return new LinkedListIterator<T>();
           //Method to determine whether searchItem is in
           //the list.
           //Postcondition: Returns true if searchItem is found
           //               in the list; false otherwise.
        public abstract boolean search(T searchItem);
           //Method to insert newItem in the list.
           //Postcondition: first points to the new list
           //               and newItem is inserted at the
           //               beginning of the list. Also,
           //               last points to the last node and
           //               count is incremented by 1.
        public abstract void insertFirst(T newItem);
           //Method to insert newItem at the end of the list.
           //Postcondition: first points to the new list and
           //               newItem is inserted at the end
           //               of the list. Also, last points to
           //               the last node and
           //               count is incremented by 1.
        public abstract void insertLast(T newItem);
           //Method to delete deleteItem from the list.
           //Postcondition: If found, the node containing
           //               deleteItem is deleted from the
           //               list. Also, first points to the first
           //               node, last points to the last
           //               node of the updated list, and count
           //               is decremented by 1.
        public abstract void deleteNode(T deleteItem);
        public abstract void splitAt(LinkedListClass<T> secondList, T item);
    }And this is the UnorderedLinked Class with the very last method the one being Im stuck on. The SplitAt Method.
    public class UnorderedLinkedList<T> extends LinkedListClass<T>
           //Default constructor
        public UnorderedLinkedList()
            super();
            //Method to determine whether searchItem is in
            //the list.
            //Postcondition: Returns true if searchItem is found
            //               in the list; false otherwise.
        public boolean search(T searchItem)
            LinkedListNode<T> current; //variable to traverse
                                       //the list
            boolean found;
            current = first;  //set current to point to the first
                              //node in the list
            found = false;    //set found to false
            while (current != null && !found) //search the list
                if (current.info.equals(searchItem)) //item is found
                    found = true;
                else
                   current = current.link; //make current point to
                                           //the next node
            return found;
            //Method to insert newItem in the list.
            //Postcondition: first points to the new list
            //               and newItem is inserted at the
            //               beginning of the list. Also,
            //               last points to the last node and
            //               count is incremented by 1.
        public void insertFirst(T newItem)
            LinkedListNode<T> newNode;     //variable to create the
                                        //new node
            newNode =
               new LinkedListNode<T>(newItem, first); //create and
                                           //insert newNode before
                                           //first
            first = newNode;   //make first point to the
                               //actual first node
            if (last == null)   //if the list was empty, newNode is
                                //also the last node in the list
                last = newNode;
            count++;     //increment count
            //Method to insert newItem at the end of the list.
            //Postcondition: first points to the new list and
            //               newItem is inserted at the end
            //               of the list. Also, last points to
            //               the last node and
            //               count is incremented by 1.
        public void insertLast(T newItem)
            LinkedListNode newNode; //variable to create the
                                    //new node
            newNode =
               new LinkedListNode(newItem, null);  //create newNode
            if (first == null)  //if the list is empty, newNode is
                                //both the first and last node
                first = newNode;
                last = newNode;
            else     //if the list is not empty, insert
                     //newNode after last
                last.link = newNode; //insert newNode after last
                last = newNode;      //set last to point to the
                                     //actual last node
            count++;
        }//end insertLast
            //Method to delete deleteItem from the list.
            //Postcondition: If found, the node containing
            //               deleteItem is deleted from the
            //               list. Also, first points to the first
            //               node, last points to the last
            //               node of the updated list, and count
            //               is decremented by 1.
        public void deleteNode(T deleteItem)
            LinkedListNode<T> current; //variable to traverse
                                       //the list
            LinkedListNode<T> trailCurrent; //variable just
                                            //before current
            boolean found;
            if ( first == null)    //Case 1; the list is empty
                System.err.println("Cannot delete from an empty "
                                 + "list.");
            else
                if (first.info.equals(deleteItem)) //Case 2
                    first = first.link;
                       if (first == null)  //the list had only one node
                          last = null;
                       count--;
                else  //search the list for the given info
                    found = false;
                    trailCurrent = first; //set trailCurrent to
                                          //point to the first node
                    current = first.link; //set current to point to
                                          //the second node
                    while (current != null && !found)
                        if (current.info.equals(deleteItem))
                            found = true;
                        else
                            trailCurrent = current;
                            current = current.link;
                    }//end while
                    if (found) //Case 3; if found, delete the node
                        count--;
                        trailCurrent.link = current.link;
                        if (last == current)  //node to be deleted
                                              //was the last node
                           last = trailCurrent;  //update the value
                                                 //of last
                    else
                       System.out.println("Item to be deleted is "
                                        + "not in the list.");
                }//end else
            }//end else
        }//end deleteNode
        public void splitAt(LinkedListClass<T> secondList, T item)
         LinkedListNode<T> current;
         LinkedListNode<T> trailCurrent;
         int i;
         boolean found;
         if (first==null)
        System.out.println("Empty.");
        first=null;
        last=null;
        count--;
        count=0;
         else
              current=first;
              found=false;
              i=1;
              while(current !=null &&!found)
                   if(current.info.equals(item))
                       found= true;
                       else
                            trailCurrent=first;
                            current=first;
                            i++;
              if(found)
                   if(first==current)
                        first.link=first;
                        last.link=last;
                           count--;
                        count=0;
                   else
                        first.link=current;
                        last.link=last;
                        last=null;
                        count = count- i+1;
                        count = i-1;
              } else  {
                  System.out.println("Item to be split at is "
                    + "not in the list.");
                   first=null;
                   last=null;
                   count=0;
        Any help or just advice would be fine. Im not the best at Java, better at VB. Am completely stumped! Thanks so much!

  • Help needed in Drop down list value input

    Hi experts,
    My problem is, I added a field on a screen as a drop down list box and passed all the values to it. Everything is fine. But I need to display the field like if there are no input values to be used by the user, the user should be able to enter some value manually which is not in the list. I'm unable to get this facility. Plzz Help me out.
    It's really urgent. Points will be rewarded to the solution.

    hi ,
    Here is a sample of code for creating a dropdown list in screen painter , and this has got the solution of your question :
    module create_drop_down_box_material output.
      select matnr from mara
               into table l_tab_mara_matnr
               where matkl = 'ZPMBMAT'.
      if not l_tab_mara_matnr[] is initial.
        select maktx from makt
                     into  l_tab_collect_maktx_frm_db-material_descr
                     for all entries in l_tab_mara_matnr
                     where matnr = l_tab_mara_matnr-material_no.
          append l_tab_collect_maktx_frm_db.
        endselect.
      endif.
      loop at l_tab_collect_maktx_frm_db into l_wa_collect_maktx_frm_db.
        l_wa_mat_descr-key = l_wa_collect_maktx_frm_db-material_descr.
        append l_wa_mat_descr to l_tab_mat_descr.
      endloop.
      name = 'ZCOT_PPT_DTLS-MATERIAL_DESCR'.
      call function 'VRM_SET_VALUES'
        exporting
          id              = name
          values          = l_tab_mat_descr
        exceptions
          id_illegal_name = 1
          others          = 2.
      free: l_tab_mat_descr,l_tab_collect_maktx_frm_db.
    endmodule.                 " create_drop_down_box_material  OUTPUT
    Regards,
    Ranjita

  • Create a linked list

    Hi guys!
    I read the manual of java 2 and says that is not that pointers don't exist, they do exist but they are not explicit as they are in C languagge. So in need to create a circular linked list how can I do this? The instructions of the manual are not so clear. Does anyone have an idea and can give me a sample code?
    Thanks to all
    Maddy

    References are like pointers except that you cannot make any add operation on them. But you can of course change their values to make it point to other objects.
    This also means that you can create graph objects and every data structure you like. For example :
    class BinaryNode {
        public Object data;
        public BinaryNode left;
        public BinaryNode right;
    }To create binary trees or
    class GraphNode {
        public Object data;
        public ArrayList links;
    }Where links is a Java list containing a list of links (references) to other GraphNode.
    Matthieu

  • Help with creating a price list

    I'm just wondering if anybody could possibly help me when creating a price list?. I'm new to SAP so don't have a great knowledge of it.
    Our company needs to send out a wholesale price list to customers, however some of the items we stock do not include vat, when the price list is previewed it doesnt show which items include vat or exclusive of vat. this information could do with being visible to make it clearer to the customers.
    Is there anyway the priclist could be exported to microsoft excel etc for editing?
    many thanks.

    go to inventory--prce lists-Price List.
    double click on the price list you want.
    It will open the new window showing Items with prices.
    Click on the Excel icon on menu bar on the top.
    save file as .xls.

  • How do you create a linked list

    i need a linked list to hold data which would be words so that the words can be held by the linked list and appear in alphabetica order?

    public class DoubleLink1
         private NodeData head;
         private NodeData tail;
         public DoubleLink1()
         this.tail = null;
         this.head = null;
         public void add(Contact info)
         NodeData newNode = new NodeData(info);
         if(head != null)
         newNode.next = head;
         head.prev = newNode;
         head = newNode;
         else
         head = tail = newNode;
         public Contact retrieve(String name)
         NodeData current = head;
         while(current !=null)
         if(current.data.getName().equals(name))
         return current.data;
         current = current.next;
         return null;
         public void traverse()
         NodeData current = head;
         while(current !=null)
    //     current.getData());print();
         current = current.next;
         public boolean delPhoneNum(String name)
         NodeData current = head;
         NodeData previous = head.prev;
         NodeData next = head.next;
         boolean found = false;
         if (head == null)
         return false;
         while(current != null)
         if(current.data.getName().equals(name))
         found = true;
         return found;
         previous = current;
         current = current.next;
         if (current != null)
         next = current.next;
         if (found)
         if (previous == null)
         head = head.next;
         else if (next == null)
         tail = tail.prev;
         else
         previous = current.next;
         next = current.prev;
         return found;
         }//DoubleLink
    so i have this linked list..how can i apply it to my program with the words instead of the numbers and phone contact

  • Help - can't print linked list object

    Hi all,
    I've written a program that creates an Airplane object. I've added the Airplane object to a linked list. I am trying to test by printing the linked list..but I get the addresses of the airplane object instead of the integer variables that the Airplane object contains. How can I fix this? Here's my output showing what I am talking about:
    Airplane type: 2
    Airplane arrival time: 600
    Airplane cleaning time: 45
    Airplane take-off time: 645
    [Airplane@665753]
    Airplane type: 3
    Airplane arrival time: 1100
    Airplane cleaning time: 60
    Airplane take-off time: 1160
    [Airplane@665753, Airplane@ef22f8]
    Airplane type: 1
    Airplane arrival time: 900
    Airplane cleaning time: 30
    Airplane take-off time: 930
    [Airplane@665753, Airplane@ef22f8, Airplane@e0cf70]
    Airplane type: 1
    Airplane arrival time: 1100
    Airplane cleaning time: 30
    Airplane take-off time: 1130
    [Airplane@665753, Airplane@ef22f8, Airplane@e0cf70, Airplane@52fe85]
    Airplane type: 3
    Airplane arrival time: 1000
    Airplane cleaning time: 60
    Airplane take-off time: 1060
    [Airplane@665753, Airplane@ef22f8, Airplane@e0cf70, Airplane@52fe85, Airplane@c40c80]
    Airplane type: 2
    Airplane arrival time: 900
    Airplane cleaning time: 45
    Airplane take-off time: 945
    [Airplane@665753, Airplane@ef22f8, Airplane@e0cf70, Airplane@52fe85, Airplane@c40c80, Airplane@10d81b]
    Airplane type: 2
    Airplane arrival time: 900
    Airplane cleaning time: 45
    Airplane take-off time: 945
    [Airplane@665753, Airplane@ef22f8, Airplane@e0cf70, Airplane@52fe85, Airplane@c40c80, Airplane@10d81b, Airplane@dbe178]
    Airplane type: 3
    Airplane arrival time: 1000
    Airplane cleaning time: 60
    Airplane take-off time: 1060
    [Airplane@665753, Airplane@ef22f8, Airplane@e0cf70, Airplane@52fe85, Airplane@c40c80, Airplane@10d81b, Airplane@dbe178, Airplane@af9e22]
    Airplane type: 1
    Airplane arrival time: 900
    Airplane cleaning time: 30
    Airplane take-off time: 930
    [Airplane@665753, Airplane@ef22f8, Airplane@e0cf70, Airplane@52fe85, Airplane@c40c80, Airplane@10d81b, Airplane@dbe178, Airplane@af9e22, Airplane@b6ece5]
    Airplane type: 1
    Airplane arrival time: 700
    Airplane cleaning time: 30
    Airplane take-off time: 730
    [Airplane@665753, Airplane@ef22f8, Airplane@e0cf70, Airplane@52fe85, Airplane@c40c80, Airplane@10d81b, Airplane@dbe178, Airplane@af9e22, Airplane@b6ece5, Airplane@7ace8d]
    Airplane@665753
    import java.io.*;
    import java.util.*;
    public class AirPortSimulator {
         public static void main(String[] args) {
              LinkedList<Airplane> myEventList = new LinkedList();
                   //for loop to test random number generator for airplane type
              for( int i = 0; i < 10; i++){
                   int parOne = myNumber();
                   System.out.println("Airplane type: " + parOne);
                   int parTwo = myTime();
                   System.out.println("Airplane arrival time: " + parTwo);
                   int parThree = 0;
                   switch(parOne){
                   case 1: parThree = 30;break;
                   case 2: parThree = 45;break;
                   case 3: parThree = 60;break;
                   System.out.println("Airplane cleaning time: " + parThree);
                   int parFour=0;
                   switch(parOne){
                   case 1:     parFour = parTwo + 30;break;
                   case 2: parFour = parTwo + 45;break;
                   case 3: parFour = parTwo + 60;break;
                   System.out.println("Airplane take-off time: " + parFour);
                   System.out.println();
                   Airplane myAirplane = new Airplane(parOne, parTwo, parThree, parFour);
                   myEventList.addLast(myAirplane);
                   System.out.println(myEventList);
                   System.out.println();
         public static int myTime(){
              Random generator = new Random();
              int number = generator.nextInt(16)+1;
              number = number * 100;
              if (number < 600){
                   number = number + 600;
              return number;
         public static int myNumber(){
              Random generator = new Random();
              return generator.nextInt(3)+1;
    }

    I've written a method before that prints all the
    elements of a linked list..but that method onlyheld
    one integer or string...it was a "while (head !=
    null) loop that traversed the list and printed
    "head.info"
    But i'm confused with an object that has 4integers
    inside it...You don't have to write any kind of loop. The
    LinkedList implementation of toString does that for
    you. All you have to do is write a toString for
    Airplane that prints whatever you feel is important
    for a single Airplane object.
    But note that since the list uses commas to separate
    entries, your toString method will be clearer if you
    can write it in such a way that it doesn't use
    commas, or so that you can see where the output
    begins and ends. For example, maybe you can wrap the
    output with curly brackets.Thanks, I just had to understand what the toString method was and then how to override it. This works well:
    Thank you for pointing me in the right direction.
    aiki985
    public String toString(){
                  return "{" + airplaneType + ", " + arrivalTime + ", " +
                                  waitingTime + ", " + departureTime + "}";
              } // end toString method

  • How can you create a linked list? GUI?

    I have the following program that I wrote:
    package damagecounter;
    import java.io.*;
    import java.util.*;
    public class Main
         public static void main (String[] args) throws Exception
              String logline;
              Player player1 = new Player("Kazzandar");
              try
                   BufferedReader logfile = new BufferedReader(new FileReader("TeilmonRun.txt"));
                   logline = logfile.readLine();
                   while (logline != null)
                        if (logline.startsWith (player1.getName (), 0))
                             if (logline.contains ("recites"))
                                  player1.recites++;
                             if (logline.contains ("rescues"))
                                  player1.rescues++;
                             if (logline.contains ("utters the words"))
                                  player1.spells++;
                             if (logline.contains ("sprawling with a powerful bash."))
                                  player1.bashes++;
                             if (logline.contains ("got toasted by"))
                                  player1.deaths++;
                             if ((logline.contains ("-=")) && (logline.contains ("=-")))
                                  if (logline.startsWith (player1.getName (), 0))
                                       String damage = logline.substring(logline.indexOf ("-=") + 2 , logline.indexOf ("=-"));
                                       player1.setDamage (Integer.parseInt (damage));
                        logline = logfile.readLine ();
              catch (Exception e)
                   System.out.println ("Log file not found or corrupt.");
                   e.printStackTrace();
              player1.printStats();
    }As of right now the code require a person to enter the name of a player and then scans the log file to determine the appropriate counts for that player. If I want to scan the file for multiple players how would I be able to do that without having to run the program over and over. The reason being that sometimes the logs have over 15 different players and I'd hate to have to run the program 15 times to get each players stats. Any suggestions? Would I have to make a linked list?

    Yes, the log file looks something like that. Here is a small 15 line version of what the log file actually looks like:
    Kazzandar's stab misses Icingdeath. -=0=-
    Arien's slash >>> ANNIHILATES <<< Icingdeath! -=118=-
    Arien's slash >>> ANNIHILATES <<< Icingdeath! -=112=-
    Arien's slash <<< ERADICATES >>> Icingdeath! -=158=-
    Parrish utters the words, 'yjrr pzar'.
    Arien rescues Shargaas!
    Kazzandar's counterattack does UNSPEAKABLE things to Icingdeath! -=636=-
    Icingdeath's claw does UNSPEAKABLE things to Arien! -=760=-
    Arien's fireball scratches Icingdeath. -=4=-
    Arien's lightning bolt grazes Icingdeath. -=7=-
    Arien's counterattack -- DESSICATES -- Icingdeath! -=540=-
    Icingdeath's claw COMPLETELY TRASHES Arien! -=802=-
    Arien is DEAD!
    Kitiara's fireball grazes Icingdeath. -=5=-
    Kitiara's lightning bolt grazes Icingdeath. -=8=-
    Almost always the player name is first but sometimes the "mob" name (In this case Icingdeath) comes out. I don't mind if Icingdeath is referenced as a player and included in the stats, not that big a deal. Thanks for the idea on the HashMap I'll looking into how it works. Since this is my first Java program I often find myself lost at where to begin.
    I changed "got toasted by" to "is DEAD!" since it's easier to read. I also changed the majority of the main code into a method for the player class. The main code looks like this now:
    public static void main (String[] args) throws Exception
              Player player1 = new Player("Shargaas");
              player1.scanLogForStats("TeilmonRun.txt");
              player1.printStats();
         I was hoping this would make it easier, anyway, thanks again and I'll definitely be looking into HashMap.

  • How to create two linked lists (Master/Detail or Parent/Child)

    I need to create a couple of related lists in a Master/Detail approach. Users are supposed to choose one "Master" Option, and "Detail" column should be refreshed to display only the items that are strictly related to the chosen option
    in "Master". Any posible solution?
    Thanks in advance.

    One option is to connect two web parts. This will give you option button for your master list web part and based on the value selected your results will be filtered in the detailed list web part. Here is the example. Though it is for SP 2010 it should work
    the same in SP 2013.
    http://sarahlhaase.wordpress.com/2012/05/21/connecting-web-parts-with-a-selector-and-a-detail-pane-sharepoint-2010-version/
    Second option is with some customization using Jquery.
    http://summit7systems.com/creating-a-parentchild-list-relationship-in-sharepoint-2013/
    Amit

  • Need help with creating invoice and list of invoices

    Hello everybody,
    I need to create Credit / Debit memo invoices and for this I try to use FM GN_INVOICE_CREATE in my Z program, please let me know if it is correct way to go?
    As well I need to create list of Credit / Debit memo invoices, how to achieve this?
    Thanks in advance.
    Usefull answers will be awarded.
    Regards, M.

    You can use RV_INVOICE_CREATE for credit memo and debit memo
    list of credit and debit memo - use this FM - RV_INVOICE_LIST_CREATE
    see the below sample code
    refresh: XKOMFK, XKOMV,
               XTHEAD, XVBFS,
               XVBPA,  XVBRK,
               XVBRP,  XVBSS.
      clear  : XKOMFK, XKOMV,
               XTHEAD, XVBFS,
               XVBPA,  XVBRK,
               XVBRP,  XVBSS,
               VBSK_I.
      VBSK_I-SMART = 'F'.
      XKOMFK-VBELN =  v_deliv.
      XKOMFK-VBTYP = 'J'.
      APPEND XKOMFK.
      CALL FUNCTION 'RV_INVOICE_CREATE'
           EXPORTING
                VBSK_I       = VBSK_I
                WITH_POSTING = 'C'
           TABLES
                XKOMFK       = XKOMFK
                XKOMV        = XKOMV
                XTHEAD       = XTHEAD
                XVBFS        = XVBFS
                XVBPA        = XVBPA
                XVBRK        = XVBRK
                XVBRP        = XVBRP
                XVBSS        = XVBSS.
      if sy-subrc eq 0.
        COMMIT WORK.
       flag = 'X'.
      else.
      message i011 with p_vbeln.
      endif.
    Reward Points if it is helpful
    Thanks
    Seshu

Maybe you are looking for