This text is not mine. It belongs to Renan Correa and it was posted at the SPED and NFe SCN Blog:

Unfortunately the SCN Blog above is in Portuguese and the text below is good enough to be missed. I am translating it to English.

All the credits to the text below go to Renan ( and the SAP Localization team. I am only translating it to English and posting it in my blog.

XML Tag not mapped correctly

How to start the analysis?

It is suggested to start from function J_1B_NF_MAP_TO_XML where it is the begin of the information mapping to the structures that will be sent to the NFe Message system (SAP NFe).

What to check?

Into the function J_1B_NF_MAP_TO_XML the ERP tables information are read and it is made a preliminary mapping where it will populate the xml structure data (xmlh for header and xmli for item).

The hint to check the issue is to create a breakpoint at the statement “RFC”. When executing the program with this breakpoint, this will bring the function /XNFE/OUTNFE_CREATE.

At this point it is required to check if the tables/structures GT_RFC* and GS_RFC* are populated with the required data or not. If the information is correct at this point, then the issue is in the data mapping at the SAP NFe. If the information is not fulfilled or incorrect, then the issue is in the mapping of the data in the SAP ERP.


To the 3.10 layout specifically, the final data mapping runs into the perform call_message_system_comm where the xml* structure data xml* are mapped to the GT_RFC* and GS_RFC* which will be sent to SAP NFe.


In the end of the perfom call_message_system_comm there is a call to SAP NFe  at the function /XNFE/OUTNFE_CREATE.


The suggestion to identify to identify where a field is fulfilled on SAP ERP is to use the  search “in main program” using the XML Tag ( or field/structure from SAP ERP) and then display the code line where the information is fulfilled.


There are basically 3 ways to fulfill an information on SAP ERP Structures:

1 – From tables J_1BNF* and Master Data

2 – Execution Time Calculation from Tables

3 – BadI’s

In the screenshots below, you will see respectively the code point where the header and item methods are called:




In the end of the program processing, it will run the SAP NFE call using the function /xnfe/outnfe_create according to the screenshot below:


In the SAP Nfe, the program will get the data from SAP ERP and it will pass to the technical validation in the function /xnfe/outvalidation and if everything is technically ok, then the program will pass to the function /xnfe/outnfe_transform where the proxy structures are fulfilled as per screenshots below:


At the form fill_proxy_structure the program will check what was sent from SAP ERP and map the relevant fields according to the XML hierarchy information and this will be converted to the XML format by the proxy in the following step:


That’s all for today, and don’t forget, all the credit to Renan Correa and the SAP Brasil Localization Team putting all those details together…


Copyright Notice: © Leandro da Pia Nascimento and SAPBR.COM (SAP BRAZIL) WordPress Blog. Unauthorized use and/or duplication of this material without express and written permission from this blog’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Leandro da Pia Nascimento and SAPBR.COM with appropriate and specific direction to the original content.