SAPBR Technologies home

SAP in Brazil, explained

How to find the missing CFOP rule entry?

Creating a sales order, posting an invoice in MIRO or generating a Nota Fiscal, you may get an error like:

  • 8B115 - It is not possible to determine the CFOP automatically
  • 8B569 - CFOP not found for item XYZ in sales order XYZ

It means SAP couldn’t determine the CFOP (Código Fiscal de Operações e Prestações) because configuration entries are missing.

Missing piece illustration

These errors usually come from incomplete or missing entries in the CFOP determination tables:

  • J_1BAON: incoming goods and returns
  • J_1BAPN: outgoing goods and returns

How to find what’s missing

If you can’t tell which combination causes the error, debug the CFOP determination by setting a breakpoint in the function for the direction (incoming or outgoing).

1. Outgoing (sales, deliveries, returns)

Outgoing operations use function J_1B_NF_CFOP_2_DETERMINATION.

  1. Go to transaction SE37.
  2. Enter function J_1B_NF_CFOP_2_DETERMINATION.
  3. Set a breakpoint at the line READ TABLE it_bapn INTO wbapn WITH KEY ...:
..
* The concept with generic read was abandoned. Only the exact version
* is used!
*  do 2 times.
***** select with all parameters
  READ TABLE it_bapn INTO wbapn WITH KEY
                   direct = cfop_parameters-direct
                   dstcat = cfop_parameters-dstcat
                   indus3 = cfop_parameters-indus3
                   itmtyp = cfop_parameters-itmtyp
                   spcsto = cfop_parameters-spcsto
                   ownpro = cfop_parameters-ownpro
                   matuse = cfop_parameters-matuse
                   indus1 = cfop_parameters-indus1
                   origin = space
                   version = i_version.
...

  1. Run your process (for example, create the sales order or billing document).
  2. At the breakpoint, check structure cfop_parameters and note these fields:
FieldDescription
directMovement direction (5 = outgoing)
dstcatCustomer CFOP category
indus3NF item special case (e.g., ST/ISS)
itmtypNF item type
spcstoProduced in-house indicator
ownproOwn production flag
matuseMaterial usage
indus1Material CFOP category
i_versionCFOP version

These values are the exact keys you need to maintain in table J_1BAPN for the CFOP to be found.

2. Incoming (purchases, subcontracting, returns)

Incoming operations use function J_1B_NF_CFOP_1_DETERMINATION.

  1. Go to transaction SE37.
  2. Enter function J_1B_NF_CFOP_1_DETERMINATION.
  3. Set a breakpoint at the line PERFORM read_cfop USING cfop_parameters-direct ...:
...
*-------------------------------------------------------
*---> Read CFOP with version of the region
*-------------------------------------------------------
*--- access with all key fields
PERFORM read_cfop USING cfop_parameters-direct
cfop_parameters-dstcat
cfop_parameters-indus3
cfop_parameters-itmtyp
cfop_parameters-spcsto
cfop_parameters-matuse
cfop_parameters-indus2
lv_version
CHANGING cfop.
...

  1. Run your incoming process (for example, MIRO or MIGO).
  2. At the breakpoint, check structure cfop_parameters and note these fields:
FieldDescription
directMovement direction (1–3 = incoming)
dstcatVendor CFOP category
indus3NF item special case
itmtypNF item type
spcstoProduced in-house indicator
matuseMaterial usage
indus2Material CFOP category

These are the values to maintain in table J_1BAON to complete the CFOP configuration.

Note: this reflects SAP’s behavior at the time of publication. Legal and system updates may change the process.

Comments

Leave a Reply