cancel
Showing results for 
Search instead for 
Did you mean: 

How to get multiple records from a service using HTTP GET?

gopalkrishna_baliga
Participant
0 Kudos

Hi experts

    I have a REST based SAP Gateway service. This service has a key field called DeliveryNumber. It returns PGI data for the given Delivery Number.

    It works fine when for one Delivery Number using the below url where '345667' is one delivery number.

    http://xxxxxxxx/getpgidata('345667')

    What I have to do if I want more than one delivery number details? How will my url look?

    For example if I need to get PGI data for DN numbers 12345 and 678989 

    

    Please help.

Thanks

Gopal

Accepted Solutions (0)

Answers (3)

Answers (3)

EkanshCapgemini
Active Contributor
0 Kudos

Hi,

Did you get your answer? If yes, please close this thread.

How to close a discussion and why

0 Kudos

Hi Gopalakrishna,

                 You have to use GET_ENTITYSET method to fetch multiple records . If you are using RFC then create two import parameters and pass those numbers to the RFC and include it in where condition in your select querry .

Regards,

Dinesh Jeyasurian.

EkanshCapgemini
Active Contributor
0 Kudos

Hi Gopalkrishna,

Till now you are using GET_ENTTITY method to get the PGI data of one Delivery Number i.e. Read scenario. Now you want the data of more than one delivery numbers so you need to use GET_ENTITYSET method of this entityset.

If you are using standard BAPI then check if you can pass multiple delivery numbers in that or not. If there is no provision of passing multiple numbers as input, you need to use a custom FM which accepts multiple delivery numbers. For this, you need to make delivery number as range(with SIGN, OPTION, LOW, HIGH fields). Then map your delivery number property to this range in GET_ENTITYSET method.

The HTTP Request URL would be something like: (say DeliveryNum is the key)

http://<server>:<port>/sap/opu/odata/ZXXXX/getpgidata?$filter=( DeliveryNum eq '123' or DeliveryNum eq '456' )

Regards

Ekansh