Printing long text

Hi,
       i am trying to display purchase order, material and material long text, actually few of the materials long text contains more than 700 characters is it possible to display.
i was trying to read the material  long text using  read_text function module but it returns long text in the table format, how can we display table data in the list column.
regards,
revoori

data: l_v_text type char1024.
"suppose the output of read_text is in it_text then
loop at it_text in wa_text.
concatenate l_v_text wa-text-tdline into l_v_text seperated by ` `.
clear wa_text.
endloop.
кu03B1ятu03B9к

Similar Messages

  • How to print long text in scripts

    plzzzzzzzzz answer this qestion
    how to print long text in scripts

    Hi Kranthi,
    You can create Text Id and include that in your script.
    For example:
    /E TEXT
    /: INCLUDE ZTEXT OBJECT TEXT ID ST
    Hope this helps.
    Please reward if useful.
    Thanks,
    Srinivasa

  • How to Print Long Text

    Hi All
    I want to print long text of WCD (work clearance document) in smart form (Field name is LTXT). How do i do. I don't know different parameters for function module 'READ_TEXT'. Any suggestion.
    Thanx and Regards,
    Rajesh Vasudeva

    Hi,
    Go to the text in the Standard Document and then double Cliick on it. Then Click on the Lens below(Detail). In the new screen, Naviagate Goto---->Header. It will give you the relevant details like Text object, Text ID etc which can be used in the read text FM. Usally the text name is the Document Number and the Text ID  and Text Object is Constant for that particular Document type.
    Hope this helps
    TC

  • How to print long Text & No of page settings in F-58

    Dear Gurus,
    Can anybody guide me reg. below:
    01. user want to print long text also along with document.
    02. When user printing F-58 Payment advice..where we can set no of pages
    Pls guide me.
    REgards,
    Venkat

    Hi,
    a. Display Document FB03 and change current layout (Ctrl+F8) and choose GL Long Text (SKAT_TXT50).
    Rgds.

  • How to print long text in ALV

    i want to print a description in text  mode which is 5-6 lines some times it have a blank line also so
    how to print in ALV .i m using READ_TEXT function but sumtime it not works when text exceed 4-5 lines
    what i sud do.

    hi,
    there is another way u can use yours internal table field like long text field. that is.
    parameters: salno type vbak-vbeln.
    data: begin of itab occurs 0,
      vbeln type vbak-vbeln,
      matnr type vbap-matnr,
      longtext type thead occurs 0,
      end of itab.
      data: itabstxl type standard table of stxl with header line.
      select single vbakvbeln vbapmatnr into (itab-vbeln, itab-matnr)
                                     from vbak inner join vbap
                                       on vbakvbeln = vbapvbeln
                                        where vbak~vbeln = salno.
        select single tdobject tdname tdid tdspras from stxl
                                                     into (itabstxl-tdobject,itabstxl-tdname,itabstxl-tdid,itabstxl-tdspras)
                                                           where relid = 'TX'
                                                            and  tdobject = 'VBBK'
                                                            and tdname = salno    "YOUR OWN TDNAME e,g
                                                            and tdid = 'Z003'
                                                            and tdspras = 'EN'.
    call function 'READ_TEXT'
      exporting
      CLIENT                        = SY-MANDT
        id                            = itabstxl-tdid
        language                      = itabstxl-tdspras
        name                          = itabstxl-tdname
        object                        = itabstxl-tdobject
      ARCHIVE_HANDLE                = 0
      LOCAL_CAT                     = ' '
    IMPORTING
      HEADER                        =
      tables
        lines                         = itab-longtext
    EXCEPTIONS
      ID                            = 1
      LANGUAGE                      = 2
      NAME                          = 3
      NOT_FOUND                     = 4
      OBJECT                        = 5
      REFERENCE_CHECK               = 6
      WRONG_ACCESS_TO_ARCHIVE       = 7
      OTHERS                        = 8
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    break abaper.
    I HOPE THIS WILL SOLVE THIS WILL SOLVE THE PROBLEM OF THE OTHERS AS WELL.

  • Printing Long text in Send Mail Task

    Hi All,
    My requirement is to print the long text of particular error message in the send mail task, which will be sent to outlook.
    for this i have an activity beforr the mail task, where i have filled the multiline parameter called 'TEXT' and this is exported to workflow also.
    In my send mail task, in the body of the message, using insert expression i have inserted the multiline container 'TEXT' with the option of line break, so it came &TEXT##&.
    But once the WF is executed , i checked the WF log and found that the mail is sent and i have checked the container 'TEXT' in my previous activity where the TEXT container has 10 lines.
    But when i checked the mail in SOST the contents of TEXT is not getting printed.
    What will be the issue?
    Thanks and Regards,
    Swaminathan

    @Rick
    How is TEXT defined in the container? Is it passed in via the binding?
    I think if at all you want to use the container element in the mail then binding is not necessary from workflow to task.
    @Swaminathan PJ 
    the multiline container 'TEXT' with the option of line break, so it came &TEXT##&.
    Try to print the entire text continuosly with out line breaks then it works.

  • Printing Long Text of Production Order

    Dear all,
    Can we print the long text of Production Order using Co04N transaction? Please suggest.
    regards,
    Kumar

    Hi,
    Thanks for suggestion,,, awarded points.
    Thread closed
    regards,
    Kumar

  • Printing long text from Routing instead of Production order for an order.

    Hi Gurus,
    When a production order prints it is printing  the long text from the routing master rather than the long text on the actual production order.
    This field is used to provide specific instructions in special circumstances in addition to the standard text.
    I need system to be changed so that printing takes long text from production order.
    Please help me.
    Naveen.A

    Hi,
    In the production order long text, the text we are maintaining is only for information. It can't be able to print. In Production order, copies all the masters and the texts which we are maintaining in the masters only will be able to print. Standard SAP will not print the production order long text.
    Regards,
    V. Suresh

  • Printing long text from material master in from MM07ET

    Hello,
    I'm using WEE1 output condition to print labels for gr. I'm using the standard object MM07ET and I need to include in the label the long text from material master - table STXL. I know that there is a function READ-TEXT in ABAP for this but I don't have access to abap development. I need to know if it's possible to include a command in the sap scrip to retrive the long text without modifing the program SAPM07DR.
    Thank you!

    Hi,
    Sorry for the late Reply, Please use the following code in SAPSCRIPT
    /: INCLUDE &EKPO-EMATN& OBJECT MATERIAL IDGRUN LANGUAGE EN
    &EKPO-EMATN&  material Number ( Here please maintain the Field value which is used to print Material Number )
    MATERIAL is the Object Name
    GRUN Is Text ID
    EN Language
    You can use the above code for priting long text in the SAPSCRIPT FORM. to find the object name and ID please follow the below Steps
    Go to the window were you have maintained Long text... Double click on the text, then it will open a new window.. there Click on the top Goto-->Header.. here you will find the relevant data as follows:
    Language: EN
    Text ID : GRUN
    Text Object: MATERIAL
    Name: Material Code
    Regards
    GK.

  • Print long text in FB70

    How to print the what is entered in the long text in AR invoice in FB70. What settings need to be done in order to print the long text.

    Hi,
    Request the document number in FB12 transaction by giving correspondence type xxxxx and Fiscal year XXXX, afterwards F.64 give the required fields and execute, double click on the line which is displayed.
    Cheers...!
    S

  • How can I print long text in Notification

    Dear All,
    I want to take Long Text of notification in my printout . Please tell me where this is stored and how can I access it as I am unable to find out it in notification table.
    Regards

    In the long text screen
    Go to header
    Here all the details of the text are available.

  • HOW TO PRINT LONG TEXT OF 255 CHARACTER IN ALV GRID instead of132 Char's

    Hi sir/mam
    i'm sreekar can any one help me on this please
    "As I took a variable 'STR' with 255 length, But still ALV GRID DISPLAYS the same 132 characters, and
    When I download the report into excel it is showing the 250 charactered text"
    how can i print it in alv grid
    FORM BUID_CATALOG .
      DATA : COL_POS TYPE I.
      COL_POS = COL_POS + 1.
    *--DECLARING FIELDCATALOG FOR HEADER
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'EBELN'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Purch.doc.no.'(002).
      LT_FCAT-REF_FIELDNAME = 'EBELN'.
      LT_FCAT-REF_TABNAME = 'EKKO'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'BEDAT'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Po Date'(003).
      LT_FCAT-REF_FIELDNAME = 'EBDAT'.
      LT_FCAT-EDIT_MASK = '__.__.____'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'EKGRP'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Purch.Grp'(004).
      LT_FCAT-REF_FIELDNAME = 'BKGRP'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'EKNAM'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Purch.Grp. Name'(005).
      LT_FCAT-REF_FIELDNAME = 'EKNAM'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'LIFNR'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Vendor No.'(006).
      LT_FCAT-REF_FIELDNAME = 'ELIFN'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'NAME1'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Vendor Name'(007).
      LT_FCAT-REF_FIELDNAME = 'NAME1_GP'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'ZTERM'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Pay.Code'(008).
      LT_FCAT-REF_FIELDNAME = 'ZTERM'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'TEXT1'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Own explanation'(009).
      LT_FCAT-REF_FIELDNAME = 'DZTERM'.
      LT_FCAT-OUTPUTLEN = '30'.
      LT_FCAT-DDICTXT = 'L'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'WAERS'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Curr'(010).
      LT_FCAT-REF_FIELDNAME = 'WAERS'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'NETWR'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Net Value'(011).
      LT_FCAT-REF_FIELDNAME = 'BWERT'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
    ENDFORM.                    " BUID_CATALOG
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_BUFFER_ACTIVE         = 'X'
          I_BACKGROUND_ID         = 'ALV_BACKGROUND'
          IS_LAYOUT               = GS_LAYOUT
          IT_FIELDCAT             = LT_FCAT[]
          I_SAVE                  = G_SAVE
          IS_VARIANT              = GS_VARIANT
        IMPORTING
          E_EXIT_CAUSED_BY_CALLER = G_EXIT_CAUSED_BY_CALLER
          ES_EXIT_CAUSED_BY_USER  = GS_EXIT_CAUSED_BY_USER
        TABLES
          T_OUTTAB                = LT_FINAL[]
        EXCEPTIONS
          PROGRAM_ERROR           = 1
          OTHERS                  = 2.
      IF SY-SUBRC = 0.
        IF G_EXIT_CAUSED_BY_CALLER = 'X'.
        ELSE.
          IF GS_EXIT_CAUSED_BY_USER-BACK = 'X'.       "F3
            EXIT.
          ELSE.
            IF GS_EXIT_CAUSED_BY_USER-EXIT = 'X'.     "F15
              LEAVE TO SCREEN 1000.
            ELSE.
              IF GS_EXIT_CAUSED_BY_USER-CANCEL = 'X'. "F12
                LEAVE TO SCREEN 1000.
              ELSE.
                EXIT.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
      ELSE.
      ENDIF.
    ENDFORM.                    " DISPLAY_DATA
    CALL FUNCTION 'READ_TEXT'
    EXPORTING
    CLIENT = SY-MANDT
    ID = 'F15' "ls_thead-tdid PAYMENT TERMS
    LANGUAGE = SY-LANGU "ls_thead-tdspras "CURRENT LANGUAGE 'E'
    NAME = NAME "ls_thead-tdname PO NUMBER LW_EKKO-EBELN
    OBJECT = 'EKKO' "ls_thead-tdobject TABLE NAME EKKO
    IMPORTING
    HEADER = HTEXT
    TABLES
    LINES = LTEXT
    EXCEPTIONS
    ID = 1
    LANGUAGE = 2
    NAME = 3
    NOT_FOUND = 4
    OBJECT = 5
    REFERENCE_CHECK = 6
    WRONG_ACCESS_TO_ARCHIVE = 7
    OTHERS = 8.
    IF SY-SUBRC = 0.
    LOOP AT LTEXT.
    IF LTEXT-TDLINE NE ''.
    MOVE LTEXT-TDLINE TO WA_WORD-TEXT.
    APPEND WA_WORD TO LT_SENTENCE.
    ENDIF.
    ENDLOOP.
    ENDIF.
    LOOP AT LT_SENTENCE INTO WA_WORD.
    COUNT = COUNT + 1.
    IF COUNT = 1.
    STR = WA_WORD-TEXT.
    LW_FINAL-TEXT1 = STR.
    ELSEIF COUNT = 2 OR COUNT = 3 OR COUNT = 4 OR COUNT = 5 OR COUNT = 6 OR COUNT = 7 OR COUNT = 8.
    CONCATENATE STR WA_WORD-TEXT INTO STR SEPARATED BY SPACE.
    LW_FINAL-TEXT1 = STR.
    ENDIF.
    ENDLOOP.

    can you provide an example of how to wrap the text i have like this please see the below code and correct if any errors
    FORM GET_TEXT_LINES .
      DATA :NAME TYPE THEAD-TDNAME.
      NAME = LW_EKKO-EBELN.
      V_TABIX = SY-TABIX.
    CALLING FUNCTION READ_TEXT FOR PAYMENT TEXTS
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
          CLIENT                  = SY-MANDT          "CLIENT ID 200/600/400
          ID                      = 'F15' "ls_thead-tdid "PAYMENT TERMS TEXT ID 'F15'
          LANGUAGE                = SY-LANGU "ls_thead-tdspras "CURRENT LANGUAGE 'E'
          NAME                    = NAME "ls_thead-tdname "PO NUMBER LW_EKKO-EBELN
          OBJECT                  = 'EKKO' "ls_thead-tdobject "TABLE NAME EKKO
        IMPORTING
          HEADER                  = HTEXT "LS_THEAD
        TABLES
          LINES                   = LTEXT "LT_LINES[]
        EXCEPTIONS
          ID                      = 1
          LANGUAGE                = 2
          NAME                    = 3
          NOT_FOUND               = 4
          OBJECT                  = 5
          REFERENCE_CHECK         = 6
          WRONG_ACCESS_TO_ARCHIVE = 7
          OTHERS                  = 8.
      IF SY-SUBRC = 0.
        LOOP AT LTEXT.
          IF LTEXT-TDLINE NE ''.
            MOVE LTEXT-TDLINE TO WA_WORD-TEXT.
            APPEND WA_WORD TO LT_SENTENCE.
          ENDIF.
        ENDLOOP.
      ENDIF.
    Word Wrap the text in multiple lines
      LOOP AT LT_SENTENCE INTO WA_WORD.
        CALL FUNCTION 'RKD_WORD_WRAP'
          EXPORTING
            TEXTLINE            = WA_WORD-TEXT
             OUTPUTLEN           = 100
          TABLES
            OUT_LINES           = LT_SENTENCE
          EXCEPTIONS
            OUTPUTLEN_TOO_LARGE = 1
            OTHERS              = 2.
        IF SY-SUBRC EQ 0.
             IF not LT_SENTENCE IS INITIAL.
          READ TABLE LT_SENTENCE INTO WA_WORD INDEX v_tabix.
          LW_FINAL-TEXT1 = WA_WORD_TEXT.
          MODIFY LT_FINAL FROM LW_FINAL INDEX V_TABIX.
      ENDLOOP.
      CLEAR: LT_SENTENCE.
    ENDFORM.                    " GET_TEXT_LINES
    *&      Form  LAYOUT_INIT
          text
         -->P_GS_LAYOUT  text
    FORM LAYOUT_INIT  USING RS_LAYOUT TYPE SLIS_LAYOUT_ALV.
    *"Build layout for list display
      RS_LAYOUT-DETAIL_POPUP      = 'X'.
    ENDFORM.                    " LAYOUT_INIT
    *&      Form  EVENTTAB_BUILD
          text
         -->P_GT_EVENTS[]  text
    FORM EVENTTAB_BUILD  USING RT_EVENTS TYPE SLIS_T_EVENT.
    *"Registration of events to happen during list display
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE = 0
        IMPORTING
          ET_EVENTS   = RT_EVENTS.
      READ TABLE RT_EVENTS WITH KEY NAME = SLIS_EV_AFTER_LINE_OUTPUT
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        APPEND LS_EVENT TO RT_EVENTS.
      ENDIF.
    ENDFORM.                    " EVENTTAB_BUILD
    *&      Form  AFTER_LINE_OUTPUT
          text
    -->  p1        text
    <--  p2        text
    FORM AFTER_LINE_OUTPUT.
    CLEAR :COUNT,LT_SENTENCE.
    LOOP AT LT_SENTENCE INTO WA_WORD.
      READ TABLE LT_SENTENCE INTO WA_WORD INDEX V_TABIX.
      CHECK SY-SUBRC = 0.
    CALL FUNCTION 'RKD_WORD_WRAP'
        EXPORTING
          TEXTLINE  = WA_WORD-TEXT
          OUTPUTLEN = 20
        TABLES
          OUT_LINES = LT_SENTENCE.
      DESCRIBE TABLE LT_SENTENCE LINES V_TABIX.
      CHECK V_TABIX > 1.
        COUNT = COUNT + 1.                                                   
        IF COUNT = 1.                                                      
          STR = WA_WORD-TEXT.                                                         
          LW_FINAL-TEXT1 = STR.                                          
        ELSEIF COUNT = 2 OR COUNT = 3 OR COUNT = 4 OR COUNT = 5 OR COUNT = 6 OR COUNT = 7 OR COUNT = 8.
          CONCATENATE STR WA_WORD-TEXT INTO STR SEPARATED BY SPACE.
          LW_FINAL-TEXT1 = STR.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " AFTER_LINE_OUTPUT

  • Long Text printing in SAP SCRIPT

    Hi Experts,
    I have a requirement of printing long text in sapscript.
    There are 15 condition types for each item in sales order and one long text for each condition record.
    Each long text has multiple lines i.e. for one long text it may have 2 lines and other may have 1 or 3 lines or etc.
    My trials :
    I used read_text() function mudule in a routine which is being called from the sap script to get the whole long text which has 5 lines and is stored in an internal table.
    Now is there a way to transfer the whole internal_table data as a whole into the script i.e. is there a way to transfer the table from the routine to the sapscript.
    Thanks in advance.
    kalikonda.

    Hi
    In addition of my include solution.
    you ofcourse can use a perform statement if you havea maximum of lines which is possible.
    like (if you have a maximum of 5 lines
    define &line_1& := ' '
    define &line_2& := ' '
    define &line_3& := ' '
    define &line_4& := ' '
    define &line_5& := ' '
    Perform getsomedate in program abcxyz
    using orderno
    using itemno
    changing &line_1&
    changing &line_2&
    changing &line_3&
    changing &line_4&
    changing &line_5&
    Endperform
    when printing the data
    /: if &line_1& NE ' '
    IL &line_1&
    /: endif
    /: if &line_2& NE ' '
    IL &line_2&
    /: endif
    /: if &line_3& NE ' '
    IL &line_3&
    /: endif
    /: if &line_4& NE ' '
    IL &line_4&
    /: endif
    /: if &line_5& NE ' '
    IL &line_5&
    /: endif
    Gr., Frank

  • Smart Form Long Text

    Dear Guys
    I am trying to print long text stores at line Item of ME 23n Text Editor, in Smart From.
    I am calling a BAPI for reading Purchase requistion details. The itab is also showing complete paragraph of text. But when I write it on smart from, previw is not showing complete paragraph. Infact many space is still left in smart form column.

    Thnx Subramanian PL for replying.
    When user writes text in ME23N text field, he normally use Enter Key many times to go to next line but while displaying it on a smart form using a loop the text also breaks unexpectedly due to those Enter Key press by user,while still there is more space to write the text in a sigle line on smart form.
    To avoid above problem I first store all the text belong to a single papragraph in a variable string of smart from. But now when I try to display this text on smart from it is missing few last lines. Infact while debugging it, I can see that text is stored completely in variable.
    Message was edited by:
            Adnan Maqbool

  • How to print a text file with long lines?

    I am trying to print a text file which contains many long lines. I find that the long lines are truncated on the printouts. How do I wrap up these long lines? Could you give me some examples?
    Thank you very much!

    Here's an example. The "\n" makes anything after it go to the next line. I hope this helps. Look at the Private void getTable() section.
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*;
    public class LabNine extends Frame implements ActionListener, WindowListener {
         private TextField txtInfo;
         private List lstInfo;
         private Button btnAddInfo;
         private BorderLayout borderlayout;
         private Connection databaseConnection;
         Statement statement;
         ResultSet resultSet;
    public LabNine( ) {
         super("Lab Nine");
         // addWindowListener to close application
         addWindowListener(this);
         // create layout
         borderlayout = new BorderLayout();
         setLayout(borderlayout);
         // create text field so the file input that is selected will be seen in here
         txtInfo = new TextField();
         txtInfo.setEnabled(false);
         Color color = new Color(255, 136, 183);
         txtInfo.setBackground(color);
         add(txtInfo, BorderLayout.NORTH);
         // create list so the file input can be populated in here
         lstInfo = new List();
         add(lstInfo, BorderLayout.CENTER);
         // create button to add selected input file in the text field
         btnAddInfo = new Button("Add Info");
         btnAddInfo.setBackground(Color.cyan);
         btnAddInfo.setFont(new Font("TimesRoman", Font.BOLD, 16));
         btnAddInfo.addActionListener( this );          
         add(btnAddInfo, BorderLayout.SOUTH);
         // set frame attributes
         setSize(450, 250);
         setResizable( false );
         show();
         // get the table/ get the query
         loadConnection();
         getTable();
    public void actionPerformed(java.awt.event.ActionEvent e) {
         // if add button is pushed then it will check to see if an item was selected.
         // if not, then an error message will be displayed else the selected item will be in the text box
         if ( e.getSource() == btnAddInfo ) {
              if ( lstInfo.getSelectedIndex() == -1 ) {
                   System.out.print( "You have not selected an item" );
              else {
                   txtInfo.setText(( lstInfo.getSelectedItem() ));
    private void getTable() {
         try {
              String query = "SELECT FIRST, LAST, EMAIL FROM Names";
              statement = databaseConnection.createStatement();
              resultSet = statement.executeQuery( query );
              while ( resultSet.next() ) {
                   lstInfo.add( resultSet.getString( "FIRST" ) + " " + resultSet.getString( "LAST") + " " +
                        resultSet.getString( "EMAIL" ) + "\n" );
              statement.close();     
         catch ( Exception e ) {
              System.err.println( e );
    private void loadConnection() {
         // define the data source for the driver
         String sourceURL = "jdbc:odbc:people";
         String username = "";
         String password = "";
         // load the driver
         try {
              // load the drive class
              Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
              // create a connection through the drivermanager
              databaseConnection = DriverManager.getConnection( sourceURL , username, password );     
         catch( ClassNotFoundException cnfe ) {
              System.err.println( cnfe );
         catch( SQLException sqle ) {
              System.err.println( sqle );
    public static void main(java.lang.String[] args) {
         LabNine aLabNine = new LabNine( );
    public void windowActivated(java.awt.event.WindowEvent e) {
    public void windowClosed(java.awt.event.WindowEvent e) {
         // closes the application
         System.exit( 0 );
    public void windowClosing(java.awt.event.WindowEvent e) {
         // closes the application
         System.exit( 0 );

Maybe you are looking for