Supply Function

Hello Everybody,
Can someone tell me what Suppy Function used for?
Whats the significance of it? Is it mandatory?
Please explain it to me.
Thanks,
Sneha SIngh.

Hi Sneha,
I assume you are asking in connection with the Laptop Application you are developing (from your other thread)?
I am not used Web Dynpro much, but supply functions are mandatory if you're using a singleton node (i.e. Say node B is the child of node A, and node B is a singleton). So every time you change the lead selection of node A, you need to repopulate node B with the corresponding child values, and a supply function is used to do this.
Also, you can define supply functions for non singleton nodes as well. If you try to access such a node and it turns out to be empty, Web Dynpro will automatically fill the values with a supply function and return it to you. (this is when a supply function is not mandatory).
This link explains supply functions concisely:
https://wiki.sdn.sap.com/wiki/display/WDJava/SupplyFunctionin+Webdynpro
By the way, this question looks relevant for Web Dynpro forum.
Cheers!

Similar Messages

  • Supply function in webdynpro for abap

    Hi ,
            I have tree structure as below.
    1.      Node A
                   1.a      Node B
                       1.a.i    Node C
            I have declared method 'Method_A' as supply function for Node A.similarly
            I have declared method 'Method_B' as supply function for Node B.similary
            I have declared method 'Method_C' as supply function for Node C.
            When I am executing in debugging mode both 'Method_A' and 'Method_B' is triggering for initial display of tree. Without expanding Node A ,we are already getting the Node B data and storing in corresponding nodes. This is becoming performance issue as I am hitting database in those 3 methods. My problem is without expanding why that 'Method_B' supply function is
    triggering. Please let me know if you have any idea.
    Thanks,
    Suma

    The supply function is always get triggered even if you do not expand the parent node in tree.
    Reason: It fills the value to the child node based on parent's value.
    To avoid this, you can set teh condition as follows:
    In node B supply function, method_B:
    check the instance of parent node A here, and if that is not initial, then only hit the database for filling node B.
    In node C supply function, method_C:
    Check the instance of parent node B here, and if that is not initial, then only hit the database for filling node C.
    This is the only possible solution one can think of.

  • SUpply function in Web Dynpro ABAP

    I have 2 views - an INPUTVIEW and a DISPLAYVIEW.  I created 2 nodes in the component controller - INPUTNODE and TABLENODE.  In the INPUTVIEW, I mapped INPUTNODE of the component controller and in the DISPLAYVIEW, I mapped both the nodes of the component controller. I need to enter a value in the first view and the corresponding result should be displayed in the second view. I wrote the code in the supply function of the TABLENODE of the component controller. When i enter a value for the first time, the result is being displayed fine in the 2nd view.  But even if i go back and select another value in the INPUTNODE, the result is still the same.  Only if i refresh the 1st view, the result is changing.
    This is the code i wrote in the supply function of the TABLENODE of the component controller.
    data:   inputnode type ref to if_wd_context_node,
            tablenode type ref to if_wd_context_node,
            covalue   type string,
            itab_st  type standard table of zstate.
    inputnode = wd_context->get_child_node( name = 'INPUT_COUNTRY').
    inputnode->get_attribute( exporting name = 'zzco' importing value = covalue ).
    select * from zstate into table itab_st
    where zzco = covalue.
    tablenode = wd_context->get_child_node( name = 'DISPLAY_STATE' ).
    tablenode->bind_elements( itab_St ).
    Any ideas appreciated.  Thanks in advance.

    Hello,
    the supply method runs only when the node is invalid
    this is the case when you start your application.
    solution
    1. You can make the node invalid with the   method "INVALIDATE" in the method which is triggered by your back button.
    2.Don't use the supply method use the method which belongs to the inbount-plug called handle......
    3. You can change th lifetime in property of the view from
    "framworkcontrolled" to "when visible"
    Klaus
    Message was edited by: Klaus Helfrich
    Message was edited by: Klaus Helfrich

  • Problem in triggering the Supply Function

    Hi Experts,
    I am developing one web dynpro application to display the records in MARA table.
    I have created a radio button.Logic is if radio button is selected then displaying of the record should be done.
    NODE_PARENT consists of   NODE_CHILD ( which consists of fields to be displayed ) and key holder ( attribute which is used to check whether radio button selected or not ).
    In radio button properties i used selected key as attribute of the node NODE_PARENT.
    Now in supply function i am reading the parent element attributes i.e. radio button and checking if it is selected then read the data from MARA and bind it.
    But i am getting the runtime error 
    "  Context binding of property SELECTED_KEY cannot be resolved: Node MAIN.1.NODE_PARENT does not contain any elements "
    what is the reason for this error.
    Thanks in advance.

    Hi Kissnas and other experts ,
    Here is the code.
      DATA lo_nd_node_parent TYPE REF TO if_wd_context_node.
      DATA lo_el_node_parent TYPE REF TO if_wd_context_element.
      DATA ls_node_parent TYPE wd_this->element_node_parent.
      DATA lv_keyholder LIKE ls_node_parent-keyholder.
      DATA itab TYPE TABLE OF mara.
    navigate from <CONTEXT> to <NODE_PARENT> via lead selection
      lo_nd_node_parent = wd_context->get_child_node( name = wd_this->wdctx_node_parent ).
    @TODO handle not set lead selection
      IF lo_nd_node_parent IS INITIAL.
      ENDIF.
    get element via lead selection
      lo_el_node_parent = lo_nd_node_parent->get_element(  ).
    @TODO handle not set lead selection
      IF lo_el_node_parent IS INITIAL.
      ENDIF.
    alternative access  via index
    lo_el_node_parent = lo_nd_node_parent->get_element( index = 1 ).
    @TODO handle non existant child
    IF lo_el_node_parent IS INITIAL.
    ENDIF.
    get single attribute
      lo_el_node_parent->get_attribute(
        EXPORTING
          name =  `KEYHOLDER`
        IMPORTING
          value = lv_keyholder ).
      IF ( lv_keyholder EQ 'X'  ).
        SELECT matnr ersda ernam FROM mara INTO CORRESPONDING FIELDS OF TABLE itab." WHERE mandt  = sy-mandt.
      ENDIF.
    bind all the elements
      node->bind_table( itab ).
    *lt_node_table->bind_table( itab ).
    I have written this code in supplyfunction GET_DATA.
    Regards
    Ravindranath CH

  • Use of supply function and WDCopyService..

    Hi,
    Thank you for ur help on WdCopyService to copy node elements..
    This is current scenario n requirement is:-
    1. I have a RFC (model node) that returns 20 transactions on each "Load next" button click.
    2. Now using output data of this model node, a context node "Transaction" is populated. A Supply function "SupplyTransaction" is used for this purpose.
    3. This "Transaction" node has further subnodes and these are used to fill up several tables in view.
    3. What i want to do is, Transaction node elements which were previously added using supply function should be retained. The next new 20 elements should get added to it.
    What are the possible ways to do this? 
    Pls help me as soon as possible..
    Regards,
    Amey

    HI Amey
    I think for the result that u want to achieve, u shud nt use supply function.
    I ll suggest u to use the same logic that u ve written in the supply function to be written immediately after u get data in your output model node.
    Try this.
    I hope it solves your problem.
    Regards
    Kapil S Kamble

  • About Supply Function

    Hi , all
      1&#12289;There are two table, when select a record in the first table , the Second table
           is update automatic.
      2&#12289;The second table can be edited by user, when user select the other record
           in the first table, i update the second table data to context first.
      But when user select the other record in the first table, in this action,i can't get
      the data from the second table and update them to context.

    Hi Pei,
       first go to context and create node say vbak which is a header table and then immediately create another node say - vbap with initialization,singleton checked  and supply function name say - Get_item  and then create the item attributes
    Then create the respective attributes for the header table say vbeln, vbtyp,...etc.
    Now write the logic to get the value of the header value in wdoint and also to get the item value in supply function.
    It should work other wise (r)  i will send u the code samples
    Regards
    Sathish

  • Calling supply function

    Hi
    Can we call supply function explicitly in any other method of the view using wd_this->supply function name( ) ?.
    In case the supply function is local to the view and when it is defined in component controller ?

    hi vishal........
          you cannot call supply function explicitly.......
          what you can do is.... invalidate the node that has the supply function. so the supply function will be called again.
    ---regards,
       alex b justin

  • Use Of SUPPLY Function & Singletone Class?

    Hi,
    What is the Use of Supply Function & What is Sigletone Class?
    Thanks
    Ranveer

    Hi Ranveer,
    Each context node of a controller can be assigned a supply function. This supply
    function is called by the runtime when the data of the context node is used. This is the case
    when a UI element is to be displayed for the first time with the data of the corresponding
    context.
    In general, the supply function is called when one or more elements of a context node are
    accessed and when
    &#9679; the context node is not filled yet or is initial, or
    &#9679; the context node has been invalidated in a previous step.
    Supply Functions of Singleton Nodes
    The supply function is especially useful in combination with singleton nodes.The
    values of subnode elements of the type Singleton depend on the element of the parent node
    to which the lead selection is currently assigned. If the lead selection is changed by the user,
    the supply function can access the new lead selection element and recalculate the values of
    the subnode elements accordingly.
    You can only create such a view when the lead selection element of the node
    CARRIER_NODE is read in the supply function of the node CONNECTION_NODE:
    For eg:
    method GET_CONNECTIONS .
    data: CARR_ATTR type IF_MAINVIEW=>ELEMENT_CARRIER_NODE,
    FLIGHTS type SPFLI_TAB.
    get filled structure for parent node
    PARENT_ELEMENT->GET_STATIC_ATTRIBUTES( importing
    STATIC_ATTRIBUTES = CARR_ATTR ).
    get connections from help class
    FLIGHTS = CL_WD_GET_SPFLI=>GET_FLIGHTS_BY_CARRID(
    CARRID = CARR_ATTR-CARRID ).
    NODE->BIND_ELEMENTS( FLIGHTS ).
    endmethod.
    Explanation:
    An internal variable of the type of a context element of the parent node
    CARRIER_NODE and another internal variable of the Dictionary type SPFLI_TAB are
    declared.
    &#9679; The attribute values of the lead selection element of the parent node CARRIER_NODE
    are then passed to the internal variable CARR_ATTR.
    For this transfer, each supply function uses the parameter
    PARENT_ELEMENT of the reference type IF_WD_CONTEXT_ELEMENT.
    PARENT_ELEMENT is a reference to the lead selection element of the parent node of
    the current node. The parameter is automatically displayed in the signature of the
    supply function.
    Each time the user selects another table element as the lead selection in the table Carrier,
    the value of the parameter PARENT_ELEMENT changes. The supply function of the context
    node CONNECTION_NODE is called and the values of its attributes are newly filled
    according to the selected table line in the table Carrier.
    Supply functions can only access context data that
    &#9632; is contained in the corresponding parent node or
    &#9632; is contained in another node that is on a next-highest level compared to
    the node filled by the corresponding supply function.
    Cheers,
    Mary

  • Specialty of supply function and  how can we use it efficiently?

    Hi Experts,
    I have one question.
    What exactly the function of “Supply function” for a node.
    Some says when ever lead change happens the “Supply function” triggers.
    I put a break point in Supply function say “ZSupply” written code to populate the table.
    It triggered only once to populate the table. If this is the functionality then I can write code in method and call it in modify view my checking it for first time why “supply function”.   I want to know what is its specialty, how can we use it efficiently?
    Thanks
    Gopal

    Hi Gopal,
    You are correct even without supply function you can achieve the same functionality i.e when ever there is a change in HEADER the corresponding ITEM for the HEADER can be displayed.
    But the idea of using SUPPLY Function is - the code written in the node i.e assume HEADER and ITEM relation gets executed as and when the node is instantiated in the run time where in there is no need us to handle it explicitly.
    If not used SUPPLY Function then we need to handle the complete HEADER and ITEM relation explicitly.
    Regards,
    Mohammed

  • Bind allowed if a node has a supply function or a supplying relation role

    Hello Context-exports,
    I am using NetWeaver CE 7.1 and have implemented a WebService TRCROOF with the following method:
    public void assign(List<TRPartDTO> trparts);
    The class TRPartDTO is defined as follows:
    public class TRPartDTO implements Serializable {
        BigDecimal idProject;
        BigDecimal idSynth;
        String traceIndex;
        String serialNo;
    I have imported the WebService into WebDynpro as Adaptive WS-Model.
    The wizard has built this context:
    Request_Assign
    ---Assign
    Trparts
    IdProject
    IdSynth
    TraceIndex
    SerialNo
    ---Response_Assign
    In wdDoInit I call the following sequence, which works fine:
    TRCROOF_MODEL trcRoofModel = new TRCROOF_MODEL();
    Request_Assign request_Assign = new Request_Assign(trcRoofModel);
    Assign assign = new Assign(trcRoofModel);
    request_Assign.setAssign(assign);
    wdContext.nodeRequest_Assign().bind(request_Assign);
    Now I try to call the WebService-Method and to deliver a list to it:
    ITrparts_Assign_TRPartsElement newPart;
    Vector<ITrparts_AssignElement> partList = new Vector<ITrparts_AssignElement>();
    for (int ix = 0; ix < cnt; ix++) {
       newPart = wdContext.nodeTrparts()
                  .createTrparts_Element(
                       new TrPartDTO(trcRoofModel);
       newPart.setIdProject(...);
       newPart.setIdSynth(...);
       newPart.setSerialNo(...);
       newPart.setTraceIndex(...);
       partList.add(newPart);
    wdContext.nodeTrparts_Assign_TRParts().bind(partList);
    But when calling bind() I get an exception that essentially tells me:
    "calling bind is not allowed if a node has a supply function or a supplying relation role"
    Background info:
    My EJB defining the WebService implements another DTO-class named RoofDTO, which includes a List of TRPartDTO:
    public class RoofDTO implements Serializable {
        private List<TRPartDTO> trparts;
    But this class is not used in conjunction with the method assign().
    Nevertheless the wizard that imported the WebService-Model of course has
    defined a relation betweeen these classes.
    Could anybody explain the situation or even tell me how to fix my problem?
    Thanks for each hint,
    Christoph

    Oops,
    forget this silly question. In case that anybody else has such cranky trains of thoughts as me: Do it like this:
    Vector<TrPartDTO> partList = new Vector<TrPartDTO>();
    trcRoofModel = new TRCROOF_MODEL();
    for (int ix = 0; ix < ...; ix++) {
       partList.add(new TrPartDTO(trcRoofModel));
    wdContext.currentAssignTRPartsElement().modelObject().setTrparts(partList);
    Kind regards,
    Christoph

  • What is Supply Function, use of Supply function?

    Hi Guru's,
    Can you give a definition or description of Supply Function, and what is the use?
    Thanks,
    Pradeep.

    Hi Pradeep,
    Okay, conceptually you have understood it, that is good
    Hope you have also, visited this link
    Supply function with singleton concept | Webdynpro ABAP
    Then let us have a simple example to understand how it works.
    Let us say we have  parent node PNODE & child node CNODE
    PNODE node has 2 records and for each record CNODE has 3 records
    Whenever the data of PNODE is bound/changed, the supply function of CNODE executes. Hence, you are able to get the control during initialization.
    Now, if you have set the lead selection at line 2, i.e.  there is change to context PNODE, hence the supply function of CNODE triggers and it gets the reference of 2nd record in PARENT_ELEMENT inside supply function and based on this the child node data can be populated.
    Even, if you refresh node PNODE using method lo_pnode->INVALIDATE( ), the supply function of CNODE triggers.
    Hence, whenever there is change at PARENT'S context node, the supply function of its child node(s) gets called.
    Hope it gives little light on the supply function's  practical usage.
    Regards,
    Rama

  • Difference between method,event handler,supply function.

    hi,
    i wants to know what is the difference between
    method.
    event handler.
    supply funciton.
    Regards:
    Pankaj Aggarwal

    Hi Pankaj,
    These are few lines from the F1 help documentation given,
    Web Dynpro: Method Type :The type of a method defines whether you have an event handler, a supply
                                                function, or a (normal) method.
      Event Handler : Handlers of an event, a controller, an action, or an inbound plug of a view.
       Method : Modularization unit within a view or a controller.Methods of a view can only be called locally
                       within this view.Methods of a controller (component or custom controller) can also be called from
                       a view or another controller, provided the controller is entered as controller used .
       Supply Function : Method for filling a context node.
    For more information refer to the Thomas post
    Regards,
    Sravanthi

  • Is it mandatory to create Supply function for ItemLIstBox UI

    Hi,
    I am trying to user ItemListbox UI. I followed below link and created it. If am not using supply function ItemLIstbox is not populating data.
    I would like to know if it is mandatory to use Supply function for this UI.
    If not please give me steps to create and populate elements into ItemListBox
    Regards
    Satish
    Edited by: satish jarabana on Jan 23, 2012 11:39 AM

    Thanks Srinivas,
    I hae already done that and am able to see data.
    But my doubt is if we assign data type as Data Element for an attribute, and bind this to an input element or drodown, it will show values by default.
    Is this not the same for ItemListBox.
    Regards
    Satish

  • Supply functions not working

    Dear all
    I have an upgraded CRM (from 4.0 to 2007) and apparently the supply functions e.g. in the component MSAACTIVITIES for the MSATaskList are not working. The implicit-flag on the anchor fills the business collection, but the supply function or an beforeQueryExecute trigger on the anchor both do not work, and if one is setting a breakpoint in there the code does not reach it. As these are SAP-delivered supply functions I hoped to find something on the OSS, but this is not the case.
    Did anyone experience the same or has an idea here?
    Regards, Kai

    Hi,
    do you mean anchor supply functions on tile or tileset level?
    If on tile level, did you already check whether the both anchors hold a supply function or relation on a higher level e.g. on tileset or component level. In this case I guess this will win...
    Regards,
    Wolfhard

  • Breifly xplain  wht lead selection ,cardinality &singleton&supply function

    Hi Friends ...
                 Let plz xpalin in breif   wht is lead selection ,cardinality &singleton&supply function and how these all helpfull whtz the relation ship between while creating a table...
    itz bit urgent for me am working with dynamic tables and am in confuse...plz make it out this query...

    Lead selection
         Leadselection is the property which is used to get the index of the selected row of the table
    "OnLeadSelect" is the method used to fire an action when a row is selected
         The Method wdContext.<node>().getLeadSelection() can be used to
    find out the index of the selected element.
    Cardinality
    Any node or attribute that has the context root node as its immediate parent, is known as an independent node or attribute.
    Any node or attribute that has some other node as its immediate parent, is known as a dependent node or attribute.
    All context nodes are collections.
    A node collection is composed of elements, where an element is an aggregation of the node’s immediate children (attributes and/or other nodes).
    The cardinality property controls the number of elements a node collection may hold at runtime.
    Every context node has a property called Cardinality. This property is composed of two values that
    taken together, describe the maximum and minimum number of elements the node collection may hold
    at runtime.
    Cardinality Minimum: 0 or 1
    Cardinality Maximum: 1 or n
    Therefore, there are four possible cardinality values (specified as <Min>..<Max>)
    0..1 Zero or one elements permitted
    0..n Zero or more elements permitted
    1..1 One and only one element permitted
    1..n One or more elements permitted
    Singleton
    All independent nodes are forced to be singletons. This is because the context root node has one and only one element.
    Singleton is  boolean
    TRUE : One instance will be created for all te nodes
    FALSE : Every Element in the parent node collection,there will be a distinct instance of the child node.
    Why Singleton
         -Efficiency
         -Less Memory
         -Lazy Data Access(Creates instance only when needed,till then it will remain unprocessed)
    Supply functions
         Supply functions are the mechanism to repopulate child nodes when the lead selection in the parent node
    changes. When a singleton child node is declared, you must also write an accompanying supply function.
    The Web Dynpro Framework will then automatically call your supply function when the lead selection
    in the parent node changes.
    Regards
    Chaitanya.A

Maybe you are looking for