Using view context attribute values in view methods

Hello,
I have a view context mapped to a window context.  The window context has a supply function that gets some data.  I would like to use some of this data in one of my view methods but can't seem to find the syntax to use the values in the mapped view context attributes.  I know for displaying on the view you map the screen field to the context attribute but I just need to use this value in a method.  Any help will be greatly appreciated.
Thank you,
JR

Hi Joseph,
If you already had mapped the view context with the window context, all you have to do in the view method is to read the view context. For this, you can use the next code:
  DATA: lo_node      TYPE REF TO if_wd_context_node,
        lo_element   TYPE REF TO if_wd_context_element,
        lv_attribute TYPE wd_this->element_node-attribute.
  lo_node = wd_context->get_child_node( name = wd_this->wdctx_node ).
  lo_element = lo_node->get_element( ).
  lo_element->get_attribute(
    EXPORTING
      name =  `ATTRIBUTE`
    IMPORTING
      value = lv_attribute ).
This is supossing you have a node named 'NODE' with an attribute named 'ATTRIBUTE'.
Also, you can use the Web Dynpro Statement Structure. It's a wizard that helps you to generate some code. The icon is like a magic wand.
Regards,
Isaac Meléndez

Similar Messages

  • Using dynamic context attributes with flashisland

    I recently started looking at flashislands.
    Going through the SDN tutorials on this topic, I noticed that the declarations of GACDATASOURCE and GACPROPERTY properties inside web dynpro and their counterpart variables inside flex are a bit static (all naming and binding is done at design time).
    So I'm asking if there's a way inside flex to dynamically capture the values of the attributes of a web dynpro context node that is bound to an ArrayCollection variable inside flex without knowing the names and the amount of the attributes of the context node?
    Here's my situation:
    I have a context node (REPORT_DATA) inside web dynpro that at design time has no attributes.
    The attributes and their names are created dynamically at runtime.
    It is even so, that over time the amount of attributes may vary.
    Inside the web dynpro, the contents of this context node (REPORT_DATA) are shown in a (dynamically built) table.
    Besides using the table, I'm trying to show the same contents as a piechart and as a columnchart in a flashisland.
    The ROOTUIELEMENTCONTAINER of the FlashIsland view in web dynpro only contains a GACDATASOURCE element at design time.
    The 'dataSource' property of this GACDATASOURCE is bound to the context node REPORT_DATA.
    The 'name' property of this GACDATASOURCE is bound to an ArrayCollection variable inside flex (named dataSource).
    So much for the static part created at design time.
    At runtime inside web dynpro the correct GACPROPERTY's are created, based on the - over time changing - amount and the names of the context node.
    Suppose my REPORT_DATA context node at runtime starts with 3 attributes: ATTR1, ATTR2 and ATTR3
    Also suppose the node contains 2 elements: [ {"1_1", "1_2", "1_3"} , {"2_1", "2_2", "2_3"} ]
    The dataSource variable inside flex also contains 2 entries with 3 elements each.
    The code to show the value of (for example) the first element of all entries inside the ArrayCollection variable would be:
    +for each( var o:Object in dataSource) {
    var s:String = o.ATTR1;
    Alert.show( "the 1st value = " + s ); // 1_1 for the first entry, 1_2 for the second
    }+
    I can then use the myAC variable inside flex as dataprovider for various other objects.
    This works fine.
    But inside flex I can only capture the value of an attribute when I know its name at design time (like ATTR1 in the sample code above).
    And that's not what I want.
    Inside flex I want to capture the value of the context attributes dynamically in a (correctly typed) flex variable without knowing the names and the amount of the context attributes.
    Is this possible?
    Thanks in advance for - any - response.
    Bart.

    Hi again,
    I tried the same thing by creating a dummy context node without any attributes, and adding all attributes at runtime using the add_attribute method. In that case too, it doesnt work. All the attributes are available in the dynamic attributes of the node element, but are not getting displayed.
    Any help would be greatly appreciated. Thank you.
    regards,
    nithya

  • Values not passing from form to context attributes (value attributes)

    Hi Experts,
    I have bound the properties of theadobe interactive form (WD-Java) to the context attributes but the values are not passing to the value attributes at runtime.
    For your information I have not bound the pdfsource binary attribute of the view to the custom controller pdfsource binary attribute.
    Please advise.
    Thanks,
    Shobhit

    Context
       GetData - ModelNode mapped to controller context (DataSource)
             Attribute1 - Value Attribute (Form Field)
    Is it allright to have the Data Source as a ModelNode (mapped to the controller context node) and then have Value Attributes under the ModelNode which are then bound to the adobe form input fields.
    I know its frustrating to advise on such questions without looking at the code actually. But I would definitely need your support.
    If possible could you mail me a project of yours where you have the form being PREFILLED with some values coming from a RFC FM and then the same form gets posted to SAP though another RFC FM.
    Thanks,
    [email protected]
    OK. When I create a Fresh Adobe Interactive Form application, it works fine.
    The problem Im facing is in the case, when Im using an existing PDF file created in the ABAP stack (TCode SFP). I am importing this PDF file into the WebDynpro Java Application and then binding the fields. So in this case the context binding does not work.
    You guyz are right, I need to check if there is any other script which exists. But still what are views after this update?
    Message was edited by:
            Shobhit Swarup Mathur

  • Which master data table to be used to get attribute value

    Hi all,
    I am writing  routine in update rule to get data for one master data attribute of master data 0customer.
    But I am cofused in choosing master data table to get data.
    There are two master data table in master data tab of  0customer characteristics.
    1. View of MstrDtaTbls  :-  /BI0/MCUSTOMER
    2. Master data tab          :-  /BI0/PCUSTOMER
    Suggest me which one to take .
    Although I have tried with 2 one and it is working fine.

    Hi,
    If the attribute is not time-dependent please use  /BI0/PCUSTOMER, else use /BIC/QRCOSTCTR.
    Just remember P table and Q table.
    Regards,
    Frank

  • Attribute value inside doDML method

    Friends.
    How can I get Inserted Entity Id (DBSequence) inside doDML method?
    With the help of getId(), ID or getPostedAttribute(ID) methods I always receive integer value -16.
    Vladimir Zimin

    Repost

  • LDAP bind using the userpassword attribute value

    I'm trying to prove that I can bind to OID using an SHA password digest, so I'm binding as follows:
    ./ldapbind -h ipaddress -p myport -D cn=myuser,cn=users,dc=xxxx -w myuserspassword
    This works fine if I enter the cleartext password. What I want to do is enter the password as it appears in the users 'userpassword' field, which is an SHA digest.
    So if the password is 'abcdef', the userpassword value is something like {SHA}cGsjdkGsgfd.
    So, -w abcdef works fine, but how can I do something like -w cGsjdkGsgfd and tell OID it's an SHA digest I'm using?
    What I'm ultimately trying to do is to get a SOAP request to authenticate my user against OID and the only password available to it is the SHA digest. It's failing and I don't know why, so my first step is trying to prove I can bind with the password digest.
    Thanks in advance.

    Yes, sorry about that - I started off trying to prove a potential solution.
    Aim:
    A user logs onto a weblogic application and is authenticated against OID. The application is making SOAP service calls to a proxy endpoint monitored by another vendors software which authenticates the user against the ldap and checks their roles to see if the user can call the service.
    Solution so far:
    The initial application gets the username from the JAAS principal, but the password is not supplied. I can easily supply the SHA password digest to it (but putting a cleartext password in the header will probably not be given the go-ahead). This would enable the application to make the SOAP call with a username and digest.
    The software protecting the services can be configured in a variety of ways to authenticate the user to the ldap. One involves using the wsse username token in the header (cleartext password or digest).
    This authentication is failing and I don't yet have the diagnostic tools available to see which stage is in error. I was trying to prove that you could actually authenticate with an SHA password digest by doing a bind.
    Regards

  • How to get zclass attribute's value inside  "Execute_default" method

    Hi all,
    I am displaying a link in UD step under "Objects & Attachmnents".I am using zclass. I created a attribute in zclass and i am creating a instance (background task) before this UD step and i will be setting a attribute of the zclass inside this create instance method.
    My problem is, if i click the link, this method "BI_OBJECT~EXECUTE_DEFAULT_METHOD" is getting executed but i am not able to get the attribute value inside this method, eventhough i am setting the attribute value before the UD step.
    Pls let me know, how to get the attribute's value inside "Execute_default" method, as i need to process further using this attribute.
    P.S: I tried with both static & instance attribute. I can achieve the same using ZBO but my client needs to use only class.
    -Vinoth
    Edited by: S Vinoth on Jan 29, 2010 7:23 AM

    Lei,
    If you are concerned only about a couple of attributes, then you can manage with a separate copy of the data. But if the data is in bulk, better leave it to pl/sql side of validation.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Simple Types and Context Attributes

    Hello All,
      Can someone be kind enough to explain the difference between using a context attribute and a Simple Type ? For example... what's the difference (and I am sure there is ) between a context attribute "Name" that is declared to be of String type and a simple type "Name" that is of built-in type String  ?
    from
    Kwok Wei

    Some links on SimpleTypes and its usage.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/value help in web dynpro applications.pdf
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/internationalization of web dynpro applications.pdf
    Regards, Anilkumar

  • Data Set - Encode Attribute Value?

    I'm using an HTML data set with an active region. Some of the
    data is to be used as attribute values (e.g. as the "value" of an
    "input" tag), and some of the data is to be used within the HTML of
    the document (but should not be rendered as HTML). What is the best
    way (recommended practice) for encoding the data for these uses? In
    other words, does the spry framework provide such utilities? Is
    there a way to pull the data out of the data set already encoded
    for use as an attribute value? Or with >, <, and &
    properly encoded for use in HTML?

    I guess you are also using SpryData.js in the same page.
    SpryData.js has a function called
    Spry.Utils.encodeEntities(string);
    It will encode your Entities for you and returns the changed
    string. If you data is already encoded before you brought it in to
    the SpryDataset, make sure you didnt set the columnType to html.
    If not you can do something like this
    <script type="text/javascript">
    function encodeEntities(region, lookupFunc)
    return
    Spry.Utils.encodeEntities(lookupFunc("{dsProducts::desc}"));
    </script>
    <div spry:region="dsProducts">
    <ul spry:repeatchildren="dsProducts">
    <li>{name} - {function::encodeEntities}</li>
    </ul>
    </div>

  • Why there is a difference in a "class" attribute value of html tag when viewed in "Page Source" and using "Inspector", I am refering to new Microsoft site?

    While inspecting the new Microsoft site source, I observed that the "class" attribute value of the "html" tag when seen in Page Source the value given by Tools/Web Developer/Inspect tool. Value with the tool indicates class="en-in js no-flexbox canvas no-touch backgroundsize cssanimations csstransforms csstransforms3d csstransitions fontface video audio svg inlinesvg" while that is given in Page Source is class="en-us no-js"
    The question is why different values are shown?

    Inspector is showing you the source after it's been modified by Javascript and such.
    To see the same thing in the source viewer, press '''Ctrl+A''' to select everything on the page, then right-click the selection and choose '''View Selection Source'''.

  • How to get attribute values from one view to another

    HI all,
    Thx in Advance..
    I have 2 view like v1,v2.In v1 i used one attribute values from "get single attribute" method.And i need the same values in v2 screen.For this i did in v1 outbound plugs , i mentioned the parameter name . How can i get the same values in  v2.

    Hi chandru ,
    you said you declare the parameters in the Outbound Plug of V1.  now go to view V2 inbound plug Tab and creat one inbound plug
    double click on the plug name .it will navigate you to the event handeler method . Now add the outbound parameter variables in the
    parameters
    For example : V1firing the navigation plug
    a type string " defined in parameter
      wd_this->fire_out_to_view2_plg(
        a =      'ABCD'                           " string
    you can retrive the value freely in v2 inbound event handeler
    a type string " defined in parameter
    *   set single attribute
        lo_el_context->set_attribute(
          name =  `TEXT`
          value =  a )." here you will get the 'ABCD'.
    regards
    Chinnaiya P
    Edited by: chinnaiya pandiyan on Jun 23, 2010 7:12 PM

  • How to find out which context attributes are mapped to view elements

    Hi All,
    We have a custom WD application ( on ECC 6.0 - SAP Basis 70 ) where we have a context node whose 70 attributes are displayed over 2 seperate views.
    When a user enters the view,  we want to inform him which data was changed. 
    I have written a general method which takes the context node, grabs its attributes and compares values ... messages are generated via the message manager and context element/attributes are linked so that the input elements become red.
    Everything works fine but the only problem is that I do not know which attributes are visible on which view so the user is getting the changes of view 2 on view 1 and vice versa ( if the context is only mapped on 1 view then there is no issue ofcourse ).
    The call is currenlty executed at the views inbound plug ... I also checked the view methods themselves like modify view but nothing seems to lead me to a potential solution ...
    I have looked through almost all API classes available but I cannot find any way to obtain information about the linking of view elements with context elements/attributes during runtime ... And I don't want to 'hardcode' a list of context attributes per view ....
    Has anyone done something similar ?
    Thanks,
    Steven

    Hi All,
    We have a custom WD application ( on ECC 6.0 - SAP Basis 70 ) where we have a context node whose 70 attributes are displayed over 2 seperate views.
    When a user enters the view,  we want to inform him which data was changed. 
    I have written a general method which takes the context node, grabs its attributes and compares values ... messages are generated via the message manager and context element/attributes are linked so that the input elements become red.
    Everything works fine but the only problem is that I do not know which attributes are visible on which view so the user is getting the changes of view 2 on view 1 and vice versa ( if the context is only mapped on 1 view then there is no issue ofcourse ).
    The call is currenlty executed at the views inbound plug ... I also checked the view methods themselves like modify view but nothing seems to lead me to a potential solution ...
    I have looked through almost all API classes available but I cannot find any way to obtain information about the linking of view elements with context elements/attributes during runtime ... And I don't want to 'hardcode' a list of context attributes per view ....
    Has anyone done something similar ?
    Thanks,
    Steven

  • Using Static Variable against Context Attribute for Holding IWDView

    Dear Friends,
    I have a method which is in another DC which has a parameter of the type IWDView. In my view, I will have an action which will call the method in another component by passing the value for the view parameter. Here, I can achieve this in 2 types. One is - I declare a static variable and assign the wdDoModifyView's view as parameter value and I can pass this variable as parameter whenever calling that method or the second way - create an attribute and assign the same wdDoModifyView's view parameter as its value. Whenever I call this method, I can pass this attribute as parameter. What is the difference between these two types of holding the value since I am storing the same value i.e., wdDoModifyView's view parameter. But when I trigger the action from different user sessions, the first type of code (using static variable) prints the same value in both the sessions for view.hashCode() and View.toString(), but the same is printing the different values when I pass the attribute which holds the view parameter.
    Clarification on this is highly appreciated
    The problem I face is when I use static variable to get the view instance and export the data using the UI element's id, the data belonging to different user sessions is mixed up where as when I use Context Attribute, the same problem doesn't arise. I want to know the reason why it is so. Is there any other place or way where I can get the current view instance of each session instead of wdDoModifyView?

    Hi Sujai ,
    As you have specified the problem that we face when we use  static attributes, when end users are using the application .
    Static means i  have n number of objects but the static variable value will remain same every where.
    when it is context attribute for every object i.e nth object you have a nth context attribute i mean nth copy of the context attribute.
    so every user has a unique Iview parameter , when context is used and
    when static is used  , assume you have userA , his iview is set this intially  and u have another user B , when he is using  , since the variable is static and when you access this variable you will get the value of userA.
    Regards
    Govardan Raj

  • How-to map multiple explicit search help values to context attributes?

    Hi,
    I have a custom explicit Search Help with multiple attributes set as export and uses search help exit for data retrieval. I have set this Search Help for one of the context attribute that is binded to one of the input fields on view.
    Now, is it possible to dynamically map other export attributes from this Search Help to other Context attributes?
    I know this works for Input helps that are directly derived from check tables but not sure how to do it for explicit Search Helps.
    Can anyone please confirm and let me if this is possible? If yes, then can you please share an example or describe how to do it?
    Thanks and Regards,

    Hi Srinivas,
    Check this ..Search help can be dynamically assigned to a field.
    data lo_nd_info type if_wd_context_node_info.
    lo_nd_info = lo_nd->get_node_info( ).
    CALL METHOD lo_nd_info->set_attribute_value_help
    EXPORTING
    name = 'ATTR1'                  " Your attribute Name
    value_help_mode = '121'    " Valid value help mode
    value_help = 'Z187442'.      " Search help name
    The various possible values that you can pass to value_help_mode are as shown below.
    deactivated 101
    automatic 111
    ddic 121
    ovs 131
    Also refer this..
    Re: How to put dynamic search help in web dynpro ABAP.
    Cheers,
    Kris.

  • Error while re-using view

    Hi,
    I've several views which i want to re-use but when i add a view which I have already used, i get the error:
    Processing HTTP request to servlet [dispatcher] finished with error.
    The error is: com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: duplicate usage of view .BasketView
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:515)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.bind(ViewManager.java:397)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:554)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.bind(ViewManager.java:397)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:554)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.bind(ViewManager.java:397)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:554)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.bindRoot(ViewManager.java:421)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.init(ViewManager.java:130)
         at com.sap.tc.webdynpro.progmodel.view.InterfaceView.initController(InterfaceView.java:41)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
         at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.displayToplevelComponent(ClientComponent.java:135)
         at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:404)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:618)
         at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
         at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:251)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:48)
         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.runServlet(HttpHandlerImpl.java:390)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    Why cant I re-use my view?
    much thanks,
    Hugo

    Hallo Nikolay,
    my "Modeling Web Dynpro View Composition" tutorial was removed from the Web Dynpro Java sample applications page on SDN because I applied ViewSets and ViewAreas inside windows instead of ViewContainer  UI elements inside specific Web Dynpro layout views. Except this sub-optimal (as less flexible; you have more layout and sizing possibilities with ViewContainer UI Elements in virtual layout cells of container UI elements with Matrix or Grid layout in comparison to ViewAreas in ViewSets of a window) technique the tutorial is still very valuable for Web Dynpro application developers. As an example, it demonstrates the concept of creating multiple instances of the same visual component based on separate component usages. This principle is absolutely crucial for developing component-based Web Dynpro applications.
    You can read the tutorial description with all related links below.
    Regards, Bertram
    View Compositions
    This Web Dynpro sample application implements a complex view composition. The term view composition describes a set of all view assemblies that can be accessed by navigation. A view assembly consists of normal Web Dynpro views and interface views of Web Dynpro components within the browser window. You can model view compositions in the Navigation Modeler as part of the Web Dynpro tools.
    The following options are applicable to model view compositions:
    Embedding several views in view setsm, Embedding view sets in each other,     Embedding visible Web Dynpro components using their component interface views
    In this tutorial, a Web Dynpro component is embedded using two instances.
    Embedding views and view sets in view layouts by using the ViewContainerUIElement
    Code Sample
    The ready-to-use project is available to download from SDN  [13TutWD_ViewComposition.zip|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sapportals.km.docs/business_packages/a1-8-4/13tutwd_viewcomposition.zip]
    Corresponding Tutorial: [Modeling View Compositions in Web Dynpro|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/2cceb190-0201-0010-be88-acdbeb2ad65f]
    Details
    Project Template: The initial project (starting point for this tutorial) is available to download from SDN: [13TutWD_ViewComposition_Init.zip|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sapportals.km.docs/business_packages/a1-8-4/13tutwd_viewcomposition_init.zip]
    Level of complexity: Expert
    Key features covered: view sets, view assembly, view composition, nested view sets, component interface view, component usage, component reuse, multi-instance capability of Web Dynpro components, UI element Image, UI element ViewContainerUIElement, calculated context attributes
    Time required for completion: 2 hrs
    Created by: SAP AG

Maybe you are looking for