Skip to Content

Ruby, Camping and…Gateway?

It’s been a long time since my last Ruby blog…so I wanted to something nice…instead of emulate any SAP transaction, it was time for me to engage with new SAP technologies, and Gateway really looks promising…so…what’s Gateway?


Gateway is based on OData, which allows us to perform CRUD operations on WebService like applications…in other words…it’s just awesome technology -;) If you want to find out more, please refer to this homepage on SCN “SAP NetWeaver Gateway Demo System”.


So…we can access Gateway using many technologies, for example JavaScript or Java for Blackberry. But for sure, I wanted to go beyond those awesome examples, and searched for other ways to consume Gateway data…on the OData SDK List I found a Ruby gem called Ruby_OData, which works awesome for services like Netflix OData, but didn’t work to well for SAP Gateway services…


As you may know…here on SCN, we’re like family, so we like to work together on some nice project, so as you can see here…that’s what we did -;)



With the gem working, I knew I wanted to blog about it…build a small Ruby application to show how easy is to use the Ruby_OData gem…but of course…having a DOS style black window wasn’t very likely…so I decide to use Camping once again -:) and of course…Camping is not very classy…and I think it’s not even maintained anymore…so if you’re looking for something nicer, you can use Sinatra instead -;)


As I love to say…”Enough talk! Let’s go to the source code!”




To run this example, we need to provide only 3 simple parameters:

Client = 800

Username = GW@ESW

Password = ESW4GW






I know what you’re going to tell me after you read the source code…why I’m taking the work of reading the date, putting them on an array and looping that? I know I just could read the field from the model and all that…but…for some reason that I still need to discover…the filtering doesn’t work as I expected…for example…I should be able to pass a filter to only select the CITYTO = ‘ NEW YORK’, but it doesn’t work even when I don’t have any errors…so my approach here (and that’s for another blog), it to have all the information stored internally to be able to do the filtering after calling the Gateway service…so…if you’re an SAP Gateway expert…please let me how to make the filter work -:( Because, I know that if I pass the VALUE, SCHME_ID and SCHEME_AGENCY_ID it’s going to work, but only for 1 record…I want a better filter -;)


Hope you enjoy this one…and see you soon with more Gateway coolness!

You must be Logged on to comment or reply to a post.