cancel
Showing results for 
Search instead for 
Did you mean: 

Get multiple records with same key

Former Member
0 Kudos

Hi, I have a table Members with 2 keys Formid and Linenumber. My requirement is that I can create  multiple members with same Formid. Since identical keys in same table is not allowed that is why i created addition field Linenumber.

Now I can create multiple Members with same Formid but different Linenumber, but my READ oData service always returns 1 record for the import Formid. My FM for reading is:

DATA: latest_version TYPE zhrec_version.

   IF ( iv_formid IS NOT INITIAL ).

     CALL FUNCTION 'ZASD_GET_LATEST_VERSION'

       EXPORTING

         im_formid  = iv_formid

       IMPORTING

         ev_version = latest_version.

     IF ( iv_linenumber IS NOT INITIAL ).

       SELECT * FROM zhrec_it0021 INTO TABLE et_familymembers

         WHERE formid = iv_formid AND linenumber = iv_linenumber AND version = latest_version.

     ELSE.

       SELECT * FROM zhrec_it0021 INTO TABLE et_familymembers

         WHERE formid = iv_formid AND version = latest_version.

     ENDIF.

   ENDIF.


How can I achieve getting multiple records with same Formid?

Accepted Solutions (1)

Accepted Solutions (1)

kammaje_cis
Active Contributor
0 Kudos

You need to use a Query with a filter. Not read.

See here.

          URI Conventions (OData Version 2.0) · OData - the Best Way to REST     

Subheading

4.5. Filter System Query Option ($filter)

Answers (1)

Answers (1)

AshwinDutt
Active Contributor
0 Kudos

Hello German,

Have a look at the Query Operation ( Get_EntitySet ) for technical details and implement as shown below ->

Regards,

Ashwin