IF EXISTS (
SELECT
name
FROM
sysobjects
WHERE
name
= N
'taRMTransactionWrapper'
AND
type =
'P'
)
DROP
PROCEDURE
taRMTransactionWrapper
GO
CREATE
PROCEDURE
taRMTransactionWrapper
-- taRMTransactionWrapper '1','ORD0005','4/12/2027','MYBATCH','AARONFIT0001','123.45'
--SELECT * FROM IV40400
@RMDTYPAL
int
,
@DOCNUMBR
varchar
(20),
@DOCDATE
date
,
@BACHNUMB
varchar
(15),
@CUSTNMBR
varchar
(15),
@DOCAMNT
NUMERIC
(19,5)
AS
set
transaction
isolation
level
read
uncommitted
DECLARE
@O_iErrorState
INT
,
@oErrString
VARCHAR
(256),
@ErrorDesc
VARCHAR
(256)
SELECT
@O_iErrorState = 0,
@O_iErrorState =
''
EXEC
taRMTransaction
@I_vRMDTYPAL = @RMDTYPAL,
@I_vDOCNUMBR = @DOCNUMBR,
@I_vDOCDATE = @DOCDATE,
@I_vBACHNUMB = @BACHNUMB,
@I_vCUSTNMBR = @CUSTNMBR,
@I_vDOCAMNT = @DOCAMNT,
@I_vSLSAMNT = @DOCAMNT,
@O_iErrorState = @O_iErrorState
OUT
,
@oErrString = @oErrString
OUT
IF @O_iErrorState > 0
BEGIN
SELECT
@ErrorDesc = tec.ErrorDesc
FROM
dynamics..taErrorCode tec
WHERE
tec.ErrorCode = @O_iErrorState
END
ELSE
BEGIN
SELECT
@ErrorDesc =
''
end
SELECT
@O_iErrorState
AS
ErrorState, @oErrString
AS
ErrString, @ErrorDesc
AS
ErrorDesc
SELECT
*
FROM
RM10301
WHERE
DOCNUMBR = @DOCNUMBR
GO
grant
exec
on
taRMTransactionWrapper
to
public