on 06-29-2009 8:29 PM
I am trying to update contract start and contract end dates in a service contract in CRM I can see the dates stored in the crmd_order_index table. I would like to know what function module I can use to modify these two values. Any help would be most appreciated.
Hi ,
Please go through these function module.
CRM_SERVICE_CONTRACTS_HEADER ==> Get the contract item detail
CRM_SERVICE_CONTRACTS_ITEMLIST ==> Get the contract item detail
CRM_SERVICE_CONTRACTS_ITEM_GET ==> Get contract details for IView
CRM_SERVICE_CONTRACTS_SEARCH ==> Function module for the service contracts
Hope it will useful.
thanks
Hemant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If you want to permanently chaneg the logic for data calculation to a custom one in crmd_order_index, please use badi CRM_ORDER_INDEX_BADI.This will update all new records with new logic.In thsi badi you can put logic for a single transaction type.
To update all old records with new logic, you need to execute report CRM_INDEX_REBUILD for rebuilding the index after applying the badi.
Regards,
Pratyasha Shishodia
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, I have figured out how to use CRM_ORDER_MAINTAIN to modify elements of a sales contract. I have been able to change the status but I have not been able to effect the line item dates. Here is my code excerpt. Everthing works except for the dates:
wa_product_i-ref_guid = wa_input-item_guid.
APPEND wa_product_i TO it_product_i.
*
MAS - Added date objects.
*
IF NOT wa_input-term IS INITIAL.
wa_appointment-ref_guid = wa_input-item_guid.
wa_appointment-ref_kind = 'B'.
wa_appointment-appt_type = 'CONTDURA'.
wa_appointment-duration = wa_input-term.
wa_appointment-time_unit = 'MONTH'.
wa_appointment-is_duration = 'X'.
APPEND wa_appointment TO it_appointment.
wa_input_fields-ref_guid = wa_input-item_guid.
wa_input_fields-objectname = 'APPOINTMENT'.
wa_input_fields-ref_kind = 'B'.
wa_input_fields-logical_key = '0000'.
wa_field-fieldname = 'APPT_TYPE'.
APPEND wa_field TO wa_input_fields-field_names.
wa_field-fieldname = 'DURATION'.
APPEND wa_field TO wa_input_fields-field_names.
wa_field-fieldname = 'IS_DURATION'.
APPEND wa_field TO wa_input_fields-field_names.
wa_field-fieldname = 'TIME_UNIT'.
APPEND wa_field TO wa_input_fields-field_names.
APPEND wa_input_fields TO ct_input_fields.
CLEAR wa_input_fields.
ENDIF.
IF NOT wa_input-end_date IS INITIAL.
*
wa_appointment-ref_guid = wa_input-item_guid.
wa_appointment-ref_kind = 'B'.
wa_appointment-appt_type = 'CONTEND'.
wa_appointment-rule_name = 'CONT001'.
wa_appointment-timezone_to = 'EST'.
*
wa_appointment-timestamp_to = wa_input-end_date.
APPEND wa_appointment TO it_appointment.
*
wa_input_fields-ref_guid = wa_input-item_guid.
wa_input_fields-objectname = 'APPOINTMENT'.
wa_input_fields-ref_kind = 'B'.
wa_input_fields-logical_key = '0001'.
*
wa_field-fieldname = 'APPT_TYPE'.
APPEND wa_field TO wa_input_fields-field_names.
*
wa_field-fieldname = 'RULE_NAME'.
APPEND wa_field TO wa_input_fields-field_names.
*
wa_field-fieldname = 'TIMESTAMP_TO'.
APPEND wa_field TO wa_input_fields-field_names.
*
wa_field-fieldname = 'TIMEZONE_TO'.
APPEND wa_field TO wa_input_fields-field_names.
*
APPEND wa_input_fields TO ct_input_fields.
CLEAR wa_input_fields.
*
ENDIF.
IF NOT wa_input-start_date IS INITIAL.
*
wa_appointment-ref_guid = wa_input-item_guid.
wa_appointment-ref_kind = 'B'.
wa_appointment-appt_type = 'CONTSTART'.
wa_appointment-rule_name = 'TODAY'.
wa_appointment-timezone_to = 'EST'.
*
wa_appointment-timestamp_from = wa_input-start_date.
APPEND wa_appointment TO it_appointment.
*
wa_input_fields-ref_guid = wa_input-item_guid.
wa_input_fields-objectname = 'APPOINTMENT'.
wa_input_fields-ref_kind = 'B'.
wa_input_fields-logical_key = '0002'.
*
wa_field-fieldname = 'APPT_TYPE'.
APPEND wa_field TO wa_input_fields-field_names.
*
wa_field-fieldname = 'RULE_NAME'.
APPEND wa_field TO wa_input_fields-field_names.
*
wa_field-fieldname = 'TIMESTAMP_FROM'.
APPEND wa_field TO wa_input_fields-field_names.
*
wa_field-fieldname = 'TIMEZONE_FROM'.
APPEND wa_field TO wa_input_fields-field_names.
*
APPEND wa_input_fields TO ct_input_fields.
CLEAR wa_input_fields.
*
ENDIF.
wa_orderadm_i-guid = wa_input-item_guid.
wa_orderadm_i-header = lv_header_guid.
wa_orderadm_i-ordered_prod = wa_input-product.
wa_orderadm_i-mode = 'B'.
APPEND wa_orderadm_i TO ct_orderadm_i.
wa_input_fields-ref_guid = wa_input-item_guid.
wa_input_fields-objectname = 'ORDERADM_I'.
wa_field-fieldname = 'MODE'.
APPEND wa_field TO wa_input_fields-field_names.
wa_field-fieldname = 'ORDERED_PROD'.
APPEND wa_field TO wa_input_fields-field_names.
APPEND wa_input_fields TO ct_input_fields.
CLEAR wa_input_fields.
CLEAR wa_product.
IF NOT wa_input-service_loc IS INITIAL.
wa_partner-ref_guid = wa_input-item_guid.
wa_partner-ref_kind = 'B'.
wa_partner-partner_fct = '00000002'.
wa_partner-partner_no = wa_input-service_loc.
wa_partner-ref_partner_handle = '0001'.
wa_partner-no_type = 'BP'.
wa_partner-display_type = 'BP'.
wa_partner-kind_of_entry = 'B'.
APPEND wa_partner TO it_partner.
wa_input_fields-ref_guid = wa_input-item_guid.
wa_input_fields-ref_kind = 'B'.
wa_input_fields-objectname = 'PARTNER'.
wa_input_fields-logical_key = '0002 '.
wa_field-fieldname = 'DISPLAY_TYPE'.
APPEND wa_field TO wa_input_fields-field_names.
wa_field-fieldname = 'KIND_OF_ENTRY'.
APPEND wa_field TO wa_input_fields-field_names.
wa_field-fieldname = 'NO_TYPE'.
APPEND wa_field TO wa_input_fields-field_names.
wa_field-fieldname = 'PARTNER_FCT'.
APPEND wa_field TO wa_input_fields-field_names.
wa_field-fieldname = 'PARTNER_NO'.
APPEND wa_field TO wa_input_fields-field_names.
wa_field-fieldname = 'RELATION_PARTNER'.
APPEND wa_field TO wa_input_fields-field_names.
APPEND wa_input_fields TO ct_input_fields.
CLEAR wa_input_fields.
ENDIF.
wa_pridoc-ref_guid = wa_input-item_guid.
wa_pridoc-ref_kind = 'B'.
*
MAS: The discount_amt field has been overloaded to be the unit price
*
IF wa_input-discount_amt IS NOT INITIAL.
IF wa_input-discount_amt <> '0.00'.
wa_cond_price-kschl = 'Z017'.
wa_cond_price-kbetr = wa_input-discount_amt.
APPEND wa_cond_price TO wa_pridoc-cond_add.
ENDIF.
ENDIF.
IF wa_input-discount IS NOT INITIAL.
IF wa_input-discount > '0.00'.
wa_cond_disc-kschl = 'Z011'.
wa_cond_disc-kbetr = wa_input-discount.
APPEND wa_cond_disc TO wa_pridoc-cond_add.
ENDIF.
ENDIF.
APPEND wa_pridoc TO it_pridoc.
wa_input_fields-ref_guid = wa_input-item_guid.
wa_input_fields-ref_kind = 'B'.
wa_input_fields-objectname = 'PRIDOC'.
wa_input_fields-logical_key = '0004 '.
wa_field-fieldname = 'KBETR'.
APPEND wa_field TO wa_input_fields-field_names.
wa_field-fieldname = 'KSCHL'.
APPEND wa_field TO wa_input_fields-field_names.
APPEND wa_input_fields TO ct_input_fields.
CLEAR wa_input_fields.
wa_schedlin_i-ref_guid = wa_input-item_guid.
wa_schedlines-guid = wa_input-sc_guid.
wa_schedlines-item_guid = wa_input-item_guid.
wa_schedlines-quantity = wa_input-quantity.
APPEND wa_schedlines TO wa_schedlin_i-schedlines.
CLEAR wa_schedlines.
APPEND wa_schedlin_i TO it_schedlin_i.
CLEAR wa_schedlin_i.
wa_input_fields-ref_guid = wa_input-item_guid.
wa_input_fields-objectname = 'SCHEDLIN'.
wa_input_fields-ref_kind = 'B'.
wa_input_fields-logical_key = '0005 '.'
wa_field-fieldname = 'LOGICAL_KEY'.
APPEND wa_field TO wa_input_fields-field_names.
wa_field-fieldname = 'QUANTITY'.
APPEND wa_field TO wa_input_fields-field_names.
APPEND wa_input_fields TO ct_input_fields.
CLEAR wa_input_fields.
*
MAS - Added status object
*
wa_status-ref_guid = lv_item_guid.
wa_status-ref_kind = 'B'.
wa_status-activate = 'X'.
TRANSLATE wa_input-status_txt TO UPPER CASE.
IF wa_input-status_txt IS INITIAL.
status_v = 'I1002'.
ELSEIF wa_input-status_txt EQ 'OPEN'.
status_v = 'I1002'.
ELSEIF wa_input-status_txt EQ 'IN PROCESS'.
status_v = 'I1003'.
ELSEIF wa_input-status_txt EQ 'RELEASED'.
status_v = 'I1004'.
ELSEIF wa_input-status_txt EQ 'COMPLETED'.
status_v = 'I1005'.
ELSE.
status_v = 'I1002'.
ENDIF.
wa_status-status = status_v.
APPEND wa_status TO it_status.
wa_input_fields-ref_guid = wa_input-item_guid.
wa_input_fields-objectname = 'STATUS'.
wa_input_fields-ref_kind = 'B'.
wa_input_fields-logical_key = '0003 '.
wa_field-fieldname = 'ACTIVATE'.
APPEND wa_field TO wa_input_fields-field_names.
wa_field-fieldname = 'STATUS'.
APPEND wa_field TO wa_input_fields-field_names.
APPEND wa_input_fields TO ct_input_fields.
CLEAR wa_input_fields.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_product_i = it_product_i
it_schedlin_i = it_schedlin_i
it_partner = it_partner
it_status = it_status
it_appointment = it_appointment
CHANGING
ct_orderadm_h = ct_orderadm_h
ct_orderadm_i = ct_orderadm_i
ct_input_fields = ct_input_fields
EXCEPTIONS
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4
OTHERS = 5.
IF sy-subrc EQ 0.
result = 'SUCCESS'.
ELSEIF sy-subrc EQ 1.
result = 'ERROR'.
ELSEIF sy-subrc EQ 2.
result = 'LOCKED'.
ELSEIF sy-subrc EQ 3.
result = 'NOT ALLOWED'.
ELSEIF sy-subrc EQ 0.
result = 'NO AUTHORITY'.
ENDIF.
APPEND lv_header_guid TO it_objects_to_save.
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
it_objects_to_save = it_objects_to_save
IMPORTING
et_saved_objects = et_saved_objects
EXCEPTIONS
document_not_saved = 1
OTHERS = 2.
COMMIT WORK AND WAIT.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mark,
The Function Group CRM_ORDER_API might be helpful for your case.
Regards,
Sai
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.