rduncan10
10th July 2008, 22:37
Hi,

I'm trying to complete a display-only version of the sales order sessions (tdsls4101m000). We need to keep people from maintaining sales orders, but let them see all the information on the order (which does not show up readily on existing Baan display sessions). People in shipping, for example, will use this to view delivery addresses and shipping terms.

We don't have source code, so I'm trying to figure out how to use switch.to.process() with the subsessions. I've seen some discussion of this in other threads, but I'm not able to figure out how they all fit together.

There are three sessions involved:
tdsls4101m000 (Order Header)
tdsls4102s000 (Order Lines - the bottom of the order line screen where data is entered).
tdsls4503s000 (Order Lines - the top part of the screen where lines are displayed).

What I'm not sure about is which session calls what.

I think I use activate() and switch.to.process() in the header session to call the subession. But do I call the bottom session or the top? Does one of these then call the other using activate() and switch.to.process()?

In some initial tests I end up with all three sessions open, but overlapping and blocking one another.

Thanks,
Rob

mark_h
11th July 2008, 16:22
Why not just turn off insert, delete and modify in the original sessions? Or clone the sessions - keep the scripts, then turn off insert, delete and modify on the forms?

Just some thoughts.

rduncan10
11th July 2008, 16:59
I thought of that, but the session numbers are in the code. I would not be able to zoom to a clone of tdsls4102s000 from the header because it would have a different code.

I thought of changing access to the tables too, but shipping users probably need write access to the sales order tables.

I can do it by creating clones of tdsls4101m000 and tdsls4102s000 and dropping the split screen from lines session, but I wanted to know how to create the split screen.

Thanks,
Rob

en@frrom
11th July 2008, 17:46
I would look into the authorizations module, you can define access rights on session and/or table level...

rduncan10
14th July 2008, 16:51
Authentication does not really work here: people who do shipping need access to the tdsls040 and tdsls041 table to do deliveries and print shipping documents.

Anyway, after a few hours of trial and error, I got something that is close to working. I'm now having a few problems with the way the session refreshes the display.

If I manually refresh, from the client, it works, but I can't get the program script to work.

When I start this session, it displays everything correctly.

When I try to change views/groups (go from one sales order to another), the parent session (bottom part of the screen) moves to the next sales order, but does not show any lines. The child (top part of the screen) does not change at all. If I hit Refresh (Ctrl-R in BW), the screen updates and looks fine.

If I move from one order line to another, the parent (bottom) works normally, but the child (top) does not change. For example, if there is more lines than the child can display on the screen, it does not scroll down. In the Baan session, the position number in the top part of the screen is highlighted. I'm not sure how they do that.

Here is part of my script:

These session look like the sales order lines screen:
Parent: tdcus0501s000 = tdsls4102s000 (bottom part of screen)
Child: tdcus0502s000 = tdsls4503s000 (top part of screen)

Parent
declaration:
table ttdsls041 | Sales Order Lines
extern long instruction
long child.id

before.program:
sattr.combined = COMBINED.BOTTOM

form.1:
init.form:
get.screen.defaults()
child.id = activate("tdcus0502s000")
switch.to.process(child.id)

choice.end.program:
before.choice:
kill(child.id)

choice.abort.program:
before.choice:
kill(child.id)

choice.find.data:
after.choice:
sync.sub(find.data)

choice.first.view:
after.choice:
sync.sub(first.view)

choice.next.view:
after.choice:
sync.sub(next.view)

... Same for prev.view, last.view, next.set, etc ...
functions:
function sync.sub(long inst)
{
display.curr.occ()
refresh()
instruction = inst
export("instruction", instruction)
switch.to.process(child.id, SWITCH.WITHOUT.INTERACTION)
} Child
declaration:
table ttdsls041
long instruction

before.program:
sattr.combined = COMBINED.TOP
wait.for.switch()

form.1:
init.form:
if background then
while true
import("instruction", instruction)
on case instruction
case first.view:
execute(first.view)
refresh()
break
case next.view:
execute(next.view)
execute(first.set)
break
... Same for prev.view, last.view, next.set (etc)
case find.data:
execute(find.data)
break
default:
display.all()
endcase
switch.to.process(parent)
endwhile
endif
refresh()

choice.find.data:
after.choice:
execute(first.set)

choice.first.view:
after.choice:
execute(first.set)

.. same for next.view. etc ...

choice.first.set:
after.choice:
display.curr.occ()
refresh()
As you can see, I've tried various display commands, and tried them and the refresh commands in various places. Nothing seems to work.

Thanks,
Rob

mark_h
14th July 2008, 20:26
In debug mode does the instruction actually make it to the child session? Does the child session have all of the options set on the form? Make sure the child session has next group(and etc.) set on the form.