Generates pain.001.001.03 files.
SELECT * INTO #P27Payment FROM SoftadminUtil.P27_Pain_Payment_Definition();
INSERT #P27Payment
(
InstructionId,
EndToEndId,
Amount,
Currency,
PayDate,
FromIban,
FromBban,
FromBankgiro,
FromBic,
FromName,
FromId,
ToIban,
ToBban,
ToClearingNumber,
ToBankgiro,
ToPlusGiro,
ToName,
InvoiceReference,
OcrReference,
UnstructuredReference,
IsSalary,
ServiceLevelCode,
CategoryPurpose
)
VALUES
(
'InstrId', -- Not mandatory. Only included here because the example file from Handelsbanken had it.
'EndToEndId', -- Mandatory. Basically corresponds to PaymentId in the Bankgiro component. Used for identifying payments in reports (e.g. pain.002 and camt.0054).
100,
'SEK',
CONVERT(date, '2021-10-31'),
'SE1110000000000123456789',
NULL,
NULL,
'HANDSESS', -- If FromIban or FromBban is used.
'TESTCOMPANY', -- Not mandatory.
'123456789', -- "Identification assigned by an institution."
NULL,
'12345678', -- Handelsbanken seems to use national account numbers here and a separate clearing number (in ToClearingNumber) whereas some other banks have all information in BBAN and no separate clearing number.
'1234',
NULL,
NULL,
'TESTCOMPANY', -- Full name of the creditor is mandatory in P27.
NULL, -- Basically corresponds to Reference in the Bankgiro component, but indicates that it contains invoice numbers.
NULL, -- Basically corresponds to Reference in the Bankgiro component, but indicates that it contains OCR numbers. Will be validated as OCR by the bank.
N'123456', -- Basically corresponds to BankAccountText in the Bankgiro component.
NULL,
'NURG', -- Always 'NURG' for Handelsbanken.
'SUPP' -- Always 'SUPP' for Handelsbanken unless it is a salary payment (where the procedure will automatically use 'SALA').
),
(
'InstrId',
'EndToEndId',
100,
'EUR',
CONVERT(date, '2021-10-31'),
'SE1110000000000123456789',
NULL,
NULL,
'HANDSESS',
'TESTCOMPANY',
'123456789',
NULL,
'12345678',
'1234',
NULL,
NULL,
'TESTCOMPANY',
NULL,
NULL,
N'123456',
NULL,
'NURG',
'SUPP'
);
DECLARE
@Varbinary varbinary(MAX),
@Xml xml,
@ErrorMessage nvarchar(MAX);
EXEC SoftadminUtil.P27_Pain_001_001_03_Generate
@MessageId = 'Exempel Kontoinsättning', -- This id is for the whole file and is referenced in e.g. pain.002 files.
@InitiatorId = '123456789', -- Handelsbanken: "Business organisation number or SHB number"
@CreationDatetime = '2021-10-18T00:00:00', -- The procedure uses the current date/time if the parameter is omitted. The parameter can be used if a specific date/time is required, e.g. for testing.
@OutputAsXml = 1, -- If 1, the file will be returned as xml in @XmlOut, which can be useful for troubleshooting. If 0 or if the parameter is omitted, the file will be returned as varbinary(max) with correct encoding and xml header for UTF-8.
@VarbinaryOut = @Varbinary OUTPUT,
@XmlOut = @Xml OUTPUT,
@ErrorMessageOut = @ErrorMessage OUTPUT;