cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP to RUBY

lakshminarasimhan_n4
Active Contributor
0 Kudos

Hi,

I am an ABAP developer for the past 2 years.

My specialization is in ALE/IDOC technology.

Recently I came across ruby language and its popularity as a scripting language.

I wanted to know how exactly the ruby is used in SAP.

I am eager to learn RUBY along with its RAILS frame work.

How good this ABAP+RUBY combination would help me out in the market?

Regards,

Lakshminarasimhan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

refer this link, it will be useful to you..

https://wiki.sdn.sap.com/wiki/display/EmTech/RubyonRailsGettingStarted+Guide

Regards,

Ahamed.

Answers (6)

Answers (6)

former_member211904
Participant
0 Kudos

Hello Lakshminarasimhan,

No one seems to have addressed your last question, namely how the ABAP and Ruby combination will help you out in the market, so I don't know why this thread is marked as answered.

The RFC connectors for Ruby are not commercially supported; they are created by enthusiasts. As such, I don't think that they will be used by commercial implementations any time soon, and therefore, the "combination" you refer to is certainly not so much a plus in the job market.

You can more easily integrate Rails (or Ruby) with ABAP using web services. However, having knowledge of an extra programming language (such as Ruby) is always beneficial, but I doubt you will find SAP projects where customers are integrating Rails and ABAP very quickly.

If you are interested in learning a good language, then learn Ruby. It's fun and exciting, but don't expect to earn more from it.

Cheers,

Martin

sreenivas_pachva
Participant
0 Kudos

Hi,

i hope you will get idea about integration of abap and ruby, through the following link.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/408a9a3b-03f9-2b10-b29c-f0a3374b1...

-->Lightweight, loosely-coupled, agile programming via Ruby, executed within the robust, proven SAP NetWeaver Application Server ABAP. In many ways, Blue Ruby makes the simple things simple and the complex things possible.

-->On the technical side, Blue Ruby is using parse tree to produce BRIL code (ABAP VM bytecode). Blue Ruby takes care of security using a bridge and a virtual file system: Secured bridge packages, which allow access to the functionality of the underlying host platform in a secure way by establishing a well defined sandbox concept.

--->you can run your Ruby code from within ABAP context We reuse the ABAP VM as much as possible for things such as garbage collection, session handling, memory management, etc. It should be kept in mind that

unlike a normal Ruby environment, this is all running in the context of an application server u2013 the NetWeaver Application Server (ABAP).

This means that all of this is operating in the normal context of ABAP work-processes, roll areas, user authentication & authorizations, etc.

---> It is an enterprise application server by itself, so we donu2019t have to worry about scalability, deployment, user access management and a lot more. And the biggest strength of the overall application server are the existing applications u2013

SAP covers every aspect (may it be fincancial accounting, HCM, CRM, SRM, SCM and all the areas I forgot to list) of business processes in any industry and nearly any country. With Blue Ruby, we get local access to these nearly 300 million lines of ABAP code that has been written. And we can consume, adapt and extend these application inside the system with a modern and efficient language.

Former Member
0 Kudos

About Rubyu2019s Growth

Since its public release in 1995, Ruby has drawn devoted coders worldwide. In 2006, Ruby achieved mass acceptance. With active user groups formed in the worldu2019s major cities and Ruby-related conferences filled to capacity.

Ruby-Talk, the primary mailing list for discussion of the Ruby language, climbed to an average of 200 messages per day in 2006. It has dropped in recent years as the size of the community pushed discussion from one central list into many smaller groups.

The TIOBE index, which measures the growth of programming languages, ranks Ruby as #9 among programming languages worldwide. Much of the growth is attributed to the popularity of software written in Ruby, particularly the Ruby on Rails web framework2.

Ruby is also totally free. Not only free of charge, but also free to use, copy, modify, and distribute.

Seeing Everything as an Object

Initially, Matz looked at other languages to find an ideal syntax. Recalling his search, he said, u201CI wanted a scripting language that was more powerful than Perl, and more object-oriented than Python3.u201D

In Ruby, everything is an object. Every bit of information and code can be given their own properties and actions. Object-oriented programming calls properties by the name instance variables and actions are known as methods. Rubyu2019s pure object-oriented approach is most commonly demonstrated by a bit of code which applies an action to a number.

5.times { print "We love Ruby -- it's outrageous!" }

In many languages, numbers and other primitive types are not objects. Ruby follows the influence of the Smalltalk language by giving methods and instance variables to all of its types. This eases oneu2019s use of Ruby, since rules applying to objects apply to all of Ruby.

Rubyu2019s Flexibility

Ruby is seen as a flexible language, since it allows its users to freely alter its parts. Essential parts of Ruby can be removed or redefined, at will. Existing parts can be added upon. Ruby tries not to restrict the coder.

For example, addition is performed with the plus operator. But, if youu2019d rather use the readable word plus, you could add such a method to Rubyu2019s builtin Numeric class.

class Numeric

def plus(x)

self.+(x)

end

end

y = 5.plus 6

  1. y is now equal to 11

Rubyu2019s operators are syntactic sugar for methods. You can redefine them as well.

Blocks, a Truly Expressive Feature

Rubyu2019s block are also seen as a source of great flexibility. A programmer can attach a closure to any method, describing how that method should act. The closure is called a block and has become one of the most popular features for newcomers to Ruby from other imperative languages like PHP or Visual Basic.

Blocks are inspired by functional languages. Matz said, u201Cin Ruby closures, I wanted to respect the Lisp culture4.u201D

search_engines =

%w[Google Yahoo MSN].map do |engine|

"http://www." + engine.downcase + ".com"

end

In the above code, the block is described inside the do ... end construct. The map method applies the block to the provided list of words. Many other methods in Ruby leave a hole open for a coder to write their own block to fill in the details of what that method should do.

Ruby and the Mixin

Unlike many object-oriented languages, Ruby features single inheritance only, on purpose. But Ruby knows the concept of modules (called Categories in Objective-C). Modules are collections of methods.

Classes can mixin a module and receive all its methods for free. For example, any class which implements the each method can mixin the Enumerable module, which adds a pile of methods that use each for looping.

class MyArray

include Enumerable

end

Generally, Rubyists see this as a much clearer way than multiple inheritance, which is complex and can be too restrictive.

Rubyu2019s Visual Appearance

While Ruby often uses very limited punctuation and usually prefers English keywords, some punctuation is used to decorate Ruby. Ruby needs no variable declarations. It uses simple naming conventions to denote the scope of variables.

u2022 var could be a local variable.

u2022 @var is an instance variable.

u2022 $var is a global variable.

These sigils enhance readability by allowing the programmer to easily identify the roles of each variable. It also becomes unnecessary to use a tiresome self. prepended to every instance member.

Beyond the Basics

Ruby has a wealth of other features, among which are the following:

u2022 Ruby has exception handling features, like Java or Python, to make it easy to handle errors.

u2022 Ruby features a true mark-and-sweep garbage collector for all Ruby objects. No need to maintain reference counts in extension libraries. As Matz says, u201CThis is better for your health.u201D

u2022 Writing C extensions in Ruby is easier than in Perl or Python, with a very elegant API for calling Ruby from C. This includes calls for embedding Ruby in software, for use as a scripting language. A SWIG interface is also available.

u2022 Ruby can load extension libraries dynamically if an OS allows.

u2022 Ruby features OS independent threading. Thus, for all platforms on which Ruby runs, you also have multithreading, regardless of if the OS supports it or not, even on MS-DOS!

u2022 Ruby is highly portable: it is developed mostly on GNU/Linux, but works on many types of UNIX, Mac OS X, Windows 95/98/Me/NT/2000/XP, DOS, BeOS, OS/2, etc.

Iteration

Two Ruby features that are a bit unlike what you may have seen before, and which take some getting used to, are u201Cblocksu201D and iterators. Instead of looping over an index (like with C, C++, or pre-1.5 Java), or looping over a list (like Perlu2019s for (@a) {...}, or Pythonu2019s for i in aList: ...), with Ruby youu2019ll very often instead see

some_list.each do |this_item|

  1. We're inside the block.

  1. deal with this_item.

end

For more info on each (and itu2019s friends collect, find, inject, sort, etc.), see ri Enumerable (and then ri Enumerable#func_name).

Everything has a value

Thereu2019s no difference between an expression and a statement. Everything has a value, even if that value is nil. This is possible:

x = 10

y = 11

z = if x < y

true

else

false

end

z # => true

Symbols are not lightweight Strings

Many Ruby newbies struggle with understanding what Symbols are, and what they can be used for.

Symbols can best be described as identities. A symbol is all about who it is, not what it is. Fire up irb and see the difference:

irb(main):001:0> :george.object_id == :george.object_id

=> true

irb(main):002:0> "george".object_id == "george".object_id

=> false

irb(main):003:0>

The object_id methods returns the identity of an Object. If two objects have the same object_id, they are the same (point to the same Object in memory).

As you can see, once you have used a Symbol once, any Symbol with the same characters references the same Object in memory. For any given two Symbols that represent the same characters, the object_ids match.

Now take a look at the String (u201Cgeorgeu201D). The object_ids donu2019t match. That means theyu2019re referencing two different objects in memory. Whenever you use a new String, Ruby allocates memory for it.

If youu2019re in doubt whether to use a Symbol or a String, consider whatu2019s more important: the identity of an object (i.e. a Hash key), or the contents (in the example above, u201Cgeorgeu201D).

Everything is an Object

u201CEverything is an objectu201D isnu2019t just hyperbole. Even classes and integers are objects, and you can do the same things with them as with any other object:

  1. This is the same as

  2. class MyClass

  3. attr_accessor :instance_var

  4. end

MyClass = Class.new do

attr_accessor :instance_var

end

Variable Constants

Constants are not really constant. If you modify an already initialized constant, it will trigger a warning, but not halt your program. That isnu2019t to say you should redefine constants, though.

Naming conventions

Ruby enforces some naming conventions. If an identifier starts with a capital letter, it is a constant. If it starts with a dollar sign ($), it is a global variable. If it starts with @, it is an instance variable. If it starts with @@, it is a class variable.

Method names, however, are allowed to start with capital letters. This can lead to confusion, as the example below shows:

Constant = 10

def Constant

11

end

Now Constant is 10, but Constant() is 11.

Fake keyword parameters

Ruby doesnu2019t have keyword parameters, like Python has. However, it can be faked by using symbols and hashes. Ruby on Rails, among others, uses this heavily. Example:

def some_keyword_params( params )

params

end

some_keyword_params( :param_one => 10, :param_two => 42 )

  1. => {:param_one=>10, :param_two=>42}

The universal truth

In Ruby, everything except nil and false is considered true. In C, Python and many other languages, 0 and possibly other values, such as empty lists, are consided false. Take a look at the following Python code (the example applies to other languages, too):

  1. in Python

if 0:

print "0 is true"

else:

print "0 is false"

This will print u201C0 is falseu201D. The equivalent Ruby:

  1. in Ruby

if 0

puts "0 is true"

else

puts "0 is false"

end

Prints u201C0 is trueu201D.

Access modifiers apply until the end of scope

In the following Ruby code,

class MyClass

private

def a_method; true; end

def another_method; false; end

end

You might expect another_method to be public. Not so. The u2018privateu2019 access modifier continues until the end of the scope, or until another access modifier pops up, whichever comes first. By default, methods are public:

THIS WILL HELP U........

REGARDS,

PAVAN KUMAR.G

former_member182779
Active Contributor
0 Kudos

Ruby can be used to gather information from SAP using the Ruby:RFC Module created by Piers Harding. Also, we have the Blue Ruby project which is open source now on CodeExchange.

Also, and besides of Rails, you can use Sinatra, WxRuby, Camping and even shoes to get a better output that a simple DOS Screen -;)

You can see some examples here [https://wiki.sdn.sap.com/wiki/display/EmTech/Mustreadweblogs]

Greetings,

Blag.

Former Member
0 Kudos

The ruby is used to provide a light-weight environment for consumption and adaptation of our SAP application platform.

Best Regards,

Harish.y

Former Member
0 Kudos

Hello,

this paper looks promising:

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/505ac48e-0578-2a10-60be-c5ffe14a0134

Additionally Pires Harding have written an libary based on good old RFC which can be used to bridge between Ruby on Rails and ABAP.

All the best,

Guido Brune