USP_DATAFORMTEMPLATE_EDIT_BATCHCOMMITRESUMEPARAMETERS
The save procedure used by the edit dataform template "Batch Commit Resume Process Parameter Edit Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | The input ID parameter indicating the ID of the record being edited. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@CREATEOUTPUTIDSET | bit | IN | Create output selection |
@OUTPUTIDSETNAME | nvarchar(100) | IN | Selection name |
@OVERWRITEOUTPUTIDSET | bit | IN | Overwrite existing selection |
@CREATEEXCEPTIONBATCH | bit | IN | Create exception batch |
@EXCEPTIONBATCHNAME | nvarchar(60) | IN | Exception batch number |
@CREATECONTROLREPORT | bit | IN | Create control report |
@OVERRIDEBATCHNUMBER | bit | IN | Override |
@USENUMBERINGSCHEME | bit | IN | Use numbering scheme |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_EDIT_BATCHCOMMITRESUMEPARAMETERS
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@CREATEOUTPUTIDSET bit,
@OUTPUTIDSETNAME nvarchar(100),
@OVERWRITEOUTPUTIDSET bit,
@CREATEEXCEPTIONBATCH bit,
@EXCEPTIONBATCHNAME nvarchar(60),
@CREATECONTROLREPORT bit,
@OVERRIDEBATCHNUMBER bit,
@USENUMBERINGSCHEME bit
)
as
set nocount on;
declare @valid bit;
declare @CURRENTDATE datetime = getdate();
begin try
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
if @CREATEOUTPUTIDSET = 1
begin
if dbo.UFN_BUSINESSPROCESS_IDSETCANBECREATED(@OUTPUTIDSETNAME) = 0
raiserror('BBERR_OUTPUTSELECTION_NAMEINUSEWITHQUERY', 13, 1);
if @OVERWRITEOUTPUTIDSET = 0 or @OVERWRITEOUTPUTIDSET is null
begin
if dbo.UFN_BUSINESSPROCESS_IDSETEXISTS(@OUTPUTIDSETNAME) = 1
raiserror('BBERR_OUTPUTSELECTION_NAMEINUSE', 13, 1);
end
end
if (@CREATEEXCEPTIONBATCH = 1) and (@USENUMBERINGSCHEME = 0) and
(@EXCEPTIONBATCHNAME is not null or len(@EXCEPTIONBATCHNAME) > 0) and (@OVERRIDEBATCHNUMBER = 0)
set @EXCEPTIONBATCHNAME = '';
if (@CREATEEXCEPTIONBATCH = 1) and (@EXCEPTIONBATCHNAME is not null) and (len(@EXCEPTIONBATCHNAME) > 0)
begin
declare @BATCHTEMPLATEID uniqueidentifier;
declare @EXCEPTIONBATCHID uniqueidentifier;
select @BATCHTEMPLATEID=dbo.UFN_BATCH_GETBATCHTEMPLATEID(@ID);
select @EXCEPTIONBATCHID = dbo.UFN_BATCH_GETIDBYTEMPLATE(@EXCEPTIONBATCHNAME, @BATCHTEMPLATEID);
if @EXCEPTIONBATCHID is not null and not exists(select ID from dbo.BATCH where ID = @EXCEPTIONBATCHID and ORIGINATINGBATCHID = @ID)
raiserror('BBERR_EXCEPTIONBATCH_NUMBERINUSE', 13, 1);
end
update
dbo.[BATCH]
set
[CREATEOUTPUTIDSET] = @CREATEOUTPUTIDSET,
[OUTPUTIDSETNAME] = @OUTPUTIDSETNAME,
[OVERWRITEOUTPUTIDSET] = @OVERWRITEOUTPUTIDSET,
[CREATEEXCEPTIONBATCH] = @CREATEEXCEPTIONBATCH,
[EXCEPTIONBATCHNAME] = @EXCEPTIONBATCHNAME,
[CREATECONTROLREPORT] = @CREATECONTROLREPORT,
[OVERRIDE] = @OVERRIDEBATCHNUMBER,
[CHANGEDBYID] = @CHANGEAGENTID
where
[ID] = @ID;
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;