pegaga1979
25th November 2015, 04:16
Hi,
i would like to insert qty stock balance from table whwmd215 based on specific warehouse to standard report BOM Multilevel.
i hv insert script in report script and field at Report Layout.
the script as below;
table twhwmd215
extern domain tcqiv1 A, B, sitm.qhnd
domain tccwar whwmd215.cwar
domain tcqiv1 whwmd215.qhnd
detail.1:
before.layout:
Select whwmd215.*
from whwmd215
where whwmd215.item=:tibom010.sitm
selectdo
if strip$(whwmd215.cwar) = "A" then
A = whwmd215.qhnd
else if strip$(whwmd215.cwar) = "B" then
B = whwmd215.qhnd
endif
endif
Selectempty
if whwmd215.cwar = "A" then
A = 0.0
else if strip$(whwmd215.cwar) = "B" then
B = 0.0
endif
endif
endselect
Your help is much appreciated.
mark_h
25th November 2015, 15:56
Instead of using A and B - use the field on the report that is being printed. Just make sure you really want the selectempty if you did not find a record. Replace field.report with the name of the field being printed - maybe that is the sitm.shnd. You also do not need to declare the table fields or fields defined as input on the report.
declaration:
table twhwmd215
detail.1:
before.layout:
Select whwmd215.*
from whwmd215
where whwmd215.item=:tibom010.sitm
selectdo
if strip$(whwmd215.cwar) = "A" or strip$(whwmd215.cwar) = "B" then
field.report = whwmd215.qhnd
endif
selectempty
| Are you sure you want this - because whwmd215 will no equal A or B.
| you did not find a record for the item
field.report = 0
endselect
pegaga1979
26th November 2015, 03:08
Hi Mark,
Actually i need to have qty for both warehouse.
i have set different field at report layout for both.
Eventhough i put integer 1000 at the script, it still not come out.
it seems my script is still wrong. :(
in table whwmd215, we have 2 warehouses, name A and B.
I attached my report layout. the script as below:
table twhwmd215
extern domain tcqiv1 cwara.qhnd, cwarb.qhnd, sitm.qhnd
domain tccwar whwmd215.cwar
domain tcqiv1 whwmd215.qhnd
detail.1:
before.layout:
Select whwmd215.*
from whwmd215
where whwmd215.item = :tibom010.sitm
selectdo
if strip$(whwmd215.cwar) = "A" then
cwara.qhnd = whwmd215.qhnd
else if strip$(whwmd215.cwar) = "B" then
cwarb.qhnd = whwmd215.qhnd
endif
endif
Selectempty
if strip$(whwmd215.cwar) = "A" then
cwara.qhnd = 1000
else if strip$(whwmd215.cwar) = "B" then
cwarb.qhnd = 1000
endif
endif
endselect
Juergen
26th November 2015, 09:12
Hi,
remove the unneeded declaration for the table fields.
domain tccwar whwmd215.cwar
domain tcqiv1 whwmd215.qhnd
That's not needed, because already declared with the table statement.
Regards,
Jürgen
pegaga1979
26th November 2015, 10:08
Hi Jürgen and Mark,
It is now run successfully....it give me the data...
Thank you very much for your help and advices.
You save my day :)
bdittmar
26th November 2015, 10:14
Hello,
use the Debugger to follow your logic and trace the variable values.
Silly question :
Are the warehouses realy A and B or something like A00000 and B00000 ?
In selectempty you Need no IF's
Regards
pegaga1979
26th November 2015, 11:35
Hi Bernd,
Actually my warehouse is something like HA001, HA002...
It is not a silly questions :)
Yes, i used debugger and it is really help me a lot.
Now i can print bom multilevel with current stock balance at specific whse at dedicated column :)