Mass delete credit segment data from BP
- Step 1: Create objects for credit management and business partner accordingly.
DATA: go_facade TYPE REF TO cl_ukm_facade, go_bupa_factory TYPE REF TO cl_ukm_bupa_factory. "create UKM object go_facade = cl_ukm_facade=>create( i_activity = cl_ukm_cnst_eventing=>bp_maintenance ). "create BP object go_bupa_factory = go_facade->get_bupa_factory( ).
- Step 2: Use the method ‘delete_account’ to perform the deletion of credit segment data from BP.
DATA:lv_partner TYPE bu_partner, lv_segment TYPE ukm_credit_sgmnt. "populate BP and segment, fox example by excel upload "call delete method to delete credit segment data CALL METHOD go_bupa_factory->delete_account EXPORTING i_partner = lv_partner i_credit_sgmnt = lv_segment. "save the BP changes go_bupa_factory->save_all( ).
- Step 3: Don’t forget the ‘BAPI_TRANSACTION_COMMIT’ otherwise it just like no click of the save button after changes using UKM_BP.
IF SY-SUBRC EQ 0. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' EXPORTING wait = abap_true. ELSE. CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'. ENDIF.
Be cautious when doing such mass deletion as it’ll delete all credit data for business partners like credit limit and vector fields like Net Due Date used by credit management. Besides, you can validate the combination of credit segments and BP numbers by table UKMBP_CMS_SGM and check vector data at table UKMBP_VECTOR_IT.