Hi Gurus,
I am having a problem updating the configuration of Solution Quotation from ORDER_SAVE BADI. I tried both CRM_ORDER_MAINTAIN and CRM_ORDER_MAINTAIN, both of them are not doing the trick. I have tried all options using these two FM, nothing works. I debugged both the FM by manually updating the Config characteristic, I see that except the Item GUID and Instance ID nothing is passed, the CRM_ORDER_MAINTAIN FM is fetching the Config values from the buffer using the Instance ID, so I think I may have to instantiate the buffer before calling these. Now I am totally stuck with this. Help is greatly appreciated. Please see my code below, I have both the FM in this.
METHOD set_item_config.
DATA: ls_config TYPE crmt_config_com,
lt_config TYPE crmt_config_comt,
lt_input_fields1 TYPE crmt_input_field_names_tab,
lt_input_fields TYPE crmt_input_field_tab,
lt_exceptions TYPE crmt_exception_t,
ls_config_wrk TYPE crmt_config_wrk,
lt_guids_to_init TYPE crmt_object_guid_tab,
it_instances_init TYPE ibxx_instno_tab,
ls_cuins TYPE crmt_cuins_com.
CALL FUNCTION 'CRM_CONFIG_READ_OW'
EXPORTING
iv_guid = item_guid
IMPORTING
es_config_wrk = ls_config_wrk
EXCEPTIONS
item_not_found = 1
item_not_configured = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
MOVE-CORRESPONDING ls_config_wrk-cuins[ 1 ] TO ls_cuins.
APPEND ls_cuins TO ls_config-cuins.
ls_config-ref_guid = ls_config_wrk-guid.
ls_config-cucfg = ls_config_wrk-cucfg.
ls_config-cuval = ls_config_wrk-cuval.
ls_config-cuvk = ls_config_wrk-cuvk.
ls_config-curef = ls_config_wrk-curef.
READ TABLE ls_config-cuval ASSIGNING FIELD-SYMBOL(<fs_cuval>) WITH KEY charc = cname.
IF sy-subrc = 0.
<fs_cuval>-value = lv_value.
ENDIF.
APPEND ls_config TO lt_config.
lt_input_fields = VALUE #( ( ref_guid = item_guid ref_kind = 'D' objectname = 'CONFIG'
field_names = VALUE #( ( fieldname = 'CONFIG' ) ) ) ).
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_config = lt_config
IMPORTING
et_exception = lt_exceptions
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 <> 0.
ENDIF.
lt_input_fields1 = VALUE #( ( fieldname = 'CONFIG' ) ).
lt_guids_to_init = VALUE #( ( item_guid ) ).
it_instances_init = VALUE #( ( instance = ls_config-cucfg-int_obj_no ) ).
CALL FUNCTION 'CRM_CONFIG_INIT_OW'
EXPORTING
it_guids_to_init = lt_guids_to_init
it_instances_init = it_instances_init.
CALL FUNCTION 'CRM_CONFIG_MAINTAIN_OW'
EXPORTING
iv_guid = item_guid
is_config = ls_config
CHANGING
ct_input_field_names = lt_input_fields1
EXCEPTIONS
item_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ENDMETHOD.
Thanks.