baanspider
27th November 2009, 11:35
Hi experts
I am in LN,
Since we do not have the standard script, I wrote a session that calls another session (which is a standard report session) using AFS. But I would like to pass a variable in the new session to the report in the standard session. How to do this. Any suggestion?
This seems to be three levels
custom session -> std session -> report
Can we still use import and get.var? How?
rgds
mark_h
27th November 2009, 14:36
You need something like qkey to do this, but yes you could export/import into the session script and then pass it on to the report. You can see ~vamsi's source extender program in the code and utilities forum. If you do not need it in the session script you might try exporting from the afs script and importing into the report script - not sure if that will work.
Hitesh Shah
27th November 2009, 18:44
Certainly u can use import to get grand parent and get.var to get value from grand parent like
import("parent",grandparent)
get.var(gradparent,"var1" , var1)
Check the function sysntax before use.
baanspider
28th November 2009, 04:41
Hi Mark
What is the command for exporting the variable from afs into the report which you mentioned above?
Hi Hitesh
There is no grandparent predefined variable as you mentioned. How can I do what you suggested? Please advise
thanks and regards
Hitesh Shah
28th November 2009, 05:53
I also dont say it's pre-defined variable . It's user-defined and declared variable . So declare the same as long in ur report script .
baanspider
28th November 2009, 13:00
Hi Hitesh
there is a parent predefined variable. So i thought you meant grandparent predefined variable.
If it is user defined, what should be the value for grandparent.
I assume it is datatype long, and it should be the grandparent pid but how do i know what value it should be?
thanks and regards,
mark_h
28th November 2009, 15:16
Easy in the parent afs session:
extern domain tcorno zoom.orno
export("zoom.orno",zoom.orno)
[\code]
Put the export where you need it in the afs code - I usually set it before the first stpapi command. Then in the called session(still not sure it will work going straight to a report) put this:
[code=baan]
extern domain tcorno zoom.orno
import("zoom.orno",zoom.orno)
Again put the import in the location you need it - usually I put it in the before program section.
What hitesh provided allows you to pass the parent process id to the called session and then use the get.var to get variables from the parent. In this case I think the variables in the parent still need to be extern, but not positive. Give them a try.
Hitesh Shah
30th November 2009, 06:06
The import statement will bring value in grandparent. Did u ever debug the statement given by me.
The variables in ur custom session has to be extern as explained by mark.
However if u export in customer session and import in report script , it will never work as both work only wrt their parent sessions only . And this is not the case ur example .