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

Similar Messages

  • How to create a user in UME Database using web dynpro java custom application

    Hi,
    Can you please suggest me how to create a user in UME Database using web dynpro java custom application.
    My Requirement is user can register his/her user id in SAP Portal 7.3 UME database.
    Please suggest me.
    Thanks and Regards,
    Amit

    Hi Amit,
    Generated Documentation (Untitled)
    This is what you're looking for, there's no real cook-book -- though Amey mentioned there might be some material on SDN, perhaps some tutorials.
    You should be looking into com.sap.security.api.IUserFactory, methods newUser(String) which gives you and IUserMaint and commitUser(IUserMaint, IUserAccount) -- IUserAccount can be obtained using com.sap.security.api.IUserAccountFactory, method newUserAccount(String)
    Hope it helps,
    D.

  • Create portal user using web dynpro abap application

    Dear All,
    I would like to know is it possible to create portal user-id through web dynpro abap application.
    My requirement is
    > I have to create a web dynpro abap application. In the web dynpro abap application I have name email-id and phone number as entry fields.
    > I will click on submit, one unique id will get created. This unique id will be the login id for portal.
    I found how to create portal user using web dynpro java, but i could not find regarding web dynpro abap.
    If it is possible to create the portal users using web dynpro abap pls share the code as well.
    Regards,
    Swapnil Indulkar

    Hi swapnil,
    I think by using BAPi.. BAPI_USER_CREATE1 you can create.
    Please check this...
    Create portal user from webdynpro abap
    Creating user and assigning a group through code
    user administration su01
    How can i get the portal user id from logon ticket in the webdyn 4 ABAP
    Cheers,
    Kris.
    Edited by: kissnas on May 21, 2011 8:47 AM

  • How to find who is login Portal by using webdynpro with java

    Hi Friend
    One Supplier( Abc) Login into the portal . How to find it "ABC"  user login into portal by using webdynpro with java
    My requirement is
    One Supplier login in to the portal that supper having one Vendor number ( it is fixed)
    Exp: Portal user vijay login his vendor number 12345 like
            Suppose u r login into the portal u have one vendor number like this
    i have to desine one screen that is find PO'Status Screen, In that Screen, Meterial Group,line number,PO Status and Vendor number is avaliable.
    Supplier login in to that portal he is finding some items.
    this my Requirement. i m creating this screen ..How to fined user name from portal .once i have to find this user name by using webdybpro with java. I have to assine vendor number
    Regards
    Vijay

    Hello Vijay,
    You can wirte the following code to get the logged in user's ID
    try {
              IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
              IUser sapUser = wdClientUser.getSAPUser();
              IUserAccount[] acct = sapUser.getUserAccounts();
              String str = acct[0].getDisplayName();
              wdComponentAPI.getMessageManager().reportSuccess("user "+ str);
         } catch (WDUMException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
         } catch (UMException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
    You need security api for using it make sure that is present.
    Thanks,
    Hope this will help
    Sarbjeet

  • How to use Web Dynpro Java isChanged and isChangedByClient

    Hello,
    I have read thorugh a lot of documentation, threads, ... --> but the picture is not geting clearer fro me.
    We have Web Dynpro Java Application (on Netweaver 7.0 SP12) running in Enterprise Portal. We need to tell the portal work protect mode, that we have unsaved changes (how to do this is clear).
    I am struggling with figuring out, that my Web Dynpro Context has unsaved changes. I found the two change-indicators isChanged() and isChangedByClient(), which already confuses me a little bit.
    Anyway, this is what I have figured out so far:
    I am calling wdContext.currentContextElement().isChangedByClient() to figure out changes and when a Save operation has been completed sucessfully, I call wdContext.currentContextElement().node().getContext().resetChangedByClient(). This works for some of the changes made by the user.
    I then tried calling wdContext.nodeABC().getElementAt(i).isChanged() for all nodes of my Web Dynpro Context, but this results in detecting changes before the user ha done any interaction.
    Implementing an own change tracking (i.e. by adding a changed-Attribute to each context node) does not seem a viable option for me.
    So these are my questions:
    - Does anyone now a working pattern relying on those chnage indicators ?
    - Does anyone now how to reset the isChanged indicator (or when it is resetted by the framework) ?
    Any help appreciated.
    Thank you,
    Stefan

    Hi
    Check this link
    Re: How to keep isChangedbyClient flag set between roundtrips?
    http://help.sap.com/javadocs/NW04/current/wd/com/sap/tc/webdynpro/progmodel/api/IWDNodeElement.html
    Thanks

  • Portal Eventing between Web DynPro Java iView and non-Web DynPro iView

    Dear Experts,
    I have 1 Web DynPro Java iView and 1 non-Web DynPro (using JSPDynPage and JSP) iView, both attached to a page. When Web DynPro Java iView fire a portal raise event, the portal iView did not execute the javascript function tied to the event subscribed.
    Here is the code snippet which reside in the Web DynPro Java iView that is used to fire the event
    String param = "test";
    WPortalEventing.fire("urn:com.company.Test1", "TestEvent", param);
    This the code snippet that is in the jsp page
    function notifyTest(param)
         // Code to print param value here
    EPCM.subscribeEvent("urn:com.company.Test1", "TestEvent", notifyTest);
    Note:
    1. When Web DynPro Java iView fire the portal event the entire page is refreshed, including the non-WDP iView.
    2. When EPCM is replaced with window.top.EPCM, the page is refreshed, it is totally hanged with progress bar.
    Can anyone help to solve this problem?

    hi
    Please write the below code snippet in ur jsp for notifyTestjavascriptfunction
    function notifyTest( eventObj ) {
         eventParameter=eventObj.dataObject;
         // code to print the parameter "eventParameter"
    Thanks
    Harsimran

  • How to catch URL parameter from Portal URL in Web Dynpro iView

    Hi All,
    I have a web dynpro application running as a portal iView successfully. Now the client wants to make it internationalized with 7 languages. Currently they access the portal - and via role assignment they get to the portal tab with the wd iView. Now they want to send a parameter for the language key with the portal URL. So when they are typing in http://myportal.mydomain.com now they want to type in http://myportal.mydomain.com?sap-locale=de or so. My question is how can I catch this parameter in the WD application when it is running inside a portal iView? Is it at all possible?
    I have written a very small application which is trying to catch a URL parameter named PARAM. The code I have written is the default one as below:
    String paramValue = WDWebContextAdapter.getWebContextAdapter().getRequestParameter("PARAM");
    When I run the application standalone and add the PARAM=something in last of the URL I can catch it. But when I create an iView and while previewing it I add the same PARAM value it is coming as null all the time. Same when I add this iView to a role and show it via role assignment in protal. Please help to let me know how to achieve this. I think if I can read the parameter value from Portal URL in the WD iView - then I can set it as the default locale of the application and then show language specific file to achieve internationalization.
    Your urgent help will be highly appreciated.
    Warm Regards,
    Shubho

    Hi Shubhadip
    Even if you get the parameters, how do you internationalize your application? Are you not following the standard way as described in the following link. In this case you never need to capture any such parameter. This is done by the WD runtime automatically .
    <a href="http://help.sap.com/saphelp_erp2005/helpdata/en/f4/d95664da179b4db731e21c2e470b72/frameset.htm">Internationalization of WD projects</a>
    You can retrieve application parameters specified at the creation of iview by "adding parameters(with the same name as in iview application parameters) to the default plug of the Component Interface View of the WD application". "onDefaultPlug" method of the interface view controller you get these values as parameters, which you can save in the context node of component controller for later use.This is guaranteed to work.
    But again this is not what you want exactly. You want the user to specify the value at runtime. If you have just 7 languages, you can create 7 set of iviews with different application parameter value indicating language key, and assign to 7 different set of roles, each representing one set of users with common language.
    I hope you find a solution.
    Regards
    kk

  • How to set first_visible_row for a table on a web dynpro

    How can I set the attribute first_visible_row in a table which I placed on a Web Dynpro?
    I need the table to scroll automatically to a specific row depending on a date. So I'm calling a method using this date, but how can I change the attribute of the table?
    Thank you!

    Follow these steps,
    1- Create an attribute with char1 in the view context e.g first_vis_row
    2- go to the table properties in view and bind the property first_visible_row to this attribute.
    3- NOw go to the wddoinit method of the view...
    4- read the internal table and find out the index of the row which you want to set as first row. As in ur case you want a specific date in first row. So read the internal table and findout the index.
    5- now write this code, say your attribute name is first row inside node flag1...(you can change it for yoru requirement)
    DATA lo_nd_flag1 TYPE REF TO if_wd_context_node.
      DATA lo_el_flag1 TYPE REF TO if_wd_context_element.
      DATA ls_flag1 TYPE wd_this->element_flag1.
      DATA lv_first_row LIKE ls_flag1-first_row.
    * navigate from <CONTEXT> to <FLAG1> via lead selection
      lo_nd_flag1 = wd_context->get_child_node( name = wd_this->wdctx_flag1 ).
    * get element via lead selection
      lo_el_flag1 = lo_nd_flag1->get_element(  ).
    * get single attribute
      lo_el_flag1->get_attribute(
        EXPORTING
          name =  `FIRST_ROW`
        IMPORTING
          value = lv_first_row ).
    here change the lv_first_row to the index which you got after raeading the internal table.
    suppose it's
    lv_first_row = 4.
      lo_el_flag1->set_attribute(
        EXPORTING
          name =  `FIRST_ROW`
          value = lv_first_row ).
    Hope it works.

  • How to Disable Portal Links with Web Dynpro Java?

    Hi all,
    I have configured some access to my apps through iviews in my portal content, each application is included in a PCD Structure inside a User Role; according the roles asigned to my users are the access to the applications the user wolud have
    For example:
    Role 1
    RootApp
         iView1.1
         iView1.2
         iView1.3
    Role 2
    RootApp
         iView2.1
         iView2.2
    Role 3
    RootApp2
         iView3.1
    My users might have one or even the 3 roles, and depending on their roles is the access to the applications that they may have.
    Now I have a requirement of the user wherein when the user logs in to the portal and clic in the RootApp link the Dynpro Application must to present an iView showing a set of terms and conditions; if the users accept the terms then they can continue using the application defined by the PCD definition, but if the users don't accept the terms, the aplication links in the portal must be disabled and the user can not use the aplications defined, but this only has to be applied to the root link selected (RootApp) in wich the user doesn't agreet the terms and conditions, however, other applications that are non dependent of the root link (RootApp) can be used (RootApp2).
    Are there any way to disable only certain portal links using a web Dynpro implementation?
    Thanks In Advance

    Hi
    IMyService portalservice=(IMyService)WDPortalUtils.getServiceRefrence(IMyService.KEY);
    portalservice.myMethod();
    This is the code to get portal service reference and call methods implemented in the service
    Also, add prtapi.jar to build path. Add sharing refernce to portal:sap.com/<Portal Application name>
    Regards,
    Yoga

  • How to get user language in property renderer without web dynpro (java)

    Hi all,
    how can I get the language of the current user?
    Normally I got it with:
    IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
    com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();
    IUser ep5User = WPUMFactory.getUserFactory().getEP5User(sapUser);
    IResourceContext resourceContext = new ResourceContext(ep5User);
    String strUserLanguage = resourceContext.getLocale().getLanguage();
    But this only works in web dynpro applications. Now I need to get the language in my own property renderer. The code throws:
    com.sap.tc.webdynpro.services.sal.um.api.WDUMException: No client user defined for the current request (no regular Web Dynpro request as ITask is null.
    Thanks a lot
    Steffi

    Hi,
    If you are in a property renderer you always have a IResource which inturn has a ResourceContext and ResourceContext has the Users object.
    So the code should be:
    IResourceContext resourceContext = IResource.getContext();
    IUser user = resourceContext.getUser();
    user.getLocale().getLanguage();
    Regards,
    Praveen Gudapati
    Edited by: Praveen Gudapati on May 16, 2008 2:54 PM

  • Dynamic role Assignment in Portal using Web dynpro Java?

    Hi All,
    We have following requirement for dynamic role assignment.
    1) User Login to Portal.
    2) User Clicks on Home Tab in Portal, through RFC/BAPI, get Role from Backend(ECC) and compare the role ID with Portal Object ID through UME.
    Role gets assigned in Portal after comparison, if it exists in Portal.
    Can you please let me know what all steps I need to do to complete the above assignment.
    Thank you
    Ravi

    Thanks Tobias.
    To be precise I will explian my requirement.
    1) User Login ( User ID will be input to RFC)
    2) RFC will get Role for that user ID from Backend(ECC) and return that role ID to Portal.
    3) Now With the help of UME API, need to search role ID in Portal, If it exists, no action.
    If Role ID does not exists, then it shuld assign that role in Portal.
    Sorry for tedious comment.
    I am a bit new to webdyn pro.
    Can you please tell me each step i need to follow to complete the above requirement.
    Many Thanks,
    Ravi

  • How to implement Captcha using Web Dynpro Java

    Hi Experts,
    Can you please provide any information on CaptchaImplementation using Web Dynpro Java. We are using NWDS 7.01.
    Regards,
    Suvankar

    Hello Suvankar,
    maybe this blog will help. But haven't tryed it myself.
    http://scn.sap.com/blogs/balab/2006/09/25/bid-adieu-to-bots--using-captchas
    Regards,
    Tobi

  • How to set up environment for web dynpro Java?

    We want to develop applications in Java Web Dnpro.
    What do I need to configure in SAP R3 to use Web Dynpro Java?
    I can develop applications on the SAP NetWeaver Developer Studio and only perform a configuration  in SAP ECC ?
    Or do I need to install SAP EC Composition Environment ?
    Can I develop and set up RFC connections to integrate with my application in Web Dynpro Java?
    Please help me,
    Regards,
    Viviane

    Dear Viviane,
    In the webdynpr java application, you can use the data from SAP system. like you can use RFC's, Bapi's in your webdynpro application.
    Refer to [Linking RFC to Web Dynpro|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/761eba66-0401-0010-b982-d5f5bd9e8f90?quicklink=index&overridelayout=true] and http://wiki.sdn.sap.com/wiki/display/WDJava/WelcometoWebDynproJava%21
    Best Regards
    Arun Jaiswal

  • How to integrate Web Dynpro Java 7.1 with EP 7.0?

    Hi,
    I have 2 servers: 1 is EP 7.0 and another is CE 7.1. Is there any way how to use Web Dynpro Java deployed in CE 7.1 as an iView in EP 7.0 other than portal federation? We cannot use the portal content producer-consumer concept. Is there any other way how to do that?
    Regards,
    Tomas

    I have same task.
    I did not understood how and which system you created to resolve problem?
    As well, any reference  would be very helpful.
    thanks
    Edited by: Ivan Ivanov on Sep 7, 2009 5:51 PM

  • Using KM and Collaboration API in portal component and web dynpro

    Hi,
    I have to develop portal components and Web Dynpros (JAVA) which have to use the following functions:
    - copy, delete KM documents
    - sending E-Mails 
    Can anyone give me some actual documentation links for the KM and Collaboration APIs ?
    Which references do I need in portalapp.xml for KM/collaboration and which jar-Files do I have to add to the project?
    We are using NetWeaver 7.01 SP18.

    Hi  Yogalakshmi,
    thank you for the link and the information. Now I managed to work with the KM documents.
    One more Question: to get the resource Context, I use this code:
    portalUser = WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
    IResourceContext resourceContext = new ResourceContext(portalUser);
    The method getServiceUser is deprecated, also the com.sapportals.portal.security.usermanagement.IUser is deprecated. Is there an other possibility to get the ResourceContext. (perhaps with com.sap.security.api.IUser) ?

Maybe you are looking for

  • Which USB to DVI graphics card adapter for MBP 13

    After talking with Apple reps who had different answers, I understand that to do a second external display on a MBP 13, the only option is a USB to DVI adapter that basically has a graphics processor in it. My question is, does anyone know which bran

  • Upgrade MacBook Pro4,1 2.5 GH2 Intel Core 2 Duo

    As a novice, I am trying to find out if I can upgrade my memory and gain speed.  I have a 2.5 GH2 Intel Core 2 Duo processor and memory of 2GB 667MHz /ddr2/Sdram Any suggestions?

  • Error while opening document. PDF

    now im getting concerned about this pdf spook, i created text using a system font, but when i export the work to pdf i get an error message unless i break the text apart. i thought this only happens with brushes. and again i imported an image into fh

  • Dispatcher dead in sql server

    Hi All, I am getting the following error when tried to connect to the sap system Database is SQLSERVER trc file: "dev_disp", trc level: 1, release: "640" Thu May 22 18:21:37 2008 kernel runs with dp version 130(ext=102) (@(#) DPLIB-INT-VERSION-130) l

  • How to see adobe flash player files in iPad 2?

    How to see adobe flash player files in iPad 2?