Skip to Content
Product Information
Author's profile photo Zaheer DAWZI

SAP ERP Solution unit onboarding guide for e-Invoicing in KSA

Preface

As part of the phase 2 e-Invoicing process, The Zakat, Tax and Custom Authority (ZATCA) requires its taxpayers to onboard their Electronic Invoice Generation Solutions onto the ZATCA’s e-Invoicing portal.

In the solution for onboarding, we have systemized and simplified this process for our on-premise and cloud-based customers. Following is the stepwise representation of the onboarding process to be followed in SAP ECC, SAP S/4HANA on premise and SAP S/4HANA cloud.

High level Process Steps

The following process step diagram represents the high-level process sequence that is followed for onboarding the taxpayer’s solution ID.

Definitions

eInvoice generating solution unit (EGS)

This is a unique GUID of the taxpayers eInvoice generating solution. Taxpayers can consider one system as EGS or could also consider multiple logical separations within one physical system that generates the eDocuments and each of such separations is also called as EGS. In our solution, we consider the following parameters to create multiple unique logical units within one physical ERP unit to uniquely create a EGS unit.

  • Company code
  • Source type
  • Invoice type

Every EGS needs to be onboarded with ZATCA to submit the eDocuments generated in its logical unit and each EGS will have its own Invoice counter value (ICV).

 Table showing the different combinations possible for the creation of EGS in a company code.

 

Company code

Organizational unit for accounting.

Source type

This defines the source module in which the source document of an eDocument is created. For example, the source of SD billing document is SD_INVOICE (Billing Document) and for an invoice created directly in FI is FI_INVOICE (Accounting Document). For self-billing invoice, the source type is INV_VERIF (Invoice Verification – self billing).

Invoice type

These are the two broad classification of eDocuments as per ZATCA, i.e., Standard tax invoice and simplified tax invoice.

Compliance CSID (CCSID)

This is a cryptographic stamp identifier that is provided by ZATCA for only for performing the compliance checks.

Production CSID (CSID)

This is a CSID provided by ZATCA upon request after compliance checks are successfully completed. Every EGS unit has one unique production CSID. This is like your boarding pass of your flight journey 🙂. once you have received this it means you are good to kick off with the document submission to ZATCA.

Process Flowchart

Following is the detailed process flowchart that is defined in the solution for the onboarding process.

Onboarding programs in the solution

Following onboarding programs are built to manage the complete taxpayer onboarding process.

 

Transaction name Transaction code
Generate Solution Unit ID SAEGSG
Manage Solution Unit ID SAEGSM
Generate Cryptographic Stamp Id. SACSIDG

 

Generate Solution Unit ID

With this transaction, you can generate unique EGS units. As defined above, we have prefixed the parameters for which unique EGS units can be generated.

In this report, you will by default see all the possible combinations for the selected company codes for which you can generate the EGS unit ID by simply selecting the records and clicking on Generate solution ID button. depending on your business scenario, you need to select only the applicable combinations and create the EGS.

For multiple company codes selected in the selection screen of this report, you also can select the leading company code among them. In case a leading company code exists, the parameter value company name is copied from the leading company code. Please maintain in this company code, the organization name registered with ZATCA.

Manage Solution Unit ID

With this transaction, currently you can delete incorrectly created EGS units for which CCSID is not yet assigned by ZATCA. i.e., for example, you incorrectly selected an unnecessary entry in the generate solution ID report for which you already created the EGS GUID and later when you consider not to proceed with further steps and create a CCSID so you can delete this EGS unit ID in this transaction and create the correct one if required using Generate Solution Unit ID report.

 

Generate Cryptographic Stamp Id.

With this transaction, you can manage all the remaining onboarding process. i.e., further to the creation of the EGS unit GUID, as a next step you need to create the compliance CSID to perform the compliance checks.

The following functions that can be performed in this transaction are explained in its sequence of occurrence.

  • Request CCSID
  • Check Compliance
  • Request CSID

 Request CCSID:

For the selected EGS unit in this report you can click on the request CCSID button to request the Compliance Cryptographic stamp identifier from ZATCA. This step is a prerequisite to perform the compliance check.

Immediately after you click on the Request CSID button, you will be asked to enter the OTP that is generated from ZATCA ERD portal. The OTP needs to be manually generated by the taxpayer and the same needs to be entered in this report.

This report will then request ZATCA for the compliance CSID by sending the CSR generated with reference to the selected EGS unit through the API /compliance. The status of the EGS unit will then be updated with the status code “CCSID_REC – CCSID is received”

 

Check Compliance

As part of the onboarding process, the taxpayer needs to check for the compliance of the document types in the ZATCA Fatoora portal before it can start submitting the eDocuments to the Fatoora platform. This report facilitates in doing this function with the click of the button “Check Compliance” in this report.

When you click it, the system sends the sample static eDocument of the relevant invoice type for which the EGS unit is generated to ZATCA through Compliance check API /compliance/invoices and checks the compliance of the same. When the check is successful, the API returns the response code 200 upon successful check and returns the CCSID that can be used only for compliance checks.

In case of errors, this API returns the response code 400 when the entered OTP is wrong or if the subject compliant document submitted is not as per ZATCA standards. It returns response code 500 when the service at ZATCA end has any internal server error.

Further to receiving the response from ZATCA, this report allows to perform the next step in the process.

If the response code is 200, The status of the EGS unit is then updated with the status code “CCSID_COMP – CCSID Compliance check is completed

 

Request CSID

This functionality in the report will request with ZATCA for the production CSID that needs to be used to interface the production documents with ZATCA’s Fatoora portal.

This button calls the API /production/csids and in return captures the CSID returned by ZATCA.

The status of the EGS unit will then be updated with the status code “CSID_REC – CSID is received”.

 

Deactivation of EGS

After you have successfully received the CCSID and the CSID and you then unfortunately have to change your company VAT number because you either previously maintained incorrect VAT number or you have received a new VAT number (though does not happen so often Smile ), you will have to deactivate all the active EGS units per company code and only then you will be able to create new EGS units with the updated VAT number and onboard the same.

This functionality of deactivation of the existing active EGS units is available in the manage solution unit ID (SAEGSM) report.

Deactivation is an irreversible function. so please be mindful about it.

Note:

Before deactivating an existing active EGS unit, please ensure the below.

  1. You manually deactivated the CSID in ZATCA’s Fatoora portal. Deactivation of the EGS in SAP does not automatically deactivate the CSID in ZATCA’s system.
  2. Once you deactivate an EGS, you will not be able to submit the unprocessed eDocuments pertaining to such EGS. So, you process (submit or cancel) all the unprocessed eDocuments which have the same VAT number of the EGS you wish to deactivate.

Implement SAP note: 3258406 & 3269459 to activate this feature.

Set the Effective start date

ZATCA informs its taxpayers at least 6 months in advance to kickstart the submission of the eDocuments to comply with the phase 2 regulation.

In our solution, we have provided a configuration to set this start date of eDocuments submission as effective start date of the integration for each relevant company code defined for KSA.

With this setting, the eDocument cockpit understands that the company code is ready to start the document submission from this date and stops the creation of eDocuments in the generation phase and starts creating them in the integration phase for the source documents created from and after this effective date. This from regulation perspective means that until this date, the taxpayer will remain in phase 1 i.e., generation phase.

Please ensure that SAP note 3236978 is implemented in your system to set the effective date.

Note:

Maintaining the effective start date is a prerequisite to start the document submission.

 

Customizing path

Cross-Application Components > General Application Functions > Document and Reporting Compliance > Country/Region-Specific Settings > Saudi Arabia – Maintain Effective Date of Integration with Tax Authority

Considerations to update the effective start date:

 

Process diagram showing key considerations in updating the effective date.

  • Update of the effective date to a historical date is not allowed.
  • Update of the effective date to a future date is allowed only in the below case.
  • If the current date < the existing/new effective date in the system, then any future date from the current date can be maintained.
  • If the current date >= the existing effective date in the system and no eDocuments are created under the new submission process, then any future date from the current date can be maintained.

That is all about onboarding. now you are all set to start submitting the documents to ZATCA.

I hope this blog is very informative. Please share your feedback and questions.

Other blogs on KSA eInvoicing

Master data mapping in KSA eInvoicing solution | SAP Blogs

Handling Intercompany transactions in KSA eInvoicing | SAP Blogs

Some useful links

Note: For accessing the last three links listed above you need to login to MENA Localization SIG – Overview (sapjam.com)

Assigned Tags

      16 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Mahmoud Abdulwahab
      Mahmoud Abdulwahab

      Dear Zaheer ,

       

      Thank you for your helpful detailed post .

      I have maintained all steps till compliance check successfully then faced an error during request CSID

      E:EDOCUMENT_SA:000 The public key of the CA Reply is different from t

      Message no. EDOCUMENT_SA000

      SAP_REQUEST_CSID

       

      SAP_REQUEST_CSID

      Author's profile photo Zaheer DAWZI
      Zaheer DAWZI
      Blog Post Author

      Dear AbdulWahab,

      Please raise a support ticket in the software component : CA-GTF-CSC-EDO-SA with the error screenshots.

       

      Regards,

      zaheer

      Author's profile photo Firoz Ashraf
      Firoz Ashraf

      Dear Abdulwahab,

      How did you solve this?

       

      Regards,

      Firoz Ashraf

      Author's profile photo Naresh Kumar S
      Naresh Kumar S

      Hi Zaheer,

      Great Document!!

      Can we known, what all the changes need to be performed from the QR code level for the KSA E invoicing phase 2,

      Because from phase 2 we are having the following TAGS in the QR code

      • Hash of XML invoice.
      • ECDSA signature.
      • ECDSA public key.
      • ECDSA signature of the cryptographic stamp’s public key.

      Then is there any blog or links to implement and test the QR Codes, for phase 1 we have used VAT QR Code application to test the QR Codes.

      thanks for the support.

      Author's profile photo Firoz Ashraf
      Firoz Ashraf

      Hi Zaheer,

      Excellent blog !

      While doing the first step in onboarding using transaction code SAEGSG I am getting the following error:

      Org. Unit/Free Text is empty for company code 1234

      Message No. EDOCUMENT_SA000

      When I debugged the program, found that entry for BUKRS = 1234, PARTY = SATAXN is missing in table T001Z

      Any idea how to maintain this entry?

       

      Regards,

      Firoz Ashraf

      Author's profile photo Zaheer DAWZI
      Zaheer DAWZI
      Blog Post Author

      Hi Firoz,

      Thank you for your comments Smile

      Please read the blog Master data mapping in KSA eInvoicing solution | SAP Blogs.

      Under the section - Master data specific to onboarding this is explained.

      Regards,

      Zaheer

      Author's profile photo Firoz Ashraf
      Firoz Ashraf

      Many Thanks Zaheer,

      We implemented SAP Note 3212218 - Company code additional parameters for KSA E-invoicing

      This note created additional parameters SATAXN, SAINDU and SASEID.

      Next, we maintained the values of these parameters in SE16 table T001Z against the company code.

      This solved our problem.

      Warm Regards,

      Firoz Ashraf

      Author's profile photo Zaheer DAWZI
      Zaheer DAWZI
      Blog Post Author

      Good to know Ashraf.

      Author's profile photo Sai Thunga
      Sai Thunga

      Hi Zaheer,

       

      WE have implemented OSS note 3212218. However, SASEID & SATAXN are not available in Company Code additional details even after implementing the OSS note 3212218.

      Please advise.

       

      Thanks

      Sai

      Author's profile photo Zaheer DAWZI
      Zaheer DAWZI
      Blog Post Author

      Hi Sai,

      This is the note that makes these parameters available at company code level. please ensure that the post implementation steps are completed as well. you will see the description of these parameters at the company code level.

      Regards,

      Zaheer

      Author's profile photo Srinivas Taduka
      Srinivas Taduka

      Hi Zaheer,

       

      Thank you for the blog!!

      We stuck at onboarding the solution unit id. I had a call with ZATCA technical team for help, they mentioned about CSR needs to be sent in order to receive a CCSID.

      Also, we are having an issue with the service interface ( eDocSACSIDOperations ). Please see the error details below.

       

      Error analysis
      The statement
      "MOVE deepStruc1 TO deepStruc2"
      requires the operands "deepStruc2" and "deepStruc1" to be compatible.
      Compatibility means equivalence in the context of
      ABAP/4 type checking.

      In this case, the condition is not satisfied: The operand "deepStruc2" has the
      the type "v" and the length 328, but the operand "deepStruc1" has the type
      "EDO_SA_CSIDOPERATIONS_REQUEST1"
      and the length 336.

      Kindly help.

       

      Thank You,

      Srinivas T

       

      Author's profile photo Tomasz Pasierbski
      Tomasz Pasierbski

      Dear Zaheer and Colleagues,

      We got stuck during registration of CCSID to ZATCA Simulation system.

      After Solution Unit ID was created in our test SAP system (version S4 Hana with integration via SAP CI) we tried to Request for CCSID in tcode SACSIDG - but every time once we enter valid OTP code, then we receive a message "Unauthorized".

      In SAP CI we can find a message 401 "Unauthorized" in the log - but we don't see any issues on SAP side. Our ZATCA account is valid and authorized in Fatoorah portal.

      It looks like the message 401 occurs in SAP CI internally during calling SAP CI API before sending a message to ZATCA.

      Would it be possible to be caused by the fact that our SAP runs on servers from Europe? Is it required to run it on local Saudi system?

      Have any of you met similar error? Do you have any supposition on the root cause?

      Thank you for any support.

      Best regards,

      Tomasz

      Author's profile photo Shunyashish Mohanty
      Shunyashish Mohanty

      Hi Tomasz,

      Please add the role (ESBMESSAGING.SEND) to S-user .

      It should work.

       

      Thanks

      Author's profile photo Shunyashish Mohanty
      Shunyashish Mohanty

      Dear Zaheer,

       

      Thanks for the blog with detailed step by step explanation.

      We are facing a issue at time of Request CSID. The prior steps , CCSID request and compliance check are successful.

      But when trying to perform Request CSID the below error we are facing.

      Error%20at%20CPI%20request

      Error response from Fatoora to CPI

       

      Payload:  { "compliance_request_id": "1684059671384" }

      https://gw-fatoora.zatca.gov.sa/e-invoicing/core/production/csids

       

      SAP%20REQEUST%20AND%20RESPONSE

      SAP REQUEST AND RESPONSE

       

      Could you guide us on this issue.

      Thanks,

      Yashsish.

       

       

      Author's profile photo Fares Alshadfan
      Fares Alshadfan

      Hello Zaheer,

       

      Quick question, Is there a note that has the onboarding information available? I tried to submit my first eDoc and got the following error Solution Unit is not onboarded for Company code/VAT/TAX/SD_INVOICE, but there is no mention in the standard SAP notes. The informative guide you posted is not present anywhere in the parent note 3095262 or its sub-notes. Thanks!

       

      regards,

      Fares

      Author's profile photo Warren Nash
      Warren Nash

      Has SAP considered its existing ECC6 customer based in KSA too?