Skip to Content
avatar image
Former Member

Passing multiple partner function.

Hi friends,

Iam creating a transaction using the FM crm_order_maintain. Iam able to create a transaction, but with error in the partner function. To my understanding ,I found that I have to pass multiple partner function for a single transaction. kindly suggest. 

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jan 07, 2015 at 01:34 PM

    Hi Abhinaya,

    Tip :  try to enter multiple partner using crmd_order in GUI , put a breakpoint  in CRMD_Order_Maintain and check how standard values are getting passed.

    Anyway Below is the code to update multiple partners using Order_Maintain

    DATA: lv_order_guid     TYPE crmt_object_guid,

          lt_partner        TYPE crmt_partner_comt,

          ls_partner        TYPE crmt_partner_com,

          ls_input_fields   TYPE crmt_input_field,

          lt_input_fields   TYPE crmt_input_field_tab,

          ls_field_names    TYPE crmt_input_field_names,

          lt_field_names    TYPE crmt_input_field_names_tab,

          lv_ref_partner_no TYPE string.

    "  For First Partner Function

                                ls_partner-ref_guid             = lv_order_guid.

                                ls_partner-ref_kind             = 'A'.

                                ls_partner-ref_handle           = '0000000000'.

                                ls_partner-ref_partner_fct      = '00000009'.   " Partner Function

                                ls_partner-ref_partner_no       = lv_partner.

                                ls_partner-ref_display_type     = 'BP'.

                                ls_partner-ref_no_type          = 'BP'.

                                ls_partner-ref_partner_handle   = '0000'.

                                ls_partner-kind_of_entry        = 'C'.

                                ls_partner-partner_fct          = '00000009'.      " Partner Function

                                ls_partner-partner_no           = lv_ref_partner_no.

                                ls_partner-display_type         = 'BP'.

                                ls_partner-no_type              = 'BP'.

                                INSERT ls_partner INTO TABLE lt_partner.

                                ls_input_fields-ref_guid = lv_order_guid.

                                ls_input_fields-ref_kind = 'A'. "Administration Header

                                ls_input_fields-objectname = 'PARTNER'.

                                lv_logical_key    = ls_partner-ref_partner_handle.

                                lv_logical_key+4  = ls_partner-ref_partner_fct.

                                lv_logical_key+12 = ls_partner-ref_partner_no.

                                lv_logical_key+32 = ls_partner-ref_display_type.

                                lv_logical_key+34 = ls_partner-ref_no_type.

                                ls_input_fields-logical_key = lv_logical_key.

                                ls_field_names-fieldname = 'PARTNER_NO'.

                                INSERT ls_field_names INTO TABLE ls_input_fields-field_names.

                                ls_field_names-fieldname = 'DISPLAY_TYPE'.

                                INSERT ls_field_names INTO TABLE ls_input_fields-field_names.

                                ls_field_names-fieldname = 'KIND_OF_ENTRY'.

                                INSERT ls_field_names INTO TABLE ls_input_fields-field_names.

                                ls_field_names-fieldname = 'NO_TYPE'.

                                INSERT ls_field_names INTO TABLE ls_input_fields-field_names.

                                INSERT ls_input_fields INTO TABLE lt_input_fields.

                                CLEAR lt_field_names[].

                                CLEAR ls_field_names.

                                CLEAR ls_input_fields.

    " For Second partner Function

                                 CLEAR ls_partner.

                                  ls_partner-ref_guid             = lv_order_guid.

                                  ls_partner-ref_kind             = 'A'.

                                  ls_partner-ref_handle           = '0000000000'.

                                  ls_partner-ref_partner_fct      = '00000015'. " has Contact Person

                                  ls_partner-ref_partner_no       = lv_partner.

                                  ls_partner-ref_display_type     = 'BP'.

                                  ls_partner-ref_no_type          = 'BP'.

                                  ls_partner-ref_partner_handle   = '0000'.

                                  ls_partner-kind_of_entry        = 'C'.

                                  ls_partner-partner_fct          = '00000015'. " has Contact Person

                                  ls_partner-partner_no           = lv_ref_partner_no.

                                  ls_partner-display_type         = 'BP'.

                                  ls_partner-no_type              = 'BP'.

                                  INSERT ls_partner INTO TABLE lt_partner.

                                  CLEAR : ls_input_fields, ls_input_fields.

                                  ls_input_fields-ref_guid = lv_order_guid.

                                  ls_input_fields-ref_kind = 'A'.

                                  ls_input_fields-objectname = 'PARTNER'.

                                  lv_logical_key    = ls_partner-ref_partner_handle.

                                  lv_logical_key+4  = ls_partner-ref_partner_fct.

                                  lv_logical_key+12 = ls_partner-ref_partner_no.

                                  lv_logical_key+32 = ls_partner-ref_display_type.

                                  lv_logical_key+34 = ls_partner-ref_no_type.

                                  ls_input_fields-logical_key = lv_logical_key.

                                  ls_field_names-fieldname = 'PARTNER_NO'.

                                  INSERT ls_field_names INTO TABLE ls_input_fields-field_names.

                                  ls_field_names-fieldname = 'DISPLAY_TYPE'.

                                  INSERT ls_field_names INTO TABLE ls_input_fields-field_names.

                                  ls_field_names-fieldname = 'KIND_OF_ENTRY'.

                                  INSERT ls_field_names INTO TABLE ls_input_fields-field_names.

                                  ls_field_names-fieldname = 'NO_TYPE'.

                                  INSERT ls_field_names INTO TABLE ls_input_fields-field_names.

                                  INSERT ls_input_fields INTO TABLE lt_input_fields.

                                  CLEAR lt_field_names[].

                                  CLEAR ls_field_names.

                                  CLEAR ls_input_fields.

    • Call Order Maintain for Partner

                                CALL FUNCTION 'CRM_ORDER_MAINTAIN'

                                  EXPORTING

                                    it_partner        = lt_partner

                                  IMPORTING

                                    et_exception      = lt_exception

                                  CHANGING

                                    ct_input_fields   = lt_input_fields

                                  EXCEPTIONS

                                    error_occurred    = 1

                                    document_locked   = 2

                                    no_change_allowed = 3

                                    no_authority      = 4

                                    OTHERS            = 5.

    Then Call CALL FUNCTION 'CRM_ORDER_SAVE'

    &   CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

    Regards,

    Sumeet

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 07, 2015 at 01:38 PM

    Hi,

    When you create using CRM_ORDER_MAINTAIN pass partners in IT_PARTNER table.

    Keep debugger in CRM_ORDER_MAINTAIN FM and in WEBUI maintain partner and find what values you should pass in IT_PARTNER and CT_INPUT_FIELDS for your partner functions

    Regards,

    Deepika

    Add comment
    10|10000 characters needed characters exceeded