Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Get reference and multiple values

Former Member
0 Likes
449

Hi Experts,

I'm using the MDM ABAP API to retrieve some records from my MDM backend. I'd like to recover multiple products by their id. However I don't know how to pass the list of ids. With just one id it works just fine :


DATA ls_query TYPE mdm_query.

ls_query-parameter_code  = 'Id'.                     
ls_query-operator        = 'EQ'.                       
ls_query-dimension_type  = mdmif_search_dim_field.     
ls_query-constraint_type = mdmif_search_constr_text.   
lv_search_id = '1234'.
GET REFERENCE OF lv_search_id INTO ls_query-value_low.
APPEND ls_query TO lt_query.
...

However I'd like to use a list of ids. This doesn't work :

DATA lt_ids TYPE TABLE OF TDSR_CHAR20. * CHAR20 range

LOOP AT lt_ids INTO ls_id.
  GET REFERENCE OF ls_id-low INTO ls_query-value_low. 
  APPEND ls_query TO lt_query.
  CLEAR ls_query
ENDLOOP.
...

lt_query-value_low is of type DATA and always contains the same value (last ls_id-low value).

I understand why my code doesn't work but I don't know how to use multiple ids as parameters...

Regards,

Pierre

Edited by: Pierre DOMINIQUE on Nov 23, 2010 5:19 PM

1 REPLY 1
Read only

Former Member
0 Likes
309

Hi Pierre,

The problem in your code is that you reference to the structure that is getting copies of the internal table. So you always reference to the value of that structure.

In order to reference to the value of the internal table, you have to use a field-symbol when looping.

DATA lt_ids TYPE TABLE OF TDSR_CHAR20. * CHAR20 range
 
LOOP AT lt_ids ASSIGNIG <ls_id>.
  GET REFERENCE OF <ls_id>-low INTO ls_query-value_low. 
  APPEND ls_query TO lt_query.
  CLEAR ls_query
ENDLOOP.

Kind regards,

Koen De Ruyck

PS: I know this answer comes late, but this might be useful for other people...