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

Similar Messages

  • 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;

  • 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;

  • 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

  • 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!

  • 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

  • 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

  • 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.

  • Error while creating web dynpro project from DTR

    Hello,
    I am getting following error while creating Web Dynpro project from DTR,
    org.eclipse.jdt.core.JavaModelException: File /<track name><DC><package>/.classpath is read-only.
    Still project gets created but evenif I check out view , it does not allow me to edit it.
    Also I have checked in and activated some changes but active copy in DTR is not reflecting those changes.
    I tried Add subtree option in DTR perspective for folders in this project. Is it result of that?
    Please help me in this regard.
    Thank You
    Beena

    Hi Beena,
            .classpath file should not checked in to DTR(uncheck the Read only properties). It is local file it contains class path for local system.
             Generally in webdynpro project only src folder should be checked in DTR.
    Regards
    Suresh

  • Not able to run web dynpro application from portal.

    Hi portal experts,
    I want to run my web dynpro application from portal.
    So created a seperate iview  and a role  for the purpose.
    Assigned the iview to the role and also mapped a abap user id to the new role created.
    But when I click on 'preview'  the iview , getting the following dump.
    Error when processing your request
    What has happened?
    The URL http://mnghcmsap:8000/sap/bc/webdynpro/sap/zhr_cp_admin/ was not called due to an error.
    Note
    The following error text was processed in the system HRM : Die URL enthält keine vollständige Domainangabe (mnghcmsap statt mnghcmsap.<domain>.<ext>).
    The error occurred on the application server mnghcmsap_HRM_00 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: CHECK of program CX_FQDN=======================CP
    Method: STARTUP_CHECKS of program CL_WDR_CLIENT_ABSTRACT_HTTP===CP
    Method: HANDLE_REQUEST of program CL_WDR_CLIENT_ABSTRACT_HTTP===CP
    Method: IF_HTTP_EXTENSION~HANDLE_REQUEST of program CL_WDR_MAIN_TASK==============CP
    Method: EXECUTE_REQUEST of program CL_HTTP_SERVER================CP
    Function: HTTP_DISPATCH_REQUEST of program SAPLHTTP_RUNTIME
    Module: %_HTTP_START of program SAPMHTTP
    What can I do?
    If the termination type was RABAX_STATE, then you can find more information on the cause of the termination in the system HRM in transaction ST22.
    If the termination type was ABORT_MESSAGE_STATE, then you can find more information on the cause of the termination on the application server mnghcmsap_HRM_00 in transaction SM21.
    If the termination type was ERROR_MESSAGE_STATE, then you can search for more information in the trace file for the work process 0 in transaction ST11 on the application server mnghcmsap_HRM_00 . In some situations, you may also need to analyze the trace files of other work processes.
    If you do not yet have a user ID, contact your system administrator.
    Error code: ICF-IE-http -c: 200 -u: INF51515 -l: E -s: HRM -i: mnghcmsap_HRM_00 -w: 0 -d: 20110209 -t: 121224 -v: RABAX_STATE -e: UNCAUGHT_EXCEPTION
    HTTP 500 - Internal Server Error
    Your SAP Internet Communication Framework Team
    Please let me know if I am doing the process correctly and also let me know if I am missing somthing.
    Thanks,
    Aditya.

    Are you able to run teh web dynpro application independtly i.e. without creatin an iview.
    http://mnghcmsap:8000/sap/bc/webdynpro/sap/zhr_cp_admin/ by using this link.
    or there also you are getting the error.
    i guess there also you should be gettign the error.
    this is some problem with the FQDN settings in the abap system.
    in the host name of the web dynpro applciation server one .(dot) is must.
    so you might have to change the host name to some thing like mnghcmsap. from mnghcmsap
    thanks
    sarbjeet singh

  • Drag and Drop between Web Dynpro Tables on Cell Basis

    Hi Experts,
    I need to develop a Drag and Drop Functionality as follows:
    I have two tables. I want to drag a row of the first table and drop it in a particular cell of the second table.
    Is it possible to implement this using the Web Dynpro Drap and Drop Functionality?
    If not, does anybody have an idea of how to implement this using other concepts (Flash Integration, Building up a Grid of Images and defining those as drop tragets, etc..)??
    Valuable Advice is highly appreciated!
    THANKS, Johannes

    Thanks for the Video.. It gives some information about Drag and Drop, but still, it does not say what I need to know.
    Again:
    I need to know if there is a way to drag particular cells in a Web Dynpro Table to other locations in that same table. Plus: I need to know if there is a way to drag and drop rows of one table into particular cell of another table.
    Similar to what we do in our Outlook Calendars: We have a week in view and we see our appointments as blocks within that week view. Now, we can drag and drop these blocks to other locations. That is what I need to implement!
    Does anybody have an idea?
    THANKS, Johannes

  • 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

  • Integration of a Tree Structure in a Web Dynpro Table

    Hi,
    I am implementing an Integration of a Tree Structure in a Web Dynpro Table.
    The Tree-Table os working as required, but I can not work with the OnLeadSelect Action of the table.
    The Action does not work as required, meanning, it returns all the time the first row and not the "lead select".
    As far as I read I should add some code to the wdDoModifyView method, but I did not figure out exactly what...
    Thanks in advance,
    Aviad

    check this URL:
    /people/valery.silaev/blog/2005/06/20/master-of-columns-part-ii

  • Tree Structure in a CE Web Dynpro Table

    Hi,
    Anyone has any idea how to do it in the CE Edition?
    I've tried to follow the steps of the older versions and it didn't work:
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/bc/601c420d84db2ce10000000a1550b0/frameset.htm
    Thanks and regards,
    Eduardo

    Hi Armin,
    The tutorial asks me to: "Insert a Web Dynpro table, including the UI element TreeByNestingTableColumn (also known as the master column) in the layout of the TreeTableView."
    I didn't find this TreeByNestingTableColumn, do you have any idea what i'm doing wrong?
    Thanks and Regards,
    Eduardo

  • Using portal theme in web dynpro tables

    We are currently running EP6 (NW04).  Is there a way to make our java web dynpro table ui elements use the portal theme?  All tables appear blue unless they are checked as readonly in which case they are white. 
    I see there is a TableCellDesign ui element, but that is not available until NW04s and we are not there yet.
    Please assist. (and thank you!)
    Jeff Karls

    hi
    You are right about NW04s portal theme editor and we are able to change colour
    the tablecelleditor ui. But as far as i remember i was able to change properties like selected cell colour, non selected cell colour and mulitselected cell colour.
    However if you are not able to change it in EP 6.0 (NW04) then use the webdynpro themes. I suppose you will be able to do everything there.
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d2b1d790-0201-0010-25b7-d1fb059a8ad9">How to edit webdynpro themes</a>
    <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/1e/535d420447e054e10000000a155106/frameset.htm">Setting the theme in Visual admin</a>
    Hope it helps.
    regards
    LNV

Maybe you are looking for