on 2020 Jan 15 11:41 PM
Hello
Our compagny want to set default cost center for our shop in marketing documents (A/R invoice for ex)
We have 3 shop , 3 user with their default warehouse and for Ex :
When user 'BQ2' (Shop number 2) create A/R Invoice + payment , default cost center (BQ2) should automaticaly be there and he should not be able to create A/R Invoice without adding the cost center/distribution rule .
I know that you can allocate cost center/distribution rules directly in chart account
But our G/L Accounts (Sales and expendures) are based on Item Group , not Warehouse
i checked in form settings , document tab , i can allocate the distribution rule/cost center , but when i close the A/R invoice et re-open a new one , it reset and we need to select again the cost center.
So i searched on this forum and on internet , and saw that it's possible , for that case , to use FMS to fill the required cost center .
I tried this query for an exemple :
SELECT T0.[PrcCode] FROM OPRC T0 WHERE T0.[PrcCode] ='IT'
Put a FMS directly on COGS dimension/Distribution Rule based on this query and auto-refresh when the user select item code in A/R Invoice and its work perfectly
Now i want FMS who consider UserID and then select automatically the distribution rule using CASE query
SELECT Case when (select $[user]) = 8 then (SELECT T0.[PrcCode] FROM OPRC T0 WHERE T0.[PrcCode] ='BQ2') when (select $[user]) = 2 then SELECT T0.[PrcCode] FROM OPRC T0 WHERE T0.[PrcCode] ='IT') End
I tried this one , but i had error syntax , can you help , is it the correct way ? Thanks
https://www.leveragebusinessone.com.au/cost-centres-sap-business-one/
Also This link is another solution responding to my problem , even if the distribution rule doesn't come automatically, we can force the user to set the correct D.R
so if you can help me on how to create Additionnal autorisation and give me the SBO_SP_TransactionNotification stored procedure query for my case (they didn't show that part) , it will help.
Thanks
Hi,
You can try by this FMS , change the user code and cost center code as you required ensure you don't set "refresh regular"
Select case when (select top 1 UserCode from USR5 where SessionID = @@SPID and Source = 'SBO_Client' and Date <= GETDATE() order by Date desc) ='manager' then (SELECT T0.[PrcCode] FROM OPRC T0 WHERE T0.[PrcCode] ='BQ2') else (select top 1 UserCode from USR5 where SessionID = @@SPID and Source = 'SBO_Client' and Date <= GETDATE() order by Date desc) ='Sale' then (SELECT T0.[PrcCode] FROM OPRC T0 WHERE T0.[PrcCode] ='IT') end
For stored procedure
IF @transaction_type IN ('A','U') and @Object_type = 13
BEGIN
IF EXISTS (SELECT T0.DocEntry FROM dbo.RDR1 T0
WHERE T0.ProfitCode ='BBQ2' and usersign <>'8'
AND T0.DocEntry = @list_of_cols_val_tab_del)
Begin
SET @Error = 1111
SET @error_message = 'Ensure correct cost center selected!'
End
End
Regards:
Balaji.S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
100 | |
9 | |
8 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.