Spend Management Blogs by Members
Check out community member blog posts about spend management and SAP Ariba, SAP Fieldglass, and SAP Concur solutions. Post or comment about your experiences.
Showing results for 
Search instead for 
Did you mean: 
0 Kudos

today I will share a code snippet which was created together with SAP support to address an issue on the supplier (SD) side of the Ariba business suite integration add-on (BSAO).

If a buyer sends you a "cancellation" or "delete" of a purchase order (field type="delete" in OrderRequestHeader of cXML) the add-on deletes the item in the corresponding sales order - which is not very nice and does not really match standard SD behavior. In the worst case, this results in a sales order which does not have a position data anymore - only the header is left.

The code snippet needs to be implemented in the BAdI method if_arberp_badi_inb_map~map_ordr_to_bus2032_in_pre_upd. Afterwards, the system will set a rejection reason - if the processing status of the sales order allows that. Otherwise, an error message will be issued and the cXML will end up in the monitoring transaction. Then the corresponding sales rep has to de decide what to do (e.g. manual cancellation of the follow-up documents etc...).
** no example implementation provided *
field-symbols <fs_itemx> like line of ct_itemsx.
field-symbols <fs_item> like line of ct_items.
* Set ABGRU [Reason for rejection] instead of deleting the item.
loop at ct_itemsx assigning <fs_itemx> where updateflag = 'D'.
* Change delete to update
<fs_itemx>-updateflag = 'U'.
* mark the ABGRU as update-relevant field
<fs_itemx>-reason_rej = 'X'.
* set the ABGRU
read table ct_items
with key itm_number = <fs_itemx>-itm_number
assigning <fs_item>.

if sy-subrc is initial.
<fs_item>-reason_rej = '01'. "cancellation customer
* schedule lines must not be changed.
delete ct_schedules
where itm_number = <fs_itemx>-itm_number.
delete ct_schedulesx
where itm_number = <fs_itemx>-itm_number.


If you have any questions or feedback, feel free to leave a comment!