cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Creating Custom Post-processing of the Output Payment File- SAP S4 HANA PUBLIC CLOUD(ABAP CLOUD)

RameshYekambram
Newcomer
0 Likes
511

Hi All,

We are currently implementing custom post-processing logic for the output payment file generation.
However, we're facing an issue when a single payment includes multiple invoices.

The behavior we're experiencing is:

Three separate output files are being generated.

File 1 includes details of only the first invoice.

File 2 includes the first and second invoices.

File 3 includes all three invoices.

Our objective is to generate a single output file that contains all invoices related to the payment.

We have attempted debugging the process, but the BAdI (Business Add-In) we’re using is not getting triggered during this execution, even though the output files are being generated.

Has anyone encountered this issue before or have any insight on:

Why the BAdI might not be triggered?

How we can ensure that all invoice details are captured once in a single output file?

We referred the below link to Creating Custom Post-processing of the Output Payment File:

https://learning.sap.com/learning-journeys/exploring-localization-as-a-self-service-with-sap-s-4hana...

Any guidance or suggestions would be greatly appreciated.

Thanks in advance!

Accepted Solutions (0)

Answers (2)

Answers (2)

Lakshmipathi
SAP Champion
SAP Champion
0 Likes


To the question, why multiple files are being generated, this usually happens when:

  • the output determination logic is triggered per invoice, not per payment.
    the BAdI implementation is scoped to the invoice level, causing it to execute multiple times.
    the system accumulates invoice data across runs, generating separate files with overlapping content.

Here are common causes as to why the BAdI not triggered

1. Wrong BAdI Implementation Point
Ensure you're using the correct BAdI for post-processing:

For payment media output, the relevant BAdIs are typically:

  • FIBL_PAYMEDIUM_X (for classic payment medium programs)
  • BADI_FPAYMEDIUM (for payment medium workbench)
  • BADI_PAYM_OUTPUT (for newer output control framework)

If you're using Output Management (BRF+ based) in S/4HANA Cloud, the BAdI should be BADI_PAYM_OUTPUT_POSTPROCESSING. If this BAdI isn’t triggered, check whether your output type is correctly assigned to the payment method and whether the output determination is set to “Send Immediately.”

2. Output Triggered at Invoice Level
If the output is being triggered per invoice, the BAdI won’t consolidate all invoices into one file. You need to:

  • Ensure the output is triggered at the payment document level (FPAYH), not FPAYHX or FPAYP.
  • Use grouping logic in your BAdI to collect all invoices tied to the payment run.

Follow the below process so that you will get answer to the question "How to ensure a single output file per Payment

A. Group Invoices in BAdI Logic
In your BAdI implementation use the payment run ID or payment document number to group all related invoices. Accumulate invoice data in an internal table. Generate the output file only once per payment document.

B. Use BRF+ Output Control
If you're using SAP S/4HANA Output Management, configure BRF+ rules to trigger output only once per payment document. Avoid multiple output triggers for each invoice.

C. Check Output Parameter Settings
In the Manage Output Parameter Determination app ensure the output type is set to trigger once per payment. Avoid using invoice-specific conditions unless absolutely necessary.

Finally, the link you referred to is part of SAP’s Localization Self-Service Learning Journey, which focuses on customizing output formats. However, it doesn’t cover the execution logic or BAdI behavior in depth. For that, you’ll want to explore:

Payment Medium Workbench 

This page explains:

  • How PMW replaces classic RFFO* programs
  • Configuration steps for payment formats
  • Integration with DME administration
  • Output logs and payment advice generation

Creating Payment Media 

This guide walks through:

  • How to use PMW during payment runs
  • Format-specific mapping and output logic
  • How payment advice notes are generated alongside payment files

 

Chris1973
Active Contributor
0 Likes

Hi @RameshYekambram 

Thank you for your question. I hope this still provides some help.

Here is how this works and why you see the issue:

  1. Why multiple files are generated

In S/4HANA Public Cloud, the payment medium workbench generates one output file per payment order.

  • If multiple invoices are bundled into one payment, the system should generate a single file with all items.
  • The behaviour you describe indicates that the file merge happens incrementally and your custom logic is being applied on each iteration instead of once at the end.
  1. Here is why the BAdI is not triggered
  • The BAdI you are using is likely not the correct enhancement spot for post-processing of payment files. In Public Cloud, the relevant enhancement is:
    • BAdI FI_PAYMEDIUM_POSTPROCESS --> Postprocessing of Payment Medium File. This is available in Custom Logic app.
  • If you used a different BAdI for exammple during payment proposal or payment order creation, it will not be triggered at the final output file generation stage.
  1. The correct approach to capture all invoices in one file is to
  • Make use of BAdI FI_PAYMEDIUM_POSTPROCESS. This has been released for S/4HANA Cloud.
  • This BAdI is triggered after the payment file is generated and it receives the entire payment file content. Inside your implementation, you have the possibility to:
    • Access all invoices belonging to the payment.
    • Perform final formatting or concatenation.
    • Ensure that only one file per payment order is produced, with all invoices included.
  1. Here are few checklists you should go through
  • Go to Custom Logic app --> search for enhancement FI_PAYMEDIUM_POSTPROCESS.
  • Implement your logic here and not in earlier BAdIs.
  • Test with a payment run including multiple invoices.
  • Verify that the BAdI executes once per file and contains all items.

The references provide more details:

I am happy to help if you have further questions.

Best regards

Chris