declaration:
table tfihub002
table ttcibd007
table tttadv130
table tfifam011
table tfifam003
domain tcmcs.str2 pp
domain tcmcs.str11 ss
extern domain tcyesno smi.item,smi.set,smi.foi,smi.both.set,temp.foi
long mm
detail.1:
before.layout:
mm = 0
smi.both.set = tcyesno.no
select fihub002.item,fihub002.iown
from fihub002
where fihub002._index1 = {:tdpur401.item}
selectdo
smi.item = tcyesno.yes
mm = mm + 1
if mm = 1 then
if fihub002.iown = fihub.invt.flex then
smi.foi = tcyesno.yes
else
smi.foi = tcyesno.no
endif
else
if fihub002.iown = fihub.invt.flex then
temp.foi = tcyesno.yes
else
temp.foi =tcyesno.no
endif
if smi.foi <> temp.foi then
smi.both.set = tcyesno.yes
endif
endif
selectempty
smi.item = tcyesno.no
smi.set = tcyesno.no
smi.foi = tcyesno.no
smi.both.set = tcyesno.no
endselect
if smi.item = tcyesno.yes then
select fihub002.item
from fihub002
where fihub002._index1 = {:tdpur401.item,:tdpur401.otbp}
selectdo
smi.set = tcyesno.yes
selectempty
smi.set = tcyesno.no
endselect
endif
select tcibd007.ecpr
from tcibd007
where tcibd007._index1 = {:tdpur401.item}
selectdo
selectempty
tcibd007.ecpr(1) = 0
endselect
pp = tdpur401.acti(1;2)
ss = tdpur401.acti(3;11)
select ttadv130.desc
from ttadv130
where ttadv130._index1 between {:pp,"B50","c","",1,:ss}
and {:pp,"B50 ","c ","zzzz",1,:ss}
and ttadv130._compnr = 000
AS SET WITH 1 ROWS
selectdo
selectempty
ttadv130.desc =""
endselect
select fifam011.*
from fifam011
where fifam011._index1 = {:tdpur401.orno,:tdpur401.pono,:tdpur401.sqnb}
selectdo
select fifam003.volu
from fifam003
where fifam003._index1 = {:tdpur401.item,:fifam011.mitm,:fifam011.manu}
and fifam003.bpid = :tdpur401.otbp
selectdo
selectempty
fifam003.volu = -50
endselect
selectempty
fifam003.volu = -100
endselect