Web Dynpro Session

I apologize if this has been discussed before. However, I could not find the answer on the forum.
I have read on the forum it is not possible to access the HttpSession object from Web Dynpro.
What is the best approach then to store objects per browser session?

Hi Harm,
It is not true that you cannot access the HttpSession object in a Web Dynpro, the thing is that is not supported by SAP, here is the code.
HttpServletRequest request = ((IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).getHttpServletRequest();     
     HttpServletResponse response = ((IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).getHttpServletResponse();
     HttpSession sesion = request.getSession();
For this you will have to add servlet.jar to your build path.
A better way to mannage data is using the Context of a Web Dynpro View o Controller, I suggest you read this document
<a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/tutorial%20on%20creating%20an%20extended%20web%20dynpro%20application%20-%202.htm">https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/tutorial%20on%20creating%20an%20extended%20web%20dynpro%20application%20-%202.htm</a>
which has the basic step for creating context and mapping it.
Regards.
*Remember rewarding point if the ansewear was helpful.

Similar Messages

  • ABAP Web Dynpro Session

    Hi all,
    I have developed an ABAP Web Dynpro application which make use of a bespoke RFC fucntion module. The RFC function module will append a long text into a line item. It only works for the first attempt but not the following. I guess this is because of the statefull behaviour of the ABAP Web Dynpro application. I wonder is there anyway I could kill the session? Or is there any other possible way of solving this?
    Ricky

    Hi,
    Check these profile parameters :
    icm/server_port_xxx = PROT=HTTP,PORT=xx,TIMEOUT=xx,PROCTIMEOUT=xxx
    rdisp/plugin_auto_logout
    Regards,
    Olivier

  • How to set a variable in portal session using web dynpro java.

    Hi,
    I have created a web dynpro application, which is running inside portal. I have created a role called "R1". Inside role R1, i have created 3 workset W1, W2 and W3. and inside each workset i have some pages and iviews.
    My requirement is when user logins to the portal , and when he clicks on role R1 for the first time, a login page should come (so that we can do revalidation), and when he enters his password again in that login page , then only workset W1, W2 and W3 should be visible/accessible to him and after successful revalidation, if he clicks again on role R1, in that particular portal session, than that login page should not come.
    for this, i thought i will set a variable in portal session, whenever user successfully revalidated himself, and if after successful revalidation he clicks again on role R1, i will check in doinit method of webdynpro whether variable is set or not (which i already set on successful revalidation), and if it is set then i will do Donavigation else i will present login page to the user.
    Can anyone tells me how to set a variable in portal session using web dynpro java.
    thanks
    Arush

    Hi,
    Try this:
    WDScopeUtil.put(WDScopeType.CLIENTSESSION_SCOPE, key, value)
    WDScopeUtil.get(WDScopeType.CLIENTSESSION_SCOPE, key)
    Ex:
    WDScopeUtil.put(WDScopeType.CLIENTSESSION_SCOPE,"Key1","Value1");
    String value1=WDScopeUtil.get(WDScopeType.CLIENTSESSION_SCOPE,"Key1").toString();
    /people/william.cui/blog/2007/02/12/sharing-session-context-between-parent-and-external-windows-running-on-same-host
    Regards,
    Charan

  • Calling session bean's business method through web dynpro component

    Hi All,
    Can anybody tell me how to call a session bean's methods through a web dynpro WITHOUT java-model or web service model ??
    I have following scenario:-
    1. Stateless Session bean having two business methods
    2. Web Dynpro component
    3.Now i want to call business methods without using any model. I have got following piece of code but I dont know how to go about it.
    4.Where do i have to set JNDI name for session bean? which interface will be looked for?
    5. Do I have to declare public part for EJB DC? If yes, how?
    //This is inside web dynpro component
    InitialContext   context = new InitialContext();
    o = context.lookup(JNDIName);
    TestSessionbeanHome homeRef = (TestSessionbeanHome) PortableRemoteObject.narrow( o,                                                                               
    TestSessionbeanHome.class);
    TestSessionbean beanRef = homeRef.create();
    <returnValue> = beanRef.<ejb method name>
    Please help to get a step-by-step approach to this case.
    Thanks and regards,
    Amey Mogare

    Hi,
    If  I comment out the part that is using session bean's business method, DC is building fine.
    And if I uncomment, then compiler is unabl eto resolve business method(s).
    And i would like to mention that my EJB + J2EE App DC is building properly, but it havent yet deployed properly as I am waiting for data-source-alias name prefix to be configured by ERP team. So will this be a reason why Web Dynpro DC is not able to resolve business methods ??
    Because Web Dynpro DC is able to resolved all interfaces of Session bean and entity bean. But when it comes to business method, its not able to resolve.
    Any more ideas why it is not happening?
    Pls help.
    Now i went through some forum posts regarding this and found that we also need to add EJB DC to Java Build Path for WebDynproDC>Properties>Java Build Path.
    I did this and now it is able to resolve business methods and DTOs as well. So to summarize I did following:-
    1. Added EJB DC (complete DC) as a Used DC to Web Dynpro DC with Buid-n-Deploy-n-Run time dependency
    2. Added Sharing reference of J2EE application DC to Web Dynpro DC -->Properties
    This reference I constructed as follows:-
    <vendorname>/<name of j2ee application as appearing under display name tag in application.xml (replacing '/' with '~')>
    So my Sharing Reference becomes:- <vendorname>/reqpstapscreqpstapja_reqid
    3. Added EJB DC to Java Build Path in Web Dynpro DC's properties
    4. Then I added following piece of code to get object of SessionBean class
    InitialContext context = new InitialContext();
    Object o = context.lookup("java:comp/env/ejb/SessionRequestIDBean");
    SessionRequestIDHome homeRef = (SessionRequestIDHome) PortableRemoteObject.narrow(o, SessionRequestIDHome.class);
    SessionRequestID beanRef = homeRef.create();
    beanRef.<business method>
    But After doing this I am facing another problem :-
    The build fails saying it is not able find the package for DTOs. But when I see the Component Controller's code it is not showing any red or yellow marks.
    Can anybody pls help me out here?
    Thanks and regards,
    Amey Mogare

  • Web Dynpro application Session time expired in Portal

    Hi All ,
       I am runnnig my web dynpro application in portal. When i log in for first time its working fine. But if if lof off and try to log in again in portal in same browser and try to access that web dynpro application then i am gettting error as follows in the browser. And even if i click on link the application could not be refreshed/opened.
    500   Internal Server Error
    The Web Dynpro Application 'WhowhoAppl' has expired. Restart the application using the Refresh button or via the following link WhowhoAppl.
      Details:   No details available
    I am also sending detail log trace below. Reply how to send this issue.
    #1.#001083FEF475004D00000024000003E00004458D7D628B13#1202373905933#com.sap.tc.we
    bdynpro.sessionmanagement#sap.com/tcwddispwda#com.sap.tc.webdynpro.sessionmana
    gement.ExceptionHandler.handleExpiration#J2EE_GUEST#0####fb017f90d55811dc93ff001
    083fef475#SAPEngine_Application_Thread[impl:3]_31##0#0#Warning#1#/System/UserInt
    erface#Java###Session unknown: Request with URI= was sent to unknown session.
    Either request with wrong session parameters was sent, or session has expired b
    efore . Current request parameters=. Is termination request=. Request w
    as sent from host with IP=/name=. Hint: see SAP note 842635 for more detai
    ls on session expiration. RID=
    [EXCEPTION]
    #8#/webdynpro/dispatcher/asianpaints.com/Whoswho/WhowhoAppl#Thu Feb 07 07:44
    :39 IST 2008#{}#false#172.18.40.57#172.18.40.57#faf5bfc0d55811dccc92001083fef475
    #com.sap.tc.webdynpro.clientserver.session.SessionExpiredLongJumpException: Sess
    ion has expired due to a concurrent invalidation or logoff request. Hint: This m
    ight occur if multiple logoff requests are sent to Web Dynpro by the portal as i
    t is the case when a logoff is executed and the portal has active embedded and i
    solated Web Dynpro applications. Only the first logoff request is processed, all
    following logoff requests will lead to this message but but can be ignored. Ple
    ase restart the application.
            at com.sap.tc.webdynpro.clientserver.session.ClientSession.doSessionMana
    gementPostProcessing(ClientSession.java:868)
            at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(
    ClientSession.java:302)
            at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing
    (RequestManager.java:149)
            at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doConte
    nt(DispatcherServlet.java:62)
            at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(D
    ispatcherServlet.java:46)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
            at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServle
    t(HttpHandlerImpl.java:401)
            at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleReq
    uest(HttpHandlerImpl.java:266)
            at com.sap.engine.services.httpserver.server.RequestAnalizer.startServle
    t(RequestAnalizer.java:387)
            at com.sap.engine.services.httpserver.server.RequestAnalizer.startServle
    t(RequestAnalizer.java:365)
            at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebCo
    ntainer(RequestAnalizer.java:944)
            at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(Requ
    estAnalizer.java:266)
            at com.sap.engine.services.httpserver.server.Client.handle(Client.java:9
    5)
            at com.sap.engine.services.httpserver.server.Processor.request(Processor
    .java:175)
            at com.sap.engine.core.service630.context.cluster.session.ApplicationSes
    sionMessageListener.process(ApplicationSessionMessageListener.java:33)
            at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRu
    nner.java:41)
            at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:3
    7)
            at java.security.AccessController.doPrivileged(Native Method)
            at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.ja
    va:100)
            at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:1
    70)
    Edited by: kavita chavan on Feb 8, 2008 12:04 PM

    Default expiry time of a webdypro is 3600 sec.Try to increase it in the visual j2ee admin tool.

  • Web dynpro Application session parameter

    Need pointers   for the following queries:
    1.Can I fetch Web Dynpro java application session parameter ?
    2.Is it possible to pass the fetched session parameter of a web Dynpro java application to a URL  while creating  an external window ?
    Regards
    Radhika Kuthiala

    [SAP Network Blog: Never Ever Hijack Internal Web Dynpro Classes and Interfaces|/people/bertram.ganz/blog/2005/02/02/never-ever-hijack-internal-web-dynpro-classes-and-interfaces]
    regards,
    Angelo

  • Create a entity using a session bean in web dynpro

    Hi.
    I want to create an entity bean object trough an EJB session bean in web dynpro, e.g using a form in a WD application filled in by a user.
    I understand how to display a list of entity beans through a session bean and a table, but I don't understand how to create (or edit or remove) such information.
    My session beans look like this:
    @Stateless
    public class MyObjectBean implements MyObjectLocal {
         @PersistenceContext(name = "MyObject", unitName="ProjectPU")
         public EntityManager em;
         public void create(MyObject myObject) {
              em.persist(myObject);
         public void edit(MyObject myObject) {
              em.merge(myObject);
         public void remove(MyObject myObject) {
              em.remove(em.merge(myObject));
         public MyObject find(Integer id) {
              return em.find(MyObject.class, id);
         @SuppressWarnings("unchecked")
         public List<MyObject> findAll() {
              return em.createNamedQuery("MyObject.findAll").getResultList();
    So the model class would be called Request_MyObjectLocal_create.
    I attempted to use [this|http://help.sap.com/saphelp_nwce10/helpdata/en/45/dd45e4bc295595e10000000a1553f7/frameset.htm] help file but I find the answer (step 17) quite unclear.
    Help is greatly appreciated!
    Vincent.

    I've just found the solution from Steve Muench weblog, always useful by the way!
    You can find the solution at this link http://radio.weblogs.com/0118231/stories/2004/05/07/handcodingDynamicDiscoveryOfEjbdeployedAppmodule.html
    In summary, we need to use the class com.evermind.server.rmi.RMIInitialContextFactory, which supports dynamic lookup, and implement the lookup ourselves.
    The code I've written to lookup the service is listed below:
    public static ApplicationModule getAppModuleManutencao() {
    try {
    Context ctx = getContext();
    ManutencaoFacadeHome home = (ManutencaoFacadeHome) ctx.lookup(EJB_MANUTENCAO_BEAN_NAME);
    ApplicationModule am = ApplicationModuleProxy.create(home, null);
    return am;
    } catch (NamingException nex) {     
    nex.printStackTrace();
    return null;
    private static InitialContext getContext() {   
    try {     
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "admin");
    env.put(Context.SECURITY_CREDENTIALS, "welcome");
    env.put(Context.PROVIDER_URL, "opmn:ormi://dsv008:OC4J_dvt20/mct");
    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    return new InitialContext(env);
    }catch (NamingException e) {     
    e.printStackTrace();
    return null;
    I hope this helps someone!!!
    Cheers!

  • Maintain user session in web dynpro application

    Hello Experts,
    I have a web dynpro application. Whenever user presses F5 or refreshes the application, user is made available with login page. Instead, I want to maintain the session for that particular logged on user, so, whenever he refreshes he lands on the same page if his session is active.
    As far as I read some discussions on scn, I got to know that there is no such thing in WD ABAP. Still, is there any way to accomplish this type of requirement?
    PDN.
    Regards,
    Harsh

    Hi Harsh,
         My assumption of your requiremnt:
    The application is suppose to bypass SAP authentication and should prompt the user with a custom view .
    So when the user logs in using the custom view (input details), then user shouldnt be prompted with login screen again if he presses f5 .
    A very different requirement .. but may be you can try using a static flag which will be raised when you login using the custom view.
    This flag value can be used to determine if the user has logged in earlier during the session.
    Thanks & Regards,
    Tashi

  • ERP2004: ESS JCO session handling in Web Dynpro apps?

    Hello,
    we run ESS/MSS Web Dynpro scenarios, running on WAS 6.40, SP12 in
    Enterprise Portal EP6 SP2 Patch 32. Our go live will be with > 1000 ESS users.
    1. When will the sessions in R/3 backend system be terminated by the
    Web Dynpro Application?
    How is the session handling in FPM (Floor Plan Manager) implemented?
    2. Are there any recommendations regarding the JCO connection settings
    in Web Dynpro Content Administrator (Maximum Pool Size, Maximum Connections,
    Connection Timeout, Maximum Wait Time) to reduce / optimize the load for the
    backend system? I found a documentation in SDN but it is not
    specific for ESS / MSS based on Web Dynpro.
    Background of questions above: The customer is worry about the load on
    SAP R/3 backend side: too much current users in the R/3 backend system,
    possibly bad performance etc. because the JCO sessions are open a long time.
    Are there any experiences with customers running productive ESS / MSS scenarios
    based on Web Dynpro?
    Thanks & Best regards,
    Daniel

    Hi,
    1. For best practices on JCO settings follow the tutorial below and do it accordingly for your no of users. YOu might have to do some trial and error procedure.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3103eb90-0201-0010-71af-be6f4a6f61d1
    2. For standards, security settings, cache management etc, SAP will give a TODO list after a remote audit of your project.
    regds,
    Sukanta Rudra

  • Use HTTP Session to pass Object from Web Dynpro for Java to JSP page

    Is it possible to get a handle on the HTTP Session object from within a Web Dynpro application? I want to place a Java object in there that can be retrieved by a JSP page.
    Thanks in advance.

    Hi Tom Cole,
       You can try this. i am not sure if this will work or not.
    HttpServletRequest request = ((IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).getHttpServletRequest();
    You can also try this.
    IWDRequest mm_request = WDProtocolAdapter.getProtocolAdapter().getRequestObject();
    HttpServletRequest request = (HttpServletRequest)mm_request.getProtocolRequest();
    IWDRequest basically wraps the HttpServletRequest. if you are using NW04s then the getProtocolRequest() may not be available.
    Regards,
    Sanyev

  • TechEd recording for New Features in Web Dynpro ABAP session

    This week's SAP TechEd lecture of the week is New Features in Web Dynpro ABAP - hence this posting in the WDA forum.  It covers heavily the new features that came in NetWeaver 7.01 as well as giving a bit of a preview of some of the new features in 7.02. This session was recorded in 2009 at TechEd Phoenix.
    http://www.sdn.sap.com/irj/scn/index?rid=/media/uuid/80726482-3d07-2d10-009c-c5a4db525ff0
    These TechEd Lectures of the week only last for free for one week and then you need a subscription to the Virtual TechEd to be able to view them. So this session will only be available until June 17th.

    you can use link to action in table.So that when you click link you can see the message in window or where ever you want.
    check this link how to insert link to action in ALV Table.
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/webDynproABAP-UsingUIelementsinALVcomponentcells
    thanks
    Suman

  • Web Dynpro application session expired

    Hi SDN,
    We have installed a new NW04s system and patched it with SP13
    I  can access SAP J2EE Engine start page  without any problem. But when  I click on  “Web Dynpro Content Administrator” and click any of the buttons “Create Jco Destination” or “Check SLD”. I am getting an error message:
             The Web Dynpro Application 'Explorer' has expired. Restart the application using the Refresh button or via the following link Explorer.
    I get same error message when I go to ''Netweaver Adminstration'' and  click on any of the links “Administration”, “Configuration” or “Monitoring” .
    Any suggestion how to solve this issue...
    Thanks and Regards
    rajendra

    The expiry happens if there is significant time difference between where a logon ticket was created and where you are accessing. Equally time synchronisation should be on across the entire network.
    Equally you may be using a ticket from another system due to the same domain.
    In this case it looks like your SLD is on another server?... i sthe same time synchronisation product used between the two?

  • 500 internal server error while deploying a Web Dynpro application

    Hi
    I got the 500 internal server error while deploying the application to server.
    I tried to find the log file at usr --> SAP --> SID --> JC XX --> j2EE --> Cluster --> Server 0 --> log, but no log was there.
    There were structure changes in the RFC and also code change in my Web
    Dynpro code.
    I´m working on EP 7.
    NWDS version is 7.0.1
    Please help me as the production move is pending because of this.
    Regards
    Vineet Vikram

    Hi
    Restarting the server does not help in my case.
    I tried it several times.
    I'm getting following error message in NWA>
    Originated from: com.sapmarkets.bam.logcontroller.InvalidLogQuerySessionException: Invalid or expired log query session "1"
    at com.sapmarkets.bam.logcontroller.jmx.LogControllerFacade.closeLogQuerySession(LogControllerFacade.java:356)
    at sun.reflect.NativeMethodAccessorImpl.invoke0
    Can you pl help on this.
    Regards
    Vineet Vikram

  • Unable to download file from FileDownload UI Element - Java Web Dynpro

    Hello Experts,
    I am facing a strange issue.Scenario is:
    I created an java web Dynpro application (Please note that it is just a standalone WD app, not integrated in portal) with just one FileUpload UI Element ,one FileDownload UI element and one button (for triggering an action).
    I browse a file (e.g. text,pdf,doc etc.) and click on button. It uploads the file and when I click on download, there are two cases:
         1) Simply click on download does not downloads the file and shows error: "Unable to download <file name> from <server name>.  Unable to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later." Though it is opening the file,showing the content.
         2) I opened that portal URL in a new tab in same session and logged in with a portal user. Now if I click on download link of same WD app opened in different tab of same session, it downloads the file without any error.
    I am using portal 7.0
    Can somebody point what's going wrong with case 1?
    Helpful pointers will be appreciated.
    Thanks,
    Kirtiman

    Hi Sid,
    I did not gave any authentication of WD app as it is anonymous app. There is no parameter set in application properties.
    As I run the app, it is showing the initial screen with UI elemtns and till upload works fine,.It has to be an anonymous app, so cannot ask for credential from user.
    Thanks
    Kirtiman

  • Problem with breakpoints in Web Dynpro components

    Hello experts,
    I have problems with breakpoints in methods of Web Dynpro components. Sometimes everything works as expected and a new window with the debugger comes up. Sometimes the breakpoints are ignored, and debugging is impossible. It even happens that a colleague can debug and I can't or vice versa.
    I am setting breakpoints with button "Set/Delete External Breakpoint", and the message always is "Breakpoint is set for user xxx". But sometimes when I display a method there is a warning that external debugging is not active. What does that mean and what is the reason for that?
    As adviced in the SAP help document "Debugging Web Dynpro ABAP Applications" I have enabled the new Front-End Editor and the new debugger, but still the problem exists. Does anybody experience similar problems or have an explanation for this?
    A second question concerns the different types of break points. My Web Dynpro component has an assistance class, and if I want to set a breakpoint there, I can choose between a session breakpoint and an external breakpoint. What exactly is the difference between these types? And here in the forum I sometimes read about internal breakpoints. Is this even a third type, or the same as session breakpoints?
    Thanks, Karsten

    Hi Kartsen.
    External Breakpoint -> can be started from outside the SAP GUI (e.g. WebDynpro)
    Session breakpoints are used if you start a programm or something like that in SAP GUI.
    I have the same problem ... sometimes he does not recocnize a new break point ... so I just reload the page and the break point works.
    If external debugging is not active, you habve to activate it in SE80 Utilities->External Breakpoints.
    Also make sure that in your Settings the correct debugging user is set:
    Utilities->Abap_Editor->Debugging.
    Cheers,
    Sascha

Maybe you are looking for