rmarles
25th January 2005, 19:15
Hello.
Running Triton 3.1. Any help with the below code is greatly appreciated.
Trying to write a session to explode custom boms and the standard boms contained within (including phantom boms)
Obviously since "Recursion not yet implemented", I need to come up with another way of doing this.
I found one post that suggested using stacks, so I rewrote my code to do so.
I have the session working without getting the dreaded "Recursion" message, but when it explodes a standard BOM, I get a message "Error: Query should be in Exec Status or Eval Status".
It explodes the first component of the standard bom, dumps the error and returns back one level.
The below "report" is a sample output.
Part 123456-L2-4 at position 40 should actually have three BOM lines below it, and it only shows 1.Date : 01-25-05 [11:27] CUSTOMIZED BOMS Page : 1
Company : 100
tipcsc944m000/pcsc94411000
------------------------------------------------------------------------------------------------------------------------------------
Project : 123456 Status : Active
Start Date:
Customer : Compl.Dte : 01-07-05
Manufactured Item: 1234567890123456 Variant : Unit:
Revision :
------------------------------------------------------------------------------------------------------------------------------------
Level |Pos.|Item |Description | Revi-|IC| Length| Width|No.o| Net Quantity|Un.|Scp|Wrh|Opr|Ph.|No.|Buyer/
| | | | sion| | [ ]| [ ]| Un.| | |[ ]| | |tom|Nts|Planner
--------+----+----------------+------------------+------+--+---------+---------+----+--------------+---+---+---+---+---+---+--------
1 | 10|123456-L1-1 | | n/a|Cu| 0.00| 0.00| 0| 1.0000| | 0|001| 0|Yes| 0| 0
.2 | 10|123456-L2-1 | | n/a|St| 0.00| 0.00| 0| 1.0000| | 0|001| 0|No | 0| 0
.2 | 20|123456-L2-2 | | n/a|St| 0.00| 0.00| 0| 2.0000| | 0|001| 0|No | 0| 0
.2 | 30|123456-L2-3 | | n/a|St| 0.00| 0.00| 0| 1.0000| | 0|001| 0|No | 0| 0
.2 | 40|123456-L2-4 | | n/a|St| 0.00| 0.00| 0| 1.0000| | 0|001| 0|Yes| 0| 0
..3 | 10|123456-L3-1 | | n/a|St| 0.00| 0.00| 0| 1.0000| | 0|001| 0|No | 0| 0
.2 | 50|123456-L2-5 | | n/a|St| 0.00| 0.00| 0| 1.0000| | 0|001| 0|Yes| 0| 0
..3 | 10|123456-L3-1 | | n/a|St| 0.00| 0.00| 0| 1.0000| | 0|001| 0|No | 0| 0
.2 | 60|123456-L2-6 | | n/a|St| 0.00| 0.00| 0| 1.0000| | 0|001| 0|Yes| 0| 0
Anyways, here's the code, minus some things such as revision/effectivity checking, etc. I was concentrating more on the basics (getting the BOM to explode all the levels).function read.main.table()
{
l.count = 1
select tipcs021.*, tipcs020.*, tccom010.*
from tipcs021, tipcs020, tccom010
where tipcs021._index1 =
{:cprj.f, :item.f}
and tipcs021.cprj refers to tipcs020
and tipcs020.cuno refers to tccom010
as prepared set
selectdo
mitm.cprj = tipcs020.cprj
mitm.cprj.dsca = tipcs020.dsca
mitm.item = tipcs021.item
mitm.dsca = tipcs021.dsca
mitm.cuno = tipcs020.cuno
mitm.cuno.nama = tccom010.nama
mitm.start = tipcs020.sdat
mitm.close = tipcs020.ddat
mitm.psts = tipcs020.psts
stack.cprj(1,l.count) = tipcs021.cprj
stack.item(1,l.count) = tipcs021.item
read.custom.bom()
endselect
}
function print.line()
{
b.level = string.set$(".",l.count-2)&str$(l.count-1)
rprt_send()
}
function read.custom.item()
{
in.item = stack.item(1,l.count)
in.cprj = stack.cprj(1,l.count)
select tipcs021.*
from tipcs021
where tipcs021._index1 =
{:in.cprj, :in.item}
as prepared set
selectdo
sitm.dsca = tipcs021.dsca
sitm.revi = "n/a"
print.line()
read.custom.bom()
endselect
}
function read.standard.item()
{
in.item = stack.item(1,l.count)
in.cprj = stack.cprj(1,l.count)
select tiitm001.*
from tiitm001
where tiitm001._index1 =
{:in.item}
as prepared set
selectdo
sitm.dsca = tiitm001.dsca
sitm.revi = "n/a"
print.line()
read.standard.bom()
endselect
}
function read.custom.bom()
{
in.item = stack.item(1,l.count)
in.cprj = stack.cprj(1,l.count)
l.count = l.count + 1
select tipcs022.*
from tipcs022
where tipcs022._index1 =
{:in.cprj, :in.item}
as prepared set
selectdo
sitm.item = tipcs022.sitm
sitm.pono = tipcs022.pono
sitm.opol = tipcs022.opol
sitm.leng = tipcs022.leng
sitm.widt = tipcs022.widt
sitm.noun = tipcs022.noun
sitm.qana = tipcs022.qana
sitm.scpf = tipcs022.scpf
sitm.cwar = tipcs022.cwar
sitm.opno = tipcs022.opno
sitm.cpha = tipcs022.cpha
sitm.nnts = tipcs022.nnts
stack.cprj(1,l.count) = tipcs022.cprj
stack.item(1,l.count) = tipcs022.sitm
if tipcs022.opol = tcittb.standard then
sitm.opol = "St"
read.standard.item()
else
sitm.opol = "Cu"
read.custom.item()
endif
endselect
l.count = l.count - 1
}
function read.standard.bom()
{
in.item = stack.item(1,l.count)
in.cprj = stack.cprj(1,l.count)
l.count = l.count + 1
select tibom010.*
from tibom010
where tibom010._index1 =
{:in.item}
as prepared set
selectdo
sitm.item = tibom010.sitm
sitm.pono = tibom010.pono
sitm.opol = "St"
sitm.leng = tibom010.leng
sitm.widt = tibom010.widt
sitm.noun = tibom010.noun
sitm.qana = tibom010.qana
sitm.scpf = tibom010.scpf
sitm.cwar = tibom010.cwar
sitm.opno = tibom010.opno
sitm.cpha = tibom010.cpha
sitm.nnts = tibom010.nnts
stack.cprj(1,l.count) = ""
stack.item(1,l.count) = tibom010.sitm
read.standard.item()
endselect
l.count = l.count - 1
}
Running Triton 3.1. Any help with the below code is greatly appreciated.
Trying to write a session to explode custom boms and the standard boms contained within (including phantom boms)
Obviously since "Recursion not yet implemented", I need to come up with another way of doing this.
I found one post that suggested using stacks, so I rewrote my code to do so.
I have the session working without getting the dreaded "Recursion" message, but when it explodes a standard BOM, I get a message "Error: Query should be in Exec Status or Eval Status".
It explodes the first component of the standard bom, dumps the error and returns back one level.
The below "report" is a sample output.
Part 123456-L2-4 at position 40 should actually have three BOM lines below it, and it only shows 1.Date : 01-25-05 [11:27] CUSTOMIZED BOMS Page : 1
Company : 100
tipcsc944m000/pcsc94411000
------------------------------------------------------------------------------------------------------------------------------------
Project : 123456 Status : Active
Start Date:
Customer : Compl.Dte : 01-07-05
Manufactured Item: 1234567890123456 Variant : Unit:
Revision :
------------------------------------------------------------------------------------------------------------------------------------
Level |Pos.|Item |Description | Revi-|IC| Length| Width|No.o| Net Quantity|Un.|Scp|Wrh|Opr|Ph.|No.|Buyer/
| | | | sion| | [ ]| [ ]| Un.| | |[ ]| | |tom|Nts|Planner
--------+----+----------------+------------------+------+--+---------+---------+----+--------------+---+---+---+---+---+---+--------
1 | 10|123456-L1-1 | | n/a|Cu| 0.00| 0.00| 0| 1.0000| | 0|001| 0|Yes| 0| 0
.2 | 10|123456-L2-1 | | n/a|St| 0.00| 0.00| 0| 1.0000| | 0|001| 0|No | 0| 0
.2 | 20|123456-L2-2 | | n/a|St| 0.00| 0.00| 0| 2.0000| | 0|001| 0|No | 0| 0
.2 | 30|123456-L2-3 | | n/a|St| 0.00| 0.00| 0| 1.0000| | 0|001| 0|No | 0| 0
.2 | 40|123456-L2-4 | | n/a|St| 0.00| 0.00| 0| 1.0000| | 0|001| 0|Yes| 0| 0
..3 | 10|123456-L3-1 | | n/a|St| 0.00| 0.00| 0| 1.0000| | 0|001| 0|No | 0| 0
.2 | 50|123456-L2-5 | | n/a|St| 0.00| 0.00| 0| 1.0000| | 0|001| 0|Yes| 0| 0
..3 | 10|123456-L3-1 | | n/a|St| 0.00| 0.00| 0| 1.0000| | 0|001| 0|No | 0| 0
.2 | 60|123456-L2-6 | | n/a|St| 0.00| 0.00| 0| 1.0000| | 0|001| 0|Yes| 0| 0
Anyways, here's the code, minus some things such as revision/effectivity checking, etc. I was concentrating more on the basics (getting the BOM to explode all the levels).function read.main.table()
{
l.count = 1
select tipcs021.*, tipcs020.*, tccom010.*
from tipcs021, tipcs020, tccom010
where tipcs021._index1 =
{:cprj.f, :item.f}
and tipcs021.cprj refers to tipcs020
and tipcs020.cuno refers to tccom010
as prepared set
selectdo
mitm.cprj = tipcs020.cprj
mitm.cprj.dsca = tipcs020.dsca
mitm.item = tipcs021.item
mitm.dsca = tipcs021.dsca
mitm.cuno = tipcs020.cuno
mitm.cuno.nama = tccom010.nama
mitm.start = tipcs020.sdat
mitm.close = tipcs020.ddat
mitm.psts = tipcs020.psts
stack.cprj(1,l.count) = tipcs021.cprj
stack.item(1,l.count) = tipcs021.item
read.custom.bom()
endselect
}
function print.line()
{
b.level = string.set$(".",l.count-2)&str$(l.count-1)
rprt_send()
}
function read.custom.item()
{
in.item = stack.item(1,l.count)
in.cprj = stack.cprj(1,l.count)
select tipcs021.*
from tipcs021
where tipcs021._index1 =
{:in.cprj, :in.item}
as prepared set
selectdo
sitm.dsca = tipcs021.dsca
sitm.revi = "n/a"
print.line()
read.custom.bom()
endselect
}
function read.standard.item()
{
in.item = stack.item(1,l.count)
in.cprj = stack.cprj(1,l.count)
select tiitm001.*
from tiitm001
where tiitm001._index1 =
{:in.item}
as prepared set
selectdo
sitm.dsca = tiitm001.dsca
sitm.revi = "n/a"
print.line()
read.standard.bom()
endselect
}
function read.custom.bom()
{
in.item = stack.item(1,l.count)
in.cprj = stack.cprj(1,l.count)
l.count = l.count + 1
select tipcs022.*
from tipcs022
where tipcs022._index1 =
{:in.cprj, :in.item}
as prepared set
selectdo
sitm.item = tipcs022.sitm
sitm.pono = tipcs022.pono
sitm.opol = tipcs022.opol
sitm.leng = tipcs022.leng
sitm.widt = tipcs022.widt
sitm.noun = tipcs022.noun
sitm.qana = tipcs022.qana
sitm.scpf = tipcs022.scpf
sitm.cwar = tipcs022.cwar
sitm.opno = tipcs022.opno
sitm.cpha = tipcs022.cpha
sitm.nnts = tipcs022.nnts
stack.cprj(1,l.count) = tipcs022.cprj
stack.item(1,l.count) = tipcs022.sitm
if tipcs022.opol = tcittb.standard then
sitm.opol = "St"
read.standard.item()
else
sitm.opol = "Cu"
read.custom.item()
endif
endselect
l.count = l.count - 1
}
function read.standard.bom()
{
in.item = stack.item(1,l.count)
in.cprj = stack.cprj(1,l.count)
l.count = l.count + 1
select tibom010.*
from tibom010
where tibom010._index1 =
{:in.item}
as prepared set
selectdo
sitm.item = tibom010.sitm
sitm.pono = tibom010.pono
sitm.opol = "St"
sitm.leng = tibom010.leng
sitm.widt = tibom010.widt
sitm.noun = tibom010.noun
sitm.qana = tibom010.qana
sitm.scpf = tibom010.scpf
sitm.cwar = tibom010.cwar
sitm.opno = tibom010.opno
sitm.cpha = tibom010.cpha
sitm.nnts = tibom010.nnts
stack.cprj(1,l.count) = ""
stack.item(1,l.count) = tibom010.sitm
read.standard.item()
endselect
l.count = l.count - 1
}