fpibaan
19th May 2008, 07:31
Dear Baan Board
I have facing an issue in a report linked to the session cisli2405m000(Reprint Invoices).
The requirement is to add the Bill of Materials details(BOM) for every Invoiced Sales Order Item on the Sales Invoice layout.
The issue is I am not having access to the source code of standard session cisli2405m000.
I have only access to the report script of the report.
Is is possible to give the BOM details of every iNvoiced Sales Order Item ?????
Reason being the invoiced item can have multiple BOM's and i am not sure how many BOMs an item will be having so i cant define the same number of layouts.
Kindly help me in this regard.
I am on Baan 5.0c and SP 19
Your fast response is appreciated.
Thanks & Regards
fpibaan
19th May 2008, 09:46
does anyone have suggestion for the same?????
zardoz
19th May 2008, 12:08
You can do it by adding a detail with a condition, by example using a boolean variable called bomline.
after printing details of item, if there is a bom, set the condition true and begin reading the bom related, putting variables you want to print in arrays.
in the new detail, after print the line, if the index doesnt reach the max. number of rows you found, increment the index and layout.again() otherwise set bomline to false.
fpibaan
19th May 2008, 12:48
Thanks for replying.
But how can i know how many layouts to define cos i cant determine the number of BOMS for each invoiced item from the report script.
Secondly i want to print the Invoiced item and then the correspindong BOM for each(which could be 7 or 8 or 9 or any number) so how do i know how many layouts to define.
Awaiting ur response
zardoz
19th May 2008, 13:20
I think that you speak about "many boms by item" means "many bom lines by item".
After you print the item (so the detail), call a function that reads all the bom lines and store it in arrays. After that you knows exactly how may bom lines are to be printed, and the data you want to print are in those arrays.
You have to define only 1 detail, because the print of this layout is repeated by means of layout.again() instruction till the end of bom is reached.
fpibaan
19th May 2008, 14:37
I am able to store all the BOM in the array but cant print it in different lines as such.
I have my Main item in detail.3 and the Bom layoyt in detail.2
detail.2:
after.layout:
i = 1
select tibom010.*
from tibom010
where tibom010._index1 = {:detail.desc1}
selectdo
bom1(1,i) = tibom010.sitm
i = i + 1
endselect
detail.3:
detail.4:
before.layout:
bom = ""
j = 1
if j <= i then
bom = bom1(1,j)
j = j+1
layout.again()
endif
after.layout:
bom = ""
"bom" is the report field.
Kindly advice where am I going wrong.
As of now only the last BOM item is printed in the report,not all of them
zardoz
19th May 2008, 15:08
Try this little modification of your code:
detail.2:
after.layout:
i = 0
select tibom010.*
from tibom010
where tibom010._index1 = {:detail.desc1}
selectdo
i = i + 1
bom1(1,i) = tibom010.sitm
endselect
j = 1
print.bom = ( i >= 1 )
detail.3:
detail.4:
before.layout:
if j <= i then
bom = bom1(1,j)
j = j + 1
layout.again()
else
print.bom = FALSE
endif
If you put j = 1 in the detail.4 each time is executed starts again from first bom line...
Put the print.bom as a condition to print the detail.4 in the report layout.