Access global attribute in webdynpro component?

Hi all i have 2 webdynpro components
Comp1
Comp2
Now i have declared a global attribute in comp1 in component controller.
I have embedded both component together to share values
I want to change the global attribute of comp1 from comp2
Let me know how to proceed.
Thanks

There are different ways you can accomplish this. Using an interface method as Jitendra Yadav mentioned above is one. Another way, you can define an interface node in comp1 component controller. This node will be visible in comp2 (provided you declared comp1 usage in comp2). Then, you can set values of all of the interface node's elements.

Similar Messages

  • Access Global attribute from with the BSP code.

    I have an attribute created within the View controller implementation class. The attribute is called GV_COUNT.
    Within my BSP  code I want to access this global variable, but I'm getting an error when activating the code, having statements like CLEAR GV_COUNT. in my code.
    Is there a format that is required. At the moment I just receive an error saying that field GV_COUNT is unknown.
    I thought that anything defined in the controller class was available for anything below.
    Jason

    Thanks Christian.
    Of course the attribute has been made public, and now that you've mentioned 'CONTROLLER' I feel rather foolish, as I should have known this.
    Many thanks to yourself and others for the replies.
    Regards
    Jason

  • Reading global attributes from implementation class

    Hi,
    How to access
                    global attributes of implementation class
                             from getter method of context node class.
    Thanks in advance,
    Srinivas.

    Hi Srinivasa,
    Access the view controller using attribute
    owner
    , Then you can access the global attributes.
    Regards,
    Masood Imrani S.

  • Declaring and accessing custom global attributes of component controller

    Hi,
    I want to declare some global attributes for Component Controller and initialize them in WdDoInit() method.
    I have declared them under Component Controller --> Attributes tab --> after wd_context and wd_this (say G_MESSAGE).
    However,  when I am trying to set them in wdDoInit() method, I get compilation error saying G_MYMESSAGE is unknown and its not defined using data statement.
    How do I access these attributes?
    Thanks and regards,
    Amey

    Hello Amey,
    You need to access the variable by "wd_this->g_mymessage"
    Since wd_this attribute in each controller refers to interface of local controller. you could read the description of that attribute in attribute tab.
    Regards
    Anurag Chopra

  • Webdynpro: Reading attribute of one component in another WD component

    Hi All,
    This is a scenario in the SAP SRM system.
    I am trying to access the Contract number attribute (V_CTR_H_BD.HEADER_BD.OBJECT_ID) from the webdynpro component /SAPSRM/WDC_CTR_DODC_H_BD.
    I want that attribute to be accessed in the WD component /SAPSRM/WDC_DODC_CND view V_DODC_CONDITION.
    So, in order to achieve the above requirement, I tried to add a node as an Interface Node in the webdynpro component /SAPSRM/WDC_CTR_DODC_H_BD. But, I am unable to create any node in the component controller of WD component /SAPSRM/WDC_CTR_DODC_H_BD as a Interface Node, and hence, I am unable to create any node of Interface Controller. This is due to the reason that the node that we are creating have the Interface Node option in disable state.
    Can anybody suggest what approach we need to follow to satisfy the above requirement? (It would be great if the resolution will be containing the steps)
    Regards,
    Susanta

    Hello,
    this is the scenario.
    I could populate the account name in location field now. I do have partnerno. however, i am not able to retrieve the account number. is it possible to retrieve account number by get_related_entity when i have name. If yes, please share the piece of code that has to written. I am also doubtful about where to write it. Currently i am writing code to get account name in GET_ACT_LOCATION.
    More details :
    I need to populate the address here.
    Component - BT126H_APPT
    view-BT126H_APPT/ApptDetails
    Node- BTACTIVITYH Base Entity BTActivityH
    attribute- STRUCT.ACT_LOCATION
    details about the name i am getting curently
    Component - BT126H_APPT
    view-BT126H_APPT/ApptDetails
    Node-BTPARTNERACCOUNT Base Entity BTPartner
    attribute-PARTNERNO
    Kindly tell me can i get the partnernumber from this node anyhow. if yes, please explain.
    REGARDS
    CHANDRAKANT

  • Access Portal groups in webdynpro ABAP component

    Hi Experts,
    I have a requirement to access portal group in web dynpro ABAP application and based on whether user is assigned to particular group or not further processing for application will be done.
    Are there any UME API or some other API's available to access portal groups in Webdynpro ABAP component?
    Thanks in Advance..!!
    Regards,
    Shruti Shah

    This might be a question better suited to the portal forum. The WDA Portal APIs do not have such functionality.  You might be able to take the Java Portal APIs and wrap them in a web service so that they are callable from ABAP.

  • Changing the attributes of Standard Webdynpro component

    Hi Friends,
    There is one table ui element in standard webdynpro component, right now we can select only one  row, now i want to select multiple rows, can any one help me how to change this property
    Thnx and Regards
    Kumar Srini

    Hello Kumar,
    if this node is statically created in the standard component then you can't change the selection cardinality. By statically created means, if you can see the context node in the Context Tab of the controller.
    If its dynamically created, then in the Post-exit method, you can delete this context node and create it again (via coding). while creating you can set the Selection Cardinality to multiple.
    Hope this helps.
    BR, Saravanan

  • How to call a RFC of a remote system from an ABAP webdynpro component

    Dear Experts,
    I am a newbie in ABAP Webdynpro.
    I am working on a requirement where I have a webdynpro component on ECC system.I need to call a RFC located on CRM system from my webdynpro component on the ECC system.
    How do I do that ?? Please help.
    Regards,
    Mamai.

    Calling RFC from some other system is same as local except the difference is that you have to give destination name while calling.
    And the regarding the method of calling it depends on your FM.
    if it is big RFC with complex structure, you can create the service call for it with destination given as RFC desitination.
    if it is simple straight forward RFC you can directly call it.
    for creating RFC service call call use this method
    1. Starting the Wizard
    To start the wizard, position the cursor on the Web Dynpro component to be edited in the object list at the left margin of the
    workbench window. Open its context menu and choose the entry Create->Service Call. The wizard is started and leads you
    through the creation process.
    Press Continue.
    2. Choice of Controller
    On the second dialog window of the wizard, you can choose whether the service call is to be embedded in an existing
    controller or whether a new controller is to be created for this purpose. Service calls can only always be embedded in
    global controllers u2013 that is, in the component controller or in additionally created custom controllers. It is not possible, to
    embed service calls in view controllers.
    a. Select radio button Use Existent Controller
    b. Do not change the default entry for component: <CC name>
    c. Enter for controller COMPONENTCONTROLLER
    d. Press Continue.
    3. Service Type and Service Selection
    a. You now select, which service type should be used for this service call. Select radio button Function Module. Fill the
    destination here. Press Continue.
    b. Select the service: for Function Module enter <RFC name>. Press Continue.
    4. The Required Methods and Context Elements
    On the two subsequent dialog windows, default values are listed for giving names to the context nodes and attributes
    required by the service call as well as to the required methods. The proposed names are based on the names of the
    embedded service, but you can change them as required. However, heed the respective notes in the corresponding dialog
    box.
    a. Adapt Context: Select from Nodes/Attributes . Press Continue.
    b. Specify Method Name: leave all entries as provided: Component:  Controller: COMPONENTCONTROLLER Method: EXCUTE_ Press Continue.
    5. Completing the Choice
    When you have confirmed the last dialog box, the generation is triggered. Afterwards you now have the required methods
    and contexts at your disposal for using them within your Web Dynpro component.
    or if you want to call directly the use the call statement with destination

  • Launch webdynpro component from a assignment block

    Hi,
    I am trying to launch a webdynpro component on click of a hyperlink from a assignment block.
    This works fine but, on click of hyper link i set a global attribute GV_url = 'X'.
    based on this, i call the webdynpro link in the .htm page of the view.
    <%
    if ZL_BT116IT__BSPWDCOMPONEN_IMPL=>gv_url is not initial.
    %>
    <a href="<%= ZL_BT116IT__BSPWDCOMPONEN_IMPL=>gv_url %>" target="_blank"> Sample URL to launch Web Dynpro Application</a>
    <%
    clear: ZL_BT116IT__BSPWDCOMPONEN_IMPL=>gv_url.
    endif.
    %>
    using this i get an additional hyperlink in the assignment block which on click gets the webdynpro page.
    This is an additionaluser click which is not required.
    How can we skip this , instead directly navigate on click of the attribute in the assignment block?

    have solved this using the script window.open
    <%
    if ZL_BT116IT__BSPWDCOMPONEN_IMPL=>gv_url is not initial.
    %>
    window.open("<%= ZL_BT116IT__BSPWDCOMPONEN_IMPL=>gv_url %>).focus();
    <%
    clear: ZL_BT116IT__BSPWDCOMPONEN_IMPL=>gv_url.
    endif.
    %>
    This helped me open the link directly but have a new problem with this.
    I am able to navigate to the link in a new window only the first time i click the hyperlink.
    once i close the new window and if i try to click the hyperlink again, i am not able to open this again.
    Have tried to debug but, everything is in place.
    Pointers on this scripting would be very helpful.
    Should i clear the link before exceuting again or do any additional scripting?.

  • Webdynpro - component controller

    Hi Gurus ,
    We designed screen in webdynpro . I created attributes in component controller and i tried to copy that attributes from component controller to view context. But i can't able to drag and drop that attributes.. Is there is any other way to copy that attributes or only option is to create attribute directly in view context

    Hi meena,
    Mapping between the controller is through NODE's. If you want to make you attribute global then you have to define node and create your attribute inside that and go view controller and perform mapping.
    If you define attribute in View Controller then that can be use in same View but you cannot use it in different View controller
    for this we define global attribute and mapped to different view controllers
    As you said you read in the site, it also suggest the same CREATE NODE in CC -> Attribute  -> goto VC and perform Mapping
    Regards
    farooq

  • Upload interactive form and access field values in WD component

    Hi Experts,
    I want to upload a prefilled  interactive adobe form in my webdynpro component and then I want to read the values filled in the form in my webdynpro component.
    I don't want to display the interactive form in the WD component. Just need to read the values.
    Please let me know how can I do it.
    Warm regards,
    Sushant Singh

    You can use the fileupload and filedownload uielements.
    Check these links:
    [File Upload|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/b3/be7941601b1d09e10000000a155106/content.htm]
    [File Download|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/09/a5884121a41c09e10000000a155106/content.htm]
    When you upload a file and save in SAP, are you saving it as xstring.
    If yes follow these steps for filedownload.
    Follow these steps for file download:
    1 Create FileDownload uielement in your View
    2.Create an Attribute of type xstring.
    3.Bind this attribute to the data property of your Filedownload uielement.
    4. during fileuplaod as you are saving the document in xstring format, fetch the same from your database table and pass the value to filedownload i.e set the attribute bound to data property of filedownload uielement with the xstring content.

  • Calling a method in another webdynpro component

    Hi,
    I have two webdynpro components say Comp A and Comp B.
    In Comp A I had a view View A and in Comp B I had a View in View B.
    In View A, I had a method X, I want to call this method in View B of Comp B.
    How I can do this?
    I created a public part of Comp A and tried to add in used webdynpro components. But in the list I am not able to find it.
    Please help.
    Regards
    MQ

    Hi,
    If both the components Comp A and Comp B are in the same DC you can use the interface controller to call the method in comp A. Add this comp A interface controller in Comp B controller by going to the properties tab, so that you can access the methods of comp A interface controller.
    If you have the components in different DC's you can follow the below steps:
    Go to public parts in DC meta data section and create a public part by selecting the first radio button option and add the Comp A by selecting the option (Webdynpro Component-->Selected Entities).
    Click on Finish button so that public part for comp A is created.
    Now build the DC and go to Used Webdynpro components of CompB, give some name and browse to select the used webdynpro component, it will show you the Comp A public part select it and try to finish it.
    Once again build the Dc after doing this.
    Now  you can access the method of comp A in Comp B
    wdThis.wdGetCompA.getX()...
    Hope this helps you..
    Regards,
    Saleem

  • Calling Component details in Webdynpro Component Usage Pop-up

    Hi Experts,
    We have a WD component, say ZWD1, which has been re-used(component usage) in many other WD components.
    In all the usages the main window of ZWD1 is being called as a pop-up.
    Now we have a requirement wherein i need to write certain logic in ZWD1 view method which should be executed only when
    ZWD1 is called as a pop-up from 2 particular components out of all the components in which it has been reused.
    Is there any way in which we can get the details of the Parent window (or) component from which ZWD1 has been called, in the methods of ZWD1? (Apart from calling an interface method of ZWD1 or setting the value of an interface node of ZWD1, from the parent component)
    Thanks in advance.
    Best Regards,
    Sampath A.

    Hi,
    for your requirement you could use Assistance Classes in your Parent component and Used Component.
    Use the Same Assistance class in all the components and set an Attribute in Assistance class while in Parent component.
    Now in your Used Component , you can access that Attribute of Assistance class and check which Parent component it is calling.
    To call the attribute/method use the instance wd_assist.
    For more info on Assistance  class and its usage Refer the SAP Online Help :
    http://help.sap.com/saphelp_nw70/helpdata/EN/43/1f6442a3d9e72ce10000000a1550b0/frameset.htm
    I hope it helps.

  • How to call global attribute in .htm page in sap crm

    hi friends,
    in the class i have  created a global attribute . i want to access this global attribute in .htm page of the view . how to call this attribute in .htm  please send me the syntax .
    thanks and regards,
    sashi

    hi,
    I have accessed the global attribute in .htm page . I have declare a local variable and pass the global attribute value to local variable.
    Here I put a validation for hiding the field . If the data is not available in the field then only I have to hide the field. For this I have written the code. For your reference,
    <%
    DATA : lv_exprevenue TYPE STRING.
    DATA : lr_entity TYPE REF TO if_bol_bo_property_access.
    *lv_exprevenue = ZL_BT111H_O_DETAILS_IMPL=>gv_dref.
    *lv_exprevenue =  controller->gv_dref.
    lr_entity ?= BTOpportH->collection_wrapper->GET_CURRENT( ).
    CALL METHOD lr_entity->GET_PROPERTY_AS_STRING
    EXPORTING
       IV_ATTR_NAME = 'EXP_REVENUE'
    RECEIVING
          RV_RESULT         = lv_exprevenue.
    IF lv_exprevenue is NOT INITIAL.
    exit.
    else.
    data: lv_xml type string.
    lv_xml = controller->CONFIGURATION_DESCR->GET_CONFIG_DATA( ).
    replace all occurrences of '//BTOPPORTH/EXPREVENUE' in lv_xml with ''.
    ENDIF.
    %>
    <chtmlb:config displayMode = "<%= controller->view_group_context->is_view_in_display_mode( controller ) %>"
                    xml     = "<%= lv_xml %>"
                   mode        = "RUNTIME" />
    But the entire view is being hidden in WEB UI.
    Please Let me know if there is any mistake in the above code or I have write code some where else.
    Thanks & Regards,
    Sashi
    Edited by: skancharla on Nov 2, 2011 2:09 PM

  • Resue of Custom Controller to another webdynpro component

    Hello,
    I would like to use all the methods and context of one custom controller residing in one webdynpro component from another view residing in another webdynpro component.
    Could you please give me an idea asto how this can be achieved?
    For this I have added the first webdynpro component(which has the custom controller) to its public part and added the first component to the other webdynpro component(which will resue the previous one) as a used DC.Now I want to access all the methods of this custom controller in the view of this second component.
    Thanks and Regards,
    Arya

    Hi
    To make uses of component and its other controller u have to deal with [ Interface controller|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f07c3625-c971-2910-3a9c-ce131487f82c]
    For  [Custom Controller|http://help.sap.com/saphelp_nw04/helpdata/en/c4/862594e85911459301aa71a2b7b6b4/frameset.htm]   it is nothing but a separation of the component controller task into unit for example want to implement OVS ,so put it in one dedicated custom controller etc.
    Best Regards
    Satish Kumar

Maybe you are looking for