cancel
Showing results for 
Search instead for 
Did you mean: 

removing/clear data in input model nodes in view controller

Former Member
0 Kudos

I have many input nodes related to function modle input in my view controller.

This input nodes are used to send collection of objects(function module custome types).

At present i am using

1. INVALIDATE to clear the data in my function module output.

2. RESET for context.

BUT what is the best waay to clear the input model nodes.

In my current application i suspect the data is reatined in import parameters in context.

What is best way to clear the input nodes.

Is there any other alternative to below code ?

-


int nGroupRecords=0;

nGroupRecords=wdContext.nodeImportParameterGroupRecords().size();

if(nGroupRecords>0){

for (int i = nGroupRecords; i > 0; i--){

wdContext.nodeImportParameterGroupRecords().removeElement(wdContext.nodeImportParameterGroupRecords().getElementAt(i-1));

}

}

Accepted Solutions (0)

Answers (5)

Answers (5)

nikhil_bose
Active Contributor
0 Kudos

make Lifespan of view controller to when_visible

nikhiL

Former Member
0 Kudos

Hi

Try this..

Declare a variable of type importGroupEle (ur node element)

with Null as value.

Then bind that element to ur node.

wdContext.nodeImportGroup.bind(importGroupEle)

Hope it works..

Former Member
0 Kudos

Hi raghu,

The method invalidate() works differently for modelnodes and valuenodes. The method invalidate() makes empty value nodes only.

For model nodes invalidate() refreshes the data but don't make them empty. You have to explicitly make them empty

like

for (int i = node.size(); i > 0; i--)

node.removeElement(node.getElementAt(i - 1));

Yes, for each node, you need to use invalidate() method.

If you have a parent node having 10 child nodes, in that case only you can invalidate all by saying

wdContext.node<Parentnodename>().invalidate();

this will nuliify all your child nodes...

hope this will resolve your query

regards,

amit bagati

Former Member
0 Kudos

Amit,

You mean INVALIDATE will should be used only for MODEL Nodes?.

So i need to use below code for all value nodes.

for (int i = node.size(); i > 0; i--)

node.removeElement(node.getElementAt(i - 1));

What about below code?

When we need to use this?

Does the below code will not work for both Value nodes and model nodes?

wdContext.getContext().reset(true);

wdThis.wdGetComponentController().wdGetContext().getContext().reset(true);

Former Member
0 Kudos

Hi,

wdContext.getContext().reset(true);

This reset the value of all the context to the intial state.

The boolean argument to the above method is to specify whether you want to reset all the context values(true) or only for the dynamically created values (false).

Regards,

Murtuza

Former Member
0 Kudos

All the above options are unable to resolve my issue.

I have requirment of deleting a record in SAP from frontend(webdynpro).

The records are deleted in SAP for DELETE button action.

But the screen shows with previous data only.

Even though if i navigate to HOME page and come AGAIN to delete page the same records are shown in web page.where as record is not existing in SAP.

The same is reflected in DELETE WEB PAGE if F5(REFERESH Button in browser) button is clicked.

Is there a way to achive a F5 /Browser referesh in webdynpro ?

Former Member
0 Kudos

Hi,

Below is the sequence that is taking place.

1. Get the data from backend using some RFC and display it in a table.

2. Delete the record.

Now, the record is deleted from the backend but still visible in your Table. Is this the problem that you are facing?

If yes, then try adding one more step to the above mentioned steps.

3. Refetch the data after deleting the record as u do in the first step. Invalidate the output node.

Regards,

Murtuza

Edited by: Murtuza Kharodawala on May 5, 2008 2:33 PM

Former Member
0 Kudos

code is as per those steps only.

data will be refereshed calling function module for display.

Output node is invalidatid for data referesh of function moduule execution.

But in this display i get the OLD data in VIEW.

Commit and Rollback are done by seprate function modules.

Why the data is refereshed when coming to the DELETE PAGE from a link in EP or F5 REFERESH button.

snehal_kendre
Active Contributor
0 Kudos

HI Raghu,

simply you can do it by using bind().

as

wdContext.nodeImportParameterGroupRecords().bind(new ImportParameterGroupRecords())..

Former Member
0 Kudos

Hi raghu,

instead of removing elements of node,you can use invalidate method to nullify your node.

for your case, you can write following code:

int nGroupRecords=0;

nGroupRecords=wdContext.nodeImportParameterGroupRecords().size();

if(nGroupRecords>0){

wdContext.nodeImportParameterGroupRecords().invalidate();

}

In general,you can use the below mentioned code to nullify any node:

wdContext.node<nodename>().invalidate();

Note:for each node to nullify,you need to use invalidate method.

regards,

amit bagati

Former Member
0 Kudos

Amit,

Can we use invalidate for both input and output model nodes?.

For any nodes INVALIDATE can be used.

I am having 20 input nodes for each functionmodule and one output node.

So i need to use INVALIDATE for 20 times for all my input nodes.

Is there way to clear the ENTIRE DATA from ROOT CONTEXT NODE ?

Former Member
0 Kudos

Hi,

Ya there is a way to invalidate the entire context node.

wdContext.getContext().reset(true);

Regards,

Murtuza

nikhil_bose
Active Contributor
0 Kudos

i think you can try wdContext.nodeImportParameterGroupRecords().invalidate();

and once you invalidate you need to create new element and bind to it to accept new values

nikhiL