cancel
Showing results for 
Search instead for 
Did you mean: 

Delete Master Data

Former Member
0 Kudos

Hi everybody:

I sincronized BP's R/3 to CRM but in CRM i have the number range like internal, but i need than the BP number in R3 and CRM are the same.

So i changed the BP number range in CRM system as external and that's ok, but i have a problem:

I want to delete all the BP's that the BP Number was differet between both systems.

Although i have two BP's than was assigned a sales contrat ant these can't be deleted.

The problem is these BP's have diferrent BP Number in R3 and CRM but we did't realese that problem before we created sales contract.

The sales contrat is closed, and i cant' change the BP assing to it.

Does anybody know how i can delete the sales contrat??

Or how to sincronice the real BP R3 to CRM without delete it previously in CRM ??

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Susana,

You could create a custom program to delete business transactions. Here goes an example report:

<i>

REPORT y_test_delete_bt.

DATA:

gv_dummy_guid TYPE crmt_object_guid,

gt_objects_to_delete TYPE crmt_object_guid_tab,

gt_deleted_objects TYPE crmt_return_objects,

gs_deleted_objects TYPE crmt_return_objects_struc.

TABLES:

crmd_orderadm_h.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS s_bt FOR crmd_orderadm_h-object_id.

PARAMETERS p_otyp TYPE crmt_process_type OBLIGATORY.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN.

SELECT guid

INTO gv_dummy_guid

UP TO 1 ROWS

FROM crmd_orderadm_h

WHERE object_id IN s_bt

AND process_type EQ p_otyp.

ENDSELECT.

IF sy-subrc NE 0.

MESSAGE e031(crm_order).

ENDIF.

START-OF-SELECTION.

CLEAR gt_objects_to_delete.

SELECT guid

INTO TABLE gt_objects_to_delete

FROM crmd_orderadm_h

WHERE object_id IN s_bt

AND process_type EQ p_otyp.

IF sy-subrc NE 0.

CALL FUNCTION 'CRM_ORDER_DELETE'

EXPORTING

it_objects_to_delete = gt_objects_to_delete

  • IV_UPDATE_TASK_LOCAL = FALSE

iv_no_check = 'X'

  • IV_NO_BDOC_SEND = FALSE

  • IV_CHECK_ONLY = FALSE

IMPORTING

et_deleted_objects = gt_deleted_objects

  • ET_EXCEPTION =

EXCEPTIONS

single_deletion_error = 1

deletion_error = 2

no_authority = 3

document_not_found = 4

OTHERS = 5.

IF sy-subrc NE 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

ENDIF.

ENDIF.

END-OF-SELECTION.

WRITE: 'Following objects have been deleted'.

LOOP AT gt_deleted_objects

INTO gs_deleted_objects.

WRITE AT / gs_deleted_objects-object_id.

ENDLOOP.</i>

Hope it helps,

David

Answers (0)