cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete Partner from Order?...

Former Member
0 Kudos

Hi,

How to delete a Partner from an Order?... I've tried many times using CRM_ORDER_MAINTAIN, and it just doesn't seem to work!

There must be a way to do it.... any answers please??

Thanks,

Tim

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Tim,

You have to execute FM 'BAPI_TRANSACTION_COMMIT' after the main FM call to commit changes.

Use FM 'CRM_WR_ADD_PARTNER' with all the partner functions you want to have in transaction. Once this is executed all the Partner data maintained for partner function specified in structure 'ID_PARTNER_FCT' would be deleted and new supplied data will be maintained.

Best Regards,

Pratik Patel

<b>Reward with Points!</b>

Former Member
0 Kudos

Hi Pratik,

So, I tested by using the source of FM 'CRM_WR_ADD_PARTNER' to build the input tables <b>it_partner</b> and <b>ct_input_fields</b> for FM 'CRM_ORDER_MAINTAIN' :

LOOP AT lt_partner ASSIGNING <ls_partner>.
  CLEAR : ls_partner_chg, ls_input_fields, ls_input_field_names, ls_return.
  REFRESH lt_input_field_names.

  ls_partner_chg-partner_fct     = <ls_partner>-partner_fct.
  ls_partner_chg-partner_no      = <ls_partner>-partner_no.
  ls_partner_chg-display_type    = lc_bp.
  ls_partner_chg-no_type         = lc_bp.
  ls_partner_chg-ref_handle      = lc_1.
  ls_partner_chg-ref_guid        = lv_guid.
  ls_partner_chg-ref_kind        = lc_a.
  ls_partner_chg-kind_of_entry   = lc_c.
  INSERT ls_partner_chg INTO TABLE lt_partner_chg.

* Fill Input Fields for Partner structure
  ls_input_fields-ref_handle     = lc_1.
  ls_input_fields-ref_kind       = lc_a.
  ls_input_fields-ref_guid       = lv_guid.
  ls_input_fields-objectname     = lc_partner.
  ls_input_fields-logical_key    = lc_handle.
  ls_input_field_names-fieldname = lc_partner_fct.
  INSERT ls_input_field_names INTO TABLE lt_input_field_names.
  ls_input_field_names-fieldname = lc_partner_no.
  INSERT ls_input_field_names INTO TABLE lt_input_field_names.
  ls_input_field_names-fieldname = lc_display_type.
  INSERT ls_input_field_names INTO TABLE lt_input_field_names.
  ls_input_field_names-fieldname = lc_no_type.
  INSERT ls_input_field_names INTO TABLE lt_input_field_names.
  ls_input_fields-field_names = lt_input_field_names.
  INSERT ls_input_fields INTO TABLE lt_input_fields.

ENDLOOP.

Then my code to delete the partners in the Order is as below :

CALL FUNCTION 'CRM_ORDER_MAINTAIN'
  EXPORTING
    it_partner        = lt_partner_chg
  CHANGING
    ct_input_fields   = lt_input_fields
  EXCEPTIONS
    error_occurred    = 1
    document_locked   = 2
    no_change_allowed = 3
    no_authority      = 4
    OTHERS            = 5.

IF sy-subrc EQ 0.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait   = lc_x
    IMPORTING
      return = ls_return.
ENDIF.

But it doesn't work at all... my partners still exist in the Order, and the modification date doesn't change -- so it hasn't even been modified. What is the problem?

I really need to find out how to delete Partners from an Order.... any other solutions??

Thanks,

Tim

Patrick_McMahon
Contributor
0 Kudos

Hi Tim,

Try putting a breakpoint on CRM_ORDER_MAINTAIN and delete the partners manually via the normal transaction. Check that the entries the it_partners and ct_input_fields match your code.

Regards,

Patrick.

Former Member
0 Kudos

Hello,

I was doing the (1) 'CRM_ORDER_MAINTAIN', then (2) 'BAPI_TRANSACTION_COMMIT', but then after nothing... I added the CALL :

      CALL METHOD lc_1o_maintain->save_order
        EXPORTING
          iv_header_guid   = lv_guid
        IMPORTING
          es_saved_objects = ls_saved_objects.

after and it worked fine.

Thanks,

Tim

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Tim,

I have the same Situation. I want to delete Partners from Orders. Can you show me ( mail ? ) the whole Coding from your Function please.

I need LC_<Constant>

and the coding from the Methode LC_<order_save>.

Thanks,

Dietmar