Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
zaheer4sana
Product and Topic Expert
Product and Topic Expert

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 nameTransaction code
Generate Solution Unit IDSAEGSG
Manage Solution Unit IDSAEGSM
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.

You can create multiple EGS units for the same combination. This is particularly useful to distribute the workload of huge number of edocuments in your system.

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.

 

    1. 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)

41 Comments
MahmoudWahab
Participant
0 Kudos

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

zaheer4sana
Product and Topic Expert
Product and Topic Expert
0 Kudos
Dear AbdulWahab,

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

 

Regards,

zaheer
former_member777606
Discoverer
0 Kudos

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.

Firoz_Ashraf
Contributor
0 Kudos
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
zaheer4sana
Product and Topic Expert
Product and Topic Expert
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
Firoz_Ashraf
Contributor
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
Firoz_Ashraf
Contributor
0 Kudos
Dear Abdulwahab,

How did you solve this?

 

Regards,

Firoz Ashraf
0 Kudos
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
zaheer4sana
Product and Topic Expert
Product and Topic Expert
0 Kudos
Good to know Ashraf.
zaheer4sana
Product and Topic Expert
Product and Topic Expert
0 Kudos
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
srinivastaduka
Explorer
0 Kudos

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

 

0 Kudos

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

former_member136137
Discoverer
0 Kudos

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 response from Fatoora to CPI

 

Payload:  { "compliance_request_id": "1684059671384" }

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

 

SAP REQUEST AND RESPONSE

 

Could you guide us on this issue.

Thanks,

Yashsish.

 

 

former_member136137
Discoverer
0 Kudos
Hi Tomasz,

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

It should work.

 

Thanks
0 Kudos
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
wnash7658
Active Participant
0 Kudos

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

former_member771003
Discoverer
0 Kudos
Dear zaheer4sana

  1. I entered the Tcode "SACSIDG"

  2. Selected the line item.

  3. Clicked on CCSID Request.

  4. Systems prompt: OTP value is required.


Please guide in this regard that how to generate OTP Value.

0 Kudos
hi @zaheer4sana

Could you please confirm if we can use CI-Process Integration (1 sub-account) to connect ZATCA with different SAP systems landscape (3 systems)?

or we should use Integration Suite with one sub-account or 3 sub-accounts ?

 

Thanks for your feedback.

Regards

Morad
adeelrazashaikh
Discoverer
adeelrazashaikh
Discoverer
0 Kudos
Technically you can use one subaccount integration suite for 1 or more companies. But better check with your SAP account manager for licensing issues.
adeelrazashaikh
Discoverer
0 Kudos
As mentioned in the blog itself, you need below TCODE to onboard your system first before submitting the EDOC:

 



















Transaction name Transaction code
Generate Solution Unit ID SAEGSG
Manage Solution Unit ID SAEGSM
Generate Cryptographic Stamp Id. SACSIDG
adeelrazashaikh
Discoverer
0 Kudos
Check you SOA manager setting, you need to use CPI client id and client secret in web service and then for testing you should be able to ping from there.
Ahmed_Hassanin
Explorer
0 Kudos
Could any one clarify the below error when request CCSID ?

System failed to process your request


Message No. EDOCUMENT_SA000

 
aamir_aamir
Explorer
0 Kudos

Hi Zaheer,

Bravo...Excellent blog !

As per SAP, We can create multiple logical EGS Unit with one VAT registration number with multiple company code with one leading company code.

 

But in our organization, We have only company code with multiple sales division. i.e 5 Sales division with respective plants i.e 5 Plants and invoice is generating as per plant with respective defined number range.

I need to your help, How we can map our each sales division with Logical EGS to generate e-invoice.

As per ZATCA, Each EGS will have ICV i.e Invoice counter value...Its OK for us...in the free text field we can maintain our invoice number in IRN  i.e Invoice reference number.

 

zaheer4sana
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Aamir,

 

Thank you for your motivating comments. Iam happy that you found it useful.

 

Sales division in your case are set up as sales offices or sales organizations?

 

Regards,

Zaheer
aamir_aamir
Explorer
0 Kudos
Hi Zaheer,

How we can link for five Division or sales organization with each EGS logical unit.

One leading company code with different company code is possible as per SAP, But in our organization we have one company code with different sale division.

How we can link for five Division or sales organization with each EGS logical unit.
former_member136854
Discoverer
0 Kudos
Hello Ahmed,

Did you found the issue? , I'm facing the same issue
rahulbhat2000
Explorer
Hello Zaheer DAWZI ,

Thank you for this excellent blog. The number of people who are going to benefit out of this is enormous. Keep up the excellent work.

I have one question if you could provide me with some of your valuable inputs.

We have tried requesting the CCSID, but we are getting the 500 error. On the SAP side , I can see the error System failed to process your request'.

On the HCI side , error is as below : -

Error Details


org.apache.camel.component.ahc.AhcOperationFailedException: HTTP operation failed invoking https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance with statusCode: 500

We have raised this with SAP as well and they came back saying that everything is good on the SAP and HCI side of things and have asked us to contact ZATCA about this. I am clueless what is causing this error. Where can I start to try and resolve this error?

Rahul.
rahulbhat2000
Explorer
0 Kudos
Hello Mohamed ,

 

Were you able to resolve this issue ?

 

Rahul.
rahulbhat2000
Explorer
0 Kudos
Hello Ahmed ,

Were you able to resolve this ?

Rahul
zaheer4sana
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Rahul,

Thank you for your appreciating comments. Iam happy that a larger audience are benefitting from this.

The error you are facing is an internal server error at ZATCA side. This may be a temporary issue at their side. you can try after some time or directly check with ZATCA.

You may also check this in this link

 

Best Regards,

Zaheer
former_member446823
Discoverer
0 Kudos
Dear Team

 

This is Ganesh here,

We are implementing the Phase 2 E invoice and i am trying to generate the XML format,

However We face the below issue , How to get it resolved.

Which Filed I need to update in the SAP Hana to fix this .

 

Buyer ID is mandatory if Buyer VAT Registration Number is not provided
Field ID is empty in TaxCategory of TaxSubtotal

 

 

Regards

Ganeshj
zaheer4sana
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Ganesh,

Buyer ID is mandatory if Buyer VAT Registration Number is not provided

If VAT reg number is not provided, then the other buyer ID needs to be provided. This can be maintained in the identification type SABYID in BP. Please refer to the master data for eInvoicing blog for more details.

Field ID is empty in TaxCategory of TaxSubtotal:

You need to maintain the tax category in the value mapping for the VAT tax codes used in your transaction.

Regards,

Zaheer
s4_hipartner
Discoverer
0 Kudos
You need to configure an Oauth Authentication for that step and call.

Create an OAuth entry with the data of a Service Key belonging to a Service Instance Type api with the role SecurityMaterialEdit.

Configure that OAuth entry in the http call.

 
s4_hipartner
Discoverer
0 Kudos
Did you solved this issue?

We are facing the same problem with a valid compilance Id.

Thanks in advance.

 

Mikel
Hi Zaheer,

We’re having similar issues completing the EGS onboarding process between our system, SAP S/4Hana Cloud (public version) and the Fatoora Simulation portal. We’ve completed all of the required system configuration from our end to communicate with the ZATCA portal but, our Integration Suite is failing to authenticate the OTP generated in the ZATCA Simulation Portal.

The error code being displayed in our system is  "HTTP status code 500 - Internal Server Error”

Can you please advise if any additional guidance has been released by ZATCA?

Thank you,

Brennen

 

 
zaheer4sana
Product and Topic Expert
Product and Topic Expert
Hi Brenner,

This is an internal server error at ZATCA side. Please find below the response detail. Details can be found in link


Internal server error


Regards,

Zaheer
Thanks for your response, Zaheer.

We've been communicating with our ZATCA relationship manager to try and schedule a meeting with a ZATCA technical support agent.

rahulbhat2000 - Were you able to resolve this issue with ZATCA? Any guidance on this issue would be much appreciated.

Best,

Brennen
mahmoudwahab - we're currently stuck trying to complete the onboarding. I was hoping you could provide guidance on how you successfully requested CCSID for the compliance check?

When we select "request CCSID" to request the CSI from ZATCA, and enter a valid OTP from the fatoora simulation portal we're getting a failure message: HTTP operation failed invoking https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance with statusCode: 500

Should we be entering an OTP from the Fatoora simulation portal after "requesting CCSID" AND request CSID?

Thank you in advance,

Brennen
0 Kudos
zaheer4sana -

We’ve successfully completed the onboarding process for our Q system and the Fatoora simulation portal. Except now we’re having a different issue.

Our system is able to successfully send tax invoices to the ZATCA portal but, the ZATCA portal is timing out and failing to provide a response back to our system with the approval.

Error code: java.util.concurrent.TimeoutException: Request timeout to gw-fatoora.zatca.gov.sa/ after 60000 ms

error codes displayed in cockpit

  • Function EDOC_AIF_GENERIC_ACTION was not executed successfully

  • Value of Response Status not expected

  • Error triggering message, check interface log for details


 

Has anyone encountered a similar issue, or have guidance on how to fix?

 

thank you,

Brennen

 

 
adnanmaqbool
Contributor
0 Kudos

Hi All , @brennen_fischer12 

While requesting for CCSID, I am also getting following error. For the benefits of other , would you please explain that how you resolve this issue.

System failed to process your request.

org.apache.camel.component.ahc.AhcOperationFailedException: HTTP operation failed invoking https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance with statusCode: 500

{"code":"Invalid-Request","message":"System failed to process your request"}