Enterprise Resource
Planning Portal

 

Advertise | Founder BLOG

ERPGenie.COM ABAP Tips and Tricks Database

THE ultimate
ERP website

 

Forums | Vote for us |

Google    Other Search Options

ABAP OO
OO ABAP Dynpro Programming PDF Print E-mail
User Rating: / 1
Written by Kevin Wilson   
Wednesday, 02 September 2009

I found a great blog by Thomas Jung on using ABAP screens within classes. It's limiting but at least it makes it possible.

Check it out at http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/2322

 
Beneath Abstraction! PDF Print E-mail
User Rating: / 0
Written by Ram Tiwari   
Wednesday, 02 September 2009

By: Ram Manohar Tiwari (Check out Ram's blog at http://sapblog.rmtiwari.com/)

Problems cannot be solved from the same level of consciousness that created it. - Albert Einstein

I was trying to find this famous quote from Einstein and realized that like software, it's actually available in many versions. I could not be sure about the original so in the end just chose one of the shortest.

Sometimes the obvious solutions are unable to solve the underlying problems, because from our level of understanding, we could only see the symptoms and not the cause. Just as an example, Socialism and Communism seem to be a very obvious solution to solve the poverty issue. "Collect money from those who have plenty and distribute among others who don't" - seems to be an obvious solution. However, we could all agree, it does not work as expected.

Basically, I am trying to relate this whole stuff of "level", "abstraction" & "consciousness" etc. with "how should we go about understanding basic software concepts and solve software problems".

Advent of powerful tools, IDEs, libraries and in general this "with a click of mouse" wizards, have made software developer and administrator's life much easier than before. In fact, learning new technology and developing applications has become easier than before, even for the beginners. However, the downside is that most of the developers no longer understand the basic concepts hiding behind the layers of abstraction. This lack of understanding does affect their confidence, while designing or programming, but the problem is more obvious during troubleshooting.

The order of learning may not be important here. e.g. you can first learn about a code generator wizard/IDE and then dig deeper in the layers underneath or learn the basics without using any code generator and then relate it with the generated code.

For example: if you never had an exposure to web related programming, it's better to understand the basics before jumping the gun. There is nothing that will stop anyone from learning ABAP BSPs / WebDynpros / JSPs / Web Services etc., directly. However, you should understand that these are another layers over the basic concepts like : HTML, XML, CSS, core language (e.g. ABAP / Java ) in relation with protocols like HTTP / SOAP. So it's important to understand the underlying concepts first.

What is HTTP Protocol and how can you enhance your understanding by avoiding the abstraction layers?

From Wikipidea : HTTP is a request/response standard of a client and a server. A client is the end-user(software program), the server is the web site. The client making a HTTP request—using a web browserspider, or other end-user tool—is referred to as the user agent. The responding server—which stores or creates resources such as HTML files and images—is called the origin server. In between the user agent and origin server may be several intermediaries, such as proxiesgateways, and tunnels.
Working with the command prompt is a better way to understand the basic concepts. You can try to emulate a basic web-browser (request/response) from the command prompt using telnet.
e.g. to request the first page of Google search html page:
  • Start command prompt on your PC using Start->Run -> cmd
  • telnet www.google.co.uk  80  [ This is the command to use telnet connection with google at port 80 (web server port)]  - press enter
  • GET http://www.google.co.uk/ [ This will use the HTTP GET to fetch the default page from google. similarly you can specify any URL on google.co.uk site ] - press enter
  • You can see the raw html code as Response from Google web server.
This is to understand the basic browser functionality and how it works. Also, if you are calling a web URL using methods of ABAP Class CL_HTTP_CLIENT then just remember that this class is an abstraction and provides similar functionality as a Browser. And similar to Browser settings, you may need to provide your corporate proxy server information to get this working.
A quick adaptation of the standard SAP example program, for getting the first page from www.google.co.uk is as below:
REPORT  Z_RAM_HTTP_CLIENT.

* data declarations
data: client type ref to if_http_client.
data: host type string value 'www.google.co.uk',
service type string value '80',
path type string value '/',
errortext type string, "used for error handling.
TIMEOUT type i,
subrc like sy-subrc.

call method cl_http_client=>create
EXPORTING
host = host "e.g. www.google.co.uk
service = service "port 80
proxy_host = 'proxy.company.com' "proxy server
proxy_service = '80'
scheme = '1' "HTTP = 1
IMPORTING
client = client
EXCEPTIONS
argument_not_found = 1
internal_error = 2
plugin_not_active = 3
others = 4.

if sy-subrc <> 0.
write: / 'Client Create failed, subrc = ', sy-subrc.
exit.
endif.

* set http method GET
call method client->request->set_method(
if_http_request=>co_request_method_get ).
* set protocol version
client->request->set_version(
if_http_request=>co_protocol_version_1_0 ). "protocol = 'HTTP/1.0'.

* set request uri (/[?])
cl_http_utility=>set_request_uri( request = client->request
uri = path ).

* Send
call method client->send
EXPORTING
timeout = timeout
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
others = 4.
if sy-subrc <> 0.
call method client->get_last_error
IMPORTING
code = subrc
message = errortext.
write: / 'communication_error( send )',
/ 'code: ', subrc, 'message: ', errortext.
exit.
endif.

* receive
call method client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
others = 4.
if sy-subrc <> 0.
call method client->get_last_error
IMPORTING
code = subrc
message = errortext.
write: / 'communication_error( receive )',
/ 'code: ', subrc, 'message: ', errortext.
exit.
endif.


* Write data
data: data type string.
data: fields type tihttpnvp,
fields_wa type ihttpnvp.

call method client->response->get_header_fields
CHANGING
fields = fields.
loop at fields into fields_wa.
write: / 'header_name', fields_wa-name,
'header_value', fields_wa-value.
endloop.
data = client->response->get_cdata( ).
data: line(72) type c,
len type i,
llen type i.
len = strlen( data ).

while len > 0.
line = data+llen(*).
write: / line.
len = len - 72.
llen = llen + 72.
endwhile.
if llen < len.
line = data+llen(*).
write: / line.
endif.

* close
call method client->close
EXCEPTIONS
http_invalid_state = 1
others = 2.

Further, if you want to understand underlying concepts behind consuming web services ( SOAP over HTTP ) in ABAP then  read this excellent Blog Consuming Web Service from ABAP by Durairaj Athavan Raja. This Blog was written by Raja when web service wizard was not available for that release. Even today, this Blog can be used to avoid the wizards and understand the underlying operations of SOAP over HTTP in ABAP.
I am tempted to provide corresponding example from the web service wizard but will try later.

Also, another area  I wanted to touch :

Importance of knowing basics like HTML, XML, CSS etc. and how it adds to your understanding while learning dynamic web page generators like BSPs etc. Mainly about BSP/HTMLB extensions and how these extensions generate underlying HTML codes.
For example: HTMLB extension to generate HTML code for a 'Button' is contained in methods DO_AT_BEGINNING, DO_AT_END & RENDER_DEFAULT_START of class CL_HTMLB_BUTTON. Check these methods to have an idea about how different browsers or design type selection (e.g. Classic, Design2002 or Design2003) affect the code generation.


Just to clarify, the suggestion here is to avoid layers, wizards etc. while you are trying to learn the basics. However, use of standard libraries, IDEs and Wizards is recommended for writing productive software as it ensures better productivity, standards, harmony and best practices.
Recommended Reads on related topic:
 
Displaying data with ABAP WebDynpro table PDF Print E-mail
User Rating: / 2
Written by Kevin Wilson   
Friday, 22 February 2008

Below are the steps for displaying data within an ABAP WebDynpro table.


Step 1
Create new Web dnpro component (WDP_SEL_TABLE), double click on the ComponentController and select the 'Context' tab. Now add a new node to the contect node (right click the context and select Create->Node).

Last Updated ( Wednesday, 20 February 2008 )
Read more...
 
WebDynpro to display 'Hello world' PDF Print E-mail
User Rating: / 0
Written by Anon.   
Wednesday, 20 February 2008

Below are the steps for creating a simple ABAP WebDynpro.
Step 1
Execute transaction SE80

Step 2 – Create Web Dynpro component
Select Web Dynpro component/application from drop down and create new Web Dynpro component with a Web Dynpro window. Give the window a name of your choice e.g. INIT_WINDOW

Read more...
 
Managing persistent objects with object services PDF Print E-mail
User Rating: / 4
Written by Dany Charbonneau   
Sunday, 03 June 2007
Note: This only works for WAS 6.10 and over.

There is a way to avoid building a fully object-oriented program while still working with non-object-oriented relational database. The object services layer now provides a persistence framework that closes the object-relational gap. You no longer need to write SQL code as objects are transparently loaded from the database when needed. You must create a persistent class.
Read more...
 
Difference between Function and Objects PDF Print E-mail
User Rating: / 0
Written by P. Renjith Kumar   
Wednesday, 30 May 2007
Last Updated ( Wednesday, 27 February 2008 )
Read more...
 
Managing Persistent Objects With Object Services PDF Print E-mail
User Rating: / 0
Written by Dany Charbonneau   
Saturday, 26 May 2007
Managing persistent objects with object services.

Note: This only works for WAS 6.10 and over.

There is a way to avoid building a fully object-oriented program while still working with non-object-oriented relational database. The object services layer now provides a persistence framework that closes the object-relational gap. You no longer need to write SQL code as objects are transparently loaded from the database when needed. You must create a persistent class.

Read more...
 
Why use ABAP OO with Workflow? PDF Print E-mail
User Rating: / 1
Written by Anon.   
Friday, 20 April 2007
See entire blog here : https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3858
Read more...
 
Using ABAP OO attributes in workflows and tasks PDF Print E-mail
User Rating: / 0
Written by Anon.   
Thursday, 19 April 2007

A little background history for those who know BOR

VERY HELPFUL TIP!   If you are an ABAP OO programmer and never did any code in the Business Object Repository, skip this section... you don't need to know about it, and you probably don't want to know either.

Once upon a time, in the land of BOR (Business Object Repository), there were 3 types of attributes:

  1. Database attributes
  2. Virtual attributes
  3. Status attributes

Database attributes were always the easiest of attributes - just say what table and field you want to read and the BOR would generate some code to read all the data from a record of the table. You just had to fill in the blanks. Then you could add other database attributes referring to the same table and they would all use the same pre-generated code. Easy for workflow devlopers, but not always the most efficient way to read code, as you may only be using one or two fields but you still read the entire table row.

Virtual attributes were the most useful type of attribute as you could derive anything here including complex values, structures, tables, and instances of other objects.

Status attributes were a neat trick for business objects that used SAP status management, but most programmers didn't even know they existed. By using a special interface, and filling in the code behind a few predefined virtual attributes, you could then generate a yes/no flag to indicate if a particular status of that object was active.

In ABAP OO we no longer make the distinctions between these different types of attributes. So what do you lose? No more pre-generated code. And what do you gain? Flexibility and control over how your attributes are coded so that you can make the code as performance-efficient as possible.

Tip!  Wanting to find whether a status attribute is set or not? Just call function module STATUS_OBJECT_READ with the status object number. All the statuses set for that object will be returned.

Read entire blog here https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/4203

 

 
Using functional methods in workflows and tasks PDF Print E-mail
User Rating: / 1
Written by Anon.   
Wednesday, 18 April 2007

This is number 6 in a series of blogs on ABAP OO for workflow, so you it would be a really good idea to make sure you have worked through the first 5 blogs. The examples we'll use here continue on from those we used in the earlier blogs.

Here's the list of the earlier blogs:

  1. Why use ABAP OO with Workflow?
  2. Getting started with ABAP OO for Workflow ... using the IF_WORKFLOW interface
  3. Using ABAP OO with Workflow Tasks
  4. Raising ABAP OO events for Workflow
  5. Using ABAP OO attributes in Workflows and Tasks
Read entire blog here: https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/4662
 
Using ABAP OO methods in Workflow Tasks PDF Print E-mail
User Rating: / 1
Written by Anon.   
Tuesday, 17 April 2007
Read the blog at https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3948
 
How can I use ABAP OO Classes in Workflow? PDF Print E-mail
User Rating: / 0
Written by Anon.   
Tuesday, 17 April 2007
Jocelyn has written an excellent paper which you can download via SDN. https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3907
 
ABAP OO Syntax PDF Print E-mail
User Rating: / 1
Written by Henrik Frank   
Saturday, 03 February 2007
  • Template for making a class
  • Template for calling a class
  • Subclass
  • Template for calling a class
  • Using a class as a parameter for a method
  • Interfaces
  • Events
Read more...
 
ABAP OO Definitions PDF Print E-mail
User Rating: / 6
Written by Henrik Frank   
Wednesday, 31 January 2007
  1. Public attributes  

  2. Private attributes

  3. Instance attributes 

  4. Static attributes 

  5. Public methods 

  6. Private methods 

  7. Constructor method 

  8. Static constructor 

  9. Protected components 

  10. Polymorphism

Read more...
 

Google Search

Google Ads