Today I been working on an interesting case with eConnect, I been trying to call taAnalyticsDistribution using normal SQL Query but I didn’t find the impact of the run on Dynamics GP and it was always returning the value “0” in ErrorState which should mean that the command was executed properly:
EXEC @return_value = [dbo].[taAnalyticsDistribution]
@I_vDOCNMBR = N'3464',
@I_vDOCTYPE = 0,
@I_vAMOUNT = 50.35,
@I_vACTNUMST = N'000-1100-00',
@I_vaaTrxDim = N'DEPARTMENT',
@I_vaaTrxDimCode = N'1',
@O_iErrorState = @O_iErrorState OUTPUT,
@oErrString = @oErrString OUTPUT
I tried to break the code to see what’s going on and therefore installed a decryption application to decrypt the SP and ran an SQL trace, where I realized that the procedure is indeed not working as expected and not retuning anything due to a misplaced “RETURN” Command below:
Removing this command fixed my case! I don’t want to publish the full code of the procedure as might be having differences between every version of the eConnect and therefore I am providing a way to get this resolved on your environment.
Hope that this helps.