Skip to Content

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Jan 13, 2015 at 05:13 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 19, 2015 at 10:41 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 27, 2015 at 10:57 AM

    Hi,

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

    How to close a discussion and why

    Add comment
    10|10000 characters needed characters exceeded