Hi all,
i could update conditions in report but not successful in BADI order save, below is my code in BADI...
what is the problem maybe ? Ths
* Get order info. CALL FUNCTION 'CRM_ORDER_READ' EXPORTING it_header_guid = lt_header_guid it_requested_objects = lt_requested_objects IMPORTING et_ORDERADM_I = lt_ORDERADM_I ET_TEXT = lt_text ET_STATUS = lt_status et_pridoc = et_pridoc EXCEPTIONS DOCUMENT_NOT_FOUND = 1 ERROR_OCCURRED = 2 DOCUMENT_LOCKED = 3 NO_CHANGE_AUTHORITY = 4 NO_DISPLAY_AUTHORITY = 5 NO_CHANGE_ALLOWED = 6 OTHERS = 7. read table lt_ORDERADM_I into ls_ORDERADM_I with key ITM_TYPE = 'YTS1'. if sy-subrc = 0. read table et_pridoc INTO es_pridoc index 1. LOOP AT es_pridoc-pric_cond into es_pric_cond where kposn = ls_ORDERADM_I-guid. clear is_cond_chg. move-corresponding es_pric_cond to is_cond_chg. clear is_cond_chg-kbetr. " clear the amount INSERT is_cond_chg INTO TABLE is_pridoc-cond_change. endloop. CLEAR: lt_input_field_names. ls_input_field_names-fieldname = 'COND_CHANGE'. INSERT ls_input_field_names INTO TABLE lt_input_field_names. CLEAR: cs_input_fields, ct_input_fields. cs_input_fields-ref_guid = ls_ORDERADM_I-guid. cs_input_fields-ref_kind = 'B'. cs_input_fields-objectname = 'PRIDOC'. cs_input_fields-field_names = lt_input_field_names. INSERT cs_input_fields INTO table ct_input_fields. is_pridoc-ref_guid = ls_ORDERADM_I-guid. is_pridoc-ref_kind = 'B'. INSERT is_pridoc INTO it_pridoc INDEX 1. endif. CALL FUNCTION 'CRM_ORDER_MAINTAIN' EXPORTING it_pridoc = it_pridoc CHANGING ct_input_fields = ct_input_fields EXCEPTIONS error_occurred = 1 document_locked = 2 no_change_allowed = 3 no_authority = 4 OTHERS = 5.