Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 7915

Updating JE when Adding or Updating Ap Inv

$
0
0

Hello everyone,

     I have came across a situation, I have to update JE when Updating an AP Inv. I have wrote SP but issue is that I have multiple UDFs in my table PCH1 that is Detail table, in that table say I have a UDF U_empID,which is in row. In that invoice I add 3 lines as

 

ItemCode | Description | EmpID

A0001     |IBMPrinter|     1

A0002     |Mouse     |     2

A00003     |Keyboard|     3

 

But using below SP it only updates with the first value. as

In JE

Account     Debit|     Credit     |EmpID

                                                  1

                                                  1

                                                  1

                                                  1

 

 

 

IF (@transaction_type IN (N'A',N'U') AND (@Object_type = N'18'))

BEGIN

Update JDT1

set [U_empID]= a.U_empID,[U_EmpName]=a.U_empName,[U_CustomerCode]=a.U_CustomerCode,[U_CostCentre]=a.U_CostCentre,[U_ServCategory]=a.U_ServiceCeategory,[U_Service]=a.U_Service,[U_Location]=a.U_Location

FROM (Select DocEntry,U_empID ,U_empName,U_CustomerCode,U_CostCentre,U_ServiceCeategory,U_Service,U_Location from PCH1 with (nolock) where @object_type='18' and @list_of_key_cols_tab_del=N'DocEntry' and DocEntry=@list_of_cols_val_tab_del) a where JDT1.BaseRef=a.DocEntry and JDT1.TransType=@object_type

END

 

 

How to improve it so that it can Update the actual values rather than to update only first Line item value in all lines of JE


Viewing all articles
Browse latest Browse all 7915

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>