jbaanm
24th March 2015, 17:56
I am having few requirements of Updating a different table from User Exit of different table.

Like I want to update tdpur400 - PO Header Warehouse (cwar) field, when a line level Warehouse (cwar) is changed for the first line.

Or
If Item's Purchase Warehouse is changed then I want to change the Item Default Data table also.

What is the best way to do this.

Thanks in advance...

Jay

mark_h
24th March 2015, 19:20
Since this is LN I should not touch it - but if you have source code you could probably just add it in update maintable or even in other spots. I am on 4c4 and use source extender qkey to update various events in the original source code. Wait for someone who knows LN - I am sure there is probably a better way.

jbaanm
24th March 2015, 19:24
Thanks Mark.

This is LN. We don't have source code.

Thanks

sachinbaan
25th March 2015, 07:24
hello,

u can write UE on line level - on tdpur401 (tdpur401ue) , UE has 8 sections, u need to use after.after.save.object() section, so whenever any changes will be done on tdpur401, it will trigger your code.

hope this will help you.

bhushanchanda
25th March 2015, 10:05
Hi,

Any changes made to PO header will again need a PO Header Synchronization. And again it will be difficult to understand if the warehouse field is changed or something else is changed.

So, there is no straight forward way to do it.

Two ways -

1. You can create a table to maintain the sales order line data. Now, in UE, in after.after.save.object() in DAL_NEW case you can insert the record in your customized table. Now, when the user updates the line, check your customized table for that line, if the warehouse field is changed, you can update your header warehouse using a DLL which uses DAL.

2. Second way is to block the approval of the purchase order if warehouses are not matching. IMHO, this is the best way to deal with this requirement with less risks of data corruption.

If you go with the 1st method, make sure you update the header warehouse using dal.* functions and not db.* functions. Also, you might need to call a standard DLL to do Synchronization.

To avoid this, you can opt the second way.

Same goes for the other requirement. Write in UE but use dal.* functions wherever possible.