SAP Knowledge Base Article - Public

3532524 - Romania eInvoice Issue - Error code: 401 -> Unexpected HTTP Status Code 401 for API action

Symptom

Romania eInvoice error - while submitting the eDocument below error is encountered-

Function EDOC_AIF_GENERIC_ACTION was not executed successfully
Error code: 401 -> Unexpected HTTP Status Code 401 for API action 

Environment

SAP S/4HANA Cloud Public Edition

Reproducing the Issue

  1. eDocument cockpit application
  2. Select the source document
  3. Submit the document
  4. Error occurs

Cause

Configuration - Tax authority regulations

Resolution

  • Romanian Tax Authority recently made a significant change to the OAuth process. Specifically, support for Opaque type bearer tokens has been stopped as of July 1st 2024.
  • To resolve this issue, it needs to generate a JWT (JSON Web Token) type access and refresh token >> next configure these tokens in DRC CE.
    Once completed, submissions should proceed successfully.
  • For detailed instructions on how to generate JWT tokens, refer to page 23 of the PDF titled "OAuth Procedure for Registering Applications on the ANAF Portal".

Keywords

eDocument, EDOC_COCKPIT, Romania, eInvoice, Tax authority, submit button, JWT, Error 401, Unexpected HTTP status code 401 for API action, Function EDOC_AIF_GENERIC_ACTION was not executed successfully  , KBA , CA-GTF-CSC-EDO-RO , DRC: Electronic Document for Romania , Problem

Product

SAP S/4HANA Cloud Public Edition all versions