E-Invoicing implementation Guide V4
E-Invoicing implementation Guide V4
SAP -Hellas
Aug 2024
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
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".
2. Introduction
2.1 Glossary
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
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
PEPPOL Pan European Public Procurement On Line: A set of artifacts and technical
specifications enabling cross-border eProcurement between disparate systems across
Europe
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
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.
MARK (ΜΑΡΚ) myDATA registration number (each submission to myDATA receives a unique
MARK, even for the same document)
Legal Number (ODN) A combination of characters & numbers uniquely identifying a legal document in
Greece. It consists of:
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
B2G Business to Government (transactions of private sector enterprises with the State)
S/W Software
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
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.
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.
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.
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:
All the relevant invoices that a company issue should be submitted through SP. These are:
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:
B2C Scenarios are not covered by this guidance and if a company has retail transactions, these
remain to folder “Greece eBooks”.
The following picture shows how the invoice types are transferred to the respective folder.
2.7 Assumptions
➢ 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.
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
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.
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.
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:
<VAT ID> needs to be replaced with the value of the company's VAT ID registered with
Impact.
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.
Procedure:
In the Object Navigation (transaction se80) right click on Package ZGREINV and select Create-
Enterprise Service
In field File Select the downloaded (attached) wsdl file and press Continue
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.
Navigate to External View tab and check (or change if different) the settings as in the next
screenshot.
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.
Below are the classes to be generated for handling e-invoicing and mapping to AIF
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
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.
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.
Badi: EDOC_INTERFACE_CONNECTOR
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.
Find the proxies for SAP Document and Reporting Compliance (eDocument) for Greece with
search term ZGREIN*
Select ZGREIN_CO_EINV_GREECE_SEND_INV
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.
• Protocol: HTTPS
• Host: the SAP Cloud Integration
• Path: /cxf/GreeceSendeInvoiceImp
• Proxy: Your Proxy settings (if exists)
After Finish configuration you can check the connection using Ping Web Service
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
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
Go to Cluster (SM34) Edoc_procmgr, Copy processes GRINV & GRINVREGIN with all
depended entries to ZGREINV & ZGREINRGIN respectively.
For both newly created processes, go to ‘process step’ change class CL_EDOCUMENT_GR with
ZGREIN_CL_EDOCUMENT_GR provided from the transport request.
Copy all entries of GRINV & GRINVREGIN to ZGREINV & ZGREINRGIN respectively.
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
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
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
Go to SAP Application Interface Framework (AIF) -> Interface development -> define interfaces.
1 ZEINVEROUT
2 ZEINVOUT
3 ZEINVOUTR
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
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
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
Go to SAP Application Interface Framework (AIF) -> Interface development -> Additional
Interface Properties -> Specify Interface Engines.
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
Go to SAP Application Interface Framework (AIF) -> Interface development -> Define Structure
Mappings.
Set:
• Namespace:/EDO
• Action: GENERIC_ACTION
© SAP HELLAS Single Member S.A. 47
E-Invoicing Implementation guide
Set:
• Namespace:/EDO
• Action: GENERIC_ACTION
• Stop processing on Error = ‘X’
Set:
• Namespace:/EDO
• Action: GENERIC_ACTION
• Stop processing on Error = ‘X’
Go to SAP Application Interface Framework (AIF) -> Interface development -> Define Value
Mappings
Namespace /EDOGR
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:
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:
Go to SAP Application Interface Framework (AIF) -> error handling -> Define Namespace-
specific Features.
Namespace /EDOGR
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:
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
Go to SAP Application Interface Framework (AIF) -> error handling -> Define Interface-specific
Features.
Sequence ‘1’:
Sequence ‘2’:
Sequence ‘3’:
Sequence ‘1’:
Sequence ‘2’:
Sequence ‘3’:
Sequence ‘1’:
Sequence ‘2’:
Sequence ‘3’:
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.
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.
Method will determine if document is relevant for eBooks process or new e-invoicing process.
The enhancement comes with the below filtering to ensure that e-invoicing related documents
will go through the ZGREIN_ implementation (GENERIC_FILTER = ZGREIN_INV)
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.
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.
In case you are using the FI printing program to issue legal documents you have to make the
following modifications:
gv_impact(120) VALUE
• 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.
"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
INTO lv_msg.
* zlr_edocument_gr->raise_edoc_exception( ). --V3
*{++ V3
** create offline qrcode
*
DATA:
vat_total type MWSBP,
net_total type netwr.
lh_actions-print_mydata_info = abap_true.
*}++V3
ENDIF.
lh_actions-print_mydata_info = abap_true.
*}++V3
* lh_actions-print_mydata_info = abap_undefined. “—V3
ENDIF.
ENDIF.”
* V3 Start
gv_impact(120) VALUE
*V3 end
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.
"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
*{++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&</>
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.
*}++V3
lh_actions-print_mydata_info = abap_true.
© SAP HELLAS Single Member S.A. 77
E-Invoicing Implementation guide
ENDIF.
ENDIF.”
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.
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.
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.
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
• 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.
• 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
• 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:
Per Document Type and G/L Revenue / Supplier Offsetting (Expense, Stock, Asset) Account.
Please see previous paragraph for SD_Invoice.
• 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:
• Per Document Type and G/L Supplier Offsetting (Expense, Stock, Asset) Account.
Please see previous paragraph for FI_Invoice.
• 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.
zgrein_cl_edocument_gr.
Method is called
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
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.
4.1 ZGREIN_AADE_BOOK_INVOICE_TYPE
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
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
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 .
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:
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.
4.2.1 Issuer
Mapping details:
Counter party as provided by standard eBooks. Additional data mapped from Hellenization FM
J_2GMDM_D (structure J_2GMD).
Mapping details:
4.2.3 Recipient
Mapping details:
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
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 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:
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
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 details:
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.
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 details:
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
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
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
Mapping details:
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 details:
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 details:
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
With version below important changes are introduced. Changes are summarized in the below:
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.
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 invoice is successfully transmitted to the IARP (ΑΑΔΕ) and a MARK is assigned.
Case 2: Transmission Failure Issuer <-> Service Provider / Business Error or JSON Syntax
(zgrein_edogrinv-http_code <> 408 and <> 201)
- Offline QRCode (created on-the-fly during the legal printing process with method
create_offline_qr of class ZGREIN_CL_EDOCUMENT_GR)
- Offline QRCode (created on-the-fly during the legal printing process with method
create_offline_qr of class ZGREIN_CL_EDOCUMENT_GR)
Initial Data
Field Name Key values Type Length
Data Elements
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
Standard localisation programs printing adjustments for the offline QR code are detailed in §3.7
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,
lv_issuer_vat(20),
lv_partner_vat(20).
* 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 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&</>
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.
With version IV below changes are introduced. Changes are summarized in the below:
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.
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.
Attribute: ψ
Table: mt_rflegaldocs
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 ).
es_inv_header-is_delivery_note = 'X'.
ELSE.
es_inv_header-is_delivery_note = ''.
ENDIF.
*}
Define ls_rflegaldocs
*{-- 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
Parameters
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.
IF lv_movement IS INITIAL.
EXIT.
ENDSELECT.
ENDIF.
move_purpose = lv_movement.
ENDMETHOD.
Parameters:
METHOD fill_distribution_details.
es_distribution_details-internal_document_id = ms_source-source_header-source_key.
SORT:mt_rflegaldocs BY budat DESCENDING rflegaldoc.
* 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
ENDMETHOD
Parameters:
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.
IF lv_movement is INITIAL.
exit.
endselect.
ENDIF.
move_purpose = lv_movement.
endmethod.
© SAP HELLAS Single Member S.A. 124
E-Invoicing Implementation guide
Description
MovPurpCod
/n/aif/cust
1 Πώληση Sale
3 Δειγματισμός Sampling
4 Έκθεση Exhibition
5 Επιστροφή Return
6 Φύλαξη Keeping
9 Αγορά Buy
12 Εγγύηση Warranty
13 Χρησιδανεισμός Lending
16 Ανακύκλωση Recycling