Fehler BIC statt BICFI <|channel|>analysis<|message|>Need similar but pain.008.001.08 schema differences: maybe additional fields like MaxPayeeAccount, CreditorAgent? Provide VB6 code generating that.<|end|> <|start|>assistant<|channel|>final<|message|>Below is a **complete, self‑contained VB 6 module** that builds an example SEPA “pain.008.001.08” (Credit Transfer Initiation – newer version). It contains the most common elements you’ll need: * Message header (`GrpHdr`) – global information about the file * Payment information block (`PmtInf`) – one or more payment groups * Credit transfer transaction (`CdtTrfTxInf`) – each individual transfer * Structured remittance information (`RmtInf/Strd`) – optional but useful Just copy‑paste the module into a new VB 6 project (or add it to an existing one). After compiling and running, you’ll find a file named **`pain008_108_example.xml`** in the same folder as the executable. --- ## 1. The Code ```vb ' -------------------------------------------------------------------- ' Module: SEPA_Pain008_108_Builder ' Purpose: Creates a simple pain.008.001.08 (SEPA Credit Transfer Initiation) ' XML document and writes it to disk. ' ' Author : ChatGPT / OpenAI ' Date : 2025‑08‑22 ' -------------------------------------------------------------------- Option Explicit ' ------------------------------------------------------------ ' Public entry point – call this from Form_Load or any button ' ------------------------------------------------------------ Public Sub BuildAndSavePain008_108() Dim xmlString As String ' 1. Build the XML as a string xmlString = CreatePain008_108XML() ' 2. Write it to disk (current folder) Dim filePath As String filePath = App.Path & "\pain008_108_example.xml" If SaveTextToFile(filePath, xmlString) Then MsgBox "SEPA pain.008.001.08 file created:" & vbCrLf & filePath, vbInformation Else MsgBox "Failed to write SEPA file.", vbCritical End If End Sub ' -------------------------------------------------------------------- ' CreatePain008_108XML – builds the XML document in a single string. ' -------------------------------------------------------------------- Private Function CreatePain008_108XML() As String Dim s As String ' 1. XML header + root element with namespaces (taken from pain.008.001.08 schema) s = "" s = s & vbCrLf & _ "" ' 2. Group Header (GrpHdr) s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " MSG-001-08" ' unique message id s = s & vbCrLf & " " & Format(Now, "yyyy-MM-ddTHH:mm:ss") & "" s = s & vbCrLf & " 3" ' number of transactions s = s & vbCrLf & " 3000.00" ' total amount (sum of all) ' -- Initiating Party (who sends the file) -- s = s & vbCrLf & " " s = s & vbCrLf & " Acme Corp Ltd." s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " 123456789" s = s & vbCrLf & " SEPA" s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " " ' 3. Payment Information Block – one block for all payments (you can add more) s = s & vbCrLf & " " s = s & vbCrLf & " PMT-001-08" s = s & vbCrLf & " TRF" ' Transfer s = s & vbCrLf & " false" s = s & vbCrLf & " 3" s = s & vbCrLf & " 3000.00" ' -- Payment Method details (SEPA Credit Transfer) -- s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " SEPA" s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " CORE" s = s & vbCrLf & " " s = s & vbCrLf & " FRST" ' First transfer s = s & vbCrLf & " " ' -- Creditor Agent (the bank that will receive the payment) -- s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " DEUTDEFFXXX" ' Example BIC s = s & vbCrLf & " " s = s & vbCrLf & " " ' -- Creditor (the beneficiary) -- s = s & vbCrLf & " " s = s & vbCrLf & " John Doe" s = s & vbCrLf & " " ' -- Creditor Account (IBAN) -- s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " DE89370400440532013000" s = s & vbCrLf & " " s = s & vbCrLf & " " ' -- Payment Identification (Reference) -- s = s & vbCrLf & " " s = s & vbCrLf & " INSTR-001-08" s = s & vbCrLf & " E2E-1234567890-08" s = s & vbCrLf & " " ' ---------------------------------------------------------------- ' Credit Transfer Transaction – first payment (1500 EUR) ' ---------------------------------------------------------------- s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " 1500.00" s = s & vbCrLf & " " ' Structured Remittance Information (optional) s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " INV" s = vBCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " INV-2025-001" s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " " ' ---------------------------------------------------------------- ' Credit Transfer Transaction – second payment (1000 EUR) ' ---------------------------------------------------------------- s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " 1000.00" s = s & vbCrLf & " " ' Structured Remittance Information (optional) s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " INV" s = vBCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " INV-2025-002" s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " " ' ---------------------------------------------------------------- ' Credit Transfer Transaction – third payment (500 EUR) ' ---------------------------------------------------------------- s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " 500.00" s = s & vbCrLf & " " ' Structured Remittance Information (optional) s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " INV" s = vBCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " INV-2025-003" s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " " s = s & vbCrLf & " " ' Close Payment Information Block s = s & vbCrLf & " " ' Close Customer Credit Transfer Initiation and root Document element s = s & vbCrLf & " " s = s & vbCrLf & "" CreatePain008_108XML = s End Function ' -------------------------------------------------------------------- ' SaveTextToFile – helper to write a string into a file. ' Returns True on success, False otherwise. ' -------------------------------------------------------------------- Private Function SaveTextToFile(ByVal FileName As String, ByVal TextData As String) As Boolean On Error GoTo ErrHandler Dim fso As Object Set fso = CreateObject("Scripting.FileSystemObject") Dim ts As Object Set ts = fso.CreateTextFile(FileName, True, False) ' overwrite, ASCII ts.Write TextData ts.Close SaveTextToFile = True Exit Function ErrHandler: SaveTextToFile = False End Function ``` --- ## 2. How to Use It 1. **Create a new VB 6 project** (Standard EXE or ActiveX DLL). 2. Add a **module** (`Insert → Module`) and paste the code above. 3. In `Form_Load` (or any button click event), call: ```vb Private Sub Form_Load() BuildAndSavePain008_108 End Sub ``` 4. Compile & run – you’ll get `pain008_108_example.xml`. --- ## 3. What the XML Looks Like Here’s a **compact preview** of what the file contains (formatted for readability): ```xml MSG-001-08 2025-08-22T13:45:12 3 3000.00 Acme Corp Ltd. 123456789SEPA PMT-001-08 TRF false 3 3000.00 SEPA CORE FRST DEUTDEFFXXX John Doe DE89370400440532013000 INSTR-001-08E2E-1234567890-08