Ash Gajjar
28th June 2005, 18:21
Hi guys,

Have a session where I am hoping to output three reports. I know that I am to use the Baan V dll - tccomdll0010, but not having much success.

I have a single Function "read.main.table" which should output three reports.
I have a Single report no but three report groups

I can send my script if anyone out there has a minute to help me out

PS: Script attached

Many thanks
Ash

|******************************************************************************
|* tssoc9420o 0 VRC B52O a expt
|* Service Warranty report - Materials
|* Gajjar, Ashvin
|* 2005-05-18
|******************************************************************************
|* Main table tssoc210 Service Order Activities, Form Type 4
|******************************************************************************
|* Rev.No. 2 tsB52Oaexpt 07 Jun 05 avg01
|* prototype 2
|******************************************************************************

|****************************** declaration section ***************************
declaration:
#ident "@(#)tssoc9420o tsB52Oaexpt truman Rev.No. 3 07 Jun 05 avg01"
#ident "@(#) 1, SL20050222.1, Gajjar, Ashvin, 2005-06-07"

table ttssoc200 | Service orders
table ttssoc210 | Service order activities
table ttsmdm200 | Service items
table ttccom100 | Business Partners
table ttsbsc100 | Vessels
table ttscfg010 | Serialised item group
table ttsmdm015 | Tasks
table ttssoc220 | Service order Materials
table ttssoc230 | Service order Labour
table ttssoc240 | Service order Other
table ttcmcs002 | Currencies

| * Form variables

extern domain tscfg.sigr sigr.f
extern domain tscfg.sigr sigr.t
extern domain tsmdm.pldt date.f
extern domain tsmdm.pldt date.t
extern domain tcyesno print.detail
extern domain tcyesno print.excel
extern domain tcccur ccur.f

| * Program variables

domain tcdate date.utc | Date of currency conversion
domain tcmcs.long ref.pos | Position of reference currency in Home currency array
| Variables to get ref.currency
domain tcccur o.hcur(3)
domain tcemm.depe o.curr.system
domain tcmcs.long o.no.hcur
domain tcccur o.ref.ccur
extern domain tccrnd crnd.f | Currency round
extern domain tcamnt o.amta(3) | Amount
extern domain tcratc dummy.rats(3)
extern domain tcratf dummy.ratf(3)
extern domain tccrnd dummy.crnd(3)
extern domain tcccur home.ccur

| * Report Variables

extern domain tcamnt h.amt | Amount - hold

#include "itccom0000" | multicurrency variable and handling
#include "itsmdm0002" | Multicurrency handling

|****************************** program section ********************************


|****************************** group section **********************************

group.1:
init.group:

| itccom0000.get.multi.currency.data(get.compnr())
| tcemm.dll5000.get.home.currency.system(get.compnr(), o.hcur, o.no.hcur,
| o.curr.system, o.ref.ccur)
| tcemm.dll5000.position.of.hcur(get.compnr(), o.ref.ccur, ref.pos)

| disable.fields("print.excel")
get.screen.defaults()


|****************************** choice section ********************************

choice.cont.process:
on.choice:
execute(print.data)

choice.print.data:
on.choice:
if rprt_open() then
read.main.table()
rprt_close()
else
choice.again()
endif


|****************************** field section *********************************

field.sigr.f:
when.field.changes:
sigr.t = sigr.f


field.ccur.f:
before.display:
ccur.f = itccom0000.rcur
check.input:
if not valid.currency() then
set.input.error("tdpcg00157") | Currency not found
endif

|****************************** function section ******************************

functions:

| function read.print.materials() | REPORT 1
function read.main.table()
{

| if tccom.dll0010.open.report(1, "", 1, 2, 1) then

select tssoc210.*
from tssoc210
where tssoc210.pstm inrange {:date.f}
and {:date.t}
order by tssoc210.pstm
selectdo
select tsmdm200.item, tsmdm200.sigr
from tsmdm200
where tsmdm200._index3 inrange {:sigr.f, :tssoc210.item}
and {:sigr.t, :tssoc210.item}
selectdo
get.Vessel.data()
get.BP.data()
get.order.header.data()
get.Serialised.item.group.data()
material.data() | get data for each material detail line

endselect
endselect
| tccom.dll0010.close.reports()
| endif
}

function read.print.labour() | REPORT 2
{
if tccom.dll0010.open.report(1,"",0,2,2) then

select tssoc210.*
from tssoc210
where tssoc210.pstm inrange {:date.f}
and {:date.t}
order by tssoc210.pstm
selectdo
select tsmdm200.item, tsmdm200.sigr
from tsmdm200
where tsmdm200._index3 inrange {:sigr.f, :tssoc210.item}
and {:sigr.t, :tssoc210.item}
selectdo
get.Vessel.data()
get.BP.data()
get.order.header.data()
get.Serialised.item.group.data()
labour.data() | get data for each labour detail line

endselect
endselect
tccom.dll0010.close.reports()
endif
}

function read.print.other() | REPORT 3
{
if tccom.dll0010.open.report(1,"",0,2,3) then


select tssoc210.*
from tssoc210
where tssoc210.pstm inrange {:date.f}
and {:date.t}
order by tssoc210.pstm
selectdo
select tsmdm200.item, tsmdm200.sigr
from tsmdm200
where tsmdm200._index3 inrange {:sigr.f, :tssoc210.item}
and {:sigr.t, :tssoc210.item}
selectdo
get.Vessel.data()
get.BP.data()
get.order.header.data()
get.Serialised.item.group.data()
other.data() | get data for each other detail line

endselect
endselect
tccom.dll0010.close.reports()
endif
}

function get.Vessel.data()
{
select tsbsc100.*
from tsbsc100
where tsbsc100._index1 = {:tssoc210.clst}
selectdo
endselect
}

function get.order.header.data()
{
select tssoc200.cwoc, tssoc200.ccur
from tssoc200
where tssoc200._index1 = {:tssoc210.orno}
selectdo
endselect
}

function get.BP.data()
{
select tssoc200.ofbp
from tssoc200
where tssoc200.orno = (:tssoc210.orno)
as set with 1 rows
selectdo
select tccom100.nama
from tccom100
where tccom100._index1 = {:tssoc200.ofbp}
selectdo
endselect
endselect
}

function get.serialised.item.group.data()
{
select tscfg010.desc
from tscfg010
where tscfg010._index1 = {:tsmdm200.sigr}
selectdo
endselect
}


function Material.data()
{
select tssoc220.*
from tssoc220
where tssoc220._index1 = {:tssoc210.orno, :tssoc210.acln}
and tssoc220.wtyn = tcyesno.yes | only if warranty
and tssoc220.dltp = 4

selectdo | Get Item description
select tcibd001.dsca
from tcibd001
where tcibd001._index1 = {:tssoc220.item}
selectdo
rprt_send()
endselect
endselect
}


function labour.data()
{
select tssoc230.*
from tssoc230
where tssoc230._index1 = {:tssoc210.orno, :tssoc210.acln}
and tssoc230.wtyn = tcyesno.yes | only if warranty
selectdo
select tsmdm015.desc | get Task description
from tsmdm015
where tsmdm015._index1 = {:tssoc230.ctsk}
selectdo
rprt_send()
endselect
endselect
}


function other.data()
{
select tssoc240.*
from tssoc240
where tssoc240._index1 = {:tssoc210.orno, :tssoc210.acln}
and tssoc240.wtyn = tcyesno.yes | only if warranty
selectdo
rprt_send()
endselect
}

function domain tcbool valid.currency()
{
select tcmcs002.crnd:crnd.f
from tcmcs002
where tcmcs002._index1 = {:ccur.f}
as set with 1 rows
selectdo
return(true)
endselect
return(false)
}

mark_h
28th June 2005, 19:25
Well I did not look at the script, but depending on what you want you can do this several ways without using the DLL. I usually just use brp.open, brp.ready and brp.close for multiple reports. You do not have to let them pick a report, just prompt for a device on the first brp.open. Then just send the other two reports to it.

Below is a blurb on a zoom to one of my print sessions:

zoom.from.tppro64032:
on.entry:
import("cprj.f",cprj.f)
import("cprj.t",cprj.t)
import("cspa.f",cspa.f)
import("cspa.t",cspa.t)
import("date.f",date.f)
import("date.t",date.t)
display.all()
| Print Prorate Exception Report

rprt.id = spool.open("rtppro640302000",spool.device,1) | Open spooler in script
if not rprt.id then
spool.close()
execute(end.program)
endif
| TCL Direct Costs Report
spool.report = "rtppro640302000"
rprt_open()
print.prorate.exception.records()
rprt_close()

| Print Prorate Parent Project/CCN zero Record
spool.report = "rtppro640303000"
rprt_open()
print.prorate.parent.records()
rprt_close()

| Pirnt Prorate reports
| spool.report = "rtppro620404000"
| rprt_open()
| print.prorate.records()
| rprt_close()
|
spool.close()
execute(end.program)

The above example when I zoomed from another session I ran 3 different reports - now it is 2, but originally 3. In this case I selected to use rprt_open just so I did not have to mess with changing all rprt_send commands.

Ash Gajjar
1st July 2005, 16:25
Hi Mark

I believe I understand how to solve my problem after your seeing your example.

Thank you very much. I may come back to you if I do encounter any further problems with utilising your suggestion

Thanks !
Ash