0% found this document useful (0 votes)
238 views129 pages

E-Invoicing implementation Guide V4

The document is an implementation guide for E-Invoicing solutions in Greece, detailing the necessary steps, legal references, and system requirements for compliance with Greek regulations. It outlines the integration of SAP systems with service providers for electronic invoicing, emphasizing the submission of invoices through certified channels and the inclusion of specific information on invoices. The guide also addresses challenges and provides a comprehensive overview of the processes involved in implementing the solution.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
238 views129 pages

E-Invoicing implementation Guide V4

The document is an implementation guide for E-Invoicing solutions in Greece, detailing the necessary steps, legal references, and system requirements for compliance with Greek regulations. It outlines the integration of SAP systems with service providers for electronic invoicing, emphasizing the submission of invoices through certified channels and the inclusion of specific information on invoices. The guide also addresses challenges and provides a comprehensive overview of the processes involved in implementing the solution.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 129

E-Invoicing Implementation guide

SAP -Hellas

Aug 2024

Consulting Solution for E-Invoicing for Greece

Implementation Guide

© SAP HELLAS Single Member S.A. 1


E-Invoicing Implementation guide

1. Contents
2. Introduction ............................................................................................................................. 6
2.1 Glossary .......................................................................................................................... 6
2.2 Law Reference and Guidelines ....................................................................................... 8
2.3 General Requirement Description................................................................................... 8
2.4 Solution description –Main characteristics ................................................................... 10
2.5 Process flow .................................................................................................................. 10
2.6 Covered Scenarios ........................................................................................................ 12
2.7 Assumptions.................................................................................................................. 14
2.8 Challenges during implementation ............................................................................... 14
3. Implementation Steps............................................................................................................ 15
3.1 Integration Suite (CPI iflow) ............................................................................................ 15
3.2 Service Consumer ............................................................................................................. 18
3.2.1 Service Consumer ZGREIN_CO_EINV_GREECE_SEND_INV ........................... 18
3.3 Transport request – Objects. ............................................................................................. 23
3.3.1 E-Invoicing Handling and mapping Classes ............................................................. 23
3.3.2 Data Objects (tables, data elements, views).............................................................. 24
3.3.3 Table ZGREIN_RESP_EXT (obsolete as per V3) ................................................... 26
3.3.3.1 Table ZGREIN_EDOGRINV (V3) .......................................................................... 26
3.3.4 Table ZGREIN_IMP_CUST .................................................................................... 26
3.3.5 Program ZGREIN_2GLP_UPDATE_OLD (tc: ZGREIN_2GLP_EDOC_UPD) .... 27
3.3.6 Badi EDOC_INTERFACE_CONNECTOR implementation
ZGREIN_EI_EDOC_INTF_CONN_GR ................................................................................. 27
3.4 System Customizing Manual Actions ............................................................................... 27
3.4.1 Step 1: Create new interface ..................................................................................... 27
3.4.1.1 Create Logical Port in SOAMANAGER .................................................................. 27
3.4.1.2 EDOSOASERV (SM30) – Create SOA Service assign – logical port ..................... 31
3.4.1.3 EDOINTERFACEV(SM30) – Definition Interface ID ............................................ 32
3.4.1.4 EDOINTVERSDEFV (SM30) – Activate new interface ......................................... 32
© SAP HELLAS Single Member S.A. 2
E-Invoicing Implementation guide

3.4.1.5 EDOINTV (SM30) – Assign interface ID to SOA Service ...................................... 32


3.4.1.6 EDOINTAIFV (SM30) – Edocument assign AIF interface and Version ................. 33
3.4.2 Step 2: Create New processes ................................................................................... 33
3.4.2.1 EDOC_PROCMGR (SM34) – Create new processes .............................................. 33
3.4.2.2 EDOC_PROCMGR (SM34) – Change process step Class ...................................... 34
3.4.2.3 EDOMETASTATUSV (SM30) – Assignment of eDocument Status to Process
Status 35
3.4.2.4 EDOMAPCLASSDETV (SM30) – Assign mapping class to process/interface ...... 37
3.4.2.5 EDOPROCSPINTDETV (SM30) – Assign mapping class to process/process step 38
3.4.2.6 c (SM30) – Assign process step to process/interface/edoc type/ source type........... 40
3.4.3 Step 3: AIF Customizing (/aif/cust) .......................................................................... 41
3.4.3.1 Define interfaces ....................................................................................................... 41
3.4.3.2 Specify Interface Engines ......................................................................................... 45
3.4.3.3 Define Structure Mappings ....................................................................................... 46
3.4.3.4 Define Value Mappings ............................................................................................ 49
3.4.3.4.1 Value mapping ZGREIN_UNITS_OF_MEAS .................................................... 50
3.4.3.4.2 Value mapping ZGREIN_INVOICE_TYPE ........................................................ 52
3.4.3.5 Define Namespace-Specific Features ....................................................................... 54
3.4.3.6 Define interface-Specific Features ............................................................................ 56
3.4.4 EDOFACTORYV – Utilize new process assign class ZGREIN_EDOCUMENT_GR
to EDOFACTORY.................................................................................................................... 65
3.5 Badi EDOC_ADAPTOR implementation. ....................................................................... 65
3.6 Badi EDOC_INTERFACE_CONNECTOR implementation........................................... 67
3.7 Printing Programs Modifications ...................................................................................... 68
3.7.1 Program J_2GPFI Modifications .............................................................................. 69
3.7.2 Program J_2GLPPSD Modifications ........................................................................ 74
3.8 Process determination Customizing ZGREIN_CUST ..................................................... 78
3.8.1 Process determination Technical Details .................................................................. 84
4. Proxy structure and mapping details. .................................................................................... 85
4.1 ZGREIN_AADE_BOOK_INVOICE_TYPE ............................................................... 86

© SAP HELLAS Single Member S.A. 3


E-Invoicing Implementation guide

4.2 B2G Details ................................................................................................................... 88


4.2.1 Issuer ......................................................................................................................... 90
4.2.2 Counter Party ............................................................................................................ 91
4.2.3 Recipient ................................................................................................................... 92
4.2.4 Distribution Details ................................................................................................... 93
4.2.5 Payment Details ........................................................................................................ 95
4.2.6 Details ....................................................................................................................... 96
4.2.6.1 Details SD ................................................................................................................. 96
4.2.6.2 Details FI................................................................................................................. 100
4.2.7 Taxes ....................................................................................................................... 102
4.2.8 Summaries............................................................................................................... 103
4.2.9 VAT Analysis ......................................................................................................... 104
4.2.10 Contract Order details (V3) .................................................................................... 104
5. APPENDIX I Changes as per Version 3............................................................................. 105
5.1 Offline QR code. ......................................................................................................... 105
5.1.1 Technical changes – table zgrein_edogrinv ............................................................ 106
5.1.2 Technical changes – table ZGREIN_IMP_CUST .................................................. 107
5.1.3 Technical changes – Method CREATE_OFFLINE_QR of class
ZGREIN_CL_EDOCUMENT_GR ........................................................................................ 108
5.1.4 Technical changes – J_2JLPTIM_SUBM_EDOC.................................................. 111
5.2 Foreign currency support ............................................................................................ 111
5.3 New fields in wsdl file. ............................................................................................... 112
5.4 Bug fixing ................................................................................................................... 112
5.5 Introduction of exit indludes. ...................................................................................... 112

DISCLAIMER
Governance of the deliveries falls under the scope of relevant SAP Consulting notes 2706322 -
What is Support – What is Consulting: Cloud Solutions and 83020 - What is Support – What is
Consulting: On Premise Solutions. Implementation and adaptation should be considered at the
© SAP HELLAS Single Member S.A. 4
E-Invoicing Implementation guide

customer's discretion.

The present consulting solution will not be included in any SAP Support Package and there is no
schedule for any future development.

SAP Hellas will not provide support for the entire process of installation on call. If a customer
needs a vital implementation clarification or considers that he has found a bug, he may raise a
message at "XX-PROJ-GR" component which can be found under product "Customer Project-
Based Solutions".

© SAP HELLAS Single Member S.A. 5


E-Invoicing Implementation guide

2. Introduction

2.1 Glossary

EN (EL) Term Description

IAPR (ΑΑΔΕ) Independent Authority for Public Revenue: The Tax Authority of Greece

GSIS (ΓΓΠΣΔΔ) General Secretariate of Information Systems for Public Administration. It is also the
national Peppol Authority for Greece

KED (ΚΕΔ) GSIS National Interoperability Center: GSIS information system that connects
various electronic services of the Public Administration

CA (ΑΑ) Contracting Authorities and Financial Organizations of the public sector

eINV (ΗΤ) Electronic Invoice: An invoice that has been issued, transmitted, and received in a
structured data format which allows for its automatic and electronic processing, as
defined in Directive 2014/55/EU

eINVG Electronic Invoicing: The exchange of an electronic invoice document between a


supplier and a buyer

PEPPOL Pan European Public Procurement On Line: A set of artifacts and technical
specifications enabling cross-border eProcurement between disparate systems across
Europe

OpenPeppol AISBL Non-profit organization maintaining PEPPOL

PEPPOL CIUS PEPPOL Core Invoice Usage Specifications

PEPPOL BIS PEPPOL Business Interoperability Specification

PEPPOL eDelivery A network operating under a set of common standards defined by Peppol. Once
Network connected to the eDelivery Network, public agencies and private enterprises can
quickly and easily reach any other trading partner, also using Peppol.

AP (ΣΠ) Certified Peppol Access Point: Node providing access to PEPPOL eDelivery
network

YPAHES Electronic Invoicing Services Provider certified by IAPR.

© SAP HELLAS Single Member S.A. 6


E-Invoicing Implementation guide

(Υ.ΠΑ.Η.Ε.Σ.) YPAHES is pronounced “e-pi-es”.

SP Service Provider for B2G eInvoicing in Greece

eBooks Electronic book-keeping requirement in Greece (has been implemented with SAP
DRC)

myDATA My Digital Accounting & Tax Application: IAPR’s online platform and API that
accepts all revenue, expense, and VAT-related documents from Greek businesses,
thereby fulfilling the eBooks requirement. The purpose of myDATA is the
reconciliation of the accounting records of the liable entities with the eBooks of
IAPR.

UID myDATA unique document ID (each document submitted to myDATA receives a


UID based on certain properties of the document)

MARK (ΜΑΡΚ) myDATA registration number (each submission to myDATA receives a unique
MARK, even for the same document)

Authentication Code Unique authentication string of the eInvoice issued by myDATA

Legal Number (ODN) A combination of characters & numbers uniquely identifying a legal document in
Greece. It consists of:

1. An identifier of the document’s legal type

2. The series (alphanumeric)

3. The counter (numeric)

In SAP ERP (OP and Cloud) this is done using special printing programs of the
country’s localization package.

AFM (ΑΦΜ) Legal or physical entity’s unique registration number within the Greek Tax
Authorities

B2B Business to Business (transactions between private sector enterprises)

B2G Business to Government (transactions of private sector enterprises with the State)

S/W Software

SCI SAP Cloud Integration

© SAP HELLAS Single Member S.A. 7


E-Invoicing Implementation guide

2.2 Law Reference and Guidelines

Following are the main laws and governmental decisions (KYA) which are relevant to the B2G
eInvoicing requirement:

• Law 4601/2019 (art. 148-154) – Law that introduces the requirement to comply with
Direction 2014/55/ΕΕ of the EU for the use of eInvoicing in the context of Public Contracts.
• ΚΥΑ 98979/10-8-21 – Guidelines for the implementation of law 4601/2019
• ΚΥΑ 63446/2-6-2021 – Describes the national format for eInvoices in B2G transactions
• Α.1035/18-2-2020 – Guidelines for Electronic Data Services Provider certified by IAPR
(YPAHES)
• Α.1138/12-6-2020 – Main IAPR decision for eBooks

2.3 General Requirement Description

In accordance with current legislation, vendors who issue invoices within the scope of Public
Contracts (B2G) in Greece are required to transmit them electronically to a service provider.
The old requirement was to submit invoices in myData platform in XML format, adhering to the
specifications provided by IAPR. This XML format included essential invoice details such as
invoice type, total amount, net amount, VAT category, classification category, and classification
type.

Figure 1: As Is SAP's Solution

© SAP HELLAS Single Member S.A. 8


E-Invoicing Implementation guide

Figure 2: To Be SAP's Solution

Several key points should be noted:


• As per IAPR's decision regarding e-books, companies are no longer allowed to submit
wholesale documents to myDATA via multiple channels. The choice is now limited to
either ERP or a Service Provider. Consequently, since B2G invoices must be sent through
a certified Provider to the Contracting Authorities, the submission to myDATA must also
be handled by the Provider. As a result, all domestic companies liable to myDATA that
utilize SAP's e-book solution and issue invoices to the Greek Public sector have to submit
all their wholesale invoices, including B2B, through a Service Provider (SP).
• A customer with no B2G invoices may use the e-invoicing solution for his B2B invoices.
• "Real-time Submission": This effectively means, QR code, mark id, UID should be printed
on the invoice. Moreover, since service provider is in place, information like
Authentication code and SP’s name should also appear in the printed invoice.

Concluding, legal entities (with eINVG processes) will have to:

1. Submit all the wholesale invoices through a Service Provider.


2. Print the invoice with the information of QR code, mark id, UID, authentication code, SP
name.

Under this new framework, the SAP ERP system will play a pivotal role in serving SAP Cloud
Integration with additional information required from GSIS (ΓΓΠΣΔΔ). The Service Provider will
then dissect this information and appropriately serve myDATA and KED submissions.

© SAP HELLAS Single Member S.A. 9


E-Invoicing Implementation guide

It is essential to emphasize that, due to the submission through a Service Provider, both B2B and
B2G transactions require additional information as stipulated by ΚΥΑ 63446/2-6-2021. This is
particularly pertinent for B2G invoices, where specific details such as contracts and contracting
authorities are necessary.
The proposed solution is anchored in the e-document framework and relies on the AIF
(Application Integration Framework) application. The EDOC_COCKPIT application within this
framework offers key functionalities, including the submission, cancellation, resubmission, and
deletion (in the "created" status) of e-documents. It also serves as a reporting tool for submitted
items. Given these functions, the EDOC_COCKPIT remains an integral part of the solution being
offered.
It is worth noting that, due to the use of a Service Provider in compliance with YPAHES
(Υ.ΠΑ.Η.Ε.Σ.), the cancel functionality is no longer available. Instead, companies must issue
credit notes as a substitute for cancellations.

2.4 Solution description –Main characteristics

The main characteristics of the solution are:


• The solution is tailor made for Service Provider IMPACT (a Softone Company).
Implementations involving other Service Providers will not be supported by SAP Hellas.
• The existing customizing for e-books solution remains the same.
• Transaction code EDOC_COCKPIT remains the main application for the business users.
• Two new processes are created in the e-document framework.
• New AIF Interfaces.
• New consumer Proxy service.
• New iFlow on Cloud Platform Integration.
• New classes are created and assigned to the new processes.
• New customizing table for process determination.
• Solution is company code specific.

2.5 Process flow

The current solution undergoes enhancements to accommodate the additional information required
for both B2B and B2G invoices.
© SAP HELLAS Single Member S.A. 10
E-Invoicing Implementation guide

New folders are created to depict newly created processes. These folders include all the e-invoicing
relevant e-documents enhanced with new information required. Users continue to see XML format
per e-document pressing the display button. In the XML, users can see the information that are
familiar with plus the information required by CA. For the business user the functionality remains
the same. In the following paragraphs, a detail technical description for process creation and field
mapping, is provided.
The field mapping is a suggestion of SAP Hellas and can be modified by a customer according
to his specific requirements.
The user creates invoice and proceeds with invoice printing. Printing program assigns legal
number to the invoice and submit the e-document through EDOC_COCKPIT. The submission
goes directly to Cloud Platform Integration where transformation to JSON format takes place.
After transformation:
1. In case of B2G, Service Provider takes the e-document and serves it to KED, if there is
acceptance from KED, SP updates myData platform. When myData accepts the invoice,
responds with Mark ID and UID. SP sends back to CPI the information of Mark ID, UID,
authentication code and a URL for QR code creation. Invoice is printed and the required
information appears.
2. In case of B2B, the submission is restricted to myData platform submission.
The legal requirements for delayed submission of invoices are still the same. Companies (for all
industries) should submit withing 24 hours the invoice in case of communication inability. For
Bank Sector, the obligation is within 48 hours. In case of communication inability, user can print
the invoice with specific justification and the delayed e-document submission includes the
information of “is delayed code”.
The solution accepts the relevant information served by SP and updates accordingly the system
with SP’s URL, Mark ID, UID and Authentication code.
Printing the information to invoices is not part of the solution.
Below you can find a detailed diagram of the process flow described above:

© SAP HELLAS Single Member S.A. 11


E-Invoicing Implementation guide

Figure 2: New Process Flow

2.6 Covered Scenarios

All the relevant invoices that a company issue should be submitted through SP. These are:

• Sales Invoices to domestic, European and 3rd country customer


• Service Invoices to domestic, European and 3rd country customer
• Sales invoice / Supplemental document (debit memo with reference to an invoice)
• Credit Invoice / Associated for domestic, European and 3rd country customer
• Credit Invoice / Not Associated for domestic, European and 3rd country customer.
• Service invoice / Supplemental document (debit memo with reference to an invoice)
• Self-Delivery Item

© SAP HELLAS Single Member S.A. 12


E-Invoicing Implementation guide

• Title deed (non-liable issuer)


• Self-Billing

As it is mentioned above, new e-document processes are created for covering the requirement and
the relevant e-documents appear in different folders into EDOC_COCKPIT. So, two processes are
created to cover:

• the customer respective scenarios


• the vendor respective scenarios (acquisition title and self-billing).

B2C Scenarios are not covered by this guidance and if a company has retail transactions, these
remain to folder “Greece eBooks”.

All the Incoming processes remain with original solution.

The following picture shows how the invoice types are transferred to the respective folder.

Figure 3: Invoice Types at New Processes

© SAP HELLAS Single Member S.A. 13


E-Invoicing Implementation guide

2.7 Assumptions

The following assumptions apply in the solution provided:

• SAP Standard solution for eBooks is active in the system.


• SAP Cloud Platform Integration works as a middleware in the system.
• Solution works exclusively with IMPACT (a Softone company) as Service Provider.
• Solution works for the newly created e-documents and not retroactively.
• Implementation of relevant to ebooks SAP Notes:
For SAP document compliance Greece at least:
➢ 3419346 - SAP Document Compliance Greece: Mapping Enablement and Code
Correction XXXVI.

For Print Program Integration with eDocument at least to:

➢ 3421397 - GR: Print Program Integration with eDoc - Real-time Issuance & QR
Code
Please check the Overview SAP Note 2930400 for the complete list of prerequisites.
• The source documents which are supported, are coming from SD, MM and FI sub-modules.
• The field mapping is from SD and FI relative tables.

2.8 Challenges during implementation

During implementation, companies and implementors may face the following challenges:

• B2G Customers definition. We use the customer reconciliation account in the document.
Customers will have to evaluate the correct usage since there may be confusing cases like
PPC – ΔΕΗ, which is not classified as B2G.
• Field mapping for required fields. In the following paragraphs, SAP’s suggestion for field
mapping is described and this may not meet all customer’s current requirements. Mapping
Classes are referenced in the Mapping details section and should be modified if needed
according to specific needs.
• CPV Code mapping maintenance. Field Control Code at International Trade tab is used
(MARC-STEUC). Details at paragraph §4.2
• For FI invoices, B2G transactions, a material code & plant is required in order for the CPV

© SAP HELLAS Single Member S.A. 14


E-Invoicing Implementation guide

code to be populated. It means that even for simple FI invoices, users should maintain the
material code during posting.
• Special handling of taxes, other taxes and fees with VAT (eg. ΠΦΣ, ΕΦΚ). Separate tax
code for the taxes-fees relevant to VAT must be used for the mapping logic to work.

3. Implementation Steps
Implementation steps are detailed in this chapter. Please respect the sequence to avoid errors in
implementation.

3.1 Integration Suite (CPI iflow)

The attached file GRSAP_eInvoice.zip contains the Integration Suite Package GRSAP_eInvoice
with an Artifact GRSAP_eInvoice_Impact within.

Procedure:

Logon to Integration Suite and select Integrations and APIs from the upper left corner of the page
Menu.

Use Import to upload the above file.

© SAP HELLAS Single Member S.A. 15


E-Invoicing Implementation guide

After successfully uploading:

Click on the package GRSAP_eInvoice.

Go to the Artifacts tab page and select the artifact GRSAP_eInvoice_Impact.

Choose Actions > Configure.

The configuration tab appears.

© SAP HELLAS Single Member S.A. 16


E-Invoicing Implementation guide

Enable Logging: for switching logging on and off. Values YES/NO

Mode: for selecting environment

TEST To use the test system of the Provider.

PROD To use the productive system of the Provider.

Productive_URL: the productive URL provided by service provider (Impact)

Test_URL: the UAT URL provided by service provider (Impact)

Choose Save and Deploy to deploy it actively to server. Note down the URL of the endpoint to
use it later on soa manager configuration.

Go to the Overview tab and choose Security Material. Choose Add on the right corner and
choose User Credentials.

You need to add a User Credentials for your company code. See details as follows:

© SAP HELLAS Single Member S.A. 17


E-Invoicing Implementation guide

Name has a specific format as follows:

eInv_Impact_APIKey_test_EL<VAT ID> for the test environment.

eInv_Impact_APIKey_prod_EL<VAT ID> for the productive environment

<VAT ID> needs to be replaced with the value of the company's VAT ID registered with
Impact.

For example, "eInv_Impact_APIKey_test_EL123456789" for the test environment.

As User you may use any name

As Password use the API key provided by Service provider (Impact).

Deploy the User Credentials.

3.2 Service Consumer

Based on the attached wsdl file (eInvGreeceSendInvoiceV2.wsdl) a new service consumer is


created

CLASS/INTERFACE ZGREIN_CO_EINV_GREECE_SEND_INV

Proxy structures:

INPUT ZGREIN_SEND_INVOICE_REQUEST
OUTPUT ZGREIN_SEND_INVOICE_RESPONSE

This is a prerequisite step before importing the Attached TR. Objects imported with the TR, are
created under package ZGREINV. You may create this package before import to proceed with the
Service Consumer creation under this package or create another one for this purpose. Next step
assumes ZGREINV package is manually created.

3.2.1 Service Consumer ZGREIN_CO_EINV_GREECE_SEND_INV

© SAP HELLAS Single Member S.A. 18


E-Invoicing Implementation guide

Procedure:

In the Object Navigation (transaction se80) right click on Package ZGREINV and select Create-
Enterprise Service

Select Service Consumer and press Continue

© SAP HELLAS Single Member S.A. 19


E-Invoicing Implementation guide

Select External WSDL/Schema and press Continue

Select Local File and press Continue


© SAP HELLAS Single Member S.A. 20
E-Invoicing Implementation guide

In field File Select the downloaded (attached) wsdl file and press Continue

© SAP HELLAS Single Member S.A. 21


E-Invoicing Implementation guide

Select a transportable Request and fill Prefix field with ZGREIN_ then press Finish.

Do not use a different Prefix as the created proxy objects are used on the Transport Request.

On the next screen press Complete

Navigate to External View tab and check (or change if different) the settings as in the next
screenshot.

© SAP HELLAS Single Member S.A. 22


E-Invoicing Implementation guide

Save and Activate the Service Consumer.

3.3 Transport request – Objects.

Depending on the system the respective TR is to be imported.

For ECC: file: CCIK921386.zip

For S4: file: S4HK902495.zip

Common for both systems the below objects will be imported. Objects are in customer namespace
(Z*) so it is important to check if there is any naming conflict in the system before import. Prefix
used is ZGREIN. If there is any conflict, transport cannot be imported.

3.3.1 E-Invoicing Handling and mapping Classes

Below are the classes to be generated for handling e-invoicing and mapping to AIF

Class name SuperClass Description Usage

ZGREIN_CL_ED CL_EDOC_MAP_ Greece: e-Invoicing


OC_MAP_GR AIF Mapping to AIF Generic mapping to AIF

© SAP HELLAS Single Member S.A. 23


E-Invoicing Implementation guide

ZGREIN_CL_ED ZGREIN_CL_EDO Greece: e-Invoicing Specific Mapping to AIF


OC_MAP_GR_FI C_MAP_GR Mapping To AIF for FI for SD

ZGREIN_CL_ED Greece: e-Invoicing


OC_MAP_GR_IN ZGREIN_CL_EDO Mapping for Invoice Specific Mapping to AIF
VVERF C_MAP_GR Verification for Invoice verification

ZGREIN_CL_ED ZGREIN_CL_EDO Greece: e-Invoicing Specific Mapping to AIF


OC_MAP_GR_SD C_MAP_GR Mapping To AIF for SD for FI

ZGREIN_CL_ED Generic Class for e-


OCUMENT_GR CL_EDOCUMENT e-Invoicing Greece invoicing handling
ZGREIN_CL_ED Generate new e-
OC_FACTORY_G CL_EDOC_FACTO e-Invoicing Factory class for Invoicing instance on
R RY GR new process

3.3.2 Data Objects (tables, data elements, views)

Below are the tables and views to be generated for e-invoicing customizing configuration. The
following objects are maintained through cluster view ZGREIN_CUST (tcode SM34). For ease of
access the cluster view is also accessible directly through tcode ZGREIN_CUST.

Cluster View
name Table name View name Description Usage
Activates /
eInvoice: Deactivates the
Activation per eInvoicing
Company functionality per
ZGREIN_CUST ZGREIN_CC_ACT ZGREIN_CC_ACT_V Code View company code
Activates /
eInvoice: Deactivates the
Source type eInvoicing
SD per functionality for
Company SD source type
ZGREIN_CUST ZGREIN_SRC ZGREIN_SRC_SD_V Code View per company code

© SAP HELLAS Single Member S.A. 24


E-Invoicing Implementation guide

Determines eDoc
Process to be used
eInvoice: SD per billing type
Billing Type for company code
per Company and SD source
ZGREIN_CUST ZGREIN_SD ZGREIN_SD_V Code View type combination
Determines eDoc
Process to be used
eInvoice: per document type
Source SD and G/L accounts
Doc. Type & for company code
G/L Acc. Per and SD source
ZGREIN_CUST ZGREIN_GL ZGREIN_GL_SD_V Comp. Code type combination
Activates /
eInvoice: Deactivates the
Source type eInvoicing
FI per functionality for
Company FI source type per
ZGREIN_CUST ZGREIN_SRC ZGREIN_SRC_FI_V Code View company code
Determines eDoc
Process to be used
per self-billing
eInvoice: FI eDoc type for
Self Billing company code
per Company and FI source type
ZGREIN_CUST ZGREIN_SB ZGREIN_SB_FI_V Code View combination
Determines eDoc
Process to be used
eInvoice: FI per reason code
Reason Code for company code
per Company and FI source type
ZGREIN_CUST ZGREIN_FI ZGREIN_FI_V Code View combination
Determines eDoc
Process to be used
eInvoice: per document type
Source FI and G/L accounts
Doc. Type & for company code
G/L Acc. Per and FI source type
ZGREIN_CUST ZGREIN_GL ZGREIN_GL_FI_V Comp. Code combination
Activates /
eInvoice: Deactivates the
Source type eInvoicing
MM per functionality for
Company MM source type
ZGREIN_CUST ZGREIN_SRC ZGREIN_SRC_MM_V Code View per company code
eInvoice: MM Determines eDoc
Self Billing Process to be used
per Company per self-billing
ZGREIN_CUST ZGREIN_SB ZGREIN_SB_MM_V Code View eDoc type for
© SAP HELLAS Single Member S.A. 25
E-Invoicing Implementation guide

company code
and MM source
type combination
Determines eDoc
Process to be used
eInvoice: per document type
Source MM and G/L accounts
Doc. Type & for company code
G/L Acc. Per and MM source
ZGREIN_CUST ZGREIN_GL ZGREIN_GL_MM_V Comp. Code type combination

Please see also chapter §3.8 for the customizing maintenance for the above tables.

3.3.3 Table ZGREIN_RESP_EXT (obsolete as per V3)


This table is obsolete and is not updated anymore as from V3. Is replaced by table
ZGREIN_EDOGRINV. Please, replace it with zgrein_edogrinv in case you are using it on
printing programs.

Check details in 3.3.3.1

This Application table contains some extra fields from Response message like authentication
code, status e.t.c. Authentication code has to be on Invoice printout and Status can be used for
specific messages on Invoice printout if not ‘SUBMITTED’. The table key is the inv_uid from
standard table EDOGRINV.

3.3.3.1 Table ZGREIN_EDOGRINV (V3)


This Application table contains some extra fields from Response message like authentication
code, http_status e.t.c. Authentication code must be on Invoice printout and http_status can be
used for specific messages on Invoice printout. The table key is the edoc_guid from standard
table EDOGRINV.

Check appendix I for table details for manual creation.

3.3.4 Table ZGREIN_IMP_CUST


This Customization table contains data for Offline QRCode creation. Use the offline ApiUrl
from Impact documentation (e.g. https://einvoice-demo-portal.s1ecos.gr/TransmissionFailure or
https://einvoice.s1ecos.gr/TransmissionFailure) and the API Keys provided by Impact.

Maintenance through SM30

© SAP HELLAS Single Member S.A. 26


E-Invoicing Implementation guide

3.3.5 Program ZGREIN_2GLP_UPDATE_OLD (tc: ZGREIN_2GLP_EDOC_UPD)

Used to update legal number for new processes.

3.3.6 Badi EDOC_INTERFACE_CONNECTOR implementation


ZGREIN_EI_EDOC_INTF_CONN_GR
Badi implementation: ZGREIN_EI_EDOC_INTF_CONN_GR

Implementing class: ZGREIN_CL_EDOC_INTF_CONN_GR

Badi: EDOC_INTERFACE_CONNECTOR

3.4 System Customizing Manual Actions

3.4.1 Step 1: Create new interface

3.4.1.1 Create Logical Port in SOAMANAGER

You configure proxies that are needed to connect to the SAP Integration Suite tenant via logical
ports. In test SAP back-end systems, the logical ports are configured to connect to the test tenant.
In productive SAP back-end systems, the logical ports are configured to connect to the productive
SAP Integration Suite tenant.

Procedure:

In your SAP back-end system, go to the SOAMANAGER transaction and search for Web
Service Configuration.

© SAP HELLAS Single Member S.A. 27


E-Invoicing Implementation guide

Find the proxies for SAP Document and Reporting Compliance (eDocument) for Greece with
search term ZGREIN*

Select ZGREIN_CO_EINV_GREECE_SEND_INV

© SAP HELLAS Single Member S.A. 28


E-Invoicing Implementation guide

Go to manual configuration. Enter the logical port name ZGREIN_GR_SEND_INVOICE_IMP


and ‘eInvoice with Impact’ as a description.

The configuration you do in the Consumer Security tab in the Configuration screen depends on
the security being used in the communication between the back-end system and SAP Integration
Suite.

On the HTTP Settings tab, make the following entries:


© SAP HELLAS Single Member S.A. 29
E-Invoicing Implementation guide

• Protocol: HTTPS
• Host: the SAP Cloud Integration
• Path: /cxf/GreeceSendeInvoiceImp
• Proxy: Your Proxy settings (if exists)

On the SOAP Protocol tab, set Message ID Protocol to Suppress ID Transfer.

© SAP HELLAS Single Member S.A. 30


E-Invoicing Implementation guide

After Finish configuration you can check the connection using Ping Web Service

3.4.1.2 EDOSOASERV (SM30) – Create SOA Service assign – logical port

Maintain table EDOSOASERV add below entries :

SOA Service Name CoCd Logical Port SOA Service Description


Greece - eInvoicing
ZGREIN_INCO_INVOICE 2210 ZGREIN_GR_SEND_INVOICE_IMP Incoming
ZGREIN_SEND_INVOICE 2210 ZGREIN_GR_SEND_INVOICE_IMP Greece - eInvoicing

© SAP HELLAS Single Member S.A. 31


E-Invoicing Implementation guide

3.4.1.3 EDOINTERFACEV(SM30) – Definition Interface ID

Maintain table EDOINTERFACEV add below entries:

Interface ID Interface Direction Interface Description

ZGREIN_INCOMING_REQUEST O Outbound Incoming Request


ZGREIN_SEND_REQUEST O Outbound Send Request
ZGREIN_SEND_RESPONSE I Inbound Send Response

3.4.1.4 EDOINTVERSDEFV (SM30) – Activate new interface

Maintain table EDOINTVERSDEFV add below entries:

Version Interface
Interface ID Version Description Active Direction Description
O Incoming
ZGREIN_INCOMING_REQUEST 1 Version 1.0 10.02.2020 Outbound Request
O Send
ZGREIN_SEND_REQUEST 1 Version 1.0 10.02.2020 Outbound Request
Send
ZGREIN_SEND_RESPONSE 1 Version 1.0 10.02.2020 I Inbound Response

3.4.1.5 EDOINTV (SM30) – Assign interface ID to SOA Service

© SAP HELLAS Single Member S.A. 32


E-Invoicing Implementation guide

Maintain table EDOINTV add below entries:

Interface
Interface ID SOA Service Name Direction Description
ZGREIN_INCOMING_REQUEST ZGREIN_INCO_INVOICE O Outbound Incoming Request
ZGREIN_SEND_REQUEST ZGREIN_SEND_INVOICE O Outbound Send Request
ZGREIN_SEND_RESPONSE ZGREIN_SEND_INVOICE I Inbound Send Response

3.4.1.6 EDOINTAIFV (SM30) – Edocument assign AIF interface and Version

Maintain table EDOINTAIFV add below entries

Version AIF AIF AIF


Interface ID Version Descr Namespace Interface Version Direction
ZGREIN_INCOMING_REQUEST 1 Version 1.0 /EDOGR ZEINVEROUT 1 O Outbound
ZGREIN_SEND_REQUEST 1 Version 1.0 /EDOGR ZEINVOUT 1 O Outbound
ZGREIN_SEND_RESPONSE 1 Version 1.0 /EDOGR ZEINVOUTR 1 I Inbound

3.4.2 Step 2: Create New processes

3.4.2.1 EDOC_PROCMGR (SM34) – Create new processes

Go to Cluster (SM34) Edoc_procmgr, Copy processes GRINV & GRINVREGIN with all
depended entries to ZGREINV & ZGREINRGIN respectively.

© SAP HELLAS Single Member S.A. 33


E-Invoicing Implementation guide

3.4.2.2 EDOC_PROCMGR (SM34) – Change process step Class

For both newly created processes, go to ‘process step’ change class CL_EDOCUMENT_GR with
ZGREIN_CL_EDOCUMENT_GR provided from the transport request.

© SAP HELLAS Single Member S.A. 34


E-Invoicing Implementation guide

3.4.2.3 EDOMETASTATUSV (SM30) – Assignment of eDocument Status to


Process Status

Copy all entries of GRINV & GRINVREGIN to ZGREINV & ZGREINRGIN respectively.

© SAP HELLAS Single Member S.A. 35


E-Invoicing Implementation guide

Edoc Process Process Status Status


ZGREINRGIN ACP_EXPEN 0001
ZGREINRGIN ADD_TO_CLA 0002
ZGREINRGIN ADD_TO_DEV 0002
ZGREINRGIN ADD_TO_OM 0002
ZGREINRGIN ADD_TO_SUM 0002
ZGREINRGIN CANA 0001
ZGREINRGIN CANC 0001
ZGREINRGIN CANI 0002
ZGREINRGIN CREA 0002
ZGREINRGIN DEC_AS_DEV 0002
ZGREINRGIN DEV_ACEXCF 0001
ZGREINRGIN DEV_CANC 0002
ZGREINRGIN DEV_CORR 0001
ZGREINRGIN DEV_DEC 0002
ZGREINRGIN DEV_MD 0002
ZGREINRGIN DEV_REJE 0003
ZGREINRGIN EXPENSE 0001
ZGREINRGIN MATCH 0002
ZGREINRGIN MATCH_ERR 0003
ZGREINRGIN MATCH_OM 0002
ZGREINRGIN OM_ACEX 0001
© SAP HELLAS Single Member S.A. 36
E-Invoicing Implementation guide

ZGREINRGIN OM_DEC_EXP 0001


ZGREINRGIN OM_REJE 0003
ZGREINRGIN REJE 0003
ZGREINRGIN REV_EXPENS 0001
ZGREINRGIN SEND 0003
ZGREINRGIN SNRQ 0003
ZGREINV ACP_INCOME 0001
ZGREINV ADD_TO_CLA 0002
ZGREINV ADD_TO_SUM 0002
ZGREINV CANA 0001
ZGREINV CANC 0001
ZGREINV CREA 0002
ZGREINV DEC_AS_DEV 0002
ZGREINV DEV_CANC 0002
ZGREINV DEV_CORR 0001
ZGREINV MATCH_OM 0002
ZGREINV OM_ACIC 0001
ZGREINV REJE 0003
ZGREINV REV_INCOME 0001
ZGREINV SEND 0003
ZGREINV SNRQ 0003

3.4.2.4 EDOMAPCLASSDETV (SM30) – Assign mapping class to


process/interface

Interface
Edoc Process Version Interface ID Edoc Type Source Type Mapping Class Direction Description
Incoming
ZGREINRGIN 1 ZGREIN_INCOMING_REQUEST GR_INVI_NL FI_INVOICE ZGREIN_CL_EDOC_MAP_GR_FI O Outbound Request
Incoming
ZGREINRGIN 1 ZGREIN_INCOMING_REQUEST GR_INVI_NL INV_VERIF ZGREIN_CL_EDOC_MAP_GR_INVVERF O Outbound Request
Incoming
ZGREINRGIN 1 ZGREIN_INCOMING_REQUEST GR_INVI_SB FI_INVOICE ZGREIN_CL_EDOC_MAP_GR_FI O Outbound Request
Incoming
ZGREINRGIN 1 ZGREIN_INCOMING_REQUEST GR_INVI_SB INV_VERIF ZGREIN_CL_EDOC_MAP_GR_INVVERF O Outbound Request

ZGREINRGIN 1 ZGREIN_SEND_RESPONSE GR_INVI_NL ZGREIN_CL_EDOC_MAP_GR I Inbound Send Response

ZGREINRGIN 1 ZGREIN_SEND_RESPONSE GR_INVI_SB ZGREIN_CL_EDOC_MAP_GR I Inbound Send Response

ZGREINV 1 ZGREIN_SEND_REQUEST GR_INV FI_INVOICE ZGREIN_CL_EDOC_MAP_GR_FI O Outbound Send Request

ZGREINV 1 ZGREIN_SEND_REQUEST GR_INV SD_INVOICE ZGREIN_CL_EDOC_MAP_GR_SD O Outbound Send Request

ZGREINV 1 ZGREIN_SEND_REQUEST GR_INV_CR FI_INVOICE ZGREIN_CL_EDOC_MAP_GR_FI O Outbound Send Request

ZGREINV 1 ZGREIN_SEND_REQUEST GR_INV_CR SD_INVOICE ZGREIN_CL_EDOC_MAP_GR_SD O Outbound Send Request

ZGREINV 1 ZGREIN_SEND_RESPONSE GR_INV ZGREIN_CL_EDOC_MAP_GR I Inbound Send Response

ZGREINV 1 ZGREIN_SEND_RESPONSE GR_INV_CR ZGREIN_CL_EDOC_MAP_GR I Inbound Send Response

© SAP HELLAS Single Member S.A. 37


E-Invoicing Implementation guide

3.4.2.5 EDOPROCSPINTDETV (SM30) – Assign mapping class to


process/process step

Mapping
Edoc Process Version Interface ID Edoc Type Source Type Direction
Class
ZGREINV 1 PROC_RESP GR_INV FI_INVOICE ZGREIN_SEND_RESPONSE
ZGREINV 1 PROC_RESP GR_INV SD_INVOICE ZGREIN_SEND_RESPONSE
ZGREINV 1 PROC_RESP GR_INV_CR FI_INVOICE ZGREIN_SEND_RESPONSE
ZGREINV 1 PROC_RESP GR_INV_CR SD_INVOICE ZGREIN_SEND_RESPONSE
© SAP HELLAS Single Member S.A. 38
E-Invoicing Implementation guide

ZGREINV 1 REQ_SEND GR_INV FI_INVOICE ZGREIN_SEND_REQUEST


ZGREINV 1 REQ_SEND GR_INV SD_INVOICE ZGREIN_SEND_REQUEST
ZGREINV 1 REQ_SEND GR_INV_CR FI_INVOICE ZGREIN_SEND_REQUEST
ZGREINV 1 REQ_SEND GR_INV_CR SD_INVOICE ZGREIN_SEND_REQUEST
ZGREINV 1 SENDEDOC GR_INV FI_INVOICE ZGREIN_SEND_REQUEST
ZGREINV 1 SENDEDOC GR_INV SD_INVOICE ZGREIN_SEND_REQUEST
ZGREINV 1 SENDEDOC GR_INV_CR FI_INVOICE ZGREIN_SEND_REQUEST
ZGREINV 1 SENDEDOC GR_INV_CR SD_INVOICE ZGREIN_SEND_REQUEST
ZGREINRGIN 1 PROC_RESP GR_INVI_IM FI_INVOICE ZGREIN_SEND_RESPONSE
ZGREINRGIN 1 PROC_RESP GR_INVI_IM INV_VERIF ZGREIN_SEND_RESPONSE
ZGREINRGIN 1 PROC_RESP GR_INVI_NL FI_INVOICE ZGREIN_SEND_RESPONSE
ZGREINRGIN 1 PROC_RESP GR_INVI_NL INV_VERIF ZGREIN_SEND_RESPONSE
ZGREINRGIN 1 PROC_RESP GR_INVI_RE FI_INVOICE ZGREIN_SEND_RESPONSE
ZGREINRGIN 1 PROC_RESP GR_INVI_RE INV_VERIF ZGREIN_SEND_RESPONSE
ZGREINRGIN 1 PROC_RESP GR_INVI_SB FI_INVOICE ZGREIN_SEND_RESPONSE
ZGREINRGIN 1 PROC_RESP GR_INVI_SB INV_VERIF ZGREIN_SEND_RESPONSE
ZGREINRGIN 1 PROC_RESP GR_INV_IN FI_INVOICE ZGREIN_SEND_RESPONSE
ZGREINRGIN 1 PROC_RESP GR_INV_IN INV_VERIF ZGREIN_SEND_RESPONSE
ZGREINRGIN 1 REQ_SEND GR_INVI_IM FI_INVOICE ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 REQ_SEND GR_INVI_IM INV_VERIF ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 REQ_SEND GR_INVI_NL FI_INVOICE ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 REQ_SEND GR_INVI_NL INV_VERIF ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 REQ_SEND GR_INVI_RE FI_INVOICE ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 REQ_SEND GR_INVI_RE INV_VERIF ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 REQ_SEND GR_INVI_SB FI_INVOICE ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 REQ_SEND GR_INVI_SB INV_VERIF ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 REQ_SEND GR_INV_IN FI_INVOICE ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 REQ_SEND GR_INV_IN INV_VERIF ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 SENDEDOC GR_INVI_IM FI_INVOICE ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 SENDEDOC GR_INVI_IM INV_VERIF ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 SENDEDOC GR_INVI_NL FI_INVOICE ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 SENDEDOC GR_INVI_NL INV_VERIF ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 SENDEDOC GR_INVI_RE FI_INVOICE ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 SENDEDOC GR_INVI_RE INV_VERIF ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 SENDEDOC GR_INVI_SB FI_INVOICE ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 SENDEDOC GR_INVI_SB INV_VERIF ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 SENDEDOC GR_INV_IN FI_INVOICE ZGREIN_INCOMING_REQUEST
ZGREINRGIN 1 SENDEDOC GR_INV_IN INV_VERIF ZGREIN_INCOMING_REQUEST

© SAP HELLAS Single Member S.A. 39


E-Invoicing Implementation guide

3.4.2.6 c (SM30) – Assign process step to process/interface/edoc type/ source


type

Edoc Vers Edoc Source Process Directi Interface


Process ion Interface ID Type Type Step on Description
O
ZGREIN ZGREIN_INCOMIN GR_INV FI_INV SENDE Outbou Incoming
RGIN 1 G_REQUEST I_NL OICE DOC nd Request
O
ZGREIN ZGREIN_INCOMIN GR_INV INV_VE SENDE Outbou Incoming
RGIN 1 G_REQUEST I_NL RIF DOC nd Request
O
ZGREIN ZGREIN_INCOMIN GR_INV FI_INV SENDE Outbou Incoming
RGIN 1 G_REQUEST I_SB OICE DOC nd Request
O
ZGREIN ZGREIN_INCOMIN GR_INV INV_VE SENDE Outbou Incoming
RGIN 1 G_REQUEST I_SB RIF DOC nd Request
I
ZGREIN ZGREIN_SEND_RE GR_INV FI_INV PROC_ Inboun Send
RGIN 1 SPONSE I_NL OICE RESP d Response
I
ZGREIN ZGREIN_SEND_RE GR_INV INV_VE PROC_ Inboun Send
RGIN 1 SPONSE I_NL RIF RESP d Response
I
ZGREIN ZGREIN_SEND_RE GR_INV FI_INV PROC_ Inboun Send
RGIN 1 SPONSE I_SB OICE RESP d Response
I
ZGREIN ZGREIN_SEND_RE GR_INV INV_VE PROC_ Inboun Send
RGIN 1 SPONSE I_SB RIF RESP d Response
O
ZGREIN ZGREIN_SEND_RE FI_INV SENDE Outbou Send
V 1 QUEST GR_INV OICE DOC nd Request
O
ZGREIN ZGREIN_SEND_RE SD_INV SENDE Outbou Send
V 1 QUEST GR_INV OICE DOC nd Request
O
ZGREIN ZGREIN_SEND_RE GR_INV FI_INV SENDE Outbou Send
V 1 QUEST _CR OICE DOC nd Request
O
ZGREIN ZGREIN_SEND_RE GR_INV SD_INV SENDE Outbou Send
V 1 QUEST _CR OICE DOC nd Request
I
ZGREIN ZGREIN_SEND_RE FI_INV PROC_ Inboun Send
V 1 SPONSE GR_INV OICE RESP d Response

© SAP HELLAS Single Member S.A. 40


E-Invoicing Implementation guide

I
ZGREIN ZGREIN_SEND_RE SD_INV PROC_ Inboun Send
V 1 SPONSE GR_INV OICE RESP d Response
I
ZGREIN ZGREIN_SEND_RE GR_INV FI_INV PROC_ Inboun Send
V 1 SPONSE _CR OICE RESP d Response
I
ZGREIN ZGREIN_SEND_RE GR_INV SD_INV PROC_ Inboun Send
V 1 SPONSE _CR OICE RESP d Response

3.4.3 Step 3: AIF Customizing (/aif/cust)

Set up AIF customizing for new process/interface. To tc /n/aif/cust

3.4.3.1 Define interfaces

Go to SAP Application Interface Framework (AIF) -> Interface development -> define interfaces.

Work Area: /EDOGR

© SAP HELLAS Single Member S.A. 41


E-Invoicing Implementation guide

Build 3 new interfaces named:

1 ZEINVEROUT
2 ZEINVOUT
3 ZEINVOUTR

Add below values:

ZEINVEROUT

InterfaceName ZEINVEROUT
Version 1
SAP DATA STRUCTURE EDOC_GR_MAPPING_SOURCE
Proxy Class Inbound
Proxy Class Outbound ZGREIN_CO_EINV_GREECE_SEND_INV
CorrStruct
Raw Data Structure ZGREIN_SEND_INVOICE_REQUEST
Record Type In row Structure SEND_INVOICE_REQUEST_PARAMETER
Check Function Module EDOC_AIF_GENERIC_CHECK
Init Function Before Mapping EDOC_AIF_INIT_REQUEST_MAPPING
Sep.Commit W
Interface Direction Both

© SAP HELLAS Single Member S.A. 42


E-Invoicing Implementation guide

ZEINVOUT

Namespace /EDOGR
InterfaceName ZEINVOUT
Version 1
SAP DATA STRUCTURE EDOC_GR_MAPPING_SOURCE
Proxy Class Inbound
Proxy Class Outbound ZGREIN_CO_EINV_GREECE_SEND_INV
CorrStruct
Raw Data Structure ZGREIN_SEND_INVOICE_REQUEST
Record Type In row Structure SEND_INVOICE_REQUEST_PARAMETER
Check Function Module EDOC_AIF_GENERIC_CHECK
Init Function Before Mapping EDOC_AIF_INIT_REQUEST_MAPPING
Sep.Commit W
Interface Direction Both

© SAP HELLAS Single Member S.A. 43


E-Invoicing Implementation guide

ZEINVOUTR

Namespace /EDOGR
InterfaceName ZEINVOUTR
Version 1
SAP DATA STRUCTURE EDOC_GR_SUM_MAPPING_TARGET
Proxy Class Inbound ZGREIN_CO_EINV_GREECE_SEND_INV
Proxy Class Outbound
CorrStruct X
Raw Data Structure ZGREIN_SEND_INVOICE_RESPONSE
Record Type In row Structure
Check Function Module
Init Function Before Mapping EDOC_AIF_INIT_RESPONSE_MAPPING
Sep.Commit W
Interface Direction Both

© SAP HELLAS Single Member S.A. 44


E-Invoicing Implementation guide

3.4.3.2 Specify Interface Engines

Go to SAP Application Interface Framework (AIF) -> Interface development -> Additional
Interface Properties -> Specify Interface Engines.

© SAP HELLAS Single Member S.A. 45


E-Invoicing Implementation guide

Maintain Parameters for 3 new interfaces.

Log
Interface Vers App|Engine NS Custo PersEngine NS Cu Sel.Engine NS Cust Engine
0 AIF 0 AIF
Index Application
ZEINVEROUT 1 0 Proxy 2 XML Tables Log
0 AIF 0 AIF
Index Application
ZEINVOUT 1 0 Proxy 2 XML Tables Log
0 AIF 0 AIF
Index Application
ZEINVOUTR 1 0 Proxy 2 XML Tables Log

3.4.3.3 Define Structure Mappings

Go to SAP Application Interface Framework (AIF) -> Interface development -> Define Structure
Mappings.

Work area /EDOGR – ZEINVEROUT - 1

© SAP HELLAS Single Member S.A. 46


E-Invoicing Implementation guide

Go to -> Assign actions

Set:

• Namespace:/EDO
• Action: GENERIC_ACTION
© SAP HELLAS Single Member S.A. 47
E-Invoicing Implementation guide

• Stop processing on Error = ‘ ’

Work area /EDOGR – ZEINVOUT - 1

Go to -> Assign actions

Set:

• Namespace:/EDO
• Action: GENERIC_ACTION
• Stop processing on Error = ‘X’

© SAP HELLAS Single Member S.A. 48


E-Invoicing Implementation guide

Work area /EDOGR – ZEINVOUTR - 1

Go to -> Assign actions

Set:

• Namespace:/EDO
• Action: GENERIC_ACTION
• Stop processing on Error = ‘X’

3.4.3.4 Define Value Mappings

© SAP HELLAS Single Member S.A. 49


E-Invoicing Implementation guide

Go to SAP Application Interface Framework (AIF) -> Interface development -> Define Value
Mappings

Namespace /EDOGR

3.4.3.4.1 Value mapping ZGREIN_UNITS_OF_MEAS

Create a value mapping named ZGREIN_UNITS_OF_MEAS:

• Description: Units of Measure Mapping for E-Invoicing


Data element for EXT1: ZZGREIN_QUANTITY_TYPE
• Data element for EXT2: ZZGREIN_UNIT_CODE_EN
• Data element for INT: ‘MEINS’
• Number of external values: ‘2’
• Single or multiple Value mapping: ‘M Multiple’
• Customizing or Master Data: ‘C Customizing’’
• Check uniqueness of external Values: ‘No check’
• Check uniqueness of internal Values: ‘Check with error’
• Check uniqueness of Combination: ‘Check with error’

© SAP HELLAS Single Member S.A. 50


E-Invoicing Implementation guide

Populate values:

• Values should be a mapping between SAP unit of measure and AADE Quantity type
and unit code
• Quantity type mapping has 3 possible values:
o 1: Piece
o 2: KG
o 3: LT
• Unit Code has respective values of AADE units of measure. Example: piece = H87

Example Mapping:

© SAP HELLAS Single Member S.A. 51


E-Invoicing Implementation guide

3.4.3.4.2 Value mapping ZGREIN_INVOICE_TYPE

Create a value mapping named ZGREIN_INVOICE_TYPE:

• Description: Invoice Type determination for E-Invoicing


Data element for EXT1: ZGREIN_DOCUMENT_TYPE
• Data element for INT: ‘HKONT’
• Number of external values: ‘1’
• Single or multiple Value mapping: ‘S Single’
• Customizing or Master Data: ‘C Customizing’’
• Check uniqueness of external Values: ‘No check’
• Check uniqueness of internal Values: ‘Check with error’
• Check uniqueness of Combination: ‘Check with error’

© SAP HELLAS Single Member S.A. 52


E-Invoicing Implementation guide

© SAP HELLAS Single Member S.A. 53


E-Invoicing Implementation guide

Define values:

This VMAP will determine whether a transaction is B2G of B2B based on the reconciliation
account of the customer in the document, not necessarily the same as the one in the master file.
All reconciliation accounts which are updated during the posting of invoices should be entered in
the value mapping. INVOICE stands for B2B and ELB2G stands for B2G.

Example values:

3.4.3.5 Define Namespace-Specific Features

Go to SAP Application Interface Framework (AIF) -> error handling -> Define Namespace-
specific Features.

© SAP HELLAS Single Member S.A. 54


E-Invoicing Implementation guide

Namespace /EDOGR

Define interface specific features

Set below values:

Message Index
Interface Version table Name Program Name Screen No
ZEINVEROUT 1 EDOAIFIDXREQ EDOC_AIF_SOURCE_DOC_SCR 0001
ZEINVOUT 1 EDOAIFIDXREQ EDOC_AIF_SOURCE_DOC_SCR 0001
ZEINVOUTR 1 EDOAIFIDXRES EDOC_AIF_SOURCE_DOC_SCR 0001

Configure Alerts:

Default Include Includ Include Include


Versio Recipien Success e Info Warnin Error Include Abort
Interface n t msg Msg g Msg Msg Msg

© SAP HELLAS Single Member S.A. 55


E-Invoicing Implementation guide

ZEINVEROU
T 1 ALL X X X X X
ZEINVOUT 1 ALL X X X X X
ZEINVOUTR 1 ALL X X X X X

3.4.3.6 Define interface-Specific Features

Go to SAP Application Interface Framework (AIF) -> error handling -> Define Interface-specific
Features.

Work area /EDOGR / ZEINVOUTR/ 1

© SAP HELLAS Single Member S.A. 56


E-Invoicing Implementation guide

Go to define key fields for multi search

Create three new field sequence numbers

Sequence ‘1’:

• Key field name: EDOC_GUID


• Data Element: EDOC_GUID
• Name Select Options/Parameter: SO_EDOID
• Field is select option: ‘X’
• Field Name: REFERENCE-EDOC_GUID
• Raw or SAP structure: ‘S’
• Multi.Selection Type: Single Selection

Sequence ‘2’:

© SAP HELLAS Single Member S.A. 57


E-Invoicing Implementation guide

• Key field name: SOURCE_TYPE


• Data Element: EDOC_SOURCE_TYPE
• Name Select Options/Parameter: P_SRCTYP
• Field is select option: ‘ ’
• Field Name: SOURCE_HEADER-SOURCE_TYPE
• Raw or SAP structure: ‘S’
• Multi.Selection Type: Single Selection
• Parent field sequence Number: 1

Sequence ‘3’:

• Key field name: SOURCE_KEY


• Data Element: EDOC_SOURCE_KEY
• Name Select Options/Parameter: SO_SRKEY
• Field is select option: ‘X’
• Field Name: SOURCE_HEADER-SOURCE_KEY
• Raw or SAP structure: ‘S’
• Multi.Selection Type: Single Selection
• Parent field sequence Number: 2

© SAP HELLAS Single Member S.A. 58


E-Invoicing Implementation guide

Work area /EDOGR / ZEINVOUT/ 1

Go to define key fields for multi search

Create three new field sequence numbers

© SAP HELLAS Single Member S.A. 59


E-Invoicing Implementation guide

Sequence ‘1’:

• Key field name: EDOC_GUID


• Data Element: EDOC_GUID
• Name Select Options/Parameter: SO_EDOID
• Field is select option: ‘X’
• Field Name: REFERENCE-EDOC_GUID
• Raw or SAP structure: ‘ ’
• Multi.Selection Type: Single Selection

Sequence ‘2’:

• Key field name: SOURCE_TYPE


• Data Element: EDOC_SOURCE_TYPE
© SAP HELLAS Single Member S.A. 60
E-Invoicing Implementation guide

• Name Select Options/Parameter: P_SRCTYP


• Field is select option: ‘ ’
• Field Name: SOURCE_HEADER-SOURCE_TYPE
• Raw or SAP structure: ‘ ’
• Multi.Selection Type: Single Selection
• Parent field sequence Number: 1

Sequence ‘3’:

• Key field name: SOURCE_KEY


• Data Element: EDOC_SOURCE_KEY
• Name Select Options/Parameter: SO_SRKEY
• Field is select option: ‘X’
• Field Name: SOURCE_HEADER-SOURCE_KEY
• Raw or SAP structure: ‘ ’
• Multi.Selection Type: Single Selection
• Parent field sequence Number: 2

© SAP HELLAS Single Member S.A. 61


E-Invoicing Implementation guide

Work area /EDOGR / ZEINVEROUT/ 1

Go to define key fields for multi search

Create three new field sequence numbers

© SAP HELLAS Single Member S.A. 62


E-Invoicing Implementation guide

Sequence ‘1’:

• Key field name: EDOC_GUID


• Data Element: EDOC_GUID
• Name Select Options/Parameter: SO_EDOID
• Field is select option: ‘X’
• Field Name: REFERENCE-EDOC_GUID
• Raw or SAP structure: ‘ ’
• Multi.Selection Type: Single Selection

© SAP HELLAS Single Member S.A. 63


E-Invoicing Implementation guide

Sequence ‘2’:

• Key field name: SOURCE_TYPE


• Data Element: EDOC_SOURCE_TYPE
• Name Select Options/Parameter: P_SRCTYP
• Field is select option: ‘ ’
• Field Name: SOURCE_HEADER-SOURCE_TYPE
• Raw or SAP structure: ‘ ’
• Multi.Selection Type: Single Selection
• Parent field sequence Number: 1

Sequence ‘3’:

• Key field name: SOURCE_KEY


• Data Element: EDOC_SOURCE_KEY
• Name Select Options/Parameter: SO_SRKEY
• Field is select option: ‘X’
• Field Name: SOURCE_HEADER-SOURCE_KEY
• Raw or SAP structure: ‘ ’
• Multi.Selection Type: Single Selection
• Parent field sequence Number: 2

© SAP HELLAS Single Member S.A. 64


E-Invoicing Implementation guide

3.4.4 EDOFACTORYV – Utilize new process assign class ZGREIN_EDOCUMENT_GR


to EDOFACTORY

• Maintain view EDOFACTORYV, for FI_INVOICE, INV_VERIF, SD_INVOICE


• Create new entries for FI_INVOICE, INV_VERIF, SD_INVOICE
• Assigning class: ZGREIN_CL_EDOC_FACTORY_GR

3.5 Badi EDOC_ADAPTOR implementation.

Implement BADI EDOC_ADAPTOR/ Interface IF_EDOC_ADAPTOR.

© SAP HELLAS Single Member S.A. 65


E-Invoicing Implementation guide

Important Note: if there is already an implementation with COUNTRY = ‘GR’ in filtering there is
no need for a new implementation. Adjust below coding to the already implemented in method
‘is_relevant’.

Important Note2: if there is already an implementation with COUNTRY = ‘GR’ changes may be
needed in other methods as well (ex set_output_data) to avoid dumps.

Add a call to method zgrein_cl_edocument_gr=>det_einv_relevant_and_process In the


beginning of the implemented method, and exit coding is relevant for e-invoicing (cx_relevant
= ‘X’).

V4 Update: As per V4 a new static method is provided in ZGREIN_CL_EDOCUMENT_GR


named set_output_data.

This can be called in set_output_data method of badi edoc_adaptor in order to move custom logic
to the new process.

Example call.

This coding will ensure that documents relevant for e-Invoicing, will not get processed by the
existing process and vice versa.

Add below code in method IS_RELEVANT.

© SAP HELLAS Single Member S.A. 66


E-Invoicing Implementation guide

DATA: lv_einv_relevant TYPE abap_bool.

CALL METHOD zgrein_cl_edocument_gr=>det_einv_relevant_and_process


EXPORTING
io_source = io_source
CHANGING
cx_einv_relevant = lv_einv_relevant.
* cv_einv_process =
IF lv_einv_relevant = abap_true.
cx_relevant = abap_false.
ENDIF.

Method will determine if document is relevant for eBooks process or new e-invoicing process.

3.6 Badi EDOC_INTERFACE_CONNECTOR implementation.

A new implementation of BADI EDOC_INTERFACE_CONNECTOR will be created with the


import of the transport request provided §3.3

The enhancement comes with the below filtering to ensure that e-invoicing related documents
will go through the ZGREIN_ implementation (GENERIC_FILTER = ZGREIN_INV)

© SAP HELLAS Single Member S.A. 67


E-Invoicing Implementation guide

Ensure that current implementations of the enhancement with filter ‘GR’ have
GENERIC_FILTER = ‘’ (blank) to so that standard ebooks relevant documents should go through
the current implementation. For S4 the initial implementation should be
EI_EDOC_INTF_CONN_GR. For ECC should be a Z-implementation.

Note: interface type may vary according to system settings.

3.7 Printing Programs Modifications

In order to submit the eInvoice to Impact and achieve Printing Program Integration with eInvoice
- Real-time Issuance & QR Code you have to make the following modifications in printing
programs J_2GPFI and J_2GLPPSD.

© SAP HELLAS Single Member S.A. 68


E-Invoicing Implementation guide

3.7.1 Program J_2GPFI Modifications

In case you are using the FI printing program to issue legal documents you have to make the
following modifications:

Include Program J_2GPFI1_EDOC

• Go to transaction code se38.


• In the field Program enter ‘J_2GPFI1_EDOC’ and press change.

At the end of the include insert the following lines.

data : gv_ac type ZGREIN_edogrinv-AUTHENTICATIONCODE,

gv_impact(120) VALUE

'Information systems IMPACT Μον. AE www.einvoicing.gr


2023_10_103Impact_002_Impact eInvoicing_V1_24102023'.

data : gv_url2 TYPE edoc_gr_qrurl,

gv_offline_reason type string.

Include Program J_2GPFI4_EDOC

• Go to transaction code se38.


• In the field Program enter ‘J_2GPFI4_EDOC’ and press change.
• Find line:
“CALL METHOD cl_edocument_gr=>update_legal_data_to_edocument”
and replace it with
“CALL METHOD zgrein_cl_edocument_gr=>update_legal_data_to_edocument”
• Save and activate.

Include Program J_2GPFI4_SUBM_EDOC

• Go to transaction code se38.


• In the field Program enter ‘J_2GPFI4_SUBM_EDOC’ and press change.

© SAP HELLAS Single Member S.A. 69


E-Invoicing Implementation guide

• Find line:
“DATA : lr_edocument_gr TYPE REF TO cl_edocument_gr.”
and insert below this one, the following line:
“DATA : zlr_edocument_gr TYPE REF TO zgrein_cl_edocument_gr.”
• Find the non-commented out line:
“ro_edocument = DATA(lo_edocument) ). " eDocument Class”
and insert below this line the following code:
“ IF lo_edocument->ms_edocument-
process = zgrein_cl_edocument_gr=>gc_edoc_process-invoice_std
OR lo_edocument->ms_edocument-
process = zgrein_cl_edocument_gr=>gc_edoc_process-invoice_reg_std.”
• Find the below context:
“gv_url = 'INABILITY OF MARK RETRIEVAL FROM IAPR'(r12).
lh_actions-print_mydata_info = abap_undefined.

ENDIF.”
and insert the following code below this context:
“ ELSEIF lo_edocument->ms_edocument-
process = zgrein_cl_edocument_gr=>gc_edoc_process-invoice
OR lo_edocument->ms_edocument-
process = zgrein_cl_edocument_gr=>gc_edoc_process-invoice_reg.

zlr_edocument_gr ?= lo_edocument.

"Do we need myDATA call?


"Yes if user has not requested exception and eDoc has not been
submitted
IF p_woqr = abap_off AND zlr_edocument_gr->ms_edogrinv-
inv_mark IS INITIAL.
"online submissions to myDATA are allowed only within the bil
ling date (user's timezone) - overdue subissions only from the cockpit
* IF sy-datlo <> lh_bkpf-
budat. "n3421397mk-
IF sy-datlo <> lt_valid-
budat. "n3421397mk+
MESSAGE e398(00) WITH
|{ 'Invoices issued before current date'(eq4) } { sy-
datlo DATE = USER }|
'can be submitted to myDATA only from the cockpit.'(eq5)
'You will be able to print the invoice once it is'(eq6)
'successfully submitted.'(eq7)
INTO lv_msg.
zlr_edocument_gr->raise_edoc_exception( ).
ENDIF.

© SAP HELLAS Single Member S.A. 70


E-Invoicing Implementation guide

"submit the eDoc to myDATA


if s_list = ' ' and s_log = 'X'.
"n3421397mk+
WRITE: / |{ 'Submitting eDoc'(eqc) } { zlr_edocument_gr-
>ms_edogrinv-edoc_guid } { 'to myDATA...'(eqd) }|.
endif.
"n3421397mk+
if zlr_edocument_gr->ms_edocument-
proc_status = zlr_edocument_gr->gc_edoc_status-
rejected. "n3421397mk4+
zlr_edocument_gr->mo_process-
>execute_action( iv_action = 'RESUBMIT' ). "n34213
97mk4+
else.
"n3421397mk4+
zlr_edocument_gr->mo_process-
>execute_action( iv_action = 'SUBMIT' ).
endif.
"n3421397mk4+

"get result
IF zlr_edocument_gr->ms_edogrinv-inv_mark IS NOT INITIAL.
gv_mark_id = zlr_edocument_gr->ms_edogrinv-inv_mark.
gv_uid = zlr_edocument_gr->ms_edogrinv-inv_uid.
gv_url = zlr_edocument_gr->ms_edogrinv-qrurl.
lh_actions-print_mydata_info = abap_true.
gv_hide_url = gv_url.
*{++V3
select single AUTHENTICATIONCODE into gv_ac
from zgrein_edogrinv
where EDOC_GUID = zlr_edocument_gr->ms_edogrinv-edoc_guid.
*}++V3

if s_list = ' ' and s_log = 'X'.


"n3421397mk+
WRITE: / 'MARK:' INTENSIFIED OFF, |{ gv_mark_id }|, 'UID:
' INTENSIFIED OFF, |{ gv_uid }|,
/ 'URL:' INTENSIFIED OFF, gv_url HOTSPOT ON.
HIDE gv_hide_url. CLEAR gv_hide_url.
endif.
"n3421397mk+
ELSE.
MESSAGE e398(00) WITH
'Submission to myDATA failed. Check the errors'(eq8)
|{ 'in DRC cockpit for source'(eq9) } { lv_source_key }.|
'Reprint the invoice as soon as the error causes'(eqa)
'are eliminated (within the same day).'(eqb)
© SAP HELLAS Single Member S.A. 71
E-Invoicing Implementation guide

INTO lv_msg.
* zlr_edocument_gr->raise_edoc_exception( ). --V3
*{++ V3
** create offline qrcode
*
DATA:
vat_total type MWSBP,
net_total type netwr.

vat_total = lh_header-summ_tax + lh_header-summ_tax2 +


lh_header-summ_tax3.
net_total = lh_header-summary + lh_header-summary2 +
lh_header-summary3.

call method zlr_edocument_gr->create_offline_qr "+ Update3


exporting
i_kunnr = lh_partner-code
i_total_vat_amount = vat_total
i_total_net_amount = net_total
importing
e_offline_qr_part1 = gv_url
e_offline_qr_part2 = gv_url2
e_offline_reason = gv_offline_reason.

lh_actions-print_mydata_info = abap_true.
*}++V3
ENDIF.

"No if eDoc has already been submitted (old submissions w/ MARK


but no URL, will be printed only w/ MARK and no QR)
ELSEIF zlr_edocument_gr->ms_edogrinv-inv_mark IS NOT INITIAL.
gv_mark_id = zlr_edocument_gr->ms_edogrinv-inv_mark.
gv_uid = zlr_edocument_gr->ms_edogrinv-inv_uid.
gv_url = zlr_edocument_gr->ms_edogrinv-qrurl.
lh_actions-print_mydata_info = abap_true.
gv_hide_url = gv_url.
*{++V3
select single AUTHENTICATIONCODE into gv_ac
from zgrein_edogrinv
where EDOC_GUID = zlr_edocument_gr->ms_edogrinv-edoc_guid.
*}V3
if s_list = ' ' and s_log = 'X'.
"n3421397mk+
WRITE: / 'MARK:' INTENSIFIED OFF, |{ gv_mark_id }|, 'UID:'
INTENSIFIED OFF, |{ gv_uid }|,
/ 'URL:' INTENSIFIED OFF, gv_url HOTSPOT ON.
© SAP HELLAS Single Member S.A. 72
E-Invoicing Implementation guide

HIDE gv_hide_url. CLEAR gv_hide_url.


endif.
"n3421397mk+

"No if user requested exception to issue w/o QR (p_woqr = abap_


on)
ELSE.
if s_list = ' ' and s_log = 'X'.
"n3421397mk+
WRITE / 'User chose to print the document without submittin
g it to myDATA'(eqe).
endif.
"n3421397mk+
“—V3
*{++ V3
* lh_actions-print_mydata_info = abap_undefined.
** create offline qrcode

vat_total = lh_header-summ_tax + lh_header-summ_tax2 +


lh_header-summ_tax3.
net_total = lh_header-summary + lh_header-summary2 +
lh_header-summary3.

call method zlr_edocument_gr->create_offline_qr "+ Update3


exporting
i_kunnr = lh_partner-code
i_total_vat_amount = vat_total
i_total_net_amount = net_total
importing
e_offline_qr_part1 = gv_url
e_offline_qr_part2 = gv_url2
e_offline_reason = gv_offline_reason.

lh_actions-print_mydata_info = abap_true.
*}++V3
* lh_actions-print_mydata_info = abap_undefined. “—V3

ENDIF.

ENDIF.”

Save and activate.

© SAP HELLAS Single Member S.A. 73


E-Invoicing Implementation guide

3.7.2 Program J_2GLPPSD Modifications

* V3 Start

Include Program J_2GLPPSD_EDOC

• Go to transaction code se38.


• In the field Program enter ‘J_2GLPPSD_EDOC’ and press change.

At the end of the include insert the following lines.

data : gv_ac type ZGREIN_edogrinv-AUTHENTICATIONCODE,

gv_impact(120) VALUE

'Information systems IMPACT Ìïí. AE www.einvoicing.gr 2023_10_103Impact_002_Impact


eInvoicing_V1_24102023'.

data : gv_url2 TYPE edoc_gr_qrurl,

gv_offline_reason type string.

*V3 end

Include Program J_2GLPTIM_EDOC & J_2GLPDATIM_EDOC

• Go to transaction code se38.


• In the field Program enter ‘J_2GLPTIM_EDOC’ and press change.
• Find line:
“CALL METHOD cl_edocument_gr=>update_legal_data_to_edocument”
and replace it with
“CALL METHOD zgrein_cl_edocument_gr=>update_legal_data_to_edocument”
• Save and activate.

Include Program J_2GLPTIM_SUBM_EDOC

• Go to transaction code se38.


• In the field Program enter ‘J_2GLPTIM_SUBM_EDOC’ and press change.
• Find line:
“DATA : lr_edocument_gr TYPE REF TO cl_edocument_gr.”
and insert below this one, the following line:
© SAP HELLAS Single Member S.A. 74
E-Invoicing Implementation guide

“DATA : zlr_edocument_gr TYPE REF TO zgrein_cl_edocument_gr.”


• Find the non-commented out line:
“ro_edocument = DATA(lo_edocument) ). " eDocument Class”
and insert below this line the following code:
“ IF lo_edocument->ms_edocument-
process = zgrein_cl_edocument_gr=>gc_edoc_process-invoice_std.”
• Find the below context:
“gv_url = 'INABILITY OF MARK RETRIEVAL FROM IAPR'(r12).
lh_actions-print_mydata_info = abap_undefined.

ENDIF.”
and insert the following code below this context:
“ ELSEIF lo_edocument->ms_edocument-
process = zgrein_cl_edocument_gr=>gc_edoc_process-invoice.

zlr_edocument_gr ?= lo_edocument.

"Do we need myDATA call?


"Yes if user has not requested exception and eDoc has not been
submitted
IF p_woqr = abap_off AND zlr_edocument_gr->ms_edogrinv-
inv_mark IS INITIAL.
"online submissions to myDATA are allowed only within the bil
ling date (user's timezone) - overdue subissions only from the cockpit
IF sy-datlo <> lt_vbrk-fkdat.
MESSAGE e398(00) WITH
|{ 'Invoices issued before current date'(eq4) } { sy-
datlo DATE = USER }|
'can be submitted to myDATA only from the cockpit.'(eq5)
'You will be able to print the invoice once it is'(eq6)
'successfully submitted.'(eq7)
INTO lv_msg.
zlr_edocument_gr->raise_edoc_exception( ).
ENDIF.

"submit the eDoc to myDATA


WRITE: / |{ 'Submitting eDoc'(eqc) } { zlr_edocument_gr-
>ms_edogrinv-edoc_guid } { 'to myDATA...'(eqd) }|.
if zlr_edocument_gr->ms_edocument-
proc_status = zlr_edocument_gr->gc_edoc_status-
rejected. "n3421397mk4+
zlr_edocument_gr->mo_process-
>execute_action( iv_action = 'RESUBMIT' ). "n34213
97mk4+
else.
© SAP HELLAS Single Member S.A. 75
E-Invoicing Implementation guide

"n3421397mk4+
zlr_edocument_gr->mo_process-
>execute_action( iv_action = 'SUBMIT' ).
endif.
"n3421397mk4+

"get result
IF zlr_edocument_gr->ms_edogrinv-inv_mark IS NOT INITIAL.
gv_mark_id = zlr_edocument_gr->ms_edogrinv-inv_mark.
gv_uid = zlr_edocument_gr->ms_edogrinv-inv_uid.
gv_url = zlr_edocument_gr->ms_edogrinv-qrurl.
lh_actions-print_mydata_info = abap_true.
gv_hide_url = gv_url.
*{++V3

select single AUTHENTICATIONCODE into gv_ac


from zgrein_edogrinv
where EDOC_GUID = zlr_edocument_gr->ms_edogrinv-edoc_guid.
*}++V3

WRITE: / 'MARK:' INTENSIFIED OFF, |{ gv_mark_id }|, 'UID:'


INTENSIFIED OFF, |{ gv_uid }|,
/ 'URL:' INTENSIFIED OFF, gv_url HOTSPOT ON.
HIDE gv_hide_url. CLEAR gv_hide_url.
ELSE.
MESSAGE e398(00) WITH
'Submission to myDATA failed. Check the errors'(eq8)
|{ 'in DRC cockpit for source'(eq9) } { lv_source_key }.|
'Reprint the invoice as soon as the error causes'(eqa)
'are eliminated (within the same day).'(eqb)
INTO lv_msg.

*{++V3
** create offline qrcode
*
* Note: Due to Sapscript/Smartform variable limitation to 255
* characters, the method returns the Offline QR Code splitted in two
* parts (gv_url/gv_url2). You need to create a SO10 text with the
* following line to produce the QR Code (assuming BC is the character
* format for QRCode).
* <BC>&gv_url&&gv_url2&</>

call method zlr_edocument_gr->create_offline_qr "+ Update3


exporting
i_kunnr = lt_vbrk-kunrg
i_total_vat_amount = lt_vbrk-MWSBK
i_total_net_amount = lt_vbrk-netwr
importing
© SAP HELLAS Single Member S.A. 76
E-Invoicing Implementation guide

e_offline_qr_part1 = gv_url
e_offline_qr_part2 = gv_url2
e_offline_reason = gv_offline_reason.

lh_actions-print_mydata_info = abap_true.
}++V3

* zlr_edocument_gr->raise_edoc_exception( ).”—V3
ENDIF.

"No if eDoc has already been submitted (old submissions w/ MARK


but no URL, will be printed only w/ MARK and no QR)
ELSEIF zlr_edocument_gr->ms_edogrinv-inv_mark IS NOT INITIAL.
gv_mark_id = zlr_edocument_gr->ms_edogrinv-inv_mark.
gv_uid = zlr_edocument_gr->ms_edogrinv-inv_uid.
gv_url = zlr_edocument_gr->ms_edogrinv-qrurl.
lh_actions-print_mydata_info = abap_true.
gv_hide_url = gv_url.
WRITE: / 'MARK:' INTENSIFIED OFF, |{ gv_mark_id }|, 'UID:' IN
TENSIFIED OFF, |{ gv_uid }|,
/ 'URL:' INTENSIFIED OFF, gv_url HOTSPOT ON.
HIDE gv_hide_url. CLEAR gv_hide_url.

"No if user requested exception to issue w/o QR (p_woqr = abap_


on)
ELSE.
WRITE / 'User chose to print the document without submitting
it to myDATA'(eqe).
“—V3
*{++V3
** create offline qrcode
*
call method zlr_edocument_gr->create_offline_qr "+ Update3
exporting
i_kunnr = lt_vbrk-kunrg
i_total_vat_amount = lt_vbrk-MWSBK
i_total_net_amount = lt_vbrk-netwr
importing
e_offline_qr_part1 = gv_url
e_offline_qr_part2 = gv_url2
e_offline_reason = gv_offline_reason.

*}++V3
lh_actions-print_mydata_info = abap_true.
© SAP HELLAS Single Member S.A. 77
E-Invoicing Implementation guide

* lh_actions-print_mydata_info = abap_undefined. “—V3

ENDIF.

ENDIF.”

Save and activate.

Note 3: If company is using Z* printing program copied from the standard J these changes must
be adapted in the custom programs instead.

V3: Note 4:

With the adjustments introduced as per V3, a document will always be printed even if there is a
failure in transmission with an offline QR Code and a failure message.

According to your business procedures, you may stop the program from printing the document if
transmission fails.

3.8 Process determination Customizing ZGREIN_CUST

The purpose of this customizing table is to assign the new process to the documents which must
be submitted to the provider.

General Rule: Each document will be assigned only to one process, either the new one or to the
old one.

The table looks like this:

© SAP HELLAS Single Member S.A. 78


E-Invoicing Implementation guide

a) Company Code Activation

Since there may be many company codes in your system and the new processes may apply only to
some of your legal entities, you activate the related company codes in this step. Just create new
entries with the company codes and press the ‘Active’ checkbox.

b) Activate the Source Type

© SAP HELLAS Single Member S.A. 79


E-Invoicing Implementation guide

In this step you activate the Source Type, meaning the module which generates the document. The
valid values are SD_INVOICE, FI_INVOICE, INV_VERIF (for invoices from MM).

c) Process Derivation

Finally, we have to derive the process.

For SD_Invoice the following are true:

• The Billing Document Type may be used. In case it is used, it has priority over the next
option which is the combination of Document Type and G/L Account.

• As an alternative the Document Type /GL Revenue Account from-to combination


may be used.

• In case one line item of the document meets the criterion, the process will be
© SAP HELLAS Single Member S.A. 80
E-Invoicing Implementation guide

derived, and the program will exit.


• In case the document comes from SD and the billing type is on the customizing
table assigned to a process, the program will get the process and will exit.
• If the billing type is not in the customizing table, the program will search for the
revenue accounts. In case it finds one DT / Revenue account range in the
customizing table it will get the process and will exit. Then it will search the next
revenue account and so forth. Obviously, you can use both alternatives.
• In case the program ‘finds’ billing type in the customizing table or DT / Revenue
accounts, but the process has not been assigned in the customizing table, an error
message will be displayed, and the accounting document will not be created.

For FI_Invoice source type the following are true:

• FI_Invoice source type applies to both outgoing and incoming invoices. The
distinction between the two is achieved using the customizing table.
• Self-Billing (Αυτοτιμολόγηση) has priority, meaning that in case the document
meets the criterion defined in the Standard E-Books solution and has been
classified as ‘Self Billing’, you have to submit it through the provider, therefore
you have to assign the Standard E-Document Type GR_INVI_SB to the new
process.

• Per Reason Codes. You can derive the new process with the use of the Standard SAP
field Reason Code. Please note the that:

© SAP HELLAS Single Member S.A. 81


E-Invoicing Implementation guide

▪ The reason code is used in the customer/vendor line items. Standard


customizing is required, field status group etc.
▪ It may be already in use in the AIF value mapping customizing for the
Invoice Type derivation (see picture below). There is no problem using
it in this customizing table too.

See below picture with an example.

Per Document Type and G/L Revenue / Supplier Offsetting (Expense, Stock, Asset) Account.
Please see previous paragraph for SD_Invoice.

© SAP HELLAS Single Member S.A. 82


E-Invoicing Implementation guide

In case the document comes from FI and

• Is classified as Self-Billing then the process will be derived from the Self-Billing
customizing entry. If it is not classified as Self-Billing, the program will continue.
• There is Reason Code in the customer / vendor line item and the reason code has been
entered in the customizing table, then the process will be derived. If there is no reason
code in the customer / vendor line item, the program will continue.
• The Document and the Revenue / Supplier Offsetting (Expense, Stock, Asset) Account
have been entered in the customizing table, then the process will be derived. If not, the
program will exit. Obviously, you can use all alternatives.
• In case the program ‘finds’ the Self-Billing type in the customizing table or Reason
Code, or DT / Revenue accounts, but the process has not been assigned in the
customizing table, an error message will be displayed, and the accounting document
will not be created.

For INV_VERI, Invoice Verification source type the following are true:

• Self-Billing: Please check previous paragraph.

© SAP HELLAS Single Member S.A. 83


E-Invoicing Implementation guide

• Per Document Type and G/L Supplier Offsetting (Expense, Stock, Asset) Account.
Please see previous paragraph for FI_Invoice.

In case the document comes from MM and

• Is classified as Self-Billing then the process will be derived from the Self-Billing
customizing entry. If it is not classified as Self-Billing, the program will continue.
• The Document and the Revenue / Supplier Offsetting (Expense, Stock, Asset) Account
have been entered in the customizing table, then the process will be derived. If not, the
program will exit. Obviously, you can use both alternatives.

3.8.1 Process determination Technical Details

New process is generated in by EDOFACTORY standard logic initiated from customizing in


§3.4.4.

Determination logic is implemented in method det_einv_relevant_and_process of class


© SAP HELLAS Single Member S.A. 84
E-Invoicing Implementation guide

zgrein_cl_edocument_gr.
Method is called

• in method IS_RELEVANT of badi EDOC_ADAPTOR (§3.5), to determine if document


is relevant for standard Ebooks,
• In method IS_RELEVANT of class ZGREIN_CL_EDOCUMENT_GR to determine if
document is relevant for the new Z-process
• In method DETERMINE_PROCESS of class ZGREIN_CL_EDOCUMENT_GR to
determine which process is relevant for the specific document.

4. Proxy structure and mapping details.

Data from SAP documents are mapped to proxy structure provided from the attached
“eInvGreeceSendInvoiceV2.wsdl” file which is attached in this Sap Note:
ZGREIN_SEND_INVOICE_REQUEST

Full mapping structure is of type ZGREIN_AADE_BOOK_INVOICE_TYPE (provided by the


same .wsdl file as above)

Below you may find the mapping provided in detail mainly for the header data. Table types and
complex structures will be detailed in separate paragraphs. NP stands for ‘not provided’. For most
of the header data the mapping logic developed for the ‘standard’ eBooks is adopted. For more
details for fields mapped ‘As per standard GR eBooks’ refer to the standard eBooks
documentation.

© SAP HELLAS Single Member S.A. 85


E-Invoicing Implementation guide

4.1 ZGREIN_AADE_BOOK_INVOICE_TYPE

Header data of invoice document.

• Mapping Class: ZGREIN_CL_EDOC_MAP_GR


• Mapping Method: FILL_INVOICE_HEADER

Mapping details:

Component
Field type Mapping details
ERP STRING Default ‘X V3
UID STRING NP
Unique number of document.
VBRK-VBELN for SD invoices, concatenation of
BKPF-BUKRS BKPF-BELNR BKPF-GJAHR for
UNIQUEID STRING accounting documents
MARK STRING NP
CANCELLATION_MARK STRING NP
PUBLIC_SIGNATURE STRING NP
XSDBOOL Based on the print task code properties. Defines if V
IS_DELIVERY_NOTE EAN invoice is a combined delivery note/invoice or not 4
SERIES STRING As per standard GR eBooks
NUMBER STRING As per standard GR eBooks
BKPF-BUDAT BKPFCPUTM in yyyy-mm-
DATE_ISSUED STRING ddThh:mm:ss Format
ELB2G’ if transaction is B2G else ‘INVOICE’
Based on ZGREIN_INVOICE_TYPE value
DOCUMENT_TYPE_CODE STRING mapping
Description of document_type_code from table
EDOGRINVTYPET-DESCRIPTION . Language
INVOICE_TYPE CHAR communication language of Counter Party
INVOICE_TYPE_CODE STRING As per standard GR eBooks
SPECIAL_INVOICE_CATE
GORY INT4 Default 0
VARIATION_TYPE INT4 As per standard GR eBooks
CURRENCY_CODE STRING As per standard GR eBooks
Proxy Table Reference legal Doc (ex delivery note). As
RELATIVE_DOCUMENTS Type determined from legal printing.
Proxy Table Mark of correlated invoices. As per standard
CORRELATED_INVOICES Type eBooks

© SAP HELLAS Single Member S.A. 86


E-Invoicing Implementation guide

V
4
MULTIPLE_CONNECTED_ Proxy Table
MARKS Type NP
Concatenation
VAT_No|DD/MM/YYYY|’0’|INVOICE_TYPE|S
GSIS_RELATED_INVOICE Proxy Table ERIES|Number of correlated invoices. Applicable
S Type only for B2G
DISPATCH_ADVICE String NP V3
REFERENCE_CODE String NP V3
ORDER_CODE String NP V3
ORDER_SERIES String NP V3
ORDER_NUMBER String NP V3
LOT_NUMBER String NP V3
Proxy
B2G_DETAILS structure §4.2
Proxy
ISSUER structure §4.2.1
Proxy
COUNTER_PARTY structure §4.2.2
Proxy
RECIPIENT structure §4.2.3
Proxy V4
VAT_MEDIATOR structure NP
Proxy V4
TRANSPORTER structure NP
SENDER Proxy V4
structure NP
CONTRACT_ORDER_DET Proxy Table V3
AILS Type §4.2.10
Proxy V4
DISTRIBUTION_DETAILS structure §4.2.4
Proxy
PAYMENT_DETAILS structure §4.2.5
Proxy
ADDITIONAL_DETAILS structure NP
ALLOWANCES_CHARGE Proxy Table
S Type NP
Proxy Table
DETAILS Type §4.2.6
Proxy Table
TAXES Type §4.2.7
Proxy
SUMMARIES structure §4.2.8
Proxy Table
VAT_ANALYSIS Type §4.2.9

© SAP HELLAS Single Member S.A. 87


E-Invoicing Implementation guide

Proxy Table
BANKS Type NP
Proxy
MISCELLANEOUS_DATA structure NP
VAT_PAYMENT_SUSPEN
SION CHAR1 NP
SELF_PRICING CHAR1 Case self-billing
IS_FUEL_INVOICE CHAR1 NP
0 if document is transmitted ok and real time. V
1 if document send delayed or not transmitted to 3
IS_DELAYED_CODE String AADE due to erros .

4.2 B2G Details

In this section data applicable only for B2G transactions are provided. Mapping logic is based on
a special partner that will carry in the names of the AADE required fields.

The partner should be under a special partner function in SD documents or as an alternative payee
(BSEG- EMPFB) in FI documents. Special partner function is maintained in a constant attribute
C_CONTR_AUTH_PARVW of class ZGREIN_CL_EDOC_MAP_GR

• Mapping class:
o ZGREIN_CL_EDOC_MAP_GR_SD for SD documents
o ZGREIN_CL_EDOC_MAP_GR_FI for FI Documents
• Mapping Method: FILL_CONTRACTING_AUTHORITY

Mapping details:

Field Type Mapping details


Name1 of special
CONTRACTING_AUTHORITY CHAR50 partner
Name2 of special
CONTRACTING_AUTHORITY_CODE CHAR150 partner
Name3 of special
CONTRACT_ TYPE _CODE CHAR50 partner
Name4 of special
CONTRACT_ REFERENCE _CODE CHAR50 partner
© SAP HELLAS Single Member S.A. 88
E-Invoicing Implementation guide

Note 1:

CPV Code: This is a codification required from AADE for B2G transactions. The CPV codes are
maintained in table T604F. Then the mapping of each material is maintained in the material master
file, TAB International Trade. Please note that you can use just one plant (no need to maintain the
mapping in all plants) to maintain the mapping and then derive the correct CPV code in your
custom class.

Note 2: The alternative payee in document for the FI Invoices is maintained in the following screen
and has to be used only in cases where the customer sells goods or services to Public Sector legal
entities, using the FI module and not the SD.

© SAP HELLAS Single Member S.A. 89


E-Invoicing Implementation guide

4.2.1 Issuer

Issuer as provided by standard eBooks. Additional data mapped from Hellenization FM


J_2GMDM_C (or J_2GMDM_K in case issuer is a vendor (case self-billing with variation type
‘2’)) output structure J_2GMD.

• Mapping class: ZGREIN_CL_EDOC_MAP_GR


• Mapping Method: FILL_ISSUER

Mapping details:

Field Type Mapping details


CODE CHAR10 NP
EXTERNAL_CODE CHAR20 NP
REGISTERED_NAME CHAR200 J_2GMD-name1
OTHER_INFO String NP V3
BRAND_NAME CHAR200 J_2GMD-name1
GENERAL_COMMERCIAL_REGISTRY_NU CHAR20 Addr-sort1
REGISTRATION_NUMBER CHAR20 addr-sort2
VAT STRING EL + J_2GMD-taxauth
© SAP HELLAS Single Member S.A. 90
E-Invoicing Implementation guide

YSN String NP (V3)


URL String NP (V3)
TAX_OFFICE CHAR100 J_2GMD-taxauth
ACTIVITIES Table of string J_2GMD-prof
PHONES Table of string J_2GMD-telf1
FAXES Table of string J_2GMD-telfx
EMAILS Table of string J_2GMD-email
BRANCH_CODE INT4 NP

Country name in counter party


COUNTRY CHAR50 communication language
COUNTRY_CODE string addr-country
STREET CHAR150 J_2GMD-strna
NUMBER string J_2GMD-strnr
POSTAL string J_2GMD-pstlz
CITY CHAR150 J_2GMD-city

4.2.2 Counter Party

Counter party as provided by standard eBooks. Additional data mapped from Hellenization FM
J_2GMDM_D (structure J_2GMD).

• Mapping class: ZGREIN_CL_EDOC_MAP_GR


• Mapping Method: FILL_COUNTER_PARTY

Mapping details:

Field Type Mapping details


CODE CHAR10 NP
EXTERNAL_CODE CHAR20 NP
REGISTERED_NAME CHAR200 J_2GMD-name1
OTHER_INFO String NP V3
BRAND_NAME CHAR200 J_2GMD-name1
GENERAL_COMMERCIAL_REGISTRY_NU CHAR20 Addr-sort1
REGISTRATION_NUMBER CHAR20 addr-sort2
VAT STRING EL + J_2GMD-taxauth
YSN String NP (V3)
URL String NP (V3)
TAX_OFFICE CHAR100 J_2GMD-taxauth
© SAP HELLAS Single Member S.A. 91
E-Invoicing Implementation guide

ACTIVITIES Table of string J_2GMD-prof


PHONES Table of string J_2GMD-telf1
FAXES Table of string J_2GMD-telfx
EMAILS Table of string J_2GMD-email
BRANCH_CODE INT4 NP
Country name in counter
party communication
COUNTRY CHAR50 language
COUNTRY_CODE string addr-country
STREET CHAR150 J_2GMD-strna
NUMBER string J_2GMD-strnr
POSTAL string J_2GMD-pstlz
CITY CHAR150 J_2GMD-city

4.2.3 Recipient

Recipient partner of the SD document, maintained in constant attribute C_RECIPIENT_PARVW


of class ZGREIN_CL_EDOC_MAP_GR. Additional data mapped from Hellenization FM
J_2GMDM_D (structure J_2GMD). Applicable only for SD documents.

• Mapping class: ZGREIN_CL_EDOC_MAP_GR_SD


• Mapping Method: FILL_RECIPIENT

Mapping details:

Field Type Mapping details


CODE CHAR10 NP
EXTERNAL_CODE CHAR20 NP
REGISTERED_NAME CHAR200 J_2GMD-name1
OTHER_INFO String NP V3
BRAND_NAME CHAR200 J_2GMD-name1
GENERAL_COMMERCIAL_REGISTRY_NU CHAR20 Addr-sort1
REGISTRATION_NUMBER CHAR20 addr-sort2
VAT STRING EL + J_2GMD-taxauth
YSN String NP (V3)
URL String NP (V3)
TAX_OFFICE CHAR100 J_2GMD-taxauth

© SAP HELLAS Single Member S.A. 92


E-Invoicing Implementation guide

Table of
ACTIVITIES string J_2GMD-prof
Table of
PHONES string J_2GMD-telf1
Table of
FAXES string J_2GMD-telfx
Table of
EMAILS string J_2GMD-email
BRANCH_CODE INT4 NP

Country name in counter party


COUNTRY CHAR50 communication language
COUNTRY_CODE string addr-country
STREET CHAR150 J_2GMD-strna
NUMBER string J_2GMD-strnr
POSTAL string J_2GMD-pstlz
CITY CHAR150 J_2GMD-city

4.2.4 Distribution Details

Related documents (delivery notes) and other distribution details. Applicable only for SD
documents.

Related documents retrieved from Hellenization printing program logic (structure lt_items of
program J_2glppsd maintained in constant attribute C_PRINTING_PROGRAM_SD of class
ZGREIN_CL_EDOC_MAP_GR)

• Mapping class: ZGREIN_CL_EDOC_MAP_GR


• Mapping Method: FILL_INVOICE_DETAILS_WRAP_SD
V4 update: Other details are populated in dedicated method FILL_DISTRIBUTION_DETAILS

Mapping details:

Field Type Mapping details


Unique number of document.
VBRK-VBELN for SD invoices,
conctatenation of BKPF-BUKRS BKPF-
BELNR BKPF-GJAHR for accounting
INTERNAL_DOCUMENT_ID CHAR20 documents
Date of the delivery in DD-MM-YYYY
DELIVERY_DATE CHAR10 Format

© SAP HELLAS Single Member S.A. 93


E-Invoicing Implementation guide

Date of the delivery in DD-MM-YYYY


DISPATCH_DATE string Format
DISPATCH_TIME String NP
SHIPPING_METHOD CHAR50 NP
V4: from AIF MAPPING
ZGREIN_MOVEMENT_CODE
MOVE_PURPOSE_CODE INT4 introduced in V4
V4: Mapped through Greek localization
printing logic. Either the text set in print
MOVE_PURPOSE STRING task code, or from movement type text
TOTAL_QUANTITY STRING NP
table of lt_items-rflegaldoc from hellenisation
RELATIVE_DOCUMENTS string printing program
PROJECT STRING NP
CONTENT STRING NP
VEHILE_NUMBER STRING NP
LDM STRING NP
DELIVERY_ORIGIN_DETAILS Proxy table
DELIVERY_ORIGIN_DETAILS-
REMARKS String NP
DELIVERY_ORIGIN_DETAILS- V4. Mapped from plant address Method
ADDRESS Proxy table fill_distribution_details
DELIVERY_ORIGIN_DETAILS- V4. Mapped from plant address Method
ADDRESS-STREET CHAR150 fill_distribution_details
DELIVERY_ORIGIN_DETAILS- V4. Mapped from plant address Method
ADDRESS-NUMBER String fill_distribution_details
DELIVERY_ORIGIN_DETAILS- V4. Mapped from plant address Method
ADDRESS-POSTAL String fill_distribution_details
DELIVERY_ORIGIN_DETAILS- V4. Mapped from plant address Method
ADDRESS-CITY CHAR150 fill_distribution_details
DELIVERY_DESTINATION_DETAILS Proxy table
DELIVERY_DESTINATION_DETAILS-
REMARKS String NP
DELIVERY_DESTINATION_DETAILS- V4. Mapped from recipient address Method
ADDRESS Proxy table fill_distribution_details
DELIVERY_DESTINATION_DETAILS- V4. Mapped from recipient address Method
ADDRESS-STREET CHAR150 fill_distribution_details
DELIVERY_DESTINATION_DETAILS- V4. Mapped from recipient address Method
ADDRESS-NUMBER String fill_distribution_details
DELIVERY_DESTINATION_DETAILS- V4. Mapped from recipient address Method
ADDRESS-POSTAL String fill_distribution_details
DELIVERY_DESTINATION_DETAILS- V4. Mapped from recipient address Method
ADDRESS-CITY CHAR150 fill_distribution_details

© SAP HELLAS Single Member S.A. 94


E-Invoicing Implementation guide

4.2.5 Payment Details

Only table PAYMENT_METHOD provided in this section. Logic adopted from standard eBooks.

• Mapping class:
o ZGREIN_CL_EDOC_MAP_GR_SD (for SD documents)
o ZGREIN_CL_EDOC_MAP_GR_FI (for FI documents)
• Mapping Method: FILL_PAYMENT_METHODS (redefinition)

Mapping details:

Field Type Mapping details


TRANSACTION_PAYMENT_TERMS String NP (V3)
PREVIOUS_BALANCE string NP
NEW_BALANCE string NP
PREPAYMENT_AMOUNT String NP
ELECTRONIC_PAYMENT_CODE CHAR50 NP
PAYMENT_METHODS- proxy table As mapped from standard ebooks
PAYMENT_METHODS-
PAYMENT_METHOD_ID String NP
PAYMENT_METHODS-
PAYMENT_METHOD_TYPE String NP
PAYMENT_METHODS-
PAYMENT_METHOD_TYPE_CODE INT4 As mapped from standard ebooks
PAYMENT_METHODS-AMOUNT String As mapped from standard ebooks
PAYMENT_METHODS-AMOUNT_AC String NP (V3)
PAYMENT_METHODS-TRANSACTION_ID String NP
PAYMENT_METHODS-CARD_NUMBER String NP
PAYMENT_METHODS-REMARKS String NP
PAYMENT_METHODS-STAN String NP
PAYMENT_METHODS-RRN String NP
PAYMENT_METHODS-TTC String NP

PAYMENT_METHODS-AID String NP
PAYMENT_METHODS-AUTH String NP
PAYMENT_METHODS-
APPLICATION_LABEL String NP
PAYMENT_METHODS-CONTACTLESS Boolean NP
PAYMENT_METHODS-TIP_AMOUNT String NP
PAYMENT_METHODS-TIP_AMOUNT_AC String NP

© SAP HELLAS Single Member S.A. 95


E-Invoicing Implementation guide

PAYMENT_METHODS-
PROVIDERS_SIGNATURE String NP
PAYMENT_METHODS-ECR_TOKEN String NP
PAYMENT_METHODS-POS_INPUT String NP
PAYMENT_METHODS-TERMINAL_ID String NP
PAYMENT_TERMS Proxy table
PAYMENT_TERMS-AMOUNT NP
PAYMENT_TERMS-CURRENCY NP
PAYMENT_TERMS-ALLOWANCE NP
PAYMENT_TERMS-PAYMENT_DATE NP
OTHER_PAYMENT_DETAILS String NP
EXCHANGE_CURRENCY_RATE String BKPF-kursf
EXCHANGE_CURRENCY String NP

4.2.6 Details

4.2.6.1 Details SD

For the details section for the SD documents, data is gathered from tables, VBRP, KONV
(PRCD_ELEMENTS) as well as data coming from Hellenization printing program J_2GLPPSD
(table lt_items).

If company is using a Z* printing program copied from the standard J, and there are important
changes in the item retrieval logic they may maintain the Z* program in constant attribute
C_PRINTING_PROGRAM_SD of class ZGREIN_CL_EDOC_MAP_GR.

Cardinality of invoice lines is the lines of table VBRP + an extra line with the excise duty PFS if
exists. (Due to the low amounts in the case of ΠΦΣ, that may lead to zero VAT in a given line,
PFS is collected to a separate line. )

Taxes that have VAT like excise duties ΕΦΚ or ΠΦΣ, a different tax code with the VAT amount
of the excise duty is mandatory for the logic to work.

• Mapping class: ZGREIN_CL_EDOC_MAP_GR


• Mapping Method: FILL_INVOICE_DETAILS_WRAP_SD

Mapping details:

© SAP HELLAS Single Member S.A. 96


E-Invoicing Implementation guide

Field Type Mapping details

LINE_NO INT10 serial number

always '1' if record types are


collected (case ΠΦΣ). Serial
CLASSIFICATION_LINE_NO INT10 per item if record type per line
RECORD_TYPE_CODE INT10 As per Standard Ebooks logic

IS_INFORMATIVE CHAR1 default = False

IS_HIDDEN CHAR1 default = False

INTERNAL_ID CHAR20 Item Code ERP

CODE CHAR20 Item Code ERP


CPV_CODE CHAR20 Mapping with MARC-STEUC
Description as in Hellenization
DESCRIPTIONS string lt_items-ARTX
SPECIAL_FEATURES String table NP (V3)
SERIAL_NUMBERS String table NP (V3)
CATEGORY_ID char50 NP
LOT_NUMBER char50 NP
STARTING_DATE Char10 NP (V3)
EXPIRATION_DATE char10 NP
ORDER_ID char20 NP
QUANTITY string lt_items-Quan
MEASUREMENT_UNIT char3 lt_items-UoM
VMAP
ZGREIN_UNITS_OF_MEAS
MEASUREMENT_UNIT_CODE int10 value2
VMAP
ZGREIN_UNITS_OF_MEAS
MEASUREMENT_UNIT_CODE_EN char3 value1

NET_WEIGHT String NP (V3)

GROSS_WEIGHT String NP (V3)

VOLUME String NP (V3)


UNIT_PRICE string lt_items-Timh2
Unit price in Document
Currency if different than
Local Currency. Standard
Conversion with BKPF-
UNIT_PRICE_AC String KURSF (V3)
© SAP HELLAS Single Member S.A. 97
E-Invoicing Implementation guide

TOTAL_NET_VALUE_BEFORE_TOTAL_D string lt_items-GRVAL


LINE_APPORTIONED_DISCOUNT_VALU string NP
NET_TOTAL_AFTER_INLINE_ALCS string NP
lt_items-aad1+lt_items-
aad2+lt_items-aad3+lt_items-
ALLOWANCES_TOTAL string aad4+lt_items-aad5
LOCAL_CURRENCY_EXCHANGE_RATE String NP (V3)

NET_TOTAL string lt_items-net


Net Total in Document
Currency if different than
Local Currency. Standard
Conversion with BKPF-
NET_TOTAL_AC String KURSF (V3)

VAT_CATEGORY char10 lt_items-pfpa


VAT_CATEGORY_CODE int10 As per Standard eBooks logic
VAT_TOTAL string Calculated
VAT Total in Document
Currency if different than
Local Currency. Standard
Conversion with BKPF-
VAT_TOTAL_AC String KURSF (V3)
VAT_EXEMPTION_CATEGORY int10 As per Standard eBooks logic
TOTAL string Calculated
VAT Total in Document
Currency if different than
Local Currency. Standard
Conversion with BKPF-
TOTAL_AC String KURSF (V3)
LINE_COMMENTS char150 NP (V3)
COLOUR String NP (V3)
SIZE String NP (V3)
REASON String NP (V3)
WITHHELD_AMOUNT String As per Standard eBooks logic
WITHHELD_PERCENT_CATEGORY CHAR10 As per Standard eBooks logic
WITHHELD_PERCENT_CATEGORY_CODE INT4 As per Standard eBooks logic
STAMP_DUTY_AMOUNT String As per Standard eBooks logic
STAMP_DUTY_PERCENT_CATEGORY CHAR10 As per Standard eBooks logic
STAMP_DUTY_PERCENT_CATEGORY_CO INT4 As per Standard eBooks logic
FEES_AMOUNT String As per Standard eBooks logic
FEES_PERCENT_CATEGORY CHAR10 As per Standard eBooks logic
FEES_PERCENT_CATEGORY_CODE INT4 As per Standard eBooks logic
OTHER_TAXES_AMOUNT String As per Standard eBooks logic

© SAP HELLAS Single Member S.A. 98


E-Invoicing Implementation guide

OTHER_TAXES_PERCENT_CATEGORY CHAR10 As per Standard eBooks logic


OTHER_TAXES_PERCENT_CATEGORY_C INT4 As per Standard eBooks logic
DEDUCTIONS_AMOUNT String As per Standard eBooks logic
DEDUCTIONS_PERCENT_CATEGORY CHAR10 As per Standard eBooks logic
DEDUCTIONS_PERCENT_CATEGORY_CO INT4 As per Standard eBooks logic

ALLOWANCES_CHARGES cardinality aad* with value

ALLOWANCES_CHARGES-DESCRIPTION char150 EKPT + discount aa

ALLOWANCES_CHARGES-TYPE string default 0


ALLOWANCES_CHARGES-
UNDERLYING_VALUE string Always ls_items-grval
Underlying Value in
Document Currency if
different than Local Currency.
ALLOWANCES_CHARGES- Standard Conversion with
UNDERLYING_VALUE_AC String BKPF- KURSF (V3)
Calculated (disc_amount/
ALLOWANCES_CHARGES-
ALLOWANCES_CHARGES-PERCENTAGE string UNDERLYING_VALUE)

ALLOWANCES_CHARGES-AMOUNT string lt_items-aad*


Underlying Value in
Document Currency if
different than Local Currency.
Standard Conversion with
ALLOWANCES_CHARGES-AMOUNT_AC String BKPF- KURSF (V3)
INCOME_CLASSIFICATION
INCOME_CLASSIFICATION-
CLASSIFICATION_TYPE string As per Standard eBooks logic
INCOME_CLASSIFICATION-
CLASSIFICATION_CATEGORY string As per Standard eBooks logic
INCOME_CLASSIFICATION-AMOUNT string As per Standard eBooks logic
INCOME_CLASSIFICATION-ID int5 NP
EXPENSES_CLASSIFICATION
EXPENSES_CLASSIFICATION -
CLASSIFICATION_TYPE As per Standard eBooks logic
EXPENSE CLASSIFICATION -
CLASSIFICATION_CATEGORY As per Standard eBooks logic
EXPENSE CLASSIFICATION - AMOUNT As per Standard eBooks logic
© SAP HELLAS Single Member S.A. 99
E-Invoicing Implementation guide

VAT_CLASSIFICATION
VAT_CLASSIFICATION -
CLASSIFICATION_TYPE As per Standard eBooks logic
VAT_CLASSIFICATION -
CLASSIFICATION_CATEGORY As per Standard eBooks logic
VAT_CLASSIFICATION - AMOUNT As per Standard eBooks logic

4.2.6.2 Details FI

For the details section for the FI documents, data is gathered from tables, BKPF, BSEG.

Cardinality of line items is the respective BSEG lines (koart = S,A,M).

VAT is provided per line after a splitting routine in the case of more than one line.

For material details (description, cpv code in case of B2G transaction, article and plant is required).
Please check paragraph 3.1.2 as well.

• Mapping class: ZGREIN_CL_EDOC_MAP_GR


• Mapping Method: FILL_INVOICE_DETAILS_WRAP_FI

Mapping details:

Field Type Mapping details

LINE_NO INT10 serial number


always '1' if record types are
collected (case ΠΦΣ). Serial
per item if record type per
CLASSIFICATION_LINE_NO INT10 line
RECORD_TYPE_CODE INT10 As per Standard Ebooks logic

IS_INFORMATIVE CHAR1 default = False

IS_HIDDEN CHAR1 default = False

INTERNAL_ID CHAR20 Document Id ERP system

CODE CHAR20 Material Code ERP


Mapping with MARC-
CPV_CODE CHAR20 STEUC
Description of the material in
DESCRIPTIONS- string communication language
© SAP HELLAS Single Member S.A. 100
E-Invoicing Implementation guide

CATEGORY_ID char50 NP
LOT_NUMBER char50 NP
EXPIRATION_DATE char10 NP
ORDER_ID char20 NP
BSEG-Menge if provided
QUANTITY string else default 1
BSEG-MEINS if provided
MEASUREMENT_UNIT char3 else default ST.
VMAP
ZGREIN_UNITS_OF_MEA
MEASUREMENT_UNIT_CODE int10 S value2
VMAP
ZGREIN_UNITS_OF_MEA
MEASUREMENT_UNIT_CODE_EN char3 S value1
UNIT_PRICE string Net_value/ quan
TOTAL_NET_VALUE_BEFORE_TOTAL_
D string NP
LINE_APPORTIONED_DISCOUNT_VALU string NP
NET_TOTAL_AFTER_INLINE_ALCS string NP

ALLOWANCES_TOTAL string NP

NET_TOTAL string As in standard eBooks

VAT_CATEGORY char10 NP
VAT_CATEGORY_CODE int10 As per Standard eBooks logic
VAT_TOTAL string As in standard eBooks logic
VAT_EXEMPTION_CATEGORY int10 As per Standard eBooks logic
TOTAL string As per Standard eBooks logic
LINE_COMMENTS char150 NP

ALLOWANCES_CHARGES- NP

ALLOWANCES_CHARGES-
DESCRIPTION char150 NP

ALLOWANCES_CHARGES-TYPE string NP
ALLOWANCES_CHARGES-
UNDERLYING_VALUE string NP

© SAP HELLAS Single Member S.A. 101


E-Invoicing Implementation guide

ALLOWANCES_CHARGES-
PERCENTAGE string NP

ALLOWANCES_CHARGES-AMOUNT string NP
INCOME_CLASSIFICATION-
INCOME_CLASSIFICATION-
CLASSIFICATION_TYPE string As per Standard eBooks logic
INCOME_CLASSIFICATION-
CLASSIFICATION_CATEGORY string As per Standard eBooks logic
INCOME_CLASSIFICATION-AMOUNT string As per Standard eBooks logic
INCOME_CLASSIFICATION-ID int5 NP
EXPENSES_CLASSIFICATION
EXPENSES_CLASSIFICATION -
CLASSIFICATION_TYPE As per Standard eBooks logic
EXPENSE CLASSIFICATION -
CLASSIFICATION_CATEGORY As per Standard eBooks logic
EXPENSE CLASSIFICATION - AMOUNT As per Standard eBooks logic
VAT_CLASSIFICATION
VAT_CLASSIFICATION -
CLASSIFICATION_TYPE As per Standard eBooks logic
VAT_CLASSIFICATION -
CLASSIFICATION_CATEGORY As per Standard eBooks logic
VAT_CLASSIFICATION - AMOUNT As per Standard eBooks logic

4.2.7 Taxes

Taxes logic is based on standard GR eBooks logic.

• Mapping class: ZGREIN_CL_EDOC_MAP_GR


• Mapping Method: FILL_TAXES_TOTALS

Mapping details:

Field Type Mapping details


TAXES-TAX_TYPE_CODE int5 as per standard GR eBooks
TAXES-
TAX_CATEGORY_CODE int5 as per standard GR eBooks
TAXES-
UNDERLYING_VALUE string as per standard GR eBooks
TAXES-TAX_AMOUNT string as per standard GR eBooks
TAXES-ID int5 NP

© SAP HELLAS Single Member S.A. 102


E-Invoicing Implementation guide

4.2.8 Summaries

Summaries are based partly on standard GR eBooks logic, with except for fields that are not part
of standard eBooks scope like allowances totals, payable amount.

• Mapping class: ZGREIN_CL_EDOC_MAP_GR


• Mapping Method: FILL_INVOICE_SUMMARY

Mapping details:

Field Type Mapping details


SUMMARIES-
TOTAL_CATALOG_NET_AMOUNT STRING NP
SUMMARIES-TOTAL_NET_AMOUNT STRING as per standard GR eBooks
SUMMARIES-TOTAL_VAT_AMOUNT STRING as per standard GR eBooks
SUMMARIES-
TOTAL_NET_AMOUNT_AC STRING Addition of details-net_value_ac
SUMMARIES-
TOTAL_VAT_AMOUNT_AC STRING Addition of details-vat_value_ac
SUMMARIES-
TOTAL_WITHHELD_AMOUNT STRING as per standard GR eBooks
SUMMARIES-TOTAL_FEES_AMOUNT STRING as per standard GR eBooks
SUMMARIES-
TOTAL_STAMP_DUTY_AMOUNT STRING as per standard GR eBooks
SUMMARIES-
TOTAL_OTHER_TAXES_AMOUNT STRING as per standard GR eBooks
SUMMARIES-
TOTAL_DEDUCTIONS_AMOUNT STRING as per standard GR eBooks
SUMMARIES-TOTAL_GROSS_VALUE STRING as per standard GR eBooks
SUMMARIES- Addition of Net+VAT (assuming no
TOTAL_GROSS_VALUE_AC STRING taxes)
SUMMARIES-TOTAL_ALLOWANCES STRING Calculated
SUMMARIES-TOTAL_CHARGES STRING NP
SUMMARIES-
TOTAL_ALLOWANCES_AC STRING NP
SUMMARIES-TOTAL_CHARGES_AC STRING NP
SUMMARIES-
TOTAL_PAYABLE_AMOUNT STRING Default EQ to Gross value

© SAP HELLAS Single Member S.A. 103


E-Invoicing Implementation guide

4.2.9 VAT Analysis

VAT Analysis is based on BSET lines. BSET lines are collected per percentage (=VAT analysis
name) meaning that for the case of excise duties on SD document (check §4.2.6.1), where different
tax code will be used on the same percentage, lines will be collected.

• Mapping class: ZGREIN_CL_EDOC_MAP_GR


• Mapping Method: FILL_INVOICE_SUMMARY

Mapping details:

VAT_ANALYSIS- Cardinality Distinct BSET per VAT percentage


VAT_ANALYSIS-NAME CHAR10 BSET-KBETR + %
VAT_ANALYSIS-
VAT_AMOUNT STRING BSET-HWSTE
VAT_ANALYSIS-
UNDERLYING_VALUE STRING BSET-HWBAS
VAT_ANALYSIS-PERCENTAGE STRING BSET-KBETR

4.2.10 Contract Order details (V3)

CONTRACT_ORDER_DETAILS-
CONTRACT_TYPE_CODE CHAR512 NP
CODE CHAR512 NP
MIS_CODE CHAR512 NP
NAME CHAR512 NP
START_DATE CHAR10 NP
END_DATE CHAR10 NP
DATE CHAR10 NP
ORDER_NUMBERS Table of string NP

© SAP HELLAS Single Member S.A. 104


E-Invoicing Implementation guide

5. APPENDIX I Changes as per Version 3

With version below important changes are introduced. Changes are summarized in the below:

• Offline QR code support


• Foreign currency support
• New fields introduced in the WSDL file
• Bug fixes
• Addition of exit includes

All technical changes are included in the updated transport requests attached.

If you have already implemented the solution and have performed adaptations in the coding, you
can trace changes in the attached files following the tag “update3” and may adopt to your
custom coding what is relevant for your implementation.

5.1 Offline QR code.

Some extra fields need to be printed in the print out of the invoice, either static or depending on
the status of the response from the provider (Impact).

The main difference is the offline QR code that needs to be printed in case there is a failure in the
communication (due to network outage or application errors) but the invoice needs to be printed
regardless for business reasons. The response fields for the decision are stored in table
ZGREIN_EDOGRINV introduced in this revision.

For more details you may refer to attached document “Printing Obligations & Offline QR
Generation-EN-v2.1.pdf”

The possible cases are:

Case 1: Success MARK (zgrein_edogrinv-http_code = 201)

The invoice is successfully transmitted to the IARP (ΑΑΔΕ) and a MARK is assigned.

Fields in print out:

- Mark (edogrinv-INV_MARK) – already exists in std eBooks

- Uid (edogrinv-INV_UID) – already exists in std eBooks


© SAP HELLAS Single Member S.A. 105
E-Invoicing Implementation guide

- Authentication Code (zgrein_edogrinv-AUTHENTICATIONCODE)

- QRCode (edogrinv-qrurl) – already exists in std eBooks

Case 2: Transmission Failure Issuer <-> Service Provider / Business Error or JSON Syntax
(zgrein_edogrinv-http_code <> 408 and <> 201)

Message: Transmission Failure Issuer – Service provider

Fields in print out:

- Offline QRCode (created on-the-fly during the legal printing process with method
create_offline_qr of class ZGREIN_CL_EDOCUMENT_GR)

Case 3: Transmission Failure Service Provider <-> IAPR (ΑΑΔΕ)

Message: Transmission Failure Service provider – IAPR

- Offline QRCode (created on-the-fly during the legal printing process with method
create_offline_qr of class ZGREIN_CL_EDOCUMENT_GR)

Always (static texts to be printed always

Service Provider Signature as following:

- Information systems IMPACT Μον. AE www.einvoicing.gr


- 2023_10_103Impact_002_Impact eInvoicing_V1_24102023

5.1.1 Technical changes – table zgrein_edogrinv


For the signature and authentication code a new table is introduced to store the data
zgrein_edogrinv

Initial Data
Field Name Key values Type Length

© SAP HELLAS Single Member S.A. 106


E-Invoicing Implementation guide

MANDT MANDT X X CLNT 3


EDOC_GUID EDOC_GUID X X CHAR 32
SOURCE_KEY EDOC_SOURCE_KEY CHAR 32
INTEGRITYSIGNATURE ZZGREIN_INTEGR_SIGN CHAR 128
SIGNATURE ZZGREIN_SIGNATURE CHAR 128
AUTHENTICATIONCODE ZZGREIN_AUTH_CODE CHAR 40
STATUS ZZGREIN_STATUS CHAR 20
HTTP_CODE ZZGREIN_HTTPCODE NUMC 3
INVOICE_TYPE EDOC_GR_INVTYPE CHAR 5
DOMAIN_URL EDOC_GR_QRURL STRING 0
MESSAGE EDOC_GR_ERROR_MSG STRING 0

Data Elements

Element Type length Label S Label M Label L Label H


INTEGRITY INTEGRITY INTEGRITY
ZZGREIN_INTEGR_SIGN CHAR 128 INTEGRITY
SIGNATURE SIGNATURE SIGNATURE
ZZGREIN_SIGNATURE CHAR 128 Signature Signature Signature Signature
Authent. Authent.
ZZGREIN_AUTH_CODE CHAR 40 Authent.Cd Authent. Code
Code Code
ZZGREIN_STATUS CHAR 20 Status Status Status Status
ZZGREIN_HTTPCODE NUMC 3 Http Code Http Code Http Code Http Code

Table is updated on response method map_zeinvoutr1 of class ZGREIN_CL_EDOC_MAP_GR.

Search for tag ‘Update3 offline QR code’

5.1.2 Technical changes – table ZGREIN_IMP_CUST

New table ZGREIN_IMP_CUST

Initial Data
Field Name Key Length
values Type
MANDT MANDT X X CLNT 3
BUKRS BUKRS X X CHAR 4
SID BDLSYSID X X CHAR 3
APIURL ZZGREIN_APIURL CHAR 128
APIKEY ZZGREIN_APIKEY CHAR 40

New data elements


© SAP HELLAS Single Member S.A. 107
E-Invoicing Implementation guide

Element Type Length Label S Label M Label L Label H


ZZGREIN_APIURL CHAR 128 API Url API Url API Url API Url
ZZGREIN_APIKEY CHAR 40 API Key API Key API Key API Key

Standard localisation programs printing adjustments for the offline QR code are detailed in §3.7

5.1.3 Technical changes – Method CREATE_OFFLINE_QR of class


ZGREIN_CL_EDOCUMENT_GR
New method to create the offline QR code:

Method: CREATE_OFFLINE_QR (instance, Public)


Class: ZGREIN_CL_EDOCUMENT_GR
Parameters:
Parameter Type Optional Associated type Default
I_KUNNR Importing KUNNR
I_TOTAL_VAT_AMOUNT Importing MWSBP
I_TOTAL_NET_AMOUNT Importing NETWR
I_SAPSCRIPT Importing X XFELD 'X'
E_OFFLINE_QR_PART1 Exporting EDOC_GR_QRURL
E_OFFLINE_QR_PART2 Exporting EDOC_GR_QRURL
E_OFFLINE_REASON Exporting STRING

Source code:

method create_offline_qr.
data: lv_dttm_str(14),
lv_gross_str(20),
lv_net_str(20),
lv_vat_str(20),
lv_internalid(30),
lv_strsignature type finb_string,
lv_hash_id type hash160,
lv_xvalidationsignature type xstring,
lv_validationsignature type string,
* vat_total type bset-hwbas,
ls_cust type zgrein_imp_cust,
ls_zgrein_edogrinv type zgrein_edogrinv,
lv_total_gross_amount type netwr,
ls_kna1 type kna1,

© SAP HELLAS Single Member S.A. 108


E-Invoicing Implementation guide

lv_issuer_vat(20),
lv_partner_vat(20).

select single apiurl apikey from zgrein_imp_cust


into corresponding fields of ls_cust
where bukrs = ms_edocument-bukrs and
sid = sy-sysid.

select single * into ls_zgrein_edogrinv


from zgrein_edogrinv
where edoc_guid = ms_edogrinv-edoc_guid.

select single name1 land1 stcd2 stceg


into corresponding fields of ls_kna1
from kna1
where kunnr = i_kunnr.

clear: lv_dttm_str, lv_gross_str, lv_vat_str.

* lv_issuer_vat = ms_edogrinv-vendor_vat_reg_id.
select single stceg into lv_issuer_vat
from t001
where bukrs = ms_edocument-bukrs.
if lv_issuer_vat(2) ne 'EL'.
concatenate 'EL' lv_issuer_vat into lv_issuer_vat.
endif.

lv_partner_vat = ms_edogrinv-customer_vat_reg_id.
if ls_kna1-land1 eq zgrein_cl_edocument_gr=>gc_constants-
greece and lv_partner_vat(2) ne 'EL'.
concatenate 'EL' lv_partner_vat into lv_partner_vat.
endif.

concatenate ms_edocument-posting_date '000000' into lv_dttm_str.

lv_total_gross_amount = i_total_vat_amount + i_total_net_amount.


move: lv_total_gross_amount to lv_gross_str,
i_total_net_amount to lv_net_str,
i_total_vat_amount to lv_vat_str.
© SAP HELLAS Single Member S.A. 109
E-Invoicing Implementation guide

shift lv_gross_str left deleting leading space.


shift lv_net_str left deleting leading space.
shift lv_vat_str left deleting leading space.

* concatenate ls_zgrein_edogrinv-invoice_type
* ms_edogrinv-series
* ms_edogrinv-numbr into lv_internalid
* separated by '_'.
lv_internalid = ms_edocument-source_key.

concatenate
lv_issuer_vat '-'
lv_partner_vat '-'
ms_edogrinv-series '-'
ms_edogrinv-numbr '-'
lv_dttm_str '-'
lv_gross_str '-'
lv_internalid
ls_cust-apikey
into lv_strsignature.

*
call function 'CALCULATE_HASH_FOR_CHAR'
exporting
alg = 'SHA1'
data = lv_strsignature
importing
hash = lv_hash_id
exceptions
unknown_alg = 1
param_error = 2
internal_error = 3
others = 4.

concatenate ls_cust-apiurl
'?issuerTin=' lv_issuer_vat
'&customerTin=' lv_partner_vat
'&customerName=' ls_kna1-name1
'&invoiceType=' ls_zgrein_edogrinv-invoice_type
© SAP HELLAS Single Member S.A. 110
E-Invoicing Implementation guide

'&series=' ms_edogrinv-series
'&number=' ms_edogrinv-numbr
into e_offline_qr_part1.
CONCATENATE
'&dateIssued=' lv_dttm_str
'&totalAmount=' lv_gross_str
'&totalNetAmount=' lv_net_str
'&totalVatAmount=' lv_vat_str
'&internalId=' lv_internalid
'&signature=' lv_hash_id
into e_offline_qr_part2.

if i_sapscript = 'X'.
REPLACE ALL OCCURRENCES OF '&' in e_offline_qr_part1 with '<(>&<)>'.
REPLACE ALL OCCURRENCES OF '&' in e_offline_qr_part2 with '<(>&<)>'.
endif.

if ls_zgrein_edogrinv-http_code = '408'.
e_offline_reason = 'Αδυναμια διασύνδεσης παρόχου - ΑΑΔΕ. Transmission Failure Service
Provider - IAPR.'.
else.
e_offline_reason = 'Αδυναμια διασύνδεσης οντότητας - παρόχου. Transmission Failure Issue
r - Service Provider.'.
endif.
endmethod.

Note: Due to Sapscript/Smartform variable limitation to 255 characters, the method returns the
Offline QR Code splitted in two parts (gv_url/gv_url2). You need to create a SO10 text with the
following line to produce the QR Code (assuming BC is the character format for QRCode).

<BC>&gv_url&&gv_url2&</>

5.1.4 Technical changes – J_2JLPTIM_SUBM_EDOC


Please refer to §3.7 With tag V3 to adopt the changes for the offline QR Code.

5.2 Foreign currency support


Program was modified to support documents where document currency is different that local
© SAP HELLAS Single Member S.A. 111
E-Invoicing Implementation guide

currency (check coding of class ZGREIN_CL_EDOC_MAP_GR with tag update3_AC). Program


supports conversion where only one exchange rate exists in all documents (SD-FI). Rounding
errors may occur in the cases where the standard SAP conversion in FI accounting level is different
that the conversion occurring in pricing level in the current solution.

Cases with rounding errors and multiple rates (ex prepayment on different rate) are not supported.
A validation is introduced at the end of FILL_INVOICE_DETAILS_WRAP_SD comparing
values from FI against values from SD, to through an error in these cases.

Possible workaround that can be introduced can be to map directly the FI lines as they are extracted
from method fill_invoice_details with FULL bseg and best, (in table lt_edo_invoice_details) while
all the other lines to remain as informative (is_informative = ‘X’) if needed.

5.3 New fields in wsdl file.


New fields added to wsdl file. They are mentioned in §4 with V3 Tag. New fields include the
alternative currency fields which hold the values in document currency, and others, out of scope
of the current solution, available for the implementor to map if there is a business need for it.

5.4 Bug fixing


Known bugs and incidents are handled with this revision. Follow tag update3 to identify and
adopt if relevant.

5.5 Introduction of exit indludes.


Exit includes are added in various methods for customers to include their own logic. These
includes will not be included in any updates of the note coding.

© SAP HELLAS Single Member S.A. 112


E-Invoicing Implementation guide

6. APPENDIX II Changes as per Version 4

With version IV below changes are introduced. Changes are summarized in the below:

• Additional fields added in wsdl file.


• Support additional fields for case of combined delivery note – invoice (DATIM)
• Bug fixes (tag update4 in the code files).
• Static method set_output_data in class ZGREIN_CL_EDOCUMENT_GR check §3.5

All technical changes are included in the updated transport request attached for S4H. No
transport request available at this stage for ECC implementations. Changes have to be adopted
manually following update4 tag in S4H coding snippet.

If you have already implemented the solution and have performed adaptations in the coding, you
can trace changes in the attached files following the tag “update4” and may adopt to your custom
coding what is relevant for your implementation.

6.1 Additional fields for combined delivery note -invoice

Additional fields are added in wsdl section ‘distribution details’ to populate fields relevant for
DATIM. Some fields are premapped, some others are available for custom logic to be
implemented. Check as well §4 with tag V4

Implementation instructions.

6.1.1 Step 1 new WSDL


New WSDL file v4 is provided. Upload and generate.

6.1.2 CHANGES ZGREIN_CL_EDOC_MAP_GR

6.1.2.1 Step 2 New global attributes

© SAP HELLAS Single Member S.A. 113


E-Invoicing Implementation guide

Attribute: ψ

New global attribute to define DATIM (based on print task code).

Define global attribute GV_LKTYPE as below

GV_LKTYPE Instance Attribute Public Type J_2GLPLOGKTYP

Table: mt_rflegaldocs

*{++ update4 mt_rflegaldocs


TYPES: BEGIN OF ty_rflegaldocs,
budat TYPE budat,
rflegaldoc TYPE xblnr1,
END OF ty_rflegaldocs,
tty_rflegaldocs TYPE STANDARD TABLE OF ty_rflegaldocs.
DATA: mt_rflegaldocs TYPE tty_rflegaldocs.

*)++ update4 lt_rflegaldocs

© SAP HELLAS Single Member S.A. 114


E-Invoicing Implementation guide

6.1.2.2 Step 3 Define DATIM scenario (Method GET_PRINTING_DATA_SD)

A) retrieve logical kind from table J_2GLPP1

B) get logical type from logical kind.

DATA: lv_logkind TYPE j_2glplogkind. "Update4 additions for DATIM

*{-- update4 additions for DATIM


* SELECT SINGLE a~path FROM j_2glplp AS a
* INNER JOIN j_2glpp1 AS b ON
* a~logpaper = b~logpaper
* WHERE b~bukrs = @iv_bukrs AND
* b~prntsk = @lv_prntsk
* INTO @lv_path.
*} -- update4
*{++ update4 additions for DATIM
SELECT SINGLE a~path,
© SAP HELLAS Single Member S.A. 115
E-Invoicing Implementation guide

b~logkind
FROM j_2glplp AS a
INNER JOIN j_2glpp1 AS b ON
a~logpaper = b~logpaper
WHERE b~bukrs = @iv_bukrs AND
b~prntsk = @lv_prntsk
INTO ( @lv_path,
@lv_logkind ).

IF lv_logkind IS NOT INITIAL.


SELECT SINGLE type FROM j_2glplk INTO gv_lktype
WHERE logkind = lv_logkind.
ENDIF.
*} update4

6.1.2.3 Step 4 Update is_delivery_note Boolean in method


FILL_INVOICE_HEADER

*{++ update4 additions for DATIM


IF gv_lktype = 'DB'. "can be hardcoded
© SAP HELLAS Single Member S.A. 116
E-Invoicing Implementation guide

es_inv_header-is_delivery_note = 'X'.
ELSE.
es_inv_header-is_delivery_note = ''.
ENDIF.
*}

6.1.2.4 Step 5 Changes in FILL_INVOICE_DETAILS_WRAP_SD

Define ls_rflegaldocs

data: ls_rflegaldocs TYPE ty_rflegaldocs."update4

Populate global table mt_rflegaldocs instead of lt_distr_details

*{-- udpate4
* ls_distr_details-budat = ls_items-rfgidat.
* ls_distr_details-rflegaldoc = ls_items-rflegaldoc.
* COLLECT ls_distr_details INTO lt_distr_details.
*} --update4
*{++ update4
ls_rflegaldocs-budat = ls_items-rfgidat.
ls_rflegaldocs-rflegaldoc = ls_items-rflegaldoc.
COLLECT ls_rflegaldocs INTO mt_rflegaldocs.
*}++update4

Remove logic for distribution details from FILL_INVOICE_DETAILS_WRAP_SD


© SAP HELLAS Single Member S.A. 117
E-Invoicing Implementation guide

6.1.2.5 Step 6 New method fill_distribution details instance public

Create method ‘get_move_purpose’ instance public

Parameters

MOVE_PURPOSE Returning Type STRING

Add below coding


© SAP HELLAS Single Member S.A. 118
E-Invoicing Implementation guide

METHOD get_move_purpose.
DATA: lv_movement TYPE bwtxt,
mseg_wa TYPE mseg,
lh_mkpf_mm TYPE mkpf,
l_result(1) TYPE n,
l_badposnr TYPE vbrp-posnr,
lh_likp TYPE likp.

*Move purpose text


SELECT SINGLE movement FROM j_2glpp2 INTO lv_movement
WHERE spras = gv_com_langu AND
prntsk = ms_source-gr_legal_data-prntsk.

IF lv_movement IS INITIAL.

PERFORM find_check_delivery IN PROGRAM (c_printing_program_sd) IF FOUND


USING ms_source-vbrk-vbeln ms_source-vbrk-fktyp
CHANGING lh_likp l_badposnr l_result.
PERFORM find_delivery_mm IN PROGRAM (c_printing_program_sd) IF FOUND
USING lh_likp-vbeln '1'
CHANGING lh_mkpf_mm l_result.

SELECT bwart sobkz kzbew kzzug kzvbr


FROM mseg INTO CORRESPONDING FIELDS OF mseg_wa
WHERE mblnr = lh_mkpf_mm-mblnr
AND mjahr = lh_mkpf_mm-mjahr.

SELECT SINGLE btext INTO lv_movement


FROM t156t WHERE
spras = gv_com_langu AND
bwart = mseg_wa-bwart AND
sobkz = mseg_wa-sobkz AND
kzbew = mseg_wa-kzbew AND
kzzug = mseg_wa-kzzug AND
kzvbr = mseg_wa-kzvbr.

EXIT.
ENDSELECT.

© SAP HELLAS Single Member S.A. 119


E-Invoicing Implementation guide

ENDIF.
move_purpose = lv_movement.

ENDMETHOD.

Create method ‘fill_distribution details’ instance public

Parameters:

IS_RECIPIENT Importing Type ZGREIN_PARTY_TYPE

ES_DISTRIBUTION_DETAILS Exporting Type ZGREIN_DISTR_DET_TYPE

ES_RELATIVE_DOCUMENTS Exporting Type ZGREIN_STRING_TAB

ES_DISPATCH_ADVICE Exporting Type STRING

Fill below coding

METHOD fill_distribution_details.

DATA: ls_rflegaldocs TYPE ty_rflegaldocs,


ls_relative_documents TYPE string,
ls_vbrp TYPE vbrp,
ls_addr_sel TYPE addr1_sel,
ls_sadr TYPE sadr,
ls_address_type TYPE zgrein_address_type,
lv_adrnr TYPE adrnr,
lv_movement TYPE bwtxt,

© SAP HELLAS Single Member S.A. 120


E-Invoicing Implementation guide

lv_move_purpose_code TYPE char3.

es_distribution_details-internal_document_id = ms_source-source_header-source_key.
SORT:mt_rflegaldocs BY budat DESCENDING rflegaldoc.

IF gv_lktype = 'DB'. "can be hardcoded


*Dispatch date/ delivery date
*case: delivery note/ invoice. Dispatch date same as invoice.
CONCATENATE: ms_source-bkpf-budat(4) ms_source-bkpf-budat+4(2)
ms_source-bkpf-budat+6(2) INTO es_distribution_details-dispatch_date
SEPARATED BY '-'.

*distribution details datim.


*destination (ship-to party)
es_distribution_details-delivery_destination_details-address
= is_recipient-address.

*origin (plant address)


READ TABLE ms_source-vbrp INTO ls_vbrp INDEX 1. "assuming one plant.
*get plant address

SELECT SINGLE adrnr FROM t001w INTO lv_adrnr WHERE


werks = ls_vbrp-werks.
ls_addr_sel-addrnumber = lv_adrnr.
CALL FUNCTION 'ADDR_GET'
EXPORTING
address_selection = ls_addr_sel
* ADDRESS_GROUP =
* READ_SADR_ONLY = ' '
* READ_TEXTS =''
* IV_CURRENT_COMM_DATA =''
* BLK_EXCPT =
IMPORTING
* ADDRESS_VALUE =
* ADDRESS_ADDITIONAL_INFO =
* RETURNCODE =
* ADDRESS_TEXT =
sadr = ls_sadr
* TABLES
© SAP HELLAS Single Member S.A. 121
E-Invoicing Implementation guide

* ADDRESS_GROUPS =
* ERROR_TABLE =
* VERSIONS =
EXCEPTIONS
parameter_error = 1
address_not_exist = 2
version_not_exist = 3
internal_error = 4
address_blocked = 5
OTHERS = 6.
IF sy-subrc <> 0.
* Implement suitable error handling here
ELSE.
CLEAR: ls_address_type.
ls_address_type-country_code = ls_sadr-land1.
ls_address_type-street = ls_sadr-stras.
ls_address_type-number = ls_sadr-hausn.
ls_address_type-postal = ls_sadr-pstlz.
ls_address_type-city = ls_sadr-ort01.
es_distribution_details-delivery_origin_details-address = ls_address_type.
ENDIF.
*Move purpose text and code from print task code
es_distribution_details-move_purpose = get_move_purpose( ).

lv_move_purpose_code = get_value_mapping(
iv_vmapname = 'ZGREIN_MOVEMENT_CODE'
iv_int_value = ms_source-gr_legal_data-prntsk ).
es_distribution_details-move_purpose_code = lv_move_purpose_code.

es_distribution_details-vehile_number = 'XXX0000'.

ELSE.
*DIspatch date/delivery date
* not DB, dispatch date the date of last delivery.
READ TABLE mt_rflegaldocs INTO ls_rflegaldocs INDEX 1.
CONCATENATE:ls_rflegaldocs-budat(4) ls_rflegaldocs-budat+4(2)
ls_rflegaldocs-budat+6(2) INTO es_distribution_details-dispatch_date
SEPARATED BY '-'.
© SAP HELLAS Single Member S.A. 122
E-Invoicing Implementation guide

*Dispatch advise - reference legal doc (delivery)


es_dispatch_advice = ls_rflegaldocs-rflegaldoc.
ENDIF.
* delivery date = dispatch date
es_distribution_details-delivery_date = es_distribution_details-dispatch_date.

* relative documents (deliveries).


* if not on dispatch advise so tabix 1 is excluded.
LOOP AT mt_rflegaldocs INTO ls_rflegaldocs.
IF sy-tabix = 1.
ELSE.
ls_relative_documents = ls_rflegaldocs-rflegaldoc.
APPEND ls_relative_documents TO es_relative_documents.
ENDIF.
*APPEND ls_relative_documents TO es_distribution_details-
relative_documents."relative documents can be as well here
ENDLOOP.

INCLUDE zgreinv_exit10 IF FOUND.

ENDMETHOD

Parameters:

MOVE_PURPOSE Returning type String

method GET_MOVE_PURPOSE.
data: lv_movement TYPE bwtxt,
mseg_wa type mseg,
lh_mkpf_mm type mkpf,
© SAP HELLAS Single Member S.A. 123
E-Invoicing Implementation guide

l_result(1) type n,
l_badposnr type vbrp-posnr,
lh_likp type likp.

*Move purpose text


SELECT SINGLE movement FROM j_2glpp2 INTO lv_movement
WHERE spras = gv_com_langu AND
prntsk = ms_source-gr_legal_data-prntsk.

IF lv_movement is INITIAL.

perform find_check_delivery in program (c_printing_program_sd) if found


using ms_source-vbrk-vbeln ms_source-vbrk-fktyp
changing lh_likp l_badposnr l_result.
perform find_delivery_mm in program (c_printing_program_sd) if found
using lh_likp-vbeln '1'
changing lh_mkpf_mm l_result.

select bwart sobkz kzbew kzzug kzvbr


from mseg into CORRESPONDING FIELDS OF mseg_wa
where mblnr = lh_mkpf_mm-mblnr
and mjahr = lh_mkpf_mm-mjahr.

select single btext into lv_movement


from t156t where
spras = gv_com_langu and
bwart = mseg_wa-bwart and
sobkz = mseg_wa-sobkz and
kzbew = mseg_wa-kzbew and
kzzug = mseg_wa-kzzug and
kzvbr = mseg_wa-kzvbr.

exit.
endselect.

ENDIF.
move_purpose = lv_movement.
endmethod.
© SAP HELLAS Single Member S.A. 124
E-Invoicing Implementation guide

6.1.2.6 Step 7 call method fill distribution details in method FILL_INV_OUT

*{++ update4 distribution details for delivery note/ invoice


if ms_source-process ne 'ZGREINRGIN'.
fill_distribution_details(
exporting is_recipient = es_invoice-recipient
importing es_distribution_details = es_invoice-distribution_details
es_relative_documents = es_invoice-relative_documents
es_dispatch_advice = es_invoice-dispatch_advice ) .
endif.
*} Update4

6.1.3 Step 8 VMAP – new AIF value mapping for ZGREIN_MOVEMENT_CODE

build new data element ZGREIN_MOVEMENT_CODE NUMC 2

Description

MovPurpCod

Move Purpose Code

© SAP HELLAS Single Member S.A. 125


E-Invoicing Implementation guide

Move Purpose Code

Build new AIF value mapping, ZGREIN_MOVEMENT_CODE

/n/aif/cust

© SAP HELLAS Single Member S.A. 126


E-Invoicing Implementation guide

Populate mapping based on below table

© SAP HELLAS Single Member S.A. 127


E-Invoicing Implementation guide

8.14 Σκοπός Διακίνησης 8.14 Purpose of movement

Κωδικός Περιγραφή Description

1 Πώληση Sale

2 Πώληση για Λογαριασμό Sales on Behalf of Third Parties


Τρίτων

3 Δειγματισμός Sampling

4 Έκθεση Exhibition

5 Επιστροφή Return

6 Φύλαξη Keeping

7 Επεξεργασία Edit - Assembly


Συναρμολόγηση

8 Μεταξύ Εγκαταστάσεων Between Entity Branches


Οντότητας

9 Αγορά Buy

10 Εφοδιασμός πλοίων πλοίων Supply ships and aircraft


και αεροσκαφών

11 Δωρεάν διάθεση Free disposal

12 Εγγύηση Warranty

13 Χρησιδανεισμός Lending

14 Αποθήκευση σε Τρίτους Storage by Third Parties

15 Επιστροφή από Φύλαξη Return from save

© SAP HELLAS Single Member S.A. 128


E-Invoicing Implementation guide

16 Ανακύκλωση Recycling

17 Καταστροφή άχρηστου Destruction of useless material


υλικού

18 Διακίνηση Παγίων Asset Transfer (Intra-Transfer)


(Ενδοδιακίνηση)

19 Λοιπές Διακινήσεις Other

© SAP HELLAS Single Member S.A. 129

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy