SandraP
3rd November 2008, 17:35
Hi,

I'm hoping somebody can help me.

I have a generic item that has a inventory unit of each and a selling unit of metres. I need to create a conversion factor in the table tcibd003

To do this I have been told by support to write a constraint. This is it below but it only seems to be partially working. I have attached the constraint to Generic BOM's, so it will update/insert a record at this point (after the item code has been generated).


!table ttcibd003
!domain tcitem l.item
!db.retry.point()
!l.item = item_data
!select tcibd003.*
!from tcibd003 for update
!where tcibd003._index1 = {:l.item,"","ech","m"}
!as set with 1 rows
!selectdo
!tcibd003.item = l.item
!tcibd003.citg = ""
!tcibd003.basu = "ech"
!tcibd003.unit = "m"
tcibd003.conv = 50
tcibd003.rpow = 0
!db.insert(ttcibd003, db.retry)
!endselect
!commit.transaction()

But this updates the table with a blank item and doesn't actually select the product variant item that has been created.

Had anybody else done this before? or is there somebody out there who can help with Baan scripting?

Thanks,

SandraP

garias
4th November 2008, 23:39
Hello:

First you have to import the variables (from tables to local variables) to get
the actual item code.

Example:

!domain tcitem item_data
!import("tipcf500.item",item_data)

Really I don´t know if item field is in the tipcf500 or tipfc510. (I am not connected to baan this moment).

But I don´t know if it could work fine, because when you are using PCF you have the generic item code, and the numbe of variant, but you don´t have the the final item code for the configurated item.

However, you must to try

Gerard

Andreas
5th November 2008, 10:16
Hi SandraP,
as i understand your requirement you want to create a conv. factor for the newly created item.
If this is the case, then you can not solve this in a constraint imho , because the item is not present in tcibd001 at this time, so although you probably know the new item code (because of configuration) you get a ref error while inserting in tcibd003.
We had a similar requirement and solved it in the following way. We used the reports tdsls424401000 resp. tdsls120101100. Here in report script we coded the requirement, because at that time the newly created item is present in all tables.

Hope it's clear and helps,
Andreas

SandraP
5th November 2008, 14:48
Thanks all for your replies.

You are right in saying the item code is not generated when trying to use it withing a constraint so I have managed to solve it in a slightly different way.

The generic item has a generic conversion factor and when your generate the item it copies over this generic conversion.

All I did was update the generic item conversion factor before the item is configured item is generated and then re-generate the price/discount for the order.

Here is the constraint script I have used:

!table ttcibd003
!table ttipcf520
!domain tcqiv1 l.conv

!db.retry.point()

l.conv = [conv]

!select tcibd003.*
!from tcibd003 for update
!where tcibd003._index1 = {" INSULG2","","ech","m"}
!as set with 1 rows
!selectdo

!tcibd003.conv = l.conv

!db.update(ttcibd003, db.retry)
!endselect
!commit.transaction()

Thanks for looking