Skip to Content
avatar image
Former Member

Project and Profit Centre

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 22, 2008 at 01:08 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • avatar image
    Former Member
    Jan 13, 2012 at 06:00 AM

    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

    Add comment
    10|10000 characters needed characters exceeded