on 02-14-2014 9:46 PM
Hi all experts,
I'm completely a newbie on MDM but I'm trying to implement a demo report that access and extracts data from MDM Catalog using ABAP MDM API.
I can connect to MDM Data Manager to see the data base and check my extractions.
Actually, I'm stuck on a basic point in the extraction process.
Scenario: an MDM table represents all the catalog items. Another table contains all the vendors and these two tables are bound so that I can search for catalog items by filtering on specific vendors.
Trying to replicate this logic via MDM API. So far I have successfully extracted a specific vendor in the following way; assuming that the vendor has been introduced by a parameter P_VENDOR, here's the simple logic:
ls_query-parameter_code = 'MDMSRM_SUPPLIER_ID'. "Field code
ls_query-operator = 'EQ'. "Contains
ls_query-dimension_type = mdmif_search_dim_field. "Fieldsearch
ls_query-constraint_type = mdmif_search_constr_text. "Text search
MOVE p_vendor to lv_text.
GET REFERENCE OF lv_text INTO ls_query-value_low.
APPEND ls_query TO lt_query_ven. CLEAR ls_query.
CALL METHOD lr_api->mo_core_service->query
EXPORTING
iv_object_type_code = 'MDMSRM_SUPPLIERS'
it_query = lt_query_ven
IMPORTING
et_result_set = lt_query_vendor.
READ TABLE lt_query_vendor INTO ls_query_vendor INDEX 1.
Hence, ls_query vendor has a RECORD_ID field which contains a single row, with a number ( the index of the vendor in MDMSRM_SUPPLIERS table ).
Everything fine so far.
Now I have to query on the table MDMSRM_CATALOG_ITEMS to obtain all the items which have a reference to this Vendor.
I tried to retrieve all the items from catalog and found in debug that there's a field, MDMSRM_SUPPLIER, which has type MDM_GDT_INTEGERVALUE and contains a reference number (->26, for example).
The idea is then that I have to build a query table but don't know how to do it; more precisely:
ls_query-parameter_code = 'MDMSRM_SUPPLIER'. "Field code
ls_query-operator = 'EQ'. "Contains
but I don't know how to fill
ls_query-dimension_type and
ls_query-constraint_type = mdmif_search_constr_look.
I should the get the reference of the index value and fill ls_query-value_low:
MOVE ls_query_vendor-RECORD_IDS to lv_text.
GET REFERENCE OF lv_text INTO ls_query-value_low.
APPEND ls_query TO lt_query_cat. CLEAR ls_query.
I tried a bit but always getting dumps or exceptions. Could anyone help me out with this simple query? All the examples I've seen on the web deal exclusively with text parameters... Also, given that this seems a sort of "join", if there's a smarter and faster way to obtain the extraction please let me know
Got it!
ls_query-parameter_code = 'MDMSRM_SUPPLIER'.
ls_query-operator = 'EQ'.
ls_query-dimension_type = mdmif_search_dim_field.
ls_query-constraint_type = mdmif_search_constr_look.
GET REFERENCE OF ls_query_vendor-RECORD_IDS INTO ls_query-value_low.
APPEND ls_query TO lt_query_cat. CLEAR ls_query.
CALL METHOD lr_api->mo_core_service->query
EXPORTING
iv_object_type_code = 'MDMSRM_CATALOG_ITEMS'
it_query = lt_query_cat
IMPORTING
et_result_set = lt_query_catalog.
That did the job. Closing this one as I've got a new question about RETRIEVE_SIMPLE and Lookup values... better start a new thread.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.