SAP Document and Reporting Compliance Belgium: Electronic Invoice in Utilities using Extensibility

Estimated read time 8 min read

You want to enable your system to create electronic documents for invoices posted in Utilities using SAP Document and Reporting Compliance. In this blog, we’ll show you an example on how this can be achieved using extensibility.  

Before you begin ensure that you have implemented the SAP Notes listed in 2424886 – Electronic Document Processing for Belgium: Implementation OverviewYou can also refer the SAP Help Portal for more information, see Electronic Document Processing.
Ensure you have also implemented the SAP Notes listed in 2736880 – eDocument EU PEPPOL: Overview note for IS-U.

Steps to Create Electronic Documents

Create eDocument Class
1. Create ‘ZCL_EDOCUMENT_BE_ISU’ eDocument class by inheriting CL_EDOCUMENT_EU_ISU class.
2. Add the CONSTRUCTOR method in the ZCL_EDOCUMENT_BE_ISU eDocument class to map the ‘Z’ eDocument IS-U class name to the field ms_edocument-edocument_class. 
3. Redefine the method DETERMINE_PROCESS to assign the processes BEINV and BEINVIN.
4. Use the table TFK003EDOC to configure eDocument type against the accounting document type.
Example:

Country/Region 

Application Area 

Document Type 

eDocument Type 

IN 

Utility Company 

FA 

BE_INV 

 5. Add the class CL_EDOC_PROCESS as Friends of ‘ZCL_EDOCUMENT_BE_ISU’ eDocument class. 

Sample Code for CONSTRUCTOR and DETERMINE_PROCESS method:  
Constructor method signature: 

METHOD constructor.
super->constructor( io_source_data = io_source_data
iv_edoc_guid = iv_edoc_guid
iv_land = iv_land
iv_update_task = iv_update_task
iv_generic_badi_filter_adaptor = iv_generic_badi_filter_adaptor
iv_simulate_for_email_option = iv_simulate_for_email_option ).

ms_edocument-land = ‘BE’.
ms_edocument-edocument_class = ‘ZCL_EDOCUMENT_BE_ISU’.
ENDMETHOD.
METHOD determine_process.
CASE ms_edocument-edoc_type.
WHEN ‘BE_INVIN’.
ms_edocument-process = ‘BEINVIN’.
ms_edocument-process_version = ‘0001’.
WHEN OTHERS.
CASE ms_edocument-interface_type.
WHEN ‘AIF_PROXY’ OR ‘STANDARD’.
ms_edocument-process = ‘BEINV’.
* reference process is ‘EUINV’
ms_edocument-process_version = ‘0001’.
WHEN OTHERS.
MESSAGE e162(edocument) INTO gv_error_txt.
raise_edoc_exception( ).
ENDCASE.
ENDCASE.
ENDMETHOD.

 

Create Factory Class
1. Create a ‘Z’ factory class to get the instance of eDocument IS-U class by inheriting CL_EDOC_FACTORY class and redefine its method CREATE_EDOC_INSTANCE. 
Example: ZCL_EDOC_FACTORY_BE_ISU
2. Configure this ‘Z’ eDocument factory class in the view EDOFACTORYV using the transaction SM30.

Source Type 

Factory Class 

ISU_INVOIC 

‘Z’ factory class name (your factory class that you just created) 

Sample Code:
METHOD create_edoc_instances.

DATA: lv_land_iso TYPE edoc_land,
lv_error_txt TYPE string,
ls_source_header TYPE edoc_src_header,
lo_edocument TYPE REF TO zcl_edocument_be_isu.

CLEAR: lv_land_iso,
lv_error_txt,
ls_source_header,
lo_edocument,
et_edocument_obj.

* Country
ls_source_header = io_source->get_header( ).
CALL FUNCTION ‘COUNTRY_CODE_SAP_TO_ISO’
EXPORTING
sap_code = ls_source_header-land
IMPORTING
iso_code = lv_land_iso
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e881(b1) WITH ls_source_header-land INTO lv_error_txt.
ENDIF.
IF lv_land_iso <> ‘BE’.
RETURN.
ENDIF.

CREATE OBJECT lo_edocument
EXPORTING
io_source_data = io_source
iv_update_task = iv_update_task.

APPEND lo_edocument TO et_edocument_obj.

ENDMETHOD.

Mapping Class
1. We have a generic mapping class CL_EDOC_MAP_UBL_ISU. If you need to enhance the mapping logic, you can use the EDOC_ADAPTOR BAdI’s method SET_OUTPUT_DATA. For more details, refer to Enhancements for Electronic Documents.
Alternatively, you can implement your own custom mapping class. 
2. Configure your mapping class in the view EDOMAPCLASSDETV using the transaction SM30. 
Example:

eDocument Process 

Version 

Interface ID 

eDocument Type 

Source Type 

Mapping Class 

EUINV 

1 

UBL_INVOICE_TRANSM

BE_INV 

ISU_INVOIC 

<Your Z mapping class or CL_EDOC_MAP_UBL_ISU> 

 

Maintain the Required Customizations
Apart from maintaining Master DataCustomizing and Integration as explained in the SAP Help Portal, you must also configure the company code for the following IS-U source type.

1.  Activate company code for ISU_INVOIC source type in the view EDOCOMPANYACTIV for eDocument creation.
Example:

Company Code 

Source Type 

Application Active 

<Your company code> 

ISU_INVOICE 

X 


By following these steps, you can efficiently create electronic documents for invoices in the utilities sector, ensuring compliance and enhancing operational efficiency. 

Don’t forget to test it thoroughly. 

We hope this blog post was useful for you! You can leave a comment here or continue browsing our community for more blog posts on SAP Document and Reporting Compliance topics. 

Looking forward to seeing you here again! 

 

​ You want to enable your system to create electronic documents for invoices posted in Utilities using SAP Document and Reporting Compliance. In this blog, we’ll show you an example on how this can be achieved using extensibility.  Before you begin ensure that you have implemented the SAP Notes listed in 2424886 – Electronic Document Processing for Belgium: Implementation Overview. You can also refer the SAP Help Portal for more information, see Electronic Document Processing.Ensure you have also implemented the SAP Notes listed in 2736880 – eDocument EU PEPPOL: Overview note for IS-U.Steps to Create Electronic DocumentsCreate eDocument Class1. Create ‘ZCL_EDOCUMENT_BE_ISU’ eDocument class by inheriting CL_EDOCUMENT_EU_ISU class.2. Add the CONSTRUCTOR method in the ZCL_EDOCUMENT_BE_ISU eDocument class to map the ‘Z’ eDocument IS-U class name to the field ms_edocument-edocument_class. 3. Redefine the method DETERMINE_PROCESS to assign the processes BEINV and BEINVIN.4. Use the table TFK003EDOC to configure eDocument type against the accounting document type.Example:Country/Region Application Area Document Type eDocument Type IN Utility Company FA BE_INV  5. Add the class CL_EDOC_PROCESS as Friends of ‘ZCL_EDOCUMENT_BE_ISU’ eDocument class. Sample Code for CONSTRUCTOR and DETERMINE_PROCESS method:  Constructor method signature: METHOD constructor.
super->constructor( io_source_data = io_source_data
iv_edoc_guid = iv_edoc_guid
iv_land = iv_land
iv_update_task = iv_update_task
iv_generic_badi_filter_adaptor = iv_generic_badi_filter_adaptor
iv_simulate_for_email_option = iv_simulate_for_email_option ).

ms_edocument-land = ‘BE’.
ms_edocument-edocument_class = ‘ZCL_EDOCUMENT_BE_ISU’.
ENDMETHOD.
METHOD determine_process.
CASE ms_edocument-edoc_type.
WHEN ‘BE_INVIN’.
ms_edocument-process = ‘BEINVIN’.
ms_edocument-process_version = ‘0001’.
WHEN OTHERS.
CASE ms_edocument-interface_type.
WHEN ‘AIF_PROXY’ OR ‘STANDARD’.
ms_edocument-process = ‘BEINV’.
* reference process is ‘EUINV’
ms_edocument-process_version = ‘0001’.
WHEN OTHERS.
MESSAGE e162(edocument) INTO gv_error_txt.
raise_edoc_exception( ).
ENDCASE.
ENDCASE.
ENDMETHOD. Create Factory Class1. Create a ‘Z’ factory class to get the instance of eDocument IS-U class by inheriting CL_EDOC_FACTORY class and redefine its method CREATE_EDOC_INSTANCE. Example: ZCL_EDOC_FACTORY_BE_ISU2. Configure this ‘Z’ eDocument factory class in the view EDOFACTORYV using the transaction SM30.Source Type  Factory Class  ISU_INVOIC  ‘Z’ factory class name (your factory class that you just created)  Sample Code:METHOD create_edoc_instances.

DATA: lv_land_iso TYPE edoc_land,
lv_error_txt TYPE string,
ls_source_header TYPE edoc_src_header,
lo_edocument TYPE REF TO zcl_edocument_be_isu.

CLEAR: lv_land_iso,
lv_error_txt,
ls_source_header,
lo_edocument,
et_edocument_obj.

* Country
ls_source_header = io_source->get_header( ).
CALL FUNCTION ‘COUNTRY_CODE_SAP_TO_ISO’
EXPORTING
sap_code = ls_source_header-land
IMPORTING
iso_code = lv_land_iso
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e881(b1) WITH ls_source_header-land INTO lv_error_txt.
ENDIF.
IF lv_land_iso <> ‘BE’.
RETURN.
ENDIF.

CREATE OBJECT lo_edocument
EXPORTING
io_source_data = io_source
iv_update_task = iv_update_task.

APPEND lo_edocument TO et_edocument_obj.

ENDMETHOD.Mapping Class1. We have a generic mapping class CL_EDOC_MAP_UBL_ISU. If you need to enhance the mapping logic, you can use the EDOC_ADAPTOR BAdI’s method SET_OUTPUT_DATA. For more details, refer to Enhancements for Electronic Documents.Alternatively, you can implement your own custom mapping class. 2. Configure your mapping class in the view EDOMAPCLASSDETV using the transaction SM30. Example:eDocument Process Version Interface ID eDocument Type Source Type Mapping Class EUINV 1 UBL_INVOICE_TRANSMBE_INV ISU_INVOIC <Your Z mapping class or CL_EDOC_MAP_UBL_ISU>  Maintain the Required CustomizationsApart from maintaining Master Data, Customizing and Integration as explained in the SAP Help Portal, you must also configure the company code for the following IS-U source type.1.  Activate company code for ISU_INVOIC source type in the view EDOCOMPANYACTIV for eDocument creation.Example: Company Code  Source Type  Application Active  <Your company code>  ISU_INVOICE  X  By following these steps, you can efficiently create electronic documents for invoices in the utilities sector, ensuring compliance and enhancing operational efficiency. Don’t forget to test it thoroughly. We hope this blog post was useful for you! You can leave a comment here or continue browsing our community for more blog posts on SAP Document and Reporting Compliance topics. Looking forward to seeing you here again!    Read More Technology Blog Posts by SAP articles 

#SAP

#SAPTechnologyblog

You May Also Like

More From Author