Skip to Content
author's profile photo Former Member
Former Member

How to set value to Model Node of cardinality 0..N

hi

I am looking for a way to set value to a model node of cardinality 0..N

i imported a WSDL into my applicaion , which has the following Node Structure.

Context

--- ModelNode_Request

---ModelNode2_Input

---ModleNode3_Roles [ cardinality 0..n singleton 1..1]

****Model_Attribute RoleID <<<<<<<<<<<<

****Model_Attribute SysID <<<<<<<<<<<<

---ModelNode_Response

i tried with the below code but effort went in vain.

i tried following ways to set the value but , i get Nullpointer expection error.

	wdContext.nodeRequest__SubmitRequest().nodeRequestDetails().nodeRoles().
		currentRolesElement().setRoleId("BASIC");
	wdContext.nodeRequest__SubmitRequest().nodeRequestDetails().nodeRoles().
		currentRolesElement().setSysId("R3_220");

i aslo looked into the forum https://www.sdn.sap.com/irj/scn/thread?messageID=2035342 but couldnt find any solid solution.

It would be great if some one can throw some snippets on the same.

Thanks

Edited by: RR on Dec 22, 2008 5:48 PM

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Dec 23, 2008 at 01:46 AM

    Hi RR,

    As far as i know u can set model nodes and values nodes are different. whats shown in the link is for values node. u should do differently for model node..

    Since this is a model node...u first need to create an object of the node type. then create an arraylist for that and then add values..

    try this..

    // Create an object for structures in the node to be used

    Yweb_Po_Items objPOItems = null; // where Yweb_Po_Items is the structure of the node...

    // Create an abstractlist for structures in the RFC node to be used, if u are planning to give single or multiple rows (in node/table) as input to the RFC

    AbstractList POObjAbsList = new Yweb_Po_Items.Yweb_Po_Items_List();

    objPOItems = new Yweb_Po_Items();

    // /set first set of values

    objPOItems.setColumn1(u201Cabcu201D); // here hard codede for example

    objPOItems.setColumn2(u201Cabcfghu201D);

    // add the object to the abstract list

    POObjAbsList.add(objPOItems);

    // /set second set of values

    objPOItems.setColumn1(u201Cnewabcu201D);

    objPOItems.setColumn2(u201Cnewabcfghu201D);

    // add the object to the abstract list again

    POObjAbsList.add(objPOItems); // now u got 2 records

    // now set the abstractlist to the node in the RFC

    objGoodsReceiptPO.setPo_Items_In(POObjAbsList);

    Hope this information is useful...

    Thanks

    Md. Yusuf

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Yusuf

      Thanks for your response

      But i couldnt get clear picture from the provided code

      , i tried with the below code to populate the node value , where it gets populated

      but on executing the WSDL , it fails to return the value...

      	IPrivateOne_AppView.IRolesElement RoleE = wdContext.createRolesElement(new ComplexType_RoleData());
      	RoleE.setRoleId("BASIC");
      	RoleE.setSysId("R3_220");
      	wdContext.nodeRoles().addElement(RoleE);
      
      //To check the value whether it get populated on to Model Node.
      ///////////////////////////////////////////////////////////////////////////////////////
      		MsgManger.reportSuccess( " COntroller getRoleId -- "+wdContext.nodeRequest__getSubmitRequest().nodeRequestDetails().nodeRoles().currentRolesElement().getRoleId().toString());
      		MsgManger.reportSuccess( " COntroller getSysId -- "+wdContext.nodeRequest__getSubmitRequest().nodeRequestDetails().nodeRoles().currentRolesElement().getSysId().toString());
      
      
      

      Yes i get the value wat i populated from the above code.....

      But on executing the WSDL , it fails to return the output.......

      apperciate any help on this ...

      Thanks

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.