Skip to Content
Technical Articles
Author's profile photo Jigang Zhang 张吉刚

Mass delete credit segment data from BP

Tcode UKM_MASS_UPD3 can be used for Credit Management: Mass creation/Change to Credit Limit for BP. Sometimes unnecessary credit segment data have been created for business partners by accident like keep blank credit segments while using UKM_MASS_UPD3, then we need to find out one way to mass delete those credit segments for those BP.

No result by wildcard searches the Tcode like UKM_MASS*. Not found any BAPI or FM provide mass deletion as well, but SAP does provide one convenient class that contains a method to achieve this easily.

  • 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.

 

Assigned tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.