Andy..
29th August 2006, 16:00
Hi, I have generated AFS for whinh2100s000 but it does not include the 2 buttons for to/from project. Looking at the forms, they are exec.user.0 and exec.user.1 - but they are nowhere to be found in the generated DLL. It does however include the inbound/outbound buttons...

function extern void whinh2100s000f.Inbound_Order_Lines( ref string error )
{
DLLUSAGE
Function to start form command Inbound Order Lines in session whinh2100s000
ENDDLLUSAGE
stpapi.form.command( "whinh2100s000", 5, "to.inbound.lines", error )
}

function extern void whinh2100s000f.Outbound_Order_Lines( ref string error )
{
DLLUSAGE
Function to start form command Outbound Order Lines in session whinh2100s000
ENDDLLUSAGE
stpapi.form.command( "whinh2100s000", 5, "to.outbound.lines", error )
}

So I guessed the correct command should be:
stpapi.form.command( "whinh2100s000", 5, "exec.user.1", error )

and used that to try and make it perform the 'to project' function...

stpapi.handle.subproc( "whinh2100s000", "whinh2112s000", "add" )
|CLICK 'To Project' button
stpapi.form.command( "whinh2100s000", 5, "exec.user.1", error ) |guess!
|put origin - transfer (manual) assume 3 as above
stpapi.put.field( "whinh2112s000", "whinh212.oorg", str$(3) )
|put order/set gen.orno / 1
stpapi.put.field( "whinh2112s000", "whinh212.orno", gen.orno )
stpapi.put.field( "whinh2112s000", "whinh212.oset", str$(1) )
|put project
stpapi.put.field( "whinh2112s000", "whinh212.cprj", ddc.cprj )
|put activity
stpapi.put.field( "whinh2112s000", "whinh212.cact", ddc.cact )
|put cost component
stpapi.put.field( "whinh2112s000", "whinh212.ccco", ddc.ccco )
|Click OK
ret=( stpapi.save( "whinh2112s000", error ) )
|get test
stpapi.get.field( "whinh2112s000", "whinh212.cprj", value ) |=project code
|end
stpapi.end.session( "whinh2112s000" , error )

but nothing happens, no errors appear in 'error', all ret=1 - final test value get is empty nothing seems to have happened! I've tried putting the exec.user.1 command in various places, none seem to work... HELP :confused:

mark_h
29th August 2006, 18:49
My thoughts:
(1) Did your form command start the whinh2112s000?
(2) Did you find or mark the record before the form.command?
(3) Did you try stpapi.form.command( "whinh2100s000", 2, "whinh2112s000", error ) ?
Since this is Baan 5 nothing but WAGs. The example I have shows them doing a find, marking the record then executing a function. I also am not sure how you know when one is a function verses a session in baan 5.

And ttstpcreatdll is not perfect - I only use it to give me and indication of what might be available.

Andy..
2nd September 2006, 22:19
Mark, your suggestions got me closer - but not successful. In the end I just used a SQL insert. Seeing as the code is being run from within Baan this doesn't seem to bad a solution. cheers