Display data in Web DynPro table from database via EJB

I have a JavaBeans model which has a method populateDataToTable()to retrieve data from database via Session bean (calling entity bean, returning ArrayList of data) and the data needed to be display in the Web DynPro table.
User Interface (Web DynPro) <-> JavaBeans Model <-> Busineess Logic (session bean) <-> Persistence (Entity Bean)<-> DB table.
The context bindiing and table part is ok. How do i load the data to the table ? what the coding to put in wdDoInit() ?
Any help would be appreciated.

in wdinit(),
Collection col = new ArrayList();
try{                    
  MyCommandBean bean = new MyCommandBean();
  col = bean.getDataFromDbViaEJB();
  wdContext.nodeMyCommandBean().bind(col);
} catch (Exception ex) {
   ex.printStackTrace(ex); 
in your JavaBean model class, MyCommandBean getDatafromDbViaEJB() method:
Collection col = new ArrayList();
Collection newcol = new ArrayList();
//include your own context initialization etc...
col = local.getDataViaSessionBean(param);
// if your returned result also a bean class, reassigned it to current MyCommandBean
for (Iterator iterator = col.iterator(); iterator.hasNext();) {
    MyOtherBean otherBean=(MyOtherBean)iterator.next();
    MyCommmandBean bean = new MyCommandBean();
    bean.attribute1 = outBean.getAttirbute1();
    // get other attibutes
    newcol.add(bean);
return newcol;

Similar Messages

  • SOS: Display data in Web DynPro table from database via EJB.

    i build two views : queryView and displayView!
    displayView: is used to display all query result in the table;these data is bind to a commandBean model(javaBean imported).
    queryView:   is used to full in different query conditions,then u can pressed a button  to trigger for displaying reuslt  in the table of displayView.
    commandBean(its attributes bind to the table cells in the displayView) :
    public Class TestModel{
    private String xxx;
    setXxx();....
    getXxx();...
    ArrayList query(){
    ArrayList alist= new ArrayList();
    ArrayList list= new ArrayList();
    alist = local.getDataViaSessionBean(param);
    for (int i=0;i<alist.size();i++){
      ArrayList row =(ArrayList)alist.get(i);
      TestModel model= new TestModel();
      model.setXxx((String)row.get(1));
      list.add(bean);
    return list;
    my question is:i dont' know how to invoke the commanBean' mothod to diplay data in the displayView.
    i know if that two view are combined to one views,i can write code as follow:
    wdContext.currentTestModelElement().modelObject().query(para);
    but now .u cann't access it!

    in wdinit(),
    Collection col = new ArrayList();
    try{                    
      MyCommandBean bean = new MyCommandBean();
      col = bean.getDataFromDbViaEJB();
      wdContext.nodeMyCommandBean().bind(col);
    } catch (Exception ex) {
       ex.printStackTrace(ex); 
    in your JavaBean model class, MyCommandBean getDatafromDbViaEJB() method:
    Collection col = new ArrayList();
    Collection newcol = new ArrayList();
    //include your own context initialization etc...
    col = local.getDataViaSessionBean(param);
    // if your returned result also a bean class, reassigned it to current MyCommandBean
    for (Iterator iterator = col.iterator(); iterator.hasNext();) {
        MyOtherBean otherBean=(MyOtherBean)iterator.next();
        MyCommmandBean bean = new MyCommandBean();
        bean.attribute1 = outBean.getAttirbute1();
        // get other attibutes
        newcol.add(bean);
    return newcol;

  • Web Dynpro Tables from EJB

    I am new to Web Dynpro and I'm trying to write an application that displays data from and EJB in a table in web dynpro.  The EJB returns an array "items[]" to my command bean.  Is there a way to create a table based on the array "items[]" and several properties of the item.

    Hi Jonathan,
    If the properties of the items are static (i.e. not going to change in the course of time), you can create Table with fixed TableColumns (no. of Table columns = no of properties of item) which has TableCellEditor which can be TextView if the data is display only.
    You have to also create context structure which has root node and attributes corresponding to each of the property of item and bind the node to datasource property of Table and bind attributes to each TableCellEditor(TextView's text attribute).
    Just populate the data from your bean to the context creating nodeElements for each item and setting contextAttribute value as the property value.
    Refer https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/bad3e990-0201-0010-3985-fa0936d901b4 for table
    If the properties are dynamic (i.e. changing due course of time). You can create the TableColumns, TableCellEditors dynamically and also the context attributes dynamically in wdDoModifyView.
    Refer Dynamic table column creation for more details
    Hope this helps.
    Thanks and Regards,
    Rohit Jaiswal

  • Load and Display Multiple Images in a Web Dynpro Table

    I am new to Web Dynpro and I am wondering if anyone can help me with an application that I am currently developing. I have a particular requirement to store images in a database table (not MIME repository) and then display them in a WD table element. An image can be of JPEG, PNG or TIFF format and is associated with an employee record.
    I want to create a view in my application that displays multiple images in a table, one image per row. I want to do this using Web Dynpro for ABAP, not Java. I have looked into pretty much all examples available for Web Dynpro and came to the conclusion that Components such as WDR_TEST_EVENTS and WDR_TEST_UI_ELEMENTS do not have any examples of images being stored in a database table and viewed in/from a Web Dynpro table element. Programs such as RSDEMO_PICTURE_CONTROL, DEMO_PICTURE_CONTROL and SAP_PICTURE_DEMO do not show this either.
    The images to be displayed in the Dynpro table are to come from a z-type table, stored in a column of data type XSTRING (RAW STRING). So I would also like to know how to upload these images into this z-type table using ABAP code (not Java).
    Your help would be greatly appreciated.
    Kenn

    Hi,
    May be this is the is the correct place to post your query.
    Web Dynpro ABAP
    Regards,
    Swarna Munukoti.
    Edited by: Swarna Munukoti on Jul 16, 2009 3:52 PM

  • How to use EVS with different data in each row, in a Java Web Dynpro table?

    Hi all,
    I am using EVS in a column of java web dynpro table.
    Let's say the name, and context attribute, of this column is column1.
    It's filled dynamically using an RFC, that uses as input parameter the value of another column, and related context attribute, from the same table (Let's call it column2).  Obviously, from the same row. So, in other words: the values of the EVS in column1 of row1, are dependent of the value of column2 of row1. And the values of the EVS in column1 of row2, are dependent of the value of column2 of row2. And so on... Hope i could explain myself ok.
    The code I'm using works great for filling the EVS dynamically:
    IWDAttributeInfo attrInfo = wdContext.nodeDetail().getNodeInfo().getAttribute(nodeElement.COLUMN1);
    ISimpleTypeModifiable siType = attrInfo.getModifiableSimpleType();
    IModifiableSimpleValueSet<String> value = siType.getSVServices().getModifiableSimpleValueSet();
    value.clear();
    if(this.initRFC_Input(nodeElement.getColumn2())){
         for (int i = 0; i < wdContext.nodeRFCresult().size(); i++){
              value.put(wdContext.nodeRFCresult().getRFCresultElementAt(i).getLgort()
                 , wdContext.nodeRFCresult().getRFCresultElementAt(i).getLgobe());
    In this code, nodeElement is the context row of the table that is passed dynamically to the method when the value of colum2 is changed.
    HOWEVER, the problem I'm having is that after executing this code, EACH NEW ROW that is added to the table has by default the same values as the first row, in the column1 EVS. And, for example, if I refresh the values of the column1 EVS in row 2, all EVS values in the other rows are also refreshed with the same values as the ones of EVS in row 2.
    How can I make sure each row EVS has its own set of independent values, so they don't mess with each other?
    Hope you guys can help me. And please, let me know if I didn't explain myself correctly!
    Thanks!

    I just did as you said (I think), but it's still having the same behaviour as before (same data for all EVS in the table).
    Here´s what I did:
    I
    In node "Detail" (cardinality 0...n, singleton set to true), which is binded to the table, I created a child node named "Column1Values" wth cardinality 1...1 and singleton set to false.
    "Column1Values" node has an attribute called "column1", of type String.
    I did the binding between attribute "column1" and the column1 inputfield celleditor in the table.
    I created an event called Column2Changed and binded it to the column2 celleditor of the table. I added a parameter called nodeElement of type IPrivateCompView.IDetailElement to this event, and mapped it to the column2 editor in the table so that I can dynamically get the nodeElement that is being affected.
    I added the following code to the onActionColumn2Changed(wdEvent, nodeElement) method that gets created in the view:
    IWDAttributeInfo attrInfo = nodeElement.nodeColumn1Values().getNodeInfo().getAttribute("column1");
    ISimpleTypeModifiable siType = attrInfo.getModifiableSimpleType();
    IModifiableSimpleValueSet<String> value = siType.getSVServices().getModifiableSimpleValueSet();
    if(this.initRFC_Input(nodeElement.getColumn2())){
         for(int i =0; i < wdContext.nodeRFCresults().size(); i++){
              value.put(wdContext.nodeRFCresults().getRFCresultsElementAt(i).getId(),
                                  wdContext.nodeRFCresults().getRFCresultsElementAt(i).getDesc());
    And with this, I still get the original problem... When the EVS of one row is updated, ALL other EVS of the table get also updated with the same values.
    What am I missing? Sorry Govardan, I bet I'm not seeing something really obvious... hopefully you can point me in the right direction.
    Thanks!

  • Copy from clipboard and paste in Web Dynpro table

    Hi
    I have a client requirement where the client wants to copy the table from some already existing application and paste the data  directly in web dynpro java table.  It is similiar to copy the data from clipboard and paste it directly in web dynpro table.
    I would like to know is it feasible. If yes, please provide some links or guide me on achieving the same.
    Thanks
    Harsimran

    Hi
    I think one way you can do it,
      1 . try to export the table dato to excel sheet.(copy and paste to excel)
       2. Importing the excel data to WD table.
      for more details about reading excel data, there is many blog on sdn just check it.
    Hope will help you
    Thanks

  • Internet Explorer limitation for Web Dynpro Table Data

    Hello everybody,
    I am having a trouble while trying to display a Web Dynpro table in Internet Explorer. This table is bound to a Context Node that is filled up manually with code, and for example if I passed more than 116 elements to the node the table only shows 116. Since this issue only happens with IE, I consider that it is related to the client part, something related with JavaScript. Any idea/suggestion?
    Many thanks in advance,
    Jesus

    Hello Siva,
    Thank you very much for your response. There is no message error, it is just not showing the entire node content, the weirdest thing is that even though WD is client independent this only happens with Internet Explorer. It works properly with any other browser such as Mozilla FF, Chrome and Safari browsers when the table has above 116 elements. When the table has below 116 elements it works properly with any browser. I have tried with IE6.0 and 7.0 using NWDS 7.0 and EP 7.0 SP 18.
    The table is child of a Group element which in turn is child of the Root Element.
    Best Regards,
    Baez

  • How to display multiple tables from database using netbeans swing gui

    plz reply asap on how to display multiple tables from database using netbeans swing gui into the same project

    Layered Pane with JTables or you can easily to it with a little scripting and HTML.
    plzzzzzzzzzzzzzzzzz, do not use SMS speak when posting.

  • Unable to display text with image in a cell of web dynpro table.

    Hello,
    I am unable to display an image with the text inside a cell of web dynpro table. The image doesn't come at all. I am trying to display the image of an object and the object description alongside within the same cell.
    Thanks and Regards,
    Abhijnan

    Hi
    Pls check the below link
    http://help.sap.com/saphelp_nw70ehp2/helpdata/en/9b/46bb0d339b42cc8d30636ca0c9f5b6/frameset.htm
    The only problem is only the below UI elements are supported
    ■Button
    ■ToggleButton
    ■LinkToUrl
    ■LinkToAction
    ■FileDownload

  • How to change font while displaying data through an ALV table in WDA?

    Hi all,
    I am displaying data through and ALV table. Now I want to change the FONT only for few rows. Is this possible?
    If so then do the needful to me..
    Thanks & Regards,
    Yugesh A.

    I believe as you have found 'LVC_FIELDCATALOG_MERGE' would only work with the classic dynpro (SAPGUI based) version of the ALV. 
    You won't be able to control the font the same way in the WDA version of the ALV.  You will need to create a custom cell editor for the column(s) in question.  You can then bind context attributes to the properties of the cell editor. You will need extra attributes in your bound context to control these settings on the row level.  Also you will be restricted by the changing the DESIGN property. This means only the values allowed for the DESIGN of the particluar UI element.  For a TextView that wouldn't be the font directly (the font of course comes from the Theme).
    DATA l_salv_wd_table TYPE REF TO iwci_salv_wd_table.
      l_salv_wd_table = wd_this->wd_cpifc_alv_adv( ).
      DATA l_table TYPE REF TO cl_salv_wd_config_table.
      l_table = l_salv_wd_table->get_model( ).
      data textview type ref to CL_SALV_WD_UIE_TEXT_VIEW.
      l_column = l_table->if_salv_wd_column_settings~get_column( 'ADD_PARTICIPANTS' ).
      create object textview.
      textview->SET_TEXT_FIELDNAME( 'ADD_PARTICIPANTS' ).
      textview->set_design_fieldname( 'ADD_DESIGN' ).
      textview->set_wrapping( abap_true ).
      l_column->set_cell_editor( textview ).
    DESIGN supports the following options:
    Value
    Visual Display
    Description
    emphasized
    Text is highlighted in default size
    groupTitle
    Header for forms
    This enumeration value is deprecated. Instead, use SectionHeader.
    header1
    Text is highlighted with font size +4 in relation to the default font size.
    header2
    Text is highlighted with font size +5.08 cm relation to the default font size.
    header3
    Text is highlighted in default size
    header4
    Text is highlighted in font size -1 (small) in relation to the default font size (like the legend but highlighted)
    label
    Text is display in the default font type. A space is always inserted after the text.
    label_small
    Text is displayed in default font type, as with label, onyl that font size is -1 (like the font size for header4).
    legend
    Text is displayed with default font type in size -1.
    reference
    Text is in italics and in default font size.
    standard
    Text is displayed in default font size. No text attributes are defined for this value.
    monospace
    Text is displayed in no-proportional font type. Each letter takes up the same space.

  • Sending Web Dynpro table contents via Email

    Hi,
    I have a requirement where in I need to send an email from the Web Dynpro Application.
    I am using JavaMail for this purpose. And I am able to send text messages to the required Email Id.
    But my requirement is that I need to send the contents of one of the Web Dynpro table along with the text message.
    Is it possible to send the table contents via mail?
    Kindly let me know if there is any other approach.
    Regards,
    Shilpa B.V

    Hi,
    I don't think there are any methods in IWDTable or the IWDNode which can dump entire data on to something which we can pickup.
    The only way is to iterate through the elements in the node and construct a big string buffer with HTML Table code and include the other part of the mail also in the same string buffer as html. Then set the MIME type of your mail to HTML and send the mail.
    Check sending HTML content via email
    http://java.sun.com/developer/onlineTraining/JavaMail/contents.html#ProcessingHTMLMessages
    Regards
    Srini

  • Question about meta-data of Web Dynpro ABAP / Web Dynpro Java

    Hello together,
    everywhere I can read, that Web Dynpro meta-data is platform independent.
    I´ve read into a book, that the meta-data of Web Dynpro Java is saved as XML and
    that Web-Dynpro Java Runtime generates runnable classes and sourcecode out of this...
    - What about Web-Dynpro ABAP? Is Meta-code in ABAP is saved in XML too?
    - just for theory: is ist possible to take the meta-data of a Web-Dynpro ABAP component and
      generate a Web-Dynpro Java Component out of this?
    I tried to find it out but i failed... In table WDR_RR_LOAD (is this the right one?) I found only the
    field data. But this is a RAWSTRING and I don´t know how to make I "readable".
    I must know this for my thesis for my studies, not for work.
    Thank you very much !!!!
    Greetings,
    Oliver

    Me again,
    I am not sure if I understood it right...
    The meta-data which describes the visual part of a view is saved as XML and
    would be rendered i.e. in the webbrowser... Right?
    What about the meta-data of the Web Dynpro application?
    Is this meta-code into an other structure or XML too?
    Thank you very much.
    Many Greetings,
    Oliver

  • Data Could not be retrieved from database...

    Hi All,
    I have a problem on Excel 2007 while refreshing (for pivot table) data from SQL Server view:
    "Data could not be retrieved from database. Check the database server or contact your database administrator. Make sure that external database is availiable, and then try the operation again"
    Excel file is distributed on about 20 workstations in network with the same Excel version, and problem occurs only on one station. I have checked credentials and connection between workstation and server and it seems to be ok.
    Any ideas?

    it is problem, because sql server is not member of domain... so I'm using sql aunthentication.
    strange thing is that from any other workstations (aldo in domain) it works fine when providing SQL user. I'm supposing that it is problem with some excel settings

  • Labview 2013 are closing when I try read table from database.

    Labview 2013 are closing when I try read table from database.
    I don't get error message, Labview just crashes. I'm use Labview x32 and Database Connectivity Toolkit connective on Windows 7 x64. I connect to PostgreSQL with ODBC driver, connection is stable.
    In my database I have many tables, I can read all them without one.
    When I try read bad table I get data and then labview crash. When I restart Labview I don't have any message about error.
    Also I try use LabSQL-1.1a. But it has same result.
    Solved!
    Go to Solution.
    Attachments:
    DBT.png ‏104 KB
    LabSQL.png ‏67 KB

    Try connecting using UDL file. What operation you are doing with database
    You can create the same.. Do this Tools --> Create Data link..
    Then go to http://www.ni.com/pdf/manuals/371525a.pdf link and see page 3-5. It will help
    Kudos are always welcome if you got solution to some extent.
    I need my difficulties because they are necessary to enjoy my success.
    --Ranjeet

  • How to create a Web Dynpro Project from Downloaded zip file?

    Hi,
    I have been working in Java Web Dynpro for last 1 month but not able
    to create any Web Dynpro from Downloaded zip file?
    Can anybody tell me how to create a Java Web Dynpro Project from
    Donloaded zip code?
    Regards
    Kaushik Banerjee

    Hi Kaushik,
    You can add the existing zip file into your workspace by the following way -
    First open the NWDS and create a new project by clicking file -> new -> Project -> Simple -> Project
    and then File -> Import -> zipfile and then browse the zip file into the newly created project.
    or else you can also unzip the zip file into a folder and then Use the option of Import an exisitng project into workspace. You can find this in the File-> import -> Existing project into workspace. and then use the Browse option to browse to the existing folder.
    After importing the project you need to rebuild the project
    Regards,
    Raju Bonagiri.

Maybe you are looking for

  • Facebook and Twitter app on iphone 5s

    I downloaded the facebook and twitter app on my iphone 5s and selected their respective notification sounds in the Settings but, even after that, I did not receive any notification sound whatsoever either for FB or twitter. After sifting through, I c

  • How do I remove an old apple ID from the APPS Store

    I gave my 27 inch iMac to my dad and thought I had everything deleted off my IMAC before I gave it to him.  I created an Apple ID for him; however, when we try to download updates from the APP Store it comes up with my old apple ID and asks me for th

  • ICloud is not syncing to my iPod touches.

    I am setting up iCloud and have been able to get my iCal to sync to iCloud but now new events I put in the calendar on both my 3rd and 4th gen iPod touches are not saving correctly. The event goes to iCal and iCloud but does not save on the iTouch it

  • Error When Using a destroyApp(true)

    Hello, I'm starting in Java ME development, but when i finished the code, that i'm developing using Eclipse, it shows that my code have an error, with that red x in the left of the code line, here is the code: package comm; import javax.microedition.

  • How do I create a Snow Leopard partition?

    I just upgraded to Lion, and unfortunately, can't access my Quicken 2007.  (Didn't realize Quicken didn't work in Lion until after I downloaded it.  Clearly, I live in a barrel.)  I just downloaded iBank and need to export my Quicken data to it.  Fro