cancel
Showing results for 
Search instead for 
Did you mean: 

How to access changes made in a table?

Former Member
0 Kudos

Hi Brothers,

I have a table showing information that was read from the backend. The user is able to make changes to cells in the table. access the now, I need to access the changes made by the user for processing.Unfortunately, I do not know how to that...

Do I have to create an Object containing the changed table? Do the chnages take effect in the actual Context node so that I just have to use this?

Thanks, Johannes

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

I solved the problem halfway...

I get an Object with only one entry (the last one) right now...

But I need an Array with all of them... Heres my code. I tried the commented lines alread, leading my into th eabove mentioned exceptions...

public void onActionValidateChangesCustomer(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionValidateChangesCustomer(ServerEvent)
       for( int i=0; i < wdContext.nodeE_Customer().size(); i++ ){
         // does not work: cannot create without model instance:
	//wdContext.createAndAddI_CustomerElement(); 
        //II_CustomerElement customerElement = wdContext.nodeI_Customer().
        //  createAndAddI_CustomerElement();
        //set all attributes
       wdContext.currentI_CustomerElement().set__Bic__Epsflags(wdContext.nodeE_Customer().
        getE_CustomerElementAt(i).
        get__Bic__Epsflags());
       wdContext.currentI_CustomerElement().set__Bic__Epskufuer(wdContext.nodeE_Customer().
         getE_CustomerElementAt(i).
        get__Bic__Epskufuer());
                 etc.

		  
		  //wdContext.nodeI_Customer().addElement(customerElement);
		  //if (i != 0) wdContext.nodeI_Customer().addElement(customerElement);
       }	  
	  
	  // trigger the RFC
	  wdThis.wdGetInfoObjectCustController().executeZ_Customer_Front_Controller();

    //@@end
  }

Thanks for helping me out there...

Former Member
0 Kudos

I solved it completely,

here the coding for version 7.1:

public void onActionValidateChangesCustomer(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionValidateChangesCustomer(ServerEvent)
	  for( int i=0; i < wdContext.nodeE_Customer().size(); i++ ){
		 
		  wdContext.currentI_CustomerElement().set__Bic__Epskufuer(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Epskufuer());
		  wdContext.currentI_CustomerElement().set__Bic__Rbampisbr(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbampisbr());
		  wdContext.currentI_CustomerElement().set__Bic__Rbbrand(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbbrand());
		  wdContext.currentI_CustomerElement().set__Bic__Rbcustgrp(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbcustgrp());
		  wdContext.currentI_CustomerElement().set__Bic__Rbgroup(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbgroup());
		  wdContext.currentI_CustomerElement().set__Bic__Rbkunde(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbkunde());
		  wdContext.currentI_CustomerElement().set__Bic__Rbprod(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbprod());
		  wdContext.currentI_CustomerElement().set__Bic__Rbsubgrp1(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbsubgrp1());
		  wdContext.currentI_CustomerElement().set__Bic__Rbsubgrp2(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbsubgrp2());
		  wdContext.currentI_CustomerElement().set__Bic__Rbwwrpnkz(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get__Bic__Rbwwrpnkz());
		  wdContext.currentI_CustomerElement().setChanged(wdContext.nodeE_Customer().getE_CustomerElementAt(i).getChanged());
		  wdContext.currentI_CustomerElement().setDatefrom(wdContext.nodeE_Customer().getE_CustomerElementAt(i).getDatefrom());
		  wdContext.currentI_CustomerElement().setObjvers(wdContext.nodeE_Customer().getE_CustomerElementAt(i).getObjvers());
		  
		  wdContext.nodeI_Customer().addElement(new __Bic__Mrbkunde());
		  wdContext.nodeI_Customer().moveNext();
	  }	  
	  
	  // trigger the RFC
	  wdThis.wdGetInfoObjectCustController().executeZ_Customer_Front_Controller();

    //@@end
  }

Thanks, Johannes

Former Member
0 Kudos

can you please tell me what is this new __Bic__Mrbkunde());

Former Member
0 Kudos

__Bic__Mrbkunde is a structure that was created during the model import. It is the representation of the master data table /BIC/MRBKUNDE in the R/3 system.

Let me know if you have further questions.

Best, Johannes

Former Member
0 Kudos

the Context structure is as follows:

Context

-> Z_Customer_Front_Controller_Input

-->I_Customer

---> value1

---> value2

---> value ...

-> Z_Read_Infoobject_Input

--> Output

---> E_Customer

-


> value1

-


> value2

-


> value ...

Now, I would like to call the RFC Z_Customer_Front_Controller with E_Customer as import parameter I_Customer.

After getting the above posted exception, I tried

wdContext.createAndAddZ_Customer_Front_Controller_InputElement();

before creating and adding the I_Customer element which leads to:

com.sap.tc.webdynpro.progmodel.context.ContextException: 
NodeElement(.InfoObjectCust.Z_Customer_Front_Controller_Input): 
model node element cannot be created without a model instance

What's going wrong? Thanks, Johannes

Former Member
0 Kudos

I have done the following:

I have saved the actual table content in "customerElement ":

 
wdContext.createAndAddZ_Customer_Front_Controller_InputElement();
// determine the actual element (the edited table element)
IE_CustomerElement customerElement = wdContext.currentE_CustomerElement();

Now do I need to put this element as the input parameter of the RFC "Z_Customer_Front_Controller", but how?

I have done this before in another function:

wdContext.currentZ_Read_Infoobject_InputElement().setI_Infoobject(name);

"name" was put as the input parameter. Name was a simple string. Now, I need to put the whole customerElement Object (being a node) as an input parameter of the RFC...

From my understanding the following code should be correct:

wdContext.currentZ_Customer_Front_Controller_InputElement().setI_Customer(customerElement);

but it isn't... There is no function called setI_Customer()... Why?

Thanks for helping me out there... Johannes

former_member197348
Active Contributor
0 Kudos

Hi Johannes,

may be the following code

wdContext.currentZ_Customer_Front_Controller_InputElement().setI_Customer(customerElement);

is to be changed to

wdContext.nodeI_Customer().addElement(customerElement);

But before this

you may need to do this also: try this this if your above code is not working.


II_CustomerElement customerElement = null; 
for(int i=0;i<wdContext.nodeE_Customer().size();i++)
{
customerElement  = wdContext.createI_CustomerElement();
//set all attributes
customerElement.set<yourattribute1>(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get<yourattribute1>);  
customerElement.set<yourattribute2>(wdContext.nodeE_Customer().getE_CustomerElementAt(i).get<yourattribute2>);
...etc
wdContext.nodeI_Customer().addElement(customerElement); 
}

Regards,

Siva

Edited by: Siva Rama Krushna on Aug 13, 2008 7:29 PM

Former Member
0 Kudos

I still don't get it running...

I am using v7.1. There is no function

wdContext.createI_CustomerElement();

NWDS gives me

wdContext.createAndAddI_CustomerElement();

which leads to

com.sap.tc.webdynpro.progmodel.context.ContextException: Node(Mdm/InfoObjectEditing.Z_Customer_Front_Controller_Input.I_Customer, class=com.sap.demo.testroadmap.roadmaptest.wdp.IPrivateInfoObjectEditing$II_CustomerNode): cannot bind or add elements because the node has no valid parent

Whats wrong??? Please help, I am desperate!

Former Member
0 Kudos

Hi,

Please make sure that there is element in the parent node for which you are creating element for this node.

thanks & regards,

Manoj

Former Member
0 Kudos

Hi,

could you pleasee post the context structure?

Error states that their is no valid parent when you are creating a child ex:if node X is under nodeY and if the cardinality of both is o..n then first you need to create an element of node X then node Y, reverse will not work.

Please make sure that the parent element exists.

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

I think you are directly bind Model node to table UI element. In this case, you have to create a value node and get all the values in the model node to it and bind this value node to Table UI element. ( We are following this method, Since you can not edit the Model node entries ).

Second Ans. To Perform Edit in table UI element column, In the table column, right click and add child of input field and bind that with corresponding Value node attribute.

Regards

Vinod V

former_member197348
Active Contributor
0 Kudos

Hi Johannes,

Yes, the changes take effect in the context node bound to the table.

You can access the rows and fields like this:

wdContext.node<tablenode>().
get<tablenode>ElementAt(index).get<fieldname>();

But do remember if you are showing data from backend(e.g Adaptive RFC model),then you have to send this data to backend and save it.

I mean: copy this data into input<tablenode> of RFC model and execute RFC.

Regards,

Siva

sureshmandalapu6
Active Contributor
0 Kudos

Hi Johannes Schnatz ,

You just need to bind the attributes tot the table and when user is modifying any values , you write an even for onEnter and caputre the values in the code and update tot he system with using another BAPI.

Thanks

Suresh

Former Member
0 Kudos

Hi,

Just use the same node. Loop through it if there multiple records and then set it to the web-service or RFC whatever you are using. Execute it on click of save.

The modified data will be there in the same node.

thanks & regards,

Manoj