on 08-16-2007 9:33 PM
Hi,
I have 'Categories' as Hierarchy lookup table. When I see this table in MDM Data Manager Client. It shows me the tree like structure of categories (categories with sub-categories).
Can I fetch these different level entries shown in the tree (categories and sub-categories) separately from this Hierarchy Lookup table using MDM ABAP API.
Thanks & Regards,
Gaurav
got myself
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raheja,
When I read a flat look up field from the main table I get the record position from the lookup table and not the exact field data, have you had this problem with ABAP APIs?
Could you tell me how I can get the look up field values and not the index of the field in the table.
Thanks
Dilip
Hi Dilip,
Below is the snippet of code to retrieve data from flat table. Here 'Products' is the main table and 'SHRTDESC' is the lookup field. Here I am using 'Retrieve' instead of 'Retrievesimple'.
DATA lt_model_set TYPE mdm_result_set_table.
DATA lt_result_set_definition TYPE mdm_field_list_table.
DATA ls_result_set_definition LIKE LINE OF lt_result_set_definition.
ls_result_set_definition-field_name = 'shrtdesc'.
APPEND ls_result_set_definition TO lt_result_set_definition.
CALL METHOD lr_api->mo_core_service->retrieve
EXPORTING
iv_object_type_code = 'Products'
it_result_set_definition = lt_result_set_definition
it_keys = lt_keys
IMPORTING
et_result_set = lt_model_set.
DATA ls_pair LIKE LINE OF ls_model_set-name_value_pairs.
FIELD-SYMBOLS <shrt_desc> TYPE data.
LOOP AT lt_model_set INTO ls_model_set.
READ TABLE ls_model_set-name_value_pairs WITH KEY code = 'SHRTDESC' INTO ls_pair.
IF ls_pair-value IS NOT INITIAL.
ASSIGN ls_pair-value->* TO <shrt_desc>.
ENDIF.
CLEAR ls_pair.
ENDLOOP.
Now the required value is in <shrt_desc>.
Let me know if you still have any issues.
Regards,
Gaurav
Hi Gaurav,
yes this is possible. Check the ABAP API how-to guides available on <a href="http://service.sap.com/installmdm">MDM Documentation Center</a>. How-to number 11 contains a description including some sample source coding how-to retrieve hierarchies. Having the ABAP API installed in your SAP system, you can check package "MDE_API_SAMPLES" for all how-to reports, or report "MDE_API_HOW_TO_11" for the source code as well!
BR Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Michael,
Thanks for quick response but I have already gone through these how-to guides.
Yeah you are right how-to 11 tells how to read the category for particular product in the products table. But My issue is different - I just want to read all the categories from the categories table so that I can populate my dropdown list with these categories. This is possible by just using retrive_simple on 'categories' table but this category table also contains subcategories which I can see in taxonomy mode or hierarchical mode. I want to get these subcategories also for my another dropdown. So I want both categories and subcategories separately, which are stored in a single table category - I cant see any identifier which tells that the particular entry is category or subcategory.
Hope I am not confusing you.
Gaurav
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.