Blogs

Alvaro Tejada Galindo

Tasting the mix of Blue Ruby
Alvaro Tejada Galindo SAP Employee Active Contributor Gold: 1,500-2,499 points
Business Card
Company: SAP Labs - Montreal
Posted on May. 06, 2009 01:06 PM in Scripting Languages, Ruby, Emerging Technologies, Beyond SAP, Beginner, ABAP

Subscribe.Subscribe
Print. Print
Permalink Permalink
Share

Have you ever heard of Blue Ruby? No? Well...simply put, Blue Ruby let's you run the Ruby Programming Language inside an NetWeaver ABAP Stack...good enough? It is for me of course -:)

Those who know me...virtually or personally, already know that I'm very passionate about Technologies and specially, Scripting Languages.

This week, thanks to Juergen Schmerder and The Blue Ruby Team, I  got early access to the WebGui based Blue Ruby IDE.

Of course, the first thing I did was log-in and tried to do some testing...mostly language related testing. Gladly I found that almost everything I could do on Ruby (Core Language) could be done on Blue Ruby.

So, next thing I do was to start working on my always to be example...an SE16 Emulator.

It was fairly easy because I have done a lot of SE16 example using Ruby, Camping, WxRuby, Sinatra, PHP, PHP/Flex.

Anyway...here's the code. Just to let you know...there's a way to make much smaller...almost 6 lines long...but I decided to go with the longer version for two simple reasons.

1.- I wanted to keep testing the language capabilities.

2.- Wanted to separate each field and format them invidually.

3.- Wanted to have fun by writing more code -:P

 

 

Now, some screenshots.

 

image

image

 

I'm sure you're going to get amazed with this -:) I'm still amazed myself -:D

So...if you want to learn more about, here are some useful links:

 

Blue Ruby: A Ruby VM in ABAP (PDF)

Blue Ruby - a Ruby VM in ABAP

Blue Ruby Demo Video Part 1: How to get started

Blue Ruby Demo Video Part 2: How to call ABAP functions

Introduction to Blue Ruby Replay

 

Alvaro Tejada Galindo  Active Contributor Gold: 1,500-2,499 points is a Development Expert, Scripting Languages Geek, Programming books author, Geek Comics author and SAP Mentor Alumni.


Comment on this articleIf you any comments, questions or suggestions, drop me a line.
Comment on this weblog
Showing messages 1 through 7 of 7.

Titles Only Main Topics Oldest First

  • Useful Ruby #923
    2009-05-06 19:58:20 Juergen Schmerder SAP Employee Business Card [Reply]

    BTW: there's a nice way to write


    $space = ""
    $len = ( $Fields_Length[i].to_i - $Data_Split[i].length ) + 1
    $len.times do
    $space += "\s"


    a little shorter: Ruby lets you multiply Strings with Fixnums. So


    $space = "\s" * ( $Fields_Length[i].to_i - $Data_Split[i].length + 1 )


    has the same result. Comes in handy sometimes when ABAP functions expect fixed length codes...


    --Juergen

    • Useful Ruby #923
      2009-05-07 04:55:00 Alvaro Tejada Galindo SAP Employee Business Card [Reply]

      Juergen:


      That's why I love Ruby -:) So many shorthands...actually I'm planning to re-learn Ruby...read my books and tutorials to find new tricks and apply them to my Blue Ruby developments -;)


      Greetings,
      Blag.

  • sweet
    2009-05-06 19:01:07 Daniel McWeeney Business Card [Reply]

    Very cool, glad someone is able to get in and have a look at this!


    I assume the way to make it 6 lines would be to call some abap directly from ruby, and have it print the data set?

    • sweet
      2009-05-07 04:51:31 Alvaro Tejada Galindo SAP Employee Business Card [Reply]

      Dan:


      Sure this is great -:) I was looking forward to the early access. Being able to call ABAP functions from Ruby without relying on a RFC Connector and straight from the ABAP stack is a dream come true -:)


      Greetings,
      Blag.

    • sweet
      2009-05-06 19:45:33 Juergen Schmerder SAP Employee Business Card [Reply]

      Hi Dan.


      Hi hope we'll be able to get the paperwork done and let more users on the system.


      The short version just takes advantage of the fact that the output of RFC_READ_TABLE is already pre-formatted:


      require 'rfc'
      $spfli = Rfc.new 'RFC_READ_TABLE'
      $spfli.query_table = 'SPFLI'
      $spfli.delimiter = '|'
      $spfli.call!
      $spfli.data.each do |l| puts l.wa end


      But Blag's version is much better because it creates Ruby objects for the hits


      --Juergen


Showing messages 1 through 7 of 7.