Creation of new element in Model Node

Dear All,
I am facing one problem, I have two  model node. I want to copy one model node to other model node.while copying its giving error saying the you can bind the element, coz target node doesn't have valid parent.
Pl don't suggest me work on Value node.
Can i create a element in model node at run time.
Thanks & Regards
Manoj Sahoo

Hi Manoj,
               Model node properties :
1.A context model node makes a model object look like any other context node.  I.E. it gives the model object an API that is very similar to a value node.
2.  A model node is not considered valid until it is bound to a corresponding model object.  Therefore, a model node always inherits its metadata from the model object to which it is bound.
3. The element collection in a model node does not hold the actual runtime data!   Instead, it holds a list of references to the relevant model object instances.
If u check the 2nd property, u will find the cause of ur exception. As u have already told, don't suggest to use value nodes, i don't have any other comment.
regards
Sumit

Similar Messages

  • Can't add new element to model node from web service

    Hi Folks,
    we are using the old WebService (not adaptive one) for calling a service on XI. We are reusing the same service for loading the data and also sending them back to the backend to modify, delete or add new elements. Request and response tree structure consist basically of the same structure.
    Now everything works fine so far except adding a new element to the model tree.
    So what are we doing:
    After calling the service for reading (and invalidate on the response), we copy the received data from response node into the request node. All the view forms are bound to the model elements in the request.
    Modifying single attributes worked just fine (from dialog and programatically). A new element we add to the model tree shows up in the dialog and seems to work equally fine, but when we trigger the service call to send the collected data, every change to the model data is send except the new added element. It just won't be send.
    What's the problem here? Seems to me this must be somehow related to the supplying relation role maybe.
    What code do you need to look at and how do I mark code in the new forum editor so it gets displayed properly formatted?
    Thanks,
      ok

    Hi,
    Can you tell me which code are you using currently for transferrring the data? It might help me to figure out what your problem is.

  • How to add a new element to a model node in the view controller?

    View Context
        myNode
             attri1
             attri2
    myNode is a web service model node. How to add a new element to this node?
    Regards,
    Hui
    Edited by: Hui Wang on Feb 15, 2008 12:05 PM

    Sudhir Gorantla wrote:>
    > Hi,
    >
    > myNode
    > attri1
    > attri2
    >
    > IMyNodeElement ele=wdContext.myNode().createMyNodeElement();
    >
    > ele.setAttri1("");
    > ele.setAttri2("");
    >
    > wdContext.nodeMyNode().addElement(ele);
    >
    > Regards,
    > Sudhir
    Hi we need a model as an input parameter when creating a element for a model node. How to get the instance of the model?
    Regards,
    Hui

  • How can I create an element in the model node?

    Hi, Experts,
    I create a model node that name is containerNode in the contxt. Cadinility is: 1..n
    I write the code in the method:
      private String getDataForOutputTable( IWDNode wageTypePayslip, IWDNode containerNode ){
           String betrgSumStr = "";
         int index = 0;
         Vector containerVector = new Vector();
         int size = wageTypePayslip.size();
         IWDNodeElement element = containerNode.createElement();// The system report error when I run the application.
         BigDecimal betrgSum = new BigDecimal( 0 );
    I try to create a element in the containerNode, But the system report error when I run the application.
    java.lang.IllegalArgumentException: model object must not be null
         at com.sap.tc.webdynpro.progmodel.context.ModelNodeElement.<init>(ModelNodeElement.java:66)
         at besuretech.com.wdp.IPrivatePayDataDispView$IOContainerElement.<init>(IPrivatePayDataDispView.java:1537)
         at besuretech.com.wdp.IPrivatePayDataDispView$IContextNode.doCreateElement(IPrivatePayDataDispView.java:88)
         at com.sap.tc.webdynpro.progmodel.context.NodeInfo.createElement(NodeInfo.java:884)
         at com.sap.tc.webdynpro.progmodel.context.Node.createElementInternal(Node.java:1351)
         at com.sap.tc.webdynpro.progmodel.context.Node.createElement(Node.java:1370)
         at besuretech.com.PayDataDispView.getDataForOutputTable(PayDataDispView.java:251)
         at besuretech.com.PayDataDispView.getAllData(PayDataDispView.java:196)
         at besuretech.com.PayDataDispView.onPlugPayListViewIn(PayDataDispView.java:154)
         at besuretech.com.wdp.InternalPayDataDispView.wdInvokeEventHandler(InternalPayDataDispView.java:391)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
         at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.navigate(ClientApplication.java:826)
         at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.navigate(ClientComponent.java:881)
         at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doNavigation(WindowPhaseModel.java:498)
    How can I create an element in the model node ?
    Best regards,
    tao

    Hi,
    You need to execute the model before creating the element.
    Regards
    Ayyapparaj

  • Instantiating Model Node in Component Controller with new Abstractlist()

    Hi All,
    We have the following issue.
    When we instantiate a Node - Po_Items using Element.setPo_Items( new AbstractList() )
    We get an error "The Type AbstractList Cannot be instantiate" .
    So how to successfully instantiate AbstractList()  so that ultimately the BAPI_NODE_INPUT can be instantiated.
    Best Regards,
    Roby...

    Hi Murtuza,
    Thanks alot for the response.
    I tried initializing Node using
    Element.addPo_Items(new Bapiekpoc());
    But its not getting initialized and I get following errror when I run the application.
    500   Internal Server Error
    Web Dynpro Container/SAP J2EE Engine/6.40 
    Failed to process request. Please contact your system administrator
    Is there any other way to initialize the Po_Items Node which which is inside the Model Node BAPI_PO_CREATE_INPUT.
    BAPI_PO_CREATE_INPUT ( Model Node )
        -- Po_Items ( Subnode which is an input table inside the BAPI )
    Thanks again & Best Regards,
    Roby....

  • How to bindi a UI element to 2 model nodes different in the same view

    I want to know how I can bind a set of inputfields, in a form view, to 2 different model nodes ?
    <u>example:</u>
    Im working with 2 adaptional RFC, both working, in my Custom Context.
    Ztest_Search
    Ztest_Update
    In my ResultView I have 2 Model nodes (one for each RFC) I show a set of inputfields in a form view, binded to the Ztest_Search_output of Ztest_Search. This works.
    now I want to update the changes, but I can't find the ways of binding the same inputfields to my other Model node (Ztest_Update) in the context of ResultView.
    Note: If I create a duplicate set of inputfields , one for Ztest_Search binded to the Ztest_Update_output and the other to the Ztest_Update_Input Works. But I wanna avoid this duplicated set of inputfields.
    Thx

    Rodrigo,
    If I understood correctly, your problem is to get the data from the input fields which are bound to a
    model node, Ztest_Search_output and set it to the model node of another RFC, Ztest_Update.
    This can be done by getting the suitable values from the model attributes of Ztest_Search_output
    and setting it to Ztest_Update.
    <b>/**
    * valueOne, valueTwo are the name of the model   
    * attributes that are bound to the Input fields.
    */</b>
    String firstValue = wdContext.currentZtest_Search_outputElement
         ().get<valueOne>;
    String secondValue = wdContext.currentZtest_Search_outputElement
         ().get<valueTwo>;
    Ztest_Update_Input update = new Ztest_Update_Input();
    wdContext.nodeZtest_Update_Input().bind(update);
    <b>/*
    *<b>Zstructure is the structure of the model node under
    *Ztest_Update_Input to which the values have to be 
    *updated.</b>
    */</b>
    ZStructure structure = new ZStruture();
    structure.setValueOne(valueOne);
    structure.setValueTwo(valueTwo);
    update.addZStructure(structure);
    try
       update.execute();     
    catch (Exception ex)
       wdComponentAPI.getMessageManager().reportException(ex.getMessage(), false);                     
    wdContext.nodeZtest_Update_Output().invalidate();
    Bala

  • PMS: Creation of new tabs for reference elements of ENHANCE BADis

    Dear Experts,
    I am on a PMS EHP5 implementation (for all practical purposes, it's an EHP4 implementation as we are not using the pre-defined template) and have the below problem.
    I have the ENHANCE_FIX and ENHANCE_FREE BADIs included at the VA level (as the requirement is to create immediate child objects for the template through these BADIs). I have a reference element (VB) defined for these BADIs.
    Example template (L1 = Level 1, L2 = Level 2, L3 = Level 3):
    L1 - VA
    ---- L2 - VB1
    --------- L3 VC1
    --------- L3 VC2
    ---- L2 - VB2
    ---- L2 - VB3
    In the above example template, the ENHANCE* BADIs will add VBs (example: VB4 and VB5) at the L2 level (appearing in the document below VB2 and VB3).
    The requirement is to have separate tabs for each VB at the L2 level (so I will have one tab for VA and 5 tabs for VB from the above example).
    I am unable to specify creation of new tabs for the reference element VB when I carry out my tabs and process configuration.
    I have not been able to find any information on this aspect either. Would appreciate any help that can come my way.
    Thanks.

    Thanks Maurice.
    I still feel that the product should leave that option to the designer of the solution. There are a lot of solutions which can get chaotic. If designed appropriately, I guess this chaos can be controlled.
    At the very least, I am sure that I have not left anything out in configuration. I will raise this with SAP over a CSS.
    Thank you for your input.

  • Difference among Model node creation, model attribute creation and the field creation in database through AET?

    Hello Friends,
    To display the field on the View, we can create the field via 3 ways:
    1) By creating the model attribute
    2) By creating the model node using the GENIL object and using its attributes in view
    3) Creating the field in Database structure using AET
    But, i am not aware that in exactly what kind of business scenarios we use the above 3 methods to create the field.
    Could you help me out to clarify the same.

    Hi Dev,
    1). By creating the model attribute: we will use this option in case of the field is avaibla in stanadrd sap system. It might be in another under child context nodes and we will use BOL relations to access the attribute.
    2).  By creating the model node using the GENIL object and using its attributes in view: We will use this option incase of there is no standard provision to use. Means you want to create any custom assignment block with custom attributes then you can go for this option. More over we can use AET to create custom genil object. We have an option Create Table in AET.
    3).Creating the field in Database structure using AET: We will use this option incase of there is no attribute in database relevant to your requirement then we will go for AET enhancement.
    Hope this might give you little clarification..
    Best Regards,
    Dharmakasi.

  • Adding new element block before the original nodes

    I want to form a new xml like this:
    <xml>
    <form id="name1"> // this is
    </form> // new element i'll add
    <form id="_name1"> // this is
    </form> // original element
    <form id="name2"> // this is
    </form> // new element i'll add
    <form id="_name2"> // this is
    </form> // original element
    </xml>
    how to insert new element parts into xml file by using Jdom?
    Thanks
    jj

    Sorry for my format
    I added i.previous();
                                            i.add(newFormElement);
                                            i.next();still not work properly.
    How can i do?? pls see my code again!
         public void modifyvxml(Document doc){
                   Element root = doc.getRootElement();
                   java.util.List forms = root.getChildren();
                   if(forms.size()>0)
                        for(int formloop=0; formloop < forms.size() ; formloop++)
                             List newFormList = new java.util.LinkedList();
                             Element form = (Element)forms.get(forms.size());     
                             String form_id = form.getAttributeValue("id");
                             System.out.print ("Form_id is  "+form_id+"\n");
                   ListIterator i = forms.listIterator();
                   while (i.hasNext()) {
                        Element form = (Element) i.next();
                             String form_id = form.getAttributeValue("id");
                             if(form_id != null){          
                                            int j = 0;                    
                                            StringBuffer sb_form = new StringBuffer(form_id);
                                            sb_form.insert(0, '_');
                                            form_id = sb_form.toString();
                                            form.setAttribute("id", form_id);
    //==================add new forms                         
                                            Element newFormElement = new Element("form");
                                            Element subdialog = new Element("subdialog");
                                            int index = forms.indexOf(newFormElement);
                                            newFormElement.setAttribute("id", form_id);                                        
                                            newFormElement.addContent(subdialog);
                                            subdialog.setAttribute("src", "call.jsp");
                                            i.previous();
                                            i.add(newFormElement);
                                            i.next();
    //                                        newFormList.add(formloop,newFormElement);
    //                                        newFormList.add(formloop,forms);
                        System.out.print ("new form_id is "+form_id+"\n");
    //=====================
                        try{               
                        XMLOutputter out = new XMLOutputter();
                        File myXML = new File("testvxml.xml");
                        out.output(doc,new FileOutputStream(myXML));                                   
                        }catch (IOException e) {
                        e.getMessage();
    }Thanks

  • Need help to read model node input field attribute present in view - first time developer.

    Hello Experts,
    I am new to CRM Web UI development.
    Presently, I am trying to develop a Guided Activity Page having 2 views.
    First view has the field Business Partner Number, I have added model Node BuilHeader and the attribute BP_NUMBER while creation of the view.
    The Second View consists of 2 fields from the Model Node BuilHeader, namely First Name and Last Name.
    The requirement is to enter the BP Number on the first screen then click on the NEXT button from the Guided Activity buttons, on navigating to the Second View, the Names should auto-populate.
    I have Created both views and the GP page, the GP navigation is also happening. Initially the fields were showing Not Bound text in value, so I commented the line in GET_I and GET methods to enable the field and remove the Not Bound text. I have created a custom controller with BuilHeader
    I have tried doing this but facing the below problems :
    1) When I enter the BP number on the first view and press Enter, the value disappears. How to solve this ?
    2) Does clicking on the NEXT button on the GP Navigation trigger a Server Roundtrip ?
    3) How to read the context node value of BP Number entered on the first view and populate the Name fields on the second view.
    Please help.........

    you can take reference from from below code as in above case we use BuilHeaderAdvancedSearch search object, to get current entity.
    data:    query        TYPE REF TO cl_crm_bol_dquery_service,.
      query ?= me->typed_context->BuilHeaderAdvancedSearch->collection_wrapper->get_current( ).
    Do not remove code from getter setter of fields , it will not clear.
    Check with http://scn.sap.com/thread/3391203 , for basic understanding of UI.
    Regards,
    Harish Kumar

  • How to add a new Element to the Context

    Hello all.
    I created in the wdInit()
    ArrayList datas = new ArrayList();
         for (int i = 0; i < 25; i++) {
              MyData data = new MyData();
              data.setMethods();
              datas.add(data);
         wdContext.nodeMyData().bind(datas);
    Now, I want by clicking on the Button "Create new Element", forward user to the other View, which elements are connected with the same model -> context, the new element should be added to context, the user should fill the form and click Save-Button.
    How can I add a new Element to the Collection I created and choose it as a current element?
    If I do: wdContext.nodeMyData().bind(new MyData()) all information will be lost. And I will have only one field.
    If I do it like this:
    IWDNodeElement dynTabElem=(IWDNodeElement)wdContext.nodeMyData().createElement();
    wdContext.nodeMyData().addElement(dynTabElem);
    I get an error: com.sap.tc.webdynpro.progmodel.context.ContextException: NodeInfo(DataComp.MyData): value node is created without a reference
    Well I can pass to my new View a Collection as a parameter and then
    Collection.add(new MyData()) and then bind it. But I find this solution not good.
    Is there any possibility to get the existing Collection from the Context without passing it to the view?
    Can I just add a new element to the existing collection?
    Thanks in advance.

    Hallo Monalisa,
    I did as you said. But I can't add something to my model class, because it is not collection.
                            MyData data = wdContext.currentBelegElement().modelObject();
                   data.add() ???? - don't work
                   wdContext.nodeMyData().invalidate();

  • How can I create a model node in SAP Records Management

    Product: SAP Records Management
    Hi,
    I would like to create a model node in a record tree.
    I found in the function modul BAPI_RECORD_ADDELEMENT no entry for the creation of a model node. Only the instance and the structure node can create by this function modul.
    So, does anyone know a solution to create a model note?
    Regards,
    Thomas Fanninger

    Hi Thomas,
    it is not possible with the BAPI due to the piece of coding:
    case  myElementType.
            when glob_const_elem_type_instance.
              myRecordElement->Type_Set( if_srm_sp_record_element=>type_instance ).
              myRecordInstanceElement ?= myRecordElement.
              loop at element_sp_poid into myElementSpPoidWa.
                mySpPoidWa-id = myElementSpPoidWa-name.
                mySpPoidWa-value = myElementSpPoidWa-value.
                insert mySpPoidWa into table myElementSpPoidTab.
              endloop.
              myElementSpsId = sps_id.
              myElementPoid = myClientService->poid_get_instance( im_rms_id  = myRmsId
                im_sps_id  = myElementSpsId  im_sp_poid = myElementSpPoidTab ).
              myService->check_sp_connection( myElementPoid ).
              myRecordInstanceElement->poid_set( myElementPoid ).
            when glob_const_elem_type_folder.
              myRecordElement->Type_Set( if_srm_sp_record_element=>type_folder ).
            when others.
              perform set_error using '852' return.
              return.
          endcase.
    But you can do that by using directly the Records API. How to use this is demonstrated in the report 'SRM_RECORD_API_HOWTO'. Search there for the subroutine 'fillrecordelement'. There a record element for insert is created and its type is set. You can set the type there to 'IF_SRM_SP_RECORD_ELEMENT~TYPE_MODEL'. Of course your POID then may not be an instance POID.
    Best regards,
    Thomas

  • Duplicate records in input structure of model node

    Hi,
    Following is the way, I am assigning data to a model node:
    //Clearing the model input node
    for (int i = wdContext.nodeInsppointdata().size(); i > 0; i--)
         wdContext.nodeInsppointdata().removeElement(wdContext.nodeInsppointdata().getElementAt(i - 1));
    //Creating element of the input model node
    IPrivateResultsView.IInsppointdataElement eleInspPointData;
    //START A
    Bapi2045L4 objBapi2045L4_1 = new Bapi2045L4(); //Instance of the input structure type
    //Populating data
    eleInspPointData = wdContext.nodeInsppointdata().createInsppointdataElement(objBapi2045L4_1);
    wdContext.nodeInsppointdata().addElement(eleInspPointData);
    eleInspPointData.setInsplot(wdContext.currentContextElement().getInspectionLotNumber());
    eleInspPointData.setInspoper("0101");
    //Inspection_Validate_Input is the model node. Adding instance to main node
    wdContext.currentInspection_Validate_InputElement().modelObject().addInsppointdata(objBapi2045L4_1);
    //STOP A
    //Now executing the RFC
    Above code seems to be fine. Works very well for the first time. But, when the user clicks on the same button for the second time, I can see duplicate records getting passed to RFC [Debugged using external breakpoint]. When I am sending 4 records, I can see there are total of 6 records. The number keeps increasing when clicked on the button.
    I am adding multiple records to input model node using the code from START A to STOP A. Does the code look fine? Why do I see multiple records?
    Thanks,
    Sham

    Issue solved.
    After executing RFC, I used following code to clear the input model node:
    try
         wdContext.current<yourBAPI>_InputElement().modelObject().get<yourinputnode>().clear();
    catch (Exception e1)

  • Webdynpro : How to SKIP the values of the Model Node.

    Hi
    i imported a WSDL into my WDJ application.
    where on context mapping, i mapped the MODEL with my CONTROLLER.
    I would like to SKIP couple of Attributes and Model node
    In WEBSERVICE navigator, i have the check box as SKIP, so using that i can skip in Navigator ,
    But how to do the same in WEBDYNPRO Coding.
    Say for Example
    Context
    ----------ModelNode1
    ----------ModelNode2
    ----------ModelNode3
    ----------======ModelAttribute1      NULL
    ----------======ModelAttribute2      SKIP
    ----------======ModelAttribute3      SKIP
    i know how to set the value if it need to set it to null
    wdcontext.nodelModelNode3.currentModelNode3element.setModelAttribute1("null")
    similaraly  can anyone tell me how to set the SKIP for other 2 attributes......
    Thanks

    Hi Chintan
    Thanks for your response....
    fine ... i understood your solution....
    but , my problem goes and makes me dizzzy
    i have 10 mandatory filed in my Webservice..
    i passed all the 10 mandatoy fileds and get perfect Response In WEBSERVICE Navigator....
    i tried passing the same value via WDJ application as show below
    since i have a node element with cardinalith 0..n
    I set the value those i passed in Webservice Navigator.....
    wdContext.nodeRequest_getSubmitRequest().
                     nodeRequestDetails().nodeRoles().invalidate();
           IPrivateOne_AppView.IRolesElement RoleE = wdContext.createRolesElement(new ComplexType_RoleData());
         RoleE.setRoleId("BASIC");
         RoleE.setSysId("R3");
         wdContext.nodeRequest_getSubmitRequest().
                   nodeRequestDetails().nodeRoles().addElement(RoleE);
    But Here ,I get a Error Message Saying  :Error in Submiting Request :  No role seleced for the request.
    so , i even checked whether the node is populated with rite value by printing them after executing the WSDL.
         wdContext.currentRequest_getSubmitRequestElement().modelObject().execute();
              MsgManger.reportSuccess( "After Push_execute_WSDL");
    MsgManger.reportSuccess( " COntroller getRoleId -- "+wdContext.nodeRequest_getSubmitRequest()
                        .nodeRequestDetails().nodeRoles().currentRolesElement().getRoleId().toString());
              MsgManger.reportSuccess( " COntroller getSysId -- "+wdContext.nodeRequest_getSubmitRequest()
                        .nodeRequestDetails().nodeRoles().currentRolesElement().getSysId().toString());
    Output
    After Push_execute_WSDL
    COntroller getRoleId -- BASIC
    COntroller getSysId -- R3
    Kindly let me know wat could be wrong........
    The MOST wired thing is
    if i didnt set and Role , SysId in webservice navigator , then Error thrown at Webservice Navigator is
    Error in Submiting Request : RoleId is mandatory,SysId is mandatory null
    on following same thing , if i didnt set Role and SysID in WebDynpro then, i get error as
    Error in Submiting Request :  No role seleced for the request.
    How is this possible....
    any help on this would be appreciated...
    Thanks

  • Value Nodes vs. Model Nodes

    Hi,
    why model nodes have to be initialized via Service Controller and needs to be bound to a model class instance and value nodes don't need that?
    Thank you,
    Pietro

    Hi Pietro,
    A model node is similar to value node in respect to it's API.
    The main diff are:-
    Value node
    1.It maintains it's own elemnet collection,each element holding the actual runtime data.
    2.While creating new element for a value node ,the node can create element object using metadata stored within it.
    3.the children of a value node only be value nodes or value atrributes.It can't be a mix value and model nodes or attribute if the 
       parent is a value node.
    Model Node
    1.The element collection maintains by a model node is simply a collection of reference to model object instances.
    2.Actual runtime data is stored in model object, not in model node's element collection.
    Hope this will help you. if you want more check this.
    http://help.sap.com/saphelp_webas630/helpdata/en/b8/cd96edb9c8794aa362e6e8b4236a1f/frameset.htm
    Thanks & Regards,
    Bhargava.

Maybe you are looking for

  • Error in creating a procedure

    Hi all,when i am trying to create the below procedure i am getting error.Can someone suggest where am i doing wrong SQL> ed Wrote file afiedt.buf   1  CREATE OR REPLACE PROCEDURE XXC_MTL_TRANSACTIONS(file_number IN VARCHAR2) IS   2    --process_flag 

  • Can't import songs from iTunes to my iPod

    I'm not sure if I have a problem with iTunes or my iPod, but I'll try this forum anyway. I already asked this under the iTunes category. Basically, there's a sudden problem where, for the life of me, my iPod will not accept new music. It shows up fin

  • Looking for guidance to fix my VERY SLOW imac/osx mavericks

    I installed Mavericks many months ago and was disappointed in how it just crippled my system. To date I've just muddled through.   I've tried cleaning out some programs, but I'm not sure what I should keep and what I should ditch. I'm not also sure h

  • App Store and iTunes crash ML

    I have an issue that just doesn't want to go away! I've got a fresh install of Mountain Lion and am unable to open the App Store at all. I recieve the following error and have no idea what it means. It looked like an memory error, so I downloaded a m

  • How to create Folder and subFolder using web services

    Hi, Today I've been working with some Share Point develompment but the truth is that I can't just get it. Can any body help me with some easy links to start Share Point Development? Here is wath I'm trying: I need to create a new folder (lets say Fol