sexta-feira, 1 de maio de 2020

How to prevent the sales(SD) document to post CO-PA document ?

Overview


Let´s create some situation in this blog post to have a better understanding about the content of this post.
In many businesses that run the SAP ECC system, the company sales and profitability results are analyzed by the CO-PA: Controlling – Profitability Analysis. CO-PA Documents are created during the sales processing until Billing.
I am pretty sure that many business which have this system scenario, don´t use the Sales and Distribution processing only for Profitable Sales. That means, that are some SD(outbound) scenarios which will not affect the company P&L, here we have some sales process that should not impact the company P&L:
  • Free Shipping
  • Test Consignment with or without Return
  • Donations
  • Scrapping
and… many others that are not related to the company profitable business.
Usually, the cost of these sales processing are usually absorved/consumed by the company.

Prevention of Update


In a scenario like this one how to prevent the sales document to post CO-PA document ?
A long time ago, the SAP delivers an enhancement for actual data update in CO-PA. You can check OSS note for some SAP Details 397298 – COPA0005: Prevention of update does not work
The COPA0005 – Enhancement for actual data update (CO-PA) will help us to achieve this need.
This enhancement has a component called EXIT_SAPLKEII_001 – User Exit for Processing AC-Document: Line Item Structure:

This EXIT has the following ABAP Code Function Structure:
FUNCTION EXIT_SAPLKEII_001.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"       IMPORTING
*"             VALUE(I_ERKRS) LIKE  TKEB-ERKRS
*"             VALUE(I_ITEM)
*"       EXPORTING
*"             VALUE(E_ITEM)
*"             VALUE(E_INIT)
*"       TABLES
*"              T_ACCHD STRUCTURE  ACCHD
*"              T_ACCIT STRUCTURE  ACCIT
*"              T_ACCCR STRUCTURE  ACCCR
*"              T_ACCIT_PA STRUCTURE  ACCIT_PA
*"              T_ACCCR_PA STRUCTURE  ACCCR_PA
*"----------------------------------------------------------------------


INCLUDE ZXKKEU07 .


ENDFUNCTION.

They delivered the E_INIT Exporting parameter in this enhacement function and this indicator when set TRUE will avoid the creation of the CO-PA documents.
Usually the Sales Processes have different document types for each outbound sales or non-sales processing so we set a dynamic code in this enhancement to prevent the CO-PA document creation based on the Sales Document Type.
IF >>> your condition to prevent or not the COPA.
  e_init = abap_true. "By setting e_init true, the COPA document will not be created.
else.
  e_init = abap_false.
ENDIF.

I think this tip could be helpfull you guys that are working with sales processes that should not impact the profitability analysis of the company.
Best regards,
Gabriel Coleti

Um comentário: