Skip to Content

Updating Ref2 in Journal Entry when NumAtCard field in A/R invoice is changed

Hi,

I would like to know for updating ref2 in journal entry when I update the NumAtCard field in A/R invoice.

My problem is

when I update NumAtCard in A/R invoice, didn't update Ref2 field in journal entry.

I also want to update there.

Please advise me how I should do.

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Sep 06, 2019 at 05:48 AM

    Dear Eve Lim,

    Please try with Post transaction Notification.

    Best Regards,
    Sandesh Shinde

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 06, 2019 at 07:10 AM

    Dear

    Below just an example, you modify as per your requirement and hope you know SQL:

    IF ((@object_type = N'13' ) and @transaction_type in (N'A',N'U'))

    BEGIN

    DECLARE @ExciseNum NVARCHAR(1000)

    SELECT@ExciseNum=COALESCE(@ExciseNum+ ',','') + ISNULL(Cast(A.DocNum as Nvarchar(100)),'') FROM( select Distinct T5.DocNum From OINV T0

    LEFT OUTER JOIN INV1 T1 ON T0.DocEntry = t1.docentry

    LEFT OUTER JOIN DLN1 t2 on T1.BaseEntry = T2.DocEntry and T1.BaseType = t2.ObjType and T1.BaseLine = t2.LineNum

    Left Outer Join ODLN T3 on t3.DocEntry = t2.DocEntry Left Outer Join OEI1 T4 on t4.BaseEntry = t3.DocEntry and t4.BaseLine = t2.LineNum and t2.ObjType = t4.BaseType

    Left Outer Join OOEI T5 on T4.DocEntry = T5.DocEntry WHERE

    T0.DocEntry=@list_of_cols_val_tab_del )A

    UPDATET4 SETT4.U_OEINo = @ExciseNum FROMOINV T4 WHERET4.DocEntry = @list_of_cols_val_tab_del

    END

    Add a comment
    10|10000 characters needed characters exceeded

    • Dear,

      I tried as follow. But fail. Guide me,please.

      If ((@object_type = N'13') and @transaction_type in (N'A',N'U'))

      BEGIN

      DECLARE @RefNum NVARCHAR(100)

      Set @RefNum = (select COALESCE(@RefNum+ ',','') + ISNULL(Cast(A.NumAtCard as Nvarchar(100)),'')

      from (select T0.NumAtCard from OINV T0 inner join OJDT T1 On T0.TransId = T1.TransId

      where T0.TransId = @list_of_cols_val_tab_del)A)

      Update OJDT Set OJDT.Ref2 = @RefNum where OJDT.TransId = @list_of_cols_val_tab_del

  • Posted on Sep 07, 2019 at 01:33 PM

    You can update by standard B1 feature go to administration and reference field links select your marketing document and it will show you mapping and configure mapping rule for Customer/Vendor reference to ref2 in JE. See the below image you will understand.

    Avoid using update queries as by using such queries you may loose support from SAP as per SAP's support policy.


    ref-field-links.jpg (456.4 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 16, 2020 at 05:24 AM

    Thanks, I have solved as follow. Now it's working fine.

    IF (@object_type in (13,14) and @transaction_type in (N'A',N'U'))

    BEGIN

    Update OJDT set Ref2 = T0.NumAtCard

    From OINV T0 inner join OJDT T1 on T0.DocEntry = T1.BaseRef

    Update OJDT set Ref2 = T0.NumAtCard

    From ORIN T0 inner join OJDT T1 on T0.DocEntry = T1.BaseRef

    End

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.