In this blog I am going to talk about how SAP determines whether to generate new output or not for a PO when a change is made by the user and approved (if needed ).
Standard logic for output trigger
Output triggering mechanism starts when PO gets approved / Ordered. In table BBPC_ACTIONMAP for object type BUS2201 and event category 'OUTPUT' you will find class CL_BBP_ACTION_OUTPUT_PO. This class has method CHECK_RELEVANCE_DIFF, where there is a call to FM 'BBP_PD_ALL_GET_DIFF'
CALL FUNCTION 'BBP_PD_ALL_GET_DIFF'
EXPORTING
iv_guid1 = mv_object_key
iv_guid2 = mv_object_key
iv_comp_method = bbppd_comp-po_output "POO
is_read_flags = ls_read_flags
IMPORTING
ev_objects_differ = lv_objectdiffers.
If lv_objectdiffers is set to 'X' then output is triggered.
Here ls_read_flags defines what kind of data change is relevant for PO output trigger. That list of data along with corresponding structures is mentioned below.
Type of data | Structure |
Item data | BBP_PDS_ITEM |
Partner data | BBP_PDS_PARTNER |
Longtexts | BBP_PDS_LONGTEXT |
Limit data | BBP_PDS_LIMIT |
Tax data | BBP_PDS_TAX |
Pricing doc data | BBP_PDS_PRICE |
Attachment data | BBP_PDS_ATT |
Schedule line data | BBP_PDS_SDLN |
Freight data | BBP_PDS_FREIGHT |
When any of the field value of above mentioned structures changes, only then PO output gets triggered. For every type of data/structure, SAP uses a specific FM to check, if the values have been changed. For example, for checking tax related data SAP uses FM BBP_PDTAX_GET_DIFF. These FMs have exporting parameter EV_SETS_DIFFER, whichis set to 'X', if there are changes to any of the field in respective structure.
Important thing to understand here is the role played by table BBPV_COMP_FIELDS in excluding some of the fields from triggering PO output. In this table we can maintain for specific comparison method ( POO and SYS are relevant for PO output ) and specific structure fields that will be excluded from PO trigger determination logic.
For example, if you have below entries in table BBPV_COMP_FIELDS, then changes to fields BE_OBJECT_ID, CREATIONTIME and P_GUID do not trigger new PO output
Comparison Method | Name of a structure | Field Name | Structure/Field Enters Comparison or Not |
---|
POO | BBP_PDS_ITEM | BE_OBJECT_ID | E ( E stands for Exclude ) |
POO | BBP_PDS_ATT | CREATIONTIME | E |
SYS | BBP_PDS_LIMIT | P_GUID | E |
But, it is not that simple, if you change field which has dependencies on other fields and those dependent fields are not defined in this table as E instead only the changed field is defined , then output will generated if you change this field in PO and reorder the PO.
When price is changed at item level output gets triggered, even though we maintain table BBPV_COMP_FILEDS. The reason for that is, when certain fields like Price / currency etc., changes , at run time there are lot of other fields in same/dependent structures that get change ( ex:- when we change price, Pricing doc data might get changed as well ). So, if we want to exclude certain field from PO triggering logic, we have to make sure that all dependent fields influenced by that particular field should be part of table BBPV_COMP_FILEDS
The logic for excluding the fields based on table BBPV_COMP_FILEDS happens inside each of BBP_*_GET_DIFF FMs. All these FMs have almost similar logic. I will explain BBP_PDTAX_GET_DIFF here. Inside form pdtax_get_diff, there is another form with name check_corr_setlines, inside which another form with name pdtax_check_equality. Inside this form there is a FM with name BBP_PDH_CLEAR_FIELDS. This FM does all the dirty work of excluding fields based on table BBPV_COMP_FILEDS.
Couple of questions that made me debug this
Why accounting data changes do not trigger output?
- Because accounting data is not part of the above structure
Why Internal note changes do not trigger output even though the structure BBP_PDS_LONGTEXT is considered in logic and fields are not part of table BBPV_COMP_FILEDS?
- Because for long texts, text IDs that are marked with ‘I’ in field VISIBILITY_IND in table BBPC_TEXT_ID are excluded from PO output trigger (SAP standard logic)
Thanks to wendy.xu for his help in answering my query
Thanks to gergo.domjan for his wiki page on PO output
Have a nice day :smile:
Thanks,
sankar