SAPBR Technologies home

SAP in Brazil, explained

TDF – DF-e Persistence BAdI

Editor’s note (November 2026): SAP Tax Declaration Framework (TDF) is deprecated. This post is kept for reference.

This post follows on from SAP TDF: Where to start from?

Thanks again to my friend Karen Rodrigues for letting me translate her SCN post here. If you find it useful, please take a moment to give it 5 stars: TDF – Persistência de DF-e

From here on, this is a full translation of her post.

You may have heard of BAdI J_1BNF_ADD_DATA, also called the “new BAdI”. Not yet? Or you know it exists but not how it differs? The new BAdI is a prerequisite if you’re thinking about moving to SAP TDF.

Illustration
Source: SAP

I hope this post clears things up and motivates you to implement it at your company or your customers.

First, what’s the difference between the new BAdI and the classic one (CL_NFE_PRINT~FILL_HEADER and FILL_ITEM)?

The first difference is data persistence. When you change data at NF-e creation through the classic BAdI CL_NFE_PRINT, the changes are stored only in the XML. They aren’t written back to the NF-e document in SAP ERP, which is a big problem. If you send ERP data to another system (for example, a fiscal bolt-on that produces SPED), you have to rebuild the same logic in that interface.

With the new BAdI, changes made to the XML are written back to ERP. That makes interfacing with other systems much easier and reduces differences between what you see in J1B3N and the XML generated.

It also helps avoid fines in a tax audit when reported data doesn’t match stored data, or data is missing.

The other difference is when the BAdI is called. The new BAdI runs when the document is posted, not when it’s sent to the messaging system. So you can run validation rules before the document gets a number or is sent to the messaging system.

Flow before persistence

SAP screen: Flow before persistence
Source: SAP

Flow after persistence

SAP screen: Flow after persistence
Source: SAP

Another important difference: not every field you can change with the classic BAdI is available in the new one. Be careful when migrating. If you need a field that isn’t available because of an SAP gap, open an incident with SAP. Otherwise, review the process.

The new BAdI also adds new fields and views to J1B1N. Some screenshots:

SAP screen: Flow after persistence
SAP screen: Flow after persistence
SAP screen: Flow after persistence
SAP screen: Flow after persistence
Source: SAP

Frequently asked questions

Do I need an SAP TDF license to implement the new BAdI?

No. The new BAdI is covered by the SAP ERP license and doesn’t depend on a TDF license.

Is the new BAdI a prerequisite for SAP TDF?

Yes. Implement it well before moving to TDF. Treat it as SAP best practice.

Do I need the OSS Notes for the master data enhancements (new fields)?

Yes, they’re recommended.

Besides the master data enhancements, are there other prerequisites?

Yes. You need to implement the new screen control for NF documents.

If I activate the new BAdI, will the classic BAdI stop working?

That was the original behavior, but SAP released an OSS Note that lets you move to the new BAdI in phases. More in this post (in Portuguese): Utilização de ambas as BAdIs de NF-e (J1BNFADDDATA e CLNFEPRINT)

Is the new BAdI available in all SAP versions?

No. Only ECC 6.0 EhP 5 or higher.

What are the main OSS Notes?

NoteTitle
1844619NF-e: Storing Additional Data – BAdI, derived fields, texts
1844621NF-e: Storing Additional Data – Obj.Services & NF Writer
1860433NF-e: Storing Additional Data for DANFE & Reporting
1860360NF-e: Storing Additional Data – application generated NFs
1860362NF-e: Storing Additional Data – outbound NF-e & Reports
1869063NF-e: send obsCont, obsFisco, procRef to GRC
1865657NF-e: Update MM/FI with NF-e number – Credit Memos
1889990NF-e: Update MM/FI with NF-e number – Credit Memos
1803009Renewal of Screen Controls in Nota Fiscal Writer
1877404NF-e: Enhancements NF Writer screen controls
1859126NF-e: Storing Additional Data – Enhancement of NF Writer
1882947NF-e: Storing Additional Data – Corrections for NF Writer
1923423Nota Fiscal: only two tax lines are displayed on the tax screen
1951532Nota Fiscal: scroll through items not consistent

In conclusion

The new BAdI is easy to justify. It brings the data back to the source (ECC) exactly as it was reported to SEFAZ, and it cuts maintenance on interfaces with external systems.

Karen Rodrigues

Comments

One response to “TDF – DF-e Persistence BAdI”

  1. SAP TDF – Where to start from? | SAP BRAZIL Avatar

    […] ← Calculation and Results: NT2015.003, EC87/15, ICMS Partition, Poverty Fund TDF – Persistencia de DF-e → […]

    Like

Leave a Reply