Imagine your company sells goods or services, which are sometimes part of a contractual agreement. In these cases, your customer receives the goods or services free of charge or with a 100% discount. When the net value of the invoice is zero, your company doesn’t want to send an electronic invoice to the customer.
As a prerequisite for this blog, your country/ region solution in SAP S/4HANA Cloud Public Edition is set up and electronic documents are created for all invoices. The following zero value invoice is created for testing with a free of charge service item.
As you can see in “Create Electronic Documents Manually” app, the Relevance for Creation option for the billing document is “Relevant”.
To prevent the creation of electronic documents for zero value invoices, implement method if_edoc_adaptor_cloud~is_relevant in BAdI EDOC_ADAPTOR_CLOUD (enhancement spot ES_EDOCUMENT_CLOUD). The method “is_ relevant” receives the source data in the importing parameter “is_source_data”. The changing parameter “cv_relevant” allows you to control whether electronic document is created or not – per default it is “true”, therefore you only need to handle cases, where electronic document shouldn’t be created.
Implementation Steps:
Create enhancement spot for ES_DOCUMENT_CLOUD.Create BAdI implementation for EDOC_ADAPTOR_CLOUD.Create implementing class for BAdI EDOC_ADAPTOR_CLOUD, which implements the interfaces if_badi_interfaces and if_edoc_adapter_cloud.Implement method is_relevant of interface if_edoc_adapter_cloud.Activate your BAdI implementation.
CLASS zcl_badi_edoc_adaptor_cloud DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_badi_interface .
INTERFACES if_edoc_adaptor_cloud .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_badi_edoc_adaptor_cloud IMPLEMENTATION.
METHOD if_edoc_adaptor_cloud~is_relevant.
CHECK iv_source_type = ‘SD_INVOICE’. “– Check Source Type
IF is_source_data-billing_header-netwr = 0.
cv_relevant = abap_false.
ENDIF.
ENDMETHOD.
ENDCLASS.
If you check again the “Create Electronic Documents Manually” app after the BAdI is implemented and active, you see that the Billing Document is set to “Not Relevant” for electronic document creation.
Imagine your company sells goods or services, which are sometimes part of a contractual agreement. In these cases, your customer receives the goods or services free of charge or with a 100% discount. When the net value of the invoice is zero, your company doesn’t want to send an electronic invoice to the customer.As a prerequisite for this blog, your country/ region solution in SAP S/4HANA Cloud Public Edition is set up and electronic documents are created for all invoices. The following zero value invoice is created for testing with a free of charge service item.As you can see in “Create Electronic Documents Manually” app, the Relevance for Creation option for the billing document is “Relevant”.To prevent the creation of electronic documents for zero value invoices, implement method if_edoc_adaptor_cloud~is_relevant in BAdI EDOC_ADAPTOR_CLOUD (enhancement spot ES_EDOCUMENT_CLOUD). The method “is_ relevant” receives the source data in the importing parameter “is_source_data”. The changing parameter “cv_relevant” allows you to control whether electronic document is created or not – per default it is “true”, therefore you only need to handle cases, where electronic document shouldn’t be created.Implementation Steps:Create enhancement spot for ES_DOCUMENT_CLOUD.Create BAdI implementation for EDOC_ADAPTOR_CLOUD.Create implementing class for BAdI EDOC_ADAPTOR_CLOUD, which implements the interfaces if_badi_interfaces and if_edoc_adapter_cloud.Implement method is_relevant of interface if_edoc_adapter_cloud.Activate your BAdI implementation. CLASS zcl_badi_edoc_adaptor_cloud DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_badi_interface .
INTERFACES if_edoc_adaptor_cloud .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_badi_edoc_adaptor_cloud IMPLEMENTATION.
METHOD if_edoc_adaptor_cloud~is_relevant.
CHECK iv_source_type = ‘SD_INVOICE’. “– Check Source Type
IF is_source_data-billing_header-netwr = 0.
cv_relevant = abap_false.
ENDIF.
ENDMETHOD.
ENDCLASS. If you check again the “Create Electronic Documents Manually” app after the BAdI is implemented and active, you see that the Billing Document is set to “Not Relevant” for electronic document creation. Read More Technology Blogs by SAP articles
#SAP
#SAPTechnologyblog