2023 Sep 20 9:42 AM
Within BAdIs for sales order processing/updating (e.g. SD_SLS_MODIFY_HEAD) not all relevant sales order data is available within available importing parameters. For this particular example, e.g. (adjusted) partner addresses are not available. But missing data is still relevant for follow-up processes or further functionality like pricing, exclusion, etc. In this particular example, the (possibly adjusted) country and postal code of a certain partner are relevant for pricing (-> shipping costs, island fee).
Unfortunately, class cl_sls_data_ref, which could be used within a BAdI to read further sales order data at runtime, is not released by SAP.
Is there any way to read further sales order data within a BAdI at runtime even though it is missing in importing parameters?
2023 Sep 20 10:15 AM
It's better to implement your requirements in include MV45AFZZ (e.g. form routine USEREXIT_SAVE_DOCUMENT)...
There you can access header (VBAK), item (table XVBAP) or partner data (table XVBPA).
2023 Sep 20 10:19 AM
Hello katarzynamonika.mroczkowska
If a BADI interface doesn't provide all the needed data, we need to resort to non-standard tricks. One common way to reach to global data of a BADI calling program is to use ASSIGN (PROG)DOBJ, however that is reserved for internal use only:
For internal use only, the name in name can also have the form "(PROG)DOBJ", where "PROG" is the name of an ABAP program and "DOBJ" the name of a global data object of this program. If the program "PROG" is loaded into the same internal session as the current program when the statement ASSIGN is executed, the data object "DOBJ" is found in this program and the field symbol points to this data object if the assignment was successful.
So this is pretty much in the same league as using not released classes or functions. In my opinion CL_SLS_DATA_REF is the way to go if you have to use the BADI. However consider other options to get fields to drive your pricing routine.
Best regards
Dominik Tylczynski