cancel
Showing results for 
Search instead for 
Did you mean: 

Project and Profit Centre

Former Member
0 Kudos

Hi all.

We have client that would like some limitations attached to the adding of A/R invoices. They use both Project and Profit Centre on sales documents. When adding an A/R Invoice that contains a specific profit centre, they would like that the user is told to also attach a project before proceeding. I'm thinking in terms of a stored procedure, but can't seem to figure out how to check for the correct profit centres, as the profit centre seems to only appear on the rows of the Invoice. (please correct me if I'm wrong).

I see that I may need to loop trough all rows and check each row - collect information of the rows that contain the profit centre in question and then trigger the error message - but I don't know how to do this. Can someone please guide me on my way?

Thank you very much.

Best regards, Runar.

Accepted Solutions (1)

Accepted Solutions (1)

former_member583013
Active Contributor
0 Kudos

The project should also be entered at the row level to reflect in the Journal Entry.

The SBO_SP_TransactionNotification code would be

IF @object_type = '13' AND @transaction_type = 'A'

BEGIN

If EXISTS(SELECT T0.ItemCode FROM [dbo\].[INV1\] T0 WHERE T0.DocEntry = @list_of_cols_val_tab_del AND T0.OcrCode = '{your Profit Center Code}' AND T0.Project IS NULL)

BEGIN

set @error = 1

set @error_message = 'Please enter Project Code'

END

END

Former Member
0 Kudos

Thank you Suda.

This solved my problem. Points have been assigned.

Best regards, Runar.

Former Member
0 Kudos

hi Suda,

this work for A/R invoice, How can i add AP invoice in this?

I have tried following but not work for AP Invoice, Please guide me...

...............................................................................................................

set ANSI_NULLS ON

set QUOTED_IDENTIFIER ON

go

alter proc [dbo].[SBO_SP_TransactionNotification]

@object_type nvarchar(20), -- SBO Object Type

@transaction_type nchar(1), -- [A]dd, <u>pdate, [D]elete, [C]ancel, C[L]ose

@num_of_cols_in_key int,

@list_of_key_cols_tab_del nvarchar(255),

@list_of_cols_val_tab_del nvarchar(255)

AS

Begin

-- Return values

declare @error int -- Result (0 for no error)

declare @error_message nvarchar (200) -- Error string to be displayed

select @error = 0

select @error_message = N'Ok'

IF @object_type = '13,18' AND @transaction_type = 'A'

BEGIN

If EXISTS(SELECT T0.ItemCode,T0.AcctCode FROM [dbo].[INV1] T0 WHERE T0.DocEntry = @list_of_cols_val_tab_del AND T0.U_P_Name IS NULL)

BEGIN

set @error = 1

set @error_message = 'Please enter Project Code'

END

END

-- Select the return values

select @error, @error_message

end

0 Kudos

Can you help me where to put these codes?

IF @object_type = '13' AND @transaction_type = 'A'

BEGIN

If EXISTS(SELECT T0.ItemCode FROM [dbo\].[INV1\] T0 WHERE T0.DocEntry = @list_of_cols_val_tab_del AND T0.OcrCode = '{your Profit Center Code}' AND T0.Project IS NULL)

BEGIN

set @error = 1

set @error_message = 'Please enter Project Code'

END

END

Answers (1)

Answers (1)

Former Member
0 Kudos

Dear Suda,

I would like to make a field"Transaction category" given in A/R invoice & Sales Order as mandatory.

kindly write a code for the same.

Thanking you inadvance.

Joginder75