eConnect Error Code 908 (Invalid Sales Account)
I am trying to override the default sales account when creating an invoice. I am passing in the account index (@I_vSLSINDX varchar(75)) as a string. I have tried setting it as a variable from my code and also hard coding the account index in my code and get the same error message either way. I have verified that the sales account is coming from the customer and I can change the account on the customer card to the account I want to use and it defaults just fine but if I pass in the sales account index for that same account to the taSopLineIvcInsert eConnect stored procedure I get the 908 error code returned. If I remove all references to the @I_vSLSINDX eConnect variable it works just fine and defaults the sales account from the customer card. I even validate the SLSINDX in the SOP10200 table when I create an invoice through the GP UI and it is the same index that I am passing in so I don't think it has anything to do with the account index being used.
Here is the SQL stored procedure I created and the code to call the stored procedure.
/****** Object: StoredProcedure [dbo].[zCreateSubscriptionInvoiceLine] Script Date: 4/24/2019 7:25:51 AM
4/24/2019 Added Sales Index (@SLSINDX) to make sure the specific customer sales account number is used for distributions.
******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROC [dbo].[zCreateSubscriptionInvoiceLine]
(
@SOPTYPE tinyint
,@SopNumber varchar(21)
,@CUSTNMBR varchar (15)
,@DOCDATE datetime
,@ITEMNMBR varchar(30)
,@UNITPRCE numeric(19,5)
,@XTNDPRCE numeric(19,5)
,@QUANTITY numeric(19,5)
,@ITEMDESC varchar(100)
,@NONINVEN smallint
,@LNITMSEQ int
,@DOCID varchar(15)
,@SLSINDX varchar(75)
,@ErrorState int out
,@ErrString varchar(255) out
)
AS
BEGIN
exec taSopLineIvcInsert @I_vSOPTYPE = @SOPTYPE
, @I_vSOPNUMBE = @SopNumber
, @I_vCUSTNMBR = @CUSTNMBR
, @I_vDOCDATE = @DOCDATE
, @I_vITEMNMBR = @ITEMNMBR
, @I_vUNITPRCE = @UNITPRCE
, @I_vXTNDPRCE = @XTNDPRCE
, @I_vQUANTITY = @QUANTITY
, @I_vITEMDESC = @ITEMDESC
, @I_vNONINVEN = @NONINVEN
, @I_vLNITMSEQ = @LNITMSEQ
, @I_vDOCID = @DOCID
, @I_vSLSINDX = @SLSINDX
, @O_iErrorState = @ErrorState out
, @oErrString = @ErrString out
END
/*
declare @SOPTYPE tinyint = 3
declare @SopNumber varchar(21) = 'SBINV0000000071'
declare @CUSTNMBR varchar (15) = 'SYNNEX'
declare @DOCDATE datetime = '4/24/2019'
declare @ITEMNMBR varchar(30) = 'WGM37913'
declare @UNITPRCE numeric(19,5) = 51.40000
declare @XTNDPRCE numeric(19,5) = 51.40000
declare @QUANTITY numeric(19,5) = 1.00000
declare @ITEMDESC varchar(100) = 'SB000015182 - 4/15/2019 - 5/14/2019 - 1'
declare @NONINVEN smallint = 0
declare @LNITMSEQ int = 16384
declare @DOCID varchar(15) = 'SBINV'
declare @SLSINDX varchar(75) = '11205'
declare @ErrorState int
declare @ErrString varchar(255)
exec zCreateSubscriptionInvoiceLine @SOPTYPE
,@SopNumber
,@CUSTNMBR
,@DOCDATE
,@ITEMNMBR
,@UNITPRCE
,@XTNDPRCE
,@QUANTITY
,@ITEMDESC
,@NONINVEN
,@LNITMSEQ
,@DOCID
,@SLSINDX
,@ErrorState out
,@ErrString out
select @ErrorState
*/