Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
Jigang_Zhang张吉刚
Active Contributor
The Nota Fiscal Eletrônica (NF-e) is the electronic invoice solution for Brazil, it's a big topic that involves lots of SAP note implementation. In this article just want to talk about one small issue which is NFe Invoice header text does not sync with Electronic Fiscal Document or XML format File when send to the external system.



1. Symptoms of this issue


The whole issue looks like as below:

  1. There're have 5 lines of header text maintained by the user for one delivery document;

  2. The header text has been brought from delivery to Billing correctly when creating the invoice document by VF01; There're still 5 lines of header text if fetched from the invoice header using FM read_text.

  3. Carry on the NFe processing and check the following NFe document by J1B3N, then will find only 4 lines have been displayed at Message TAB;

  4. There're only 4 lines at table J_1BNFFTX(Nota Fiscal header message) as well;

  5. The same missing happened for generated XML file when send to the external system.


As the 5th header text line already disappear before send out from SAP, it should be an issue inside SAP and not related to the interface or 3rd party software. Before checking, I thought it was caused by some enhancement like rv60afzz at SAPLV60A during the SAVE event for VF01 or maybe some customized logic specific for NFe processing when transferring text lines.

2. Possible relevant SAP Notes



  • 2941006 - Brazil Nota Fiscal Eletrônica (NFe) Troubleshooting Guide


E23 - Nota Fiscal inconsistency in tables J_1BNF*: After creating a fiscal document, in case the table J_1BNFDOC, or J_1BNFLIN, or J_1BNFSTX, or J_1BNFFTX don't have any entries related to the created document, review your custom code, user exits or CL_NFE_PRINT. Since at the standard code the whole process is commited with a single transactional object (LUW), this object will have all infomation about all tables used in the process. Possible solutions are manually fixing the documents directly in the database using transaction SE16 or creating a custom program to change the documents accordingly.


  • 2400284 - Nota Fiscal inconsistent in some J_1BNF tables


In case you are using decouple, all analyses performed by SAP have shown that 100% of the time this problem is caused by a custom code:

  1. Possibly a faulty code within a user exit (with a 'COMMIT WORK' statement, for example)

  2. CL_NFE_PRINT code that can be saving other tables and, consequently commit the current system situation to the database

  3. In the standard code, there's no possibility of leaving one table behind while saving a Nota Fiscal document.

  4. SAP does not have an out-of-the-box program or report to correct tables that are without information because each situation is different depending on the scenario.




  • 2936132 - Error in Header Text from Delivery - Nota Fiscal Document



Considerer the following scenario:




  • You are executing the STO scenario.

  • You are logged in your system in EN (English) language.

  • During the posting of the outbound delivery, you add a header text in PT (Portuguese).

  • You post the outbound delivery and generate the material document 862 and the nota fiscal.


The text you entered in the outbound delivery is not transfered to the nota fiscal document. When generating the XML, since the text is not saved in the Nota Fiscal, the text is also not transfered to the XML.

To implement the solution, you must implement the correction instructions.


  • 1237796 - NF-e: Text reference info not in BADI method FILL_HEADER


This note is only relevant for Brazil.
Note 1079826 and 1180402 are required. IN_REFER parameter includes the links of the messages to the Nota Fiscal item via the field SEQNUM. Entries passed via parameter IN_TEXT in method FILL_HEADER which have no entries in IN_REFER for field SEQNUM are header messages.

All the above-mentioned Notes do not suit my case previously, it's neither missing all the header text at J_1BNFFTX(only missing line number larger than 4) nor custom code at BADI CL_NFE_PRINT as we've no customized logic for messages inside method FILL_ITEM and FILL_HEADER.



3. The root of the issue


The functional team sends me a few pages of a document about NFe processing just for an overview. It looks quite complex, I thought will cost half a day or even more to understand how the data has been transferred from SD to FI and NFe. But it's very straight-forward after checking the below logic at FM: READ_TEXT_INLINE:


All the header text lines if its line number is greater than this value INLINE_COUNT, then it will be skipped directly! And this INLINE_COUNT comes from J_1B_SD_BI_SPLIT_NEW_DOC:


Then everything is clear now, how many lines of header text will be transferred from billing to NFe is controlled by document type with field TVFK-J_1BTDCOH(Number of text lines header).



4. About J_1BTDCOH (Number of text lines header)


I'm surprised to find that this field which domain J_1BTDCO only supports up to 4 only!


I get nothing from the service support of SAP by searching J_1BTDCO. There's one discussion about this field that mentioned:

Unfortunately not, the only response I got was that SAP is working as scheduled to do so. Here is information from SAP:
The system is working as designed.
We support only 4 lines in the header text of NF.
So, header texts from referenced documents, e.g. sales orders, that have more than 4 lines will not be fully copied to NF.
Based on this explanation, this is not considered a bug, but a system improvement.

If you want this improvement in the system. We can offer you two options to address your issue:
1. Open a new request on SAP Idea Place. Check the links: https://ideas.sap.com/ https://cw.sdn.sap.com/cw/community/ideas/brazil/nfe
2. Submit your request to Asug
3. Request a new development together with SAP GPM (Global Product Management) Area from Globalization Services.
Keep in mind that it will be only a request that will be analyzed by SAP, so it is not a guarantee that it will be developed.
Since we are not dealing with a bug, I kindly ask you to close/confirm this incident

Best regards,
Henrique Schorr
SAP Product Support
SAP Support Contact details: see note 560499

 
1 Comment