segunda-feira, 16 de novembro de 2020

Adding custom tab to billing document

1. Requirement

In order to fulfill some requirement, we may need a custom tab for transaction VF01/VF02/VF03 with some custom field(s) in that sub screen, in this document we take GTI (Golden Tax Invoice) for example.

2. Symptom

There is no screen enhancement or user exit for us to enhance the billing document tab, for SAP standard, only BADI (BADI_SD_CUST_HEADBADI_SD_CUST_ITEM) to do this, but both these BADIs are only provided for SAP internal use.

3. Environment

This document is under SAP ERP 6.0 EHP7 with IDES on NetWeaver 7.42, and also verified on SAP S4/HANA 1511(S4Core 100 SP03) on NetWeaver 7.49.

This document is under SAP GUI 750 Patch 1.

4. Reproducing the Issue

When we try to create BADI implementation for BADI_SD_CUST_HEAD or BADI_SD_CUST_ITEM, we get the error message “BAdI definition BADI_SD_CUST_xxxx is only provided for SAP internal use”.

Check the BADI definition, we can find that these BADIs marked as “Within SAP”, so we cannot use this BADI to add our own data.

5. Reason and Prerequisites

5.1 Reference

SAP Note 864944[1] describe the detail on this, these BADIs are only intended to be used for individual SAP industry solutions, and there is no solution according to the note.

5.2 Investigate

This document we take header tab on billing document for example, intended to add two fields GTI number and GTI generate date, and related data should be stored into VBRK by append structure.

From SE93, we could find the main program of VF03 is SAPMV60A (VF01/VF02 are the same), then check the screens on repository browser for program SAPMV60A, screen 6001/6101 maybe the related ones.

From where-used we can found that BADI_SD_CUST_HEAD is used within function module GET_HANDLE_SD_CUST_HEAD, and there are only 4 hits for this function module

Also check from screen (take 6001 for example), there is module CUST_HEAD_ACTIVATE in flog logic to call CUST_HEAD_ACTIVATE which using the function module GET_HANDLE_SD_CUST_HEAD.

From the navigation target for IF_EX_BADI_SD_CUST_HEAD~ACTIVATE_TAB_PAGE we could found there is an BADI implementation within the SAP standard, CL_IM_WB2_IVGUI_LAYOUT_H is referring to BADI implementation WB2_IVGUI_LAYOUT_H which could be found with SE19

So the conclusion is that BADI implementation WB2_IVGUI_LAYOUT_H is referring to BADI definition BADI_SD_CUST_HEAD, which is store in package WB2B_CORE for Global Trade Industry solution.

According to this, the whole picture to adding custom tab to billing document is to implement BADI which related to screen 6001 and 6101, since this BADI are not allowed to be implemented by ourselves, we could try to inject the similar code to screen 6001 and 6101 to achieve the goal.

5.3 Verification

Let’s debug to find out all the key point.

There are four methods within BADI implementation WB2_IVGUI_LAYOUT_H, we set breakpoint for each method, and pick a billing document to change with VF02.

When we go to the header tab, the first breakpoint is for ACTIVATE_TAB_PAGE.

When we switch to “Global Trade Management” tab, which is enhanced by BADI implementation WB2_IVGUI_LAYOUT_H, the second breakpoint is for TRANSFER_DATA_TO_SUBSCREEN.

When we input data or press button on the screen, the third breakpoint is for PASS_FCODE_TO_SUBSCREEN, and then the fourth breakpoint is for TRANSFER_DATA_FROM_SUBSCREEN.

Using debugger “Return (F7)” we can verify that these four breakpoint all related to screen 6001 and 6101, the previous conclusion verified.

All above are based on SAP ERP 6.0 EHP7 IDES, but basically for production environment we don’t have “Global Trade Management” tab, let’s find out the root cause.

Check the code within WB2_IVGUI_LAYOUT_H->ACTIVATE_TAB_PAGE and trace back, the control point come from TWGTAWB2_ADDON_ACTIVE.

Table TWGTA is maintained by view V_TWGTA, which located at SPRO–>Logistics – General–>Global Trade Management–>Active Components, and under “Enhancement Settings”–>”Add-Ons Active”.

When this option set to “2 Active for All Documents”, we can see the enhance tab named “Global Trade Management” in billing document header.

Try to set it as “Inactive”.

Then the “Global Trade Management” tab disappears.

This option is for an industry solution named “SAP Enterprise Extension Global Trade”, which contains in an individual component EA-GLTRADE, which merged into S4CORE from S4/HANA 1503.

This option differed between different SAP version, default as below:

6. Solution

6.1 Side Effect

There is only one screen reserved for enhancement on billing document header, we should check carefully for the validity of “Global Trade Management” before we adding our own custom tab to billing document header.

Below solution based on we deactivate the “Global Trade Management”, if we want to add custom data when “Global Trade Management” activated, consider to process it within BADI WB2_IVGUI_LAYOUT_H, will not discuss it in this document, referring to main program SAPLWB2B_SCREEN_HANDLING.

6.2 Append Structure

We will append ZZ fields to VBRK, which will be shown in custom tab, in order to populate the data to VBRK automatically. All the name should start with double Z to prevent conflict because some standard field name start with single Z.

Create data element ZGTINO and the description, data type, field label like below:

Create data element ZGTIDT and the description, data type, field label like below:

Display table VBRK, and go to Append Structure…, then click the Create Append and fill in the append name “ZZVBRK_APPEND_GTI”, structure name should start with “ZZ”

Fill in component “ZZGTI_NUM” and “ZZGTI_DAT” using data element created previous as component type, make sure the component name also starts with “ZZ”.

6.3 Create Program

Since all the include of main program SAPMV60A is start with MV60AF, so we could create an individual program named ZMV60AF_CUST_HEAD to store all the processing code.

Go to repository browser to create screen 6001, make sure the screen type is set to “Subscreen”.

Go to the flow logic of screen 6001, write below PBO and PAI, then double click on PBO_6001, and create PBO Module within main program ZMV60AFZ_CUST_HEAD, write down your own code, and finally back to screen 6001 to click Layout to next step.

On the screen painter, press F6 to open diction/program fields window, put VBRK into Table/Field Name, then click Get from Dictionary, and select the field(s) which should display in the screen.

6.4 Screen Enhancement

From screen 6001 of main program SAPMV60A, double click on the CUST_HEAD_ACTIVATE to the FORM, press Shift+F4 to enhance.

Select the menu Edit–>Enhancement Operations–>Show Implicit Enhancement Options.

Right click on the line under FORM CUST_HEAD_ACTIVATE, and select Enhancement Operations–>Create Implementation, choose the enhancement mode as Declaration.

Create new enhancement implementation names ZGTI_SAPMV60A.

Here I will show two solutions to implement the enhancement, and recommended to choose solution B:

  • PERFORM … IN PROGRAM … IF FOUND
  • CALL BADI … (custom BADI)

 


SOLUTION A: PERFORM … IN PROGRAM … IF FOUND


Put own code into enhancement implementation, suggest using PERFORM … IN PROGRAM … IF FOUND, and all code of detail logic could be coding within program ZMV60AFZ_CUST_HEADWB2_IVGUI_LAYOUT_H->ACTIVATE_TAB_PAGE could be a reference.

For the rest three methods of BADI BADI_SD_CUST_HEAD, which is using with screen 6101, even we don’t use for this moment, recommended to enhance and reserve to change easily within program ZMV60AFZ_CUST_HEAD, all the enhancement implementation should use the same name ZGTI_SAPMV60A, so that we could use SE20 to check all the enhancement together.


SOLUTION B: CALL BADI … (custom BADI)


The better way is to create custom BADI, start with interface refer to IF_EX_BADI_SD_CUST_HEAD. Let’s go to SE24 to create ZIF_EX_BADI_SD_CUST_HEAD.

Set the methods and parameters the same as IF_EX_BADI_SD_CUST_HEAD, and then add one more parameter FTAB for ACTIVATE_TAB_PAGE to exporting tab caption, also add one more method CHECK_BADI_ACTIVATE to check if the standard BADI already activated.

When the interface ready, go to SE20 to create enhancement spot named ZES_GTI_SAPMV60A.

Within enhancement spot element definitions, we create BADI definition named ZBADI_SD_CUST_HEAD.

Assign interface ZIF_EX_BADI_SD_CUST_HEAD we created previously.

Uncheck the “Multiple Use” option.

Create BADI implementation named ZGTI_BADI_SD_CUST_HEAD, and fill in the implementing class ZCL_IM_GTI_BADI_SD_CUST_HEAD on the popup window.

Double click or through SE19 we display BADI implementation ZGTI_BADI_SD_CUST_HEAD.

Double click on the method to create method implementation

Assign aliases for implementation class ZCL_IM_GTI_BADI_SD_CUST_HEAD.

Put own code into related implementation method, don’t forget to check if standard BADI activated, and the method of standard BADI implementation WB2_IVGUI_LAYOUT_H could be a reference.

Finally, put own code into enhancement implementation into screen 6001 and 6101 of main program SAPMV60A, which can simply use CALL BADI.

6.5 Verification

Change billing document with VF02, and go to Header–>Additional Data, fill in related data and save, then check table VBRK, the additional data already stored there.

Display billing document with VF03, the additional data in custom tab is read only.

When we activated the “Global Trade Management” again, our custom tab will be replaced, not effect to the control of standard customizing.

7. Best Practice

Try not to put the detail logic DIRECTLY into enhancement implementation, create custom BADI would be a good choice, don’t forget to reserve enough parameters and should check the validity of the call, so that the possible effect will be minimized, and if we would like to change the logic of enhancement, it is easier to control them through SE20.

Solution A should not be a choice for production environment since FORMS is an obsolete ABAP statement.

8. Quotation

segunda-feira, 12 de outubro de 2020

S/4HANA 2020: Automatic assignment of Storage Location MRP Area to Material Master

 As you probably already know, SAP S/4HANA introduced a simplification for the storage location planning scenario and it is now a requirement to use MRP Areas if you need to plan a storage location separately or to exclude it from MRP. (if you are not aware of this simplification, check this blog)

With this simplification in place, SAP is trying to bring new features to improve the S/4HANA usability, such as the improvements in MD04 delivered in MD04 (see details here)

SAP S/4HANA 2020 brought a new feature that will simplify the master data maintenance for materials with MRP Areas. In ECC, it was possible to define a default value for the storage location MRP indicator in the customizing transaction OMIR, therefore, whenever a storage location was extended for MRP, it would be automatically excluded from MRP or planned separately.

Now, in S/4HANA 2020, it is possible to automatically assign a storage location MRP Area to a material when extending this storage location to a material, and have default values for the MRP fields in the MRP area. This feature allows a storage location to be automatically excluded from MRP or planned separately whenever it is extended for a material. So let’s check how this feature can be enabled in the system.

The first step is to create an MRP Area Profile in customizing and the following picture shows the IMG activity path to this customizing activity.

MRP%20Area%20Profile%20Customizing

MRP Area Profile Customizing

 

In the MRP Area Profile we will define default values for the MRP fields under the MRP Area. These values will be used when extending the storage location assigned to the storage location to the material master, if the feature is active for the MRP Area. By setting the flag Copy Field, the value defined at the material master at plant level will be copied to the MRP Area.

MRP%20Area%20Profile

MRP Area Profile

 

After the profile creation, we need to check the flag Assign Materials Automatically and assign the profile to the MRP Area in the MRP Area customizing (transaction OMIZ).

MRP%20Area%20Customizing

MRP Area Customizing

 

With this setting in place, whenever we extend storage location 0004 (which is the storage location assigned to the MRP Area) to a new material, it will automatically create the assignment to the MRP Area, with the field values proposed on the profile. The following figure shows the MRP Area that was automatically assigned to a material. Note that the MRP Area will be created in background, once we save the material, so we will not see when extending the storage location in MM01.

MRP%20Area

MRP Area

 

This feature is one more step to streamline the adoption of MRP Areas in S/4HANA and I hope you can leverage this new feature to simplify the master data maintenance in your system.

How to Test BAPI Function Module in SAP?

 Introduction

As a SAP Consultant at some point of your career you will use BAPI. There is special way to test a BAPI whether it is really useful for you to call in your Program.

 

Solution

In our example we will be using BAPI_PO_CHANGE to change some fields in PO Line Item.

Now we will fill the Parameters and save it as a Test Data

Below is the Saved Test Data Entry

Now we go back to SE37 and follow the below path

We will put the following Function Modules.

Now we execute based on the saved Test data

After Executing we will hit Back Button and this will call the Commit Function Module

BAPI_TRANSACTION_COMMIT is called and we execute

Now executing is completed and the Database has commited.

 

Conclusion

We can use this Blog for both SAP ECC and SAP S/4HANA

 

Below is the video version

 

Also check how to Find BAPI

 

 

Synchronous goods receipt and backflush in production order in embedded Extended warehouse management (EWM) in S/4HANA 2020 Release

 SAP S/4HANA 2020 release has provided a significant simplification with ‘Synchronous Goods receipt and Backflush for Production order  in embedded Extended warehouse management (EWM)’. Synchronous goods movement is the posting of goods at Inventory management (IM) in S/4HANA and EWM at the same time. Backflush means automatic posting of goods issue for components (raw materials) of production order at the time of Production confirmation. Capability of synchronous goods receipt and backflush is one of the most important innovations for the benefit of the customers using ‘Advanced production integration’ for production order for discrete production processes.

My present blog is to describe this new feature of ‘Synchronous Goods receipt and Backflush for Production order ‘as introduced in embedded EWM of S/4HANA 2020 release, highlight the difference in previous & new processes, pre-requisite configuration and business benefits.

A typical process flow (till S/4HANA 1909 release) for Confirmation of production order with finished good and components managed in EWM managed storage location is depicted in below image. Inbound and outbound deliveries are created in ERP or S/4HANA core for goods receipt of finished good and goods issue for components respectively on confirmation of production order. Corresponding inbound delivery and outbound delivery order are also created in EWM after distribution from ERP (or S/4HANA). Stock update (Increase for goods receipt and decrease for goods issue) happens in Inventory management after goods receipt and goods issue in EWM.

 

The process for production confirmation with S/4HANA 2020 release is in below image showing significant simplifications. Now, on Production confirmation (with transaction CO15 or CO11N), following goods movements happen at the same time i.e synchronously.

  • Goods receipt & goods issue (backflush) happen in ERP (or S/4HANA)– as in image (A)
  • Goods receipt posting & goods issue posting in EWM – as in image (B)

Screenshots of SAP transactions for (A) and (B) are shown in below image. PP05 is the finished good and RM01 is the raw material or the component in this scenario.

Display of material document in transaction MIGO of S/4HANA has also been enhanced with a new tab ‘Warehouse management’ as shown below. Warehouse task of EWM is also displayed with the option to navigate to EWM warehouse monitor directly.

This new functionality will provide the following benefits.

  • Elimination of inbound and outbound deliveries
  • No requirement to monitor asynchronous queues
  • Increased user productivity with elimination of manual postings and manual errors
  • Goods receipt and goods issue in one single material document

One of the most important prerequisite configurations is in below image. Production scheduling profile in ‘Work scheduling’ view of material master of Finished good shall have the setting for ‘Goods receipt and goods issue’ in ‘Post synchronously in bin’.

Note that this functionality is possible

  • Also for Process order
  • only with embedded EWM i.e not with Decentralized EWM.

Functionality of Synchronous goods receipt with backflush for repetitive manufacturing (REM) was provided in embedded EWM in S/4HANA 1909 release as described in my blog in link https://blogs.sap.com/2020/03/13/synchronous-backflush-posting-with-repetitive-manufacturing-in-embedded-ewm-in-s-4hana-1909-release/ .

This is my first blog on innovations on S/4HANA 2020 release. I will write series of blogs with special focus on Advanced ATP, EWM, TM and YL . So, please stay tuned and inform your feedback, comments, views.

Harmonized Serial number profile introduced with Extended warehouse management (EWM) in S/4HANA 2020 Release

 Serial number is a series of characters tagged to a product to differentiate an item from another item of same product. The product code and the serial number is unique. Serialization is mandatory in certain industries and essential in case of recall or warranty claim of the product.

Serial number profile can be maintained in three views (Sales Org/ Plant, Plant/ Stor2 and WM execution) of ERP or S/4HANA material master as shown in below image. Till S/4HANA 1909 release, serial number profile maintained in WM execution view only gets transferred to Extended warehouse management (EWM) Product master. My present blog is describe how SAP has harmonized serial number profile in S/4HANA core and EWM in S/4HANA 2020 release.

Technically speaking, Fields for Serial number profile in views ‘Sales Org/Plant’ and ‘Plant/Stor2’ correspond to the table MARC (MARC-SERNP) and  ‘WM execution’ to the table MARA (MARA-SERIAL).  Table MARC contains data or values specific to a plant for a material and Table MARA contains general data (i.e values relevant for all plants for a material).

Till 1909 release, the field for serial number profile is only in ‘Storage’ view of warehouse product master in EWM. Data / values in ‘Storage’ view of warehouse product master of EWM also correspond to ‘General’ values i.e not specific to a warehouse. And hence, value of Serial number profile of ‘WM Execution’ of S/4HANA core only flows to the field of Serial number profile in Storage’ view of warehouse product of EWM i.e not from the values of serial number profile from ‘Sales org/plant’ or ‘Plant/Stor2’ . Above images are from 1909 release and we can see that field in WM execution is blank. Accordingly, we can see the field of Serial number profile is also blank in ‘Storage’ view of warehouse product master of EWM as in below image (also from 1909 release). So, till 1909 release, Serial number in warehouse product master in EWM is maintained only at global level.

Also till 1909 release for serial numbers to work in EWM at global level, we have to define the configuration of the Serial number profile in two places (which often cause inconsistencies) in IMG menu path

  • Logistics execution->Shipping->Basic shipping functions->Serial numbers->Determine serial number profiles (which is stored in table T377) depicted in (A) in below image and
  • Integration with other SAP Components->Extended warehouse management->Additional material attributes->Attribute values for additional material master fields ->Define serial number profile (which is stored in table TSERIAL) depicted in B in below image

Now in S/4HANA 2020 Release, SAP has provided the option to harmonize the serial number profiles at client level. Merged ERP & EWM serial number profile settings of S/4HANA 2020 release has been shown in below image.

Above settings can be accessed (or configured) from either of the below IMG paths

  • Logistics execution->Shipping->Serial numbers->Determine serial number profiles or
  • SCM EWM->EWM->Master data->Product->Serial number profiles->Harmonized serial number profiles->Define serial number profiles (This is new in S/4HANA 2020 release).

Now from S/4HANA 2020 Release, Serial number defined in plant or MARC level (Sales org / plant or Plant / Stor2) of material master in S/4HANA  also appears in a new field ‘Serial number profile’ in ‘Warehouse’ view of warehouse product master in EWM as in below image.

As this harmonized serial number profile is now at plant level, a material can also have different serial number profiles in different plants depending on their business requirement.

One of the prerequisite setting to use the harmonized serial number profiles is to enable the harmonization in IMG path SCM EWM->EWM->Master data->Product->Serial number profiles->Harmonized serial number profiles->Enable Harmonized serialization in EWM as shown in below image.

This harmonization of serial number profiles ensures consistency and eliminates errors in settings and use of serial numbers with EWM.

I will write series of blogs with special focus on Advanced ATP, EWM, TM and YL for innovations on S/4HANA Release . So, please stay tuned and inform your feedback, comments, views.

Source: https://blogs.sap.com/2020/10/11/harmonized-serial-number-profile-introduced-with-extended-warehouse-management-ewm-in-s-4hana-2020-release/

quinta-feira, 8 de outubro de 2020

ERP Rollout to Brazil in times of SAP S/4HANA…


This blog targets SAP solution architects and Global IT members that are studying a future SAP rollout to Brazil or the conversion/implementation of S/4HANA to replace ECC or legacy ERP systems.

Last week (CW 38 2020) was the SAP Now event where SAP and partners showcased several new solutions for Brazilian Localization of S/4HANA.

With all the changes done in the most recent releases of S/4HANA and all new solutions available it’s valid to discuss and analyze what’s the best strategy for doing a rollout to Brazil in terms of technical architecture and busines process to cover both the business requirements as well as the technical requirements.

I’ll not enter into specific details of the scope item configuration for Brazil (as there many differences to other coutnries) but rather focus on the main topics on architecture and project decisions.

With the trends on digital transformation and agile implementation projects it’s normal to question the processes, developments and new needs contemplated in the Brazil localization in S/4HANA.

The main country-specific challenges in S/4HANA for Brazil continue to be the same that we had in ECC:

  • Real-Time Integration of Electronic Documents such as outbound and inbound invoices (NF-e) and Freight bills (CT-e) into AP/AR processes
  • Complex taxation on sales/purchases (several taxes and taxation due at goods movement without added value)
  • Complex legal reporting (SPED electronic bookkeeping reports) with several national, state and city level reporting with different layouts and very high level of complexity
  • High Maintenance/Administration effort for IT to create new document types, new settings and ensure data can be consolidated into a useful manner for group reporting and performance comparison

There are other implications of Brazil localization with impact in FICO (Country Specific Reference Chart of Accounts for legal reporting, Bank Statement formats based on Febraban Standards, Actual Costs at Month-End Closing with Material Ledger) but these types of requirements are more common in rollouts to other countries and will not be part of this article.

Summed to the country-specific requirements there are still other project and technology challenges that come from new deployment model possibilities (Cloud or Hybrid models besides On-Premise) and Business Process Management, that is how to handle the Global Template (Balance business requirements, legal requirements and company global/local processes).

 

Deployment possibilities for Brazil S/4HANA implementation

There is an interesting blog from SAP that explains the difference between the different capabilities and functionalities available in the different deployment possibilities of SAP S/4HANA cloud and on-premise deployment options

I’ll highlight specific points related to Brazil country specific features:

  • On-premise

That’s the most traditional deployment (although SAP is pushing cloud solutions to become the go-to for new customers) for S/4HANA so far.

The main advantages of the On-Premise for Brazil are keeping the schedule of changes totally under the company control (SAP publishes correction notes frequently for XX-CSC-BR* components and sometimes they contain critical updates needed for allowing invoices to be issued correctly) and  allowing all enhancement techniques, some country specific features are not supported by SAP and they require extensive usage of “implicit enhancements” in localization function modules and classes/methods. On the downside it requires higher administration and IT efforts to be maintained and generally cause higher complexity for upgrades and system updates.

  • Cloud

SAP S/4HANA offers different cloud deployments ( Cloud Essentials, Cloud Extended and Private Cloud HEC ) for Brazil.

SAP released Brazil localization for S/4HANA cloud (Essentials/Extended) and it also released cloud enabled solutions like NF-e Inbound/Outbound as a Service and Tax as a Service. Interestingly some of the cloud solutions from SAP can be also integrated with an On-Premise S/4HANA via SAP cloud Platform.

The SAP documentation for S/4HANA cloud Brazil is found in the following link: S/4HANA Cloud Brazil (2008)

S/4HANA Cloud seems an interesting solution mainly for companies that are primarily service providers ( with less complex taxation requirements ) and also for companies that have less complex operations ( only administration office to do imports with external warehouse ) where they’ll not need the full scope of complex operations ( Production, Procurement and Transportation Management ).

The service tax in Brazil is less complex than the taxes for goods and also the legal requirements due for service companies are easier to be implemented. It’s also possible to implement it in other companies with more processes but then it will require more extensions to be developed in SAP Cloud Platform to complement scenarios that are not available directly in the ERP.

The cloud essentials also enforce the usage of FIORI apps ( No ABAP Dynpro or SPRO availability ) while the other cloud options have still more possibilities ( with certain restrictions only ).

SAP is focusing more and more in cloud solutions so new functionalities for Brazil localization are usually released for Cloud first and later on ( once a year ) for the On-Premise Versions.

  • Hybrid

An on-Premise S/4HANA system can be “plugged” into cloud-based solutions such as NF-e solutions or Tax as a Service or other products in SAP Cloud Platform depending on customer requirements.

It reduces the needs of maintenance by IT and ensure that frequent updates are implemented in the cloud systems ( according to legal requirements ) without changing the core ERP functionalities.

That provides an option to reduce administration effort of country specific features for companies that still want to maintain an On-Premise ERP installation.

Source: SAP 

 

Now we can go into details for each of the main Brazil country specific challenges listed above as well other important information:

 

1. Real-Time Integration of eDocuments

Probably the most known example of the brazilian legal complexity for business is the Electronic Invoice (NF-e). Unlike other eDocuments being currently implemented in Europe the Brazilian NF-e is more detailed (more than 500 tags) and the rules to accept the documents are more strict (more than 400 different validation rules). As of 2020 there are basically two main options for NF-e / CT-e (Freight Invoice) implementation.

  • On-premise solutions

The SAP solutions for OP systems are SAP Electronic Invoicing 10.0 ( aka GRC NFE ) and SAP NFE 10.0 for S/4HANA

The SAP on-Premise NFe solution GRC has both inbound and outbound functionalities ( separate licensing for each one ). The outbound solution receives data from ERP via RFC and builds the XML of the electronic invoice, sign it and send to PI that communicates with government.

The inbound automation receives XML from government webservice ( or from partners via PI / e-mail ) and processes them to allow the posting of the goods receipt and the invoice receipt. It’s integrated into ERP so the majority of the BAdI implementations are done in S/4HANA side. It supports NF-e, NFC-e, CT-e and MDF-e.

It does not support NFS-e ( Service Electronic Invoices ). Service Invoices are a special topic as service documents are linked to each city hall and there are several different file formats and integration methods such as WebServices, WebPortals and also still old paper invoices ( not all city halls work with electronic service invoice ).

  • Cloud solutions

SAP has a suite of solutions called SAP Document Compliance that compreehends edocuments for several countries. An interesting overview about it can be seen in the blog post Overview of SAP document compliance. Similarly to On-Premise there are different solutions for Incoming and Outgoing Electronic Documents:

    • Outgoing

The documentation of the SAP solution for SAP Document compliance Outbound can be found in SAP HELP Portal.

In summary SAP already developed a replacement solution for the on-premise NF-e and has live customers using it. The product covers NF-e, CT-e and NFS-e ( for RJ and SP city hall ). This solution is not based on the eDocument Framework from SAP but uses SAP Cloud Platform for communication.SAP recently released a partner enablement solution where partners can integrate other city halls with the SAP solution to extend its reach.

It’s interesting to highlight that it’s possible to acquire from SAP partners the SAP NFE ( AKA GRC NFE ) as a service ( installed, managed and monitored by partner ) which is also a viable cloud solution for E-Invoicing.

    • Incoming

The documentation of the SAP solution for SAP Document compliance Inbound can be found in SAP HELP Portal.

The SAP Cloud solution for Incoming NF-e’s is based on the eDocument Framework and it has been released after the outgoing part. The scope of NFe as a Service inbound is not yet the same of GRC NFE, but SAP is developing additional functionalities for this solution and probably they’ll have very similar scope until end of 2021..

For this case it’s also possible to acquire from SAP partners the SAP NFE Inbound ( AKA GRC NFE inbound )  as a service ( installed, managed and monitored by partner ) which is also a viable cloud solution for E-Invoicing.

Additional Info on Edocuments

There is one lecture from SAP Inside Track Brazil where I explain more technical details about the eDocument Framework from SAP.

2. Taxation in Sales/Purchases/Transfers

Brazil taxation contains several different taxes ( don’t think about VAT as it does not apply to Brazil ) and it requires different implementation in all logistics/finance processes to ensure the correct taxes are determined, calculated and postings into Accounting. In the past there was only On-Premise Solution but for S/4HANA it was also developed an interface for external tax calculation ( similarly to AC-INT / VERTEX in USA ):

  • On Premise

Popularly known by consultants as TAXBRA/RVABRA this is the pricing procedure for Brazil used in ECC and S/4HANA and it uses CBT ( Condition-based technique ) to determine validity of taxes and calculate their values.

The pricing in brazil is quite complex ( if you check SD pricing procedure you’ll find more than 80 tax-related conditions in the standard procedure ). The configuration of it requires deep expertise from Tax Topics in SD, MM and Logistics in General ( Taxation on Stock Transfers and Repairs/Free Goods apply in Brazil ).

The number of conditions and tax exceptions necessary for Brazil would start around 2 or 3 thousand entries and it can easily go into more than 100 thousand entries depending on the busines sector and in how many states a company operates.

In the SAP Best Practices even though the default implementation for S/4HANA systems is the Tax As a Service (discussed in the next section) as replacement for TAXBRA/RVABRA, most companies are still implementing S/4HANA with TAXBRA/RVABRA.

  • Cloud solutions

SAP has a solution called SAP Localization Hub where it offers a Tax Service engine. According to SAP the tax service helps you to determine and calculate applicable country/region-specific indirect taxes. The tax service works with sample tax determination / calculation content and increases automation in tax-relevant transactions.

For some countries SAP has a standard content for the tax engine, but for Brazil you have to integrate it with homologated partner tax solutions for having the tax calculation.

SAP has an interesting video with additional details about the solution:

In the API hub from SAP you can see which services SAP offer for these BRazil specific scenarios.

It’s interesting to note that SAP has a few partners homologated for the implementation of the tax service in Brazil and you’ll need to establish a contract with them before you start using the solution in the development/test systems in your project.

3. Electronic Legal Reporting (SPED bookkeeping and Additional Obligations)

Brazil has Legal Reports at federal, state and city level and it’s a major point for customers implementing SAP as it requires for most of the companies a complementary solution for tax reporting. In S/4HANA SAP offers two native solutions for Tax Reporting ( licensed separately from S/4HANA ) in addition to external tax reporting tools from Partners.

TDF is a framework that SAP developed to work as a central repository of tax data for Brazilian reports. It provides the structure of SPED Reports but requires complementary developments to meet the legal requirements to deliver the report files. It works as an add-on, so it has to be installed in a separate SAP Netweaver system. TDF does not have as standard state or city hall reports, so they have to be developed during the project or acquired from partner complementary products.

The main SPED reports are ECD, ECF, EFD-ICMS/IPI, EFD-Contribuicoes and EFD-Reinf but in projects it’s usually needed to develop additional state reports ( GIA’s and others ) and city reports ( for ISS service tax ).

ACR is an embedded solution in S/4HANA for legal reporting. The base framework for ACR BRazil are the calculation views from TDF CTR ( central tax repository ). The User Interface of ACR is based on UI5/FIORI ( TDF has both ABAP Dynpro and UI5/FIORI  ) and there are differences in reporting from TDF ( REINF solution uses a different framework for the event processing for example).

Partner Solutions

It’s important to note that even if you choose SAP standard solution for tax reporting you’ll need to have custom developments to do the tax appraisal or you’ll need to integrate them with add-on’s from partner. There are partner products that can be used to complement TDF/ACR and also options to fully replace them. In the context of S/4HANA the only SAP homologated partner solutions are the ones that are integrated to TDF.

 

4. Maintenance challenges for S/4HANA Brazilian Rollout

Due to the points mentioned before you can certainly understand that a global template designed elsewhere in the world will need many adaptations for local processes to be able to serve the company in Brazil. Two important details are highlighted in regards to this topic:

  • Fit-to-standard ( former Fit-Gap )

One of the main challenges in the rollouts is fitting the local requirements of Brazil to the template in a way that balances the complexity of IT efforts (to create new settings and support local processes exclusive to Brazil ) and the needs from the Business areas.

It’s normal that when this balance is compromised either the IT will have higher support demands to maintain hundreds of country specific settings ( document types, Tax Codes, Item Types, etc.. ) or the business will have to execute too many processes manually to redetermine data because the template settings don’t meet the requirements for automating a process.

It’s advisable to have trusted partners with local expertise to help conduct the sessions and also to communicate with users in Brazil to help them bring their needs to the workshops.

  • Best practices

The SAP Best Practices was revamped for S/4HANA making it easier to build a prototype system for doing a workshop with IT to analyze gaps between template processes and Brazil Processes and also to standard SAP Brazil localization functionalities and the company legal requirements to be implemented in Brazil.

These best practices can speed up the initial settings but will require effort to be implemented prior to fit-to-standard workshops.

 

As it’s possible to see in the blog post there are several specific requirements from Brazil for a rollout but they are manageable when the right approach is followed for the implementation and it’s possible to have a successful Go-Live that enables the company to perform their operations well with an SAP System in the Brazilian Market.

Although it requires a lot of orchestration from project team with local business and Global Process Managers if all the points mentioned above are taken into consideration for project planning and implementation it’s very likely the outcome of the project will be a successful implementation.

If you want to get in touch or share your thoughts to discuss some of the topics please feel free to leave a comment on the post with your view or the challenges you see in such projects.

Regards,

Renan Correa

 

All views expressed on this blog post are my own and do not represent the opinions of
any entity whatsoever with which I have been, am now or will be affiliated.
These views are subject to change in future due to new developments or products in
S/4HANA and other systems.

Source:https://blogs.sap.com/2020/09/28/erp-rollout-to-brazil-in-times-of-sap-s-4hana.../