cancel
Showing results for 
Search instead for 
Did you mean: 

how to keep previous session values

Former Member
0 Kudos

Hi all

I have a JCo program

teh values in the selecton screen initialized from a function module which is executed in doInitialization() for the loginID for the user logon on the portal but the user can change any of the values.

When the user click on the submit button and there is no output it catchs the exception and stay in the selection screen. but the problem is that it re-initialize the values again and I want to keep the previous values (since the user may changed any of the values as I mentioned).

Also. when it display the result and the user click Back button it tdoes the same thing and I do not want that.

Any idea how to keep pld values?

Thanx

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

Thank you Gur for your hhelp.

I tried with non static variable and it is not working..

I did another solution which is..

When I catch an error, I capture the values from the selection screen and put them in the bean and send them again to the selection screen.. this way you will have the values from the selction screen not the default values.

But, I have another problem which is when the user click the Back Button, I could not keep the values from the selection screen to send them again to the session.

any one can help in that?

Thanks.

Former Member
0 Kudos

Thank you very much Gur

I tried it but it does not work


private static boolean ss_state = true;

public void doInitialization() 
{
	if (ss_state)
	{
			
	try {
		doConnect2();			
		assingFucntion2();
		executeBAPI2();
		ss_state = false;
	} catch (RuntimeException e) {
		state = ERROR_STATE;
		ss_state = false;
		
	}
	}

any other suggestions?

Former Member
0 Kudos

It shouldn't be static.

Making it static means that it will never get true again after it was assigned false once.

The problem here should have been that the doInitialization() wouldn't have initiailized even when it should have, meaning that if it did this solution didn't work...

Former Member
0 Kudos

add a boolean flag <i>firstTimeFlag</i> as a class field, which will be set to true on decleration.

in doInitialization() do:

if (<i>firstTimeFlag</i>){

...//do your thing

firstTimeFlag = false;

}