cancel
Showing results for 
Search instead for 
Did you mean: 

Function module to delete a partner for an Opportunity

saumya_govil
Active Contributor
0 Kudos

Hi Experts,

I am looking for a Function module to delete a particular partner for an Opportunity.

For eg. if I wish to deleted the details of a Sales Manager for an Opportunity.

Any pointers to the solution would be highly appreciated.

Regards,

Saumya

Accepted Solutions (1)

Accepted Solutions (1)

BGarcia
Active Contributor
0 Kudos

Hi Saumya,

You can use FM CRM_ORDER_MAINTAIN to do that in memory.

If you want to know how to fill the parameters in CRM_ORDER_MAINTAIN to delete the partner, just put a break-point there, and the go to t-code CRMD_ORDER and delete one partner. It will stop there, and analyse the IT_PARTNER parameter and the CT_INPUT_FIELDS parameter.

Then if you want to save it to database, use FM CRM_ORDER_SAVE and commit the work.

Kind regards,

Garcia

saumya_govil
Active Contributor
0 Kudos

Hi Bruno,

Thanks for your reply!

I am currently using the same approach that you have suggested, but am not sure what parameters to pass to CRM_ORDER_MAINTAIN.

I tried to debug and then find out the parameters, but it does not work!

Can you please provide me a detailed list if possible as to what parameters to be passed?

Regards,

Saumya

BGarcia
Active Contributor
0 Kudos

Hi Saumya,

That's strange. The debug should work at CRMD_ORDER t-code.

The parameteres you must change in FM CRM_ORDER_MAINTAIN are IT_PARTNER and CT_INPUT_FIELDS. If it helps, the logic I use here (CRM4.0) to erase the partner, is this one:


*- Data
  DATA: lt_partner            TYPE crmt_partner_comt.
  DATA: ls_partner            TYPE crmt_partner_com.
  DATA: lt_input_fields       TYPE CRMT_INPUT_FIELD_TAB.
  DATA: ls_input_fields       LIKE LINE OF lt_input_fields.
  DATA: ls_input_fields_names TYPE LINE OF CRMT_INPUT_FIELD_NAMES_TAB.

*- Partner info
  ls_partner-ref_kind = 'A'.
  ls_partner-kind_of_entry = 'C'.
  ls_partner-no_type = 'BP'. "-> if it is a business partner number
  ls_partner-display_type = 'BP'. "-> if it is a business partner number
  ls_partner-ref_guid = iv_guid. "-> OPPORTUNITY Guid number
  ls_partner-ref_partner_fct = iv_partner_fct.  "-> Partner function to erase
  APPEND ls_partner TO lt_partner.

*- Input Fields info
  ls_input_fields-ref_guid = iv_guid. "-> OPPORTUNITY Guid number
  ls_input_fields-ref_kind = 'A'.
  ls_input_fields-objectname = 'PARTNER'.
  CONCATENATE ls_partner-ref_partner_handle iv_partner_fct INTO ls_input_fields-logical_key.
  ls_input_fields_names-fieldname = 'PARTNER_FCT'.
  APPEND ls_input_fields_names TO ls_input_fields-field_names.
  APPEND ls_input_fields TO lt_input_fields.
  
*- Make the changes in memory
  CALL FUNCTION 'CRM_ORDER_MAINTAIN'
    EXPORTING
      IT_PARTNER        = lt_partner
    CHANGING
      CT_INPUT_FIELDS   = lt_input_fields
    EXCEPTIONS
      ERROR_OCCURRED    = 1
      DOCUMENT_LOCKED   = 2
      NO_CHANGE_ALLOWED = 3
      NO_AUTHORITY      = 4
      OTHERS            = 5.

Check if this helps you to advance a little more

Kind regards,

Garcia

Answers (2)

Answers (2)

saumya_govil
Active Contributor
0 Kudos

Thank You Bruno!

It worked!

Regards,

Saumya

Former Member
0 Kudos

Hi Saumya

Try with below FM :

BAPI_OPPORTUNITY_CHANGEMULTI

BAPI_OPPORTUNITY_DELETEMULTI

Regards

Narayana