Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Update contract price using API

Hi,

How can I update the contract price in the MDM manager by using the API IF_MDM_API_CONFIG from ABAP?

here is the code that i use to retrive comtract price and update it.

* connect to repository + defining cdt_language_code

     call method lr_api->mo_accessor->connect

       exporting

         is_repository_language = ls_language.

     clear ls_query.

     clear ls_string.

     refresh lt_result_set.

     ls_query-parameter_code  = 'MDMSRM_CTR_ITEM_ID'. "Field code

     ls_query-operator        = 'EQ'"'CS'. "Contains

     ls_query-dimension_type  = 1. "Field search

     ls_query-constraint_type = 8. "Text search

     ls_string = p_guid.

     get reference of ls_string into ls_query-value_low .

     refresh lt_query.

     append ls_query to lt_query.

     refresh lt_result_set.

     call method lr_api->mo_core_service->query

       exporting

         iv_object_type_code = 'MDMSRM_CATALOG_ITEMS'   "tables of searches names

         it_query            = lt_query

       importing

         et_result_set       = lt_result_set.

**

     refresh lt_record_data[].

     refresh  lt_keys[].

     read table lt_result_set index 1 into  ls_result_set.

     lt_keys = ls_result_set-record_ids.

     ls_result_set_definition-field_name = 'MDMSRM_CONTRACT_PRICE'.

     append ls_result_set_definition to lt_result_set_definition.

*

     call method lr_api->mo_core_service->retrieve

       exporting

         iv_object_type_code      = 'MDMSRM_CATALOG_ITEMS'

         it_result_set_definition = lt_result_set_definition

         it_keys                  = lt_keys

       importing

         et_result_set            = lt_result_set2.

     read table lt_keys        index 1 into lv_key.

     read table lt_result_set2 index 1 into ls_result_set2.

**

*

*

       call function 'MDM_API_UPDATE'

         exporting

           iv_object_name         = 'MDM_QA_REP'

           iv_object_type_code    = 'MDMSRM_CATALOG_ITEMS'

           is_parameter           = ls_result_set2

           iv_internal_id         = lv_key

         exceptions

           ex_api_usage_error     = 1

           ex_provider_error      = 2

           ex_kernel_error        = 3

           ex_server_rc_code      = 4

           ex_not_supported       = 5

           ex_communication_error = 6

           others                 = 7.

       if sy-subrc <> 0.

* Implement suitable error handling here

       endif.


here is scree of the item in the data manager. before executing the code the contract price is fill

after executing the code, the contract price is cleared:

Regards,

Joseph

replied

oss note 1869994

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question