Joy Conner
3rd April 2006, 19:41
Is there a guideline on when it is appropriate to use get.var versus import and put.var versus export?

I have some code that uses get.var and I suspect that it does not ALWAYS work properly. Don't know why yet!

mark_h
3rd April 2006, 20:02
I am not sure if there is a difference. I found this in one place:

The function IMPORT("variable", ref variable) is a shorthand for GET.VAR( parent, "variable", ref variable )
The function EXPORT("variable", expression) is a shorthand for PUT.VAR( parent, "variable", expression )

Joy Conner
3rd April 2006, 22:17
I want to transfer a variable from sales order header to sales order lines. I have QKEY so without the source code I should be able to do this.

I have the following code:

zoom.from.all:
on entry:
message("I'm here")
import("variable name", expression)

I have observed that when you execute Maintain Sales Orders - tdsls4101m000 - and click the Lines button, the first iteration, my message is displayed.

When I exit the sales line session, tdsls4102s000, and navigate to a different sales order, and click the lines button, my message is not displayed.

Can anyone recommend section that is always executed upon entry to session tdsls4102s000?

mark_h
3rd April 2006, 22:49
Thats because I think the session tdsls4102s000 does not actually close. I think it just activates the parent session. Then the parent just calls activates the already open tdsls4102s000 session. I am not sure this will work, but you could try this:

choice.end.program:
before.choice:
|#call - do original code first
import("variable name", expression) | Re-do your import.

Not sure if your code will get executed, but worth a try. You may want to run it in debug mode to see if you can see a better spot to re-import your variable.

Joy Conner
3rd April 2006, 23:20
I have executed in debug mode and the re-entry point is ...............

field.back.t:
before.display:

I have no idea what this field is!

mark_h
3rd April 2006, 23:25
Found some other places you can try your import - init.form and first.set.

mark_h
3rd April 2006, 23:30
Well you can always try your import in that field section. When using Qkey I like to run it in debug mode to see which events happen when. This usually gives me a clue where I can put my new code.

Joy Conner
3rd April 2006, 23:31
For the record, init.form did not work but the choice.first.set does work.

Thanks.