Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

abap objects

Former Member
0 Kudos
145

hi,

i want somebody to explain step by step in creating a simple ABAP OBJECT program.

it will be helpful if the program explained with detailedly step by step.

bcos its bit confusing me to understand from where my program get processed in abap object .

points are assured.

thanks,

ganesh

9 REPLIES 9

Former Member
0 Kudos
96

Hi ganesh,

Look into ABAP document and examples(T-code: abapdocu) , under ABAP objects simple programs will be given which is useful for OOPS beginners in ABAP.

Cheers,

Madhu

Former Member
0 Kudos
96

ABAP Objects Introduction to Programming SAP Applications 0201750805 Readme

Created: Aug 31, 2004

Article ID: 334096

=================================================================

SAP LIBRARY - SAP's ONLINE DOCUMENTATION mySAP.com Workplace 2.10

=================================================================

TABLE OF CONTENTS

Overview

HTML Help Quick Setup

HTML Help Features

Installing the Adobe Acrobat Reader

Language-Specific Information

Known Problems and Issues

Technical Support

==============================================================

!!! -

-


IMPORTANT NOTE -

-


!!!

As of Release 4.6C, the online help settings in the R/3 System (i.e. help type, storage location of help files, language, etc. are no longer controlled by the profile parameters /eu/iwb/..., but are controlled by table entries which you maintain with the IMG activity "General Settings -> Setting Variants for Help (SAP Library)". See SAP Library installation guide, p.3-3.

!!! -

-


!!!

1. OVERVIEW

This CD contains SAP R/3 System online documentation (SAP Library) for mySAP.com Workplace,

Cross-application, Basis Technology components.

The folder SUPPORT contains factsheets about the support services provided by

SAP AG.

The folder UPGGUIDE contains the upgrade documentation. The folder TOPLEVEL contains

the overview documentation for the upgrade of the mySAP.com Workplace system landscape.

The folders AS400, NT and UNIX contain the documentation for the upgrade of the

mySAP.com Workplace Server.

The SAP Library is delivered in the format:

HTML Help: To be viewed with the Microsoft HTML-Help Viewer

on Windows 95, 98 and NT 4.0 front-end PCs.

The help files can be accessed either directly from the CD or from a network server. To access the files offline (that is, without connection to the R/3 System) directly from the CD or from a hard disk run the HTML-Help Quick Setup program (setup.exe) from the main directory of this CD. To access the files online from the R/3 System, follow the instructions in the SAP Library installation guide (ONLDOC_E.PDF/ONLDOC_E.HTM or ONLDOC_D.PDF/ONLDOC_D.HTM) on this CD.

Note: To view or print the PDF version of the installation guide, you need the Adobe Acrobat Reader which is also delivered on this CD (see "Installing the Adobe Acrobat Reader"). To view or print the HTML version, you need a standard web browser.

==============================================================

2. HTML HELP QUICK SETUP

USE

You want to access the SAP Library offline directly from the CD or from a hard drive.

SYSTEM REQUIREMENTS

Microsoft Windows 95 or NT 4.0 with Service Pack 3

Microsoft Internet Explorer 3.02 (or higher), version 4.01 included on this CD

Microsoft HTML-Help Viewer 1.2 (or higher), version 1.21 included on this CD

486 DX - 33 MHz (Pentium - 133 MHz recommended)

16 MB RAM (48 MB recommended)

Graphic 800 x 600/256 color

Under Windows NT 4.0, you must have administrator rights on your PC.

Note: Installing Internet Explorer and the HTML-Help Viewer does not constrain

your choice of web browser for accessing the World Wide Web.

SETUP PROCEDURE

In the Windows Explorer, select file

Double-click on the executable file in this directory

Follow the instructions of the installation program.

Once you have installed the Acrobat Reader you can display the installation guide by double-clicking on the PDF file.

System Requirements for the Adobe Acrobat Reader:

Microsoft Windows 3.1x

Minimum

i386, i486, Pentium, or Pentium Pro processor-based computer

8 MB RAM

5 MB hard-disk space

Microsoft Windows 95

Minimum

i386, i486, Pentium, or Pentium Pro processor-based computer

8 MB RAM

10 MB hard-disk space

Microsoft Windows NT 4.0

Minimum,

i386, i486, Pentium, or Pentium Pro processor-based computer

16 MB RAM

10 MB hard-disk space

IBM OS/2

Minimum

i386, i486, Pentium, or Pentium Pro processor-based personal computer

IBM OS/2 Warp or Warp Connect 3.0 or later

(Fixpak 26 required for printing using OS/2 Warp 3.0 or Warp Connect 3.0)

4 MB of RAM available for Acrobat Reader

8 MB of RAM available for system

5 MB hard-disk space, plus 5 MB of temporary space available during installation

Apple Macintosh and Power Macintosh

See the Adobe web site (http://www.adobe.com) for system requirements

on Macintosh platforms.

UNIX variants

See the Adobe web site (http://www.adobe.com) for system requirements on various UNIX platforms.

==============================================================

5. LANGUAGE-SPECIFIC INFORMATION

Language keys:

DE = German

EN = English

==============================================================

6. KNOWN PROBLEMS AND ISSUES

HTML Help:

Creating the global keyword index for the entire SAP Library (a one-time operation, when you choose the "Index" tab) requires a considerable amount of memory and processor speed. It can take up to 20 minutes to initially create the global keyword index, depending on your PC. Subsequent reloading of the index file (approx. 8 MB) is much faster. To save you time, the index file (00000001.CHW) is delivered on the CD and is copied to the required location by the setup program.

Performing a global full-text search also places high demands on memory and processor speed since all help files need to be processed. You should only use it if you access the files from your local hard disk.

On the English CD, some documentation is available in Germany only. This mainly applies to the role documentation for FI, QM, and CS.

When implementing the 4.6C release, we recommend you work with the SAPscript version of the IMG. In some areas, the exported FCS version of the IMG on this CD is incomplete.

==============================================================

7. TECHNICAL SUPPORT

If you have problems installing or viewing the SAP Library, contact SAP via SAPnet. Use the component BC-DOC-IWB-DIS to report a problem.

See Note 101481 in SAPnet for a list of notes related to the online documentation.

==============================================================

COPYRIGHT

© 2000 SAP AG. All rights reserved. Neither this documentation nor any part of it may be copied or reproduced in any form or by any means or translated into another language, without the prior consent of SAP AG.

SAP AG makes no warranties or representations with respect to the content hereof and specifically disclaims any implied warranties of merchantability or fitness for any particular purpose. SAP AG assumes no responsibility for any errors that may appear in this document. The information contained in this document is subject to change without notice. SAP AG reserves the right to make any such changes without obligation to notify any person of such revision or changes. SAP AG makes no commitment to keep the information contained herein up to date. SAP is a registered trademark of SAP AG. Microsoft Windows is a registered trademark of Microsoft Corporation. All other products mentioned in this booklet are registered or unregistered trademarks of their respective companies.

Check...

http://help.sap.com/saphelp_nw2004s/helpdata/en/c3/225b5654f411d194a60000e8353423/frameset.htm

/people/tobias.trapp/blog/2006/11/20/data-modeling-and-database-design-in-abap-150-part-1

http://www.pearson.ch/Informatik/Programmierung/ABAP/1471/9780201750805/ABAP_Objects_Introduction_to...

Former Member
0 Kudos
96

Hi,

Before coding the ABAP Objects, Please do take time to visit the below links.

http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm

Classes

http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm

Object Handling

http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5f54f411d194a60000e8353423/content.htm

Declaring and Calling methods

http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm

Inheritance.

http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm

Interfaces.

http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm

Trigerring and handling Events

http://help.sap.com/saphelp_47x200/helpdata/en/71/a8a77955bc11d194aa0000e8353423/content.htm

For Sample ABAP Object Code, Check the below Program THis is a Standard SAP Program

Using the Classes in a Program

<b>REPORT demo_class_counter_event.</b>

<b>* Class is defined</b>

CLASS counter DEFINITION.

PUBLIC SECTION.

METHODS increment_counter.

EVENTS critical_value EXPORTING value(excess) TYPE i.

PRIVATE SECTION.

DATA: count TYPE i,

threshold TYPE i VALUE 10.

ENDCLASS.

<b>* All the methods of the calls are implemented</b>

CLASS counter IMPLEMENTATION.

METHOD increment_counter.

DATA diff TYPE i.

ADD 1 TO count.

IF count > threshold.

diff = count - threshold.

RAISE EVENT critical_value EXPORTING excess = diff.

ENDIF.

ENDMETHOD.

ENDCLASS.

CLASS handler DEFINITION.

PUBLIC SECTION.

METHODS handle_excess

FOR EVENT critical_value OF counter

IMPORTING excess.

ENDCLASS.

CLASS handler IMPLEMENTATION.

METHOD handle_excess.

WRITE: / 'Excess is', excess.

ENDMETHOD.

ENDCLASS.

DATA: r1 TYPE REF TO counter,

h1 TYPE REF TO handler.

START-OF-SELECTION.

<b>* Class is instantiated</b>

CREATE OBJECT: r1, h1.

<b>* Handler is set for the event</b>

SET HANDLER h1->handle_excess FOR ALL INSTANCES.

DO 20 TIMES.

<b>* Method is called</b>

CALL METHOD r1->increment_counter.

ENDDO.

Regards,

Vara

0 Kudos
96

hi varaprasad,

can u explain what the following statement is actually doing here.

SET HANDLER h1->handle_excess FOR ALL INSTANCES.

what is the use of this FOR ALL INSTANCES.

thanks,

ganesh

0 Kudos
96

What this means is that you are setting the handler method for all instances of the class object, so there is more than one instance(object) of a class, the same handler will be fired for the different object references of the class.

Regards,

Rich Heilman

0 Kudos
96

hi heilman,

i am not able to get answer,

u said if there is more than one instance of a class ,the same handler will be fired,

but for the method hanndle_excess i didnt find any instances.

so could u pls explain detaily.

thanks,

ganesh

0 Kudos
96

Well, in this case, there is only one object R1, so it really doesn't show the use of FOR ALL INSTANCES. Taking the example above and modifing it you can see how this can be implemented below.



report zrich_0001.

*---------------------------------------------------------------------*
*       CLASS counter DEFINITION
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
class counter definition.
  public section.
    methods increment_counter.
    events critical_value exporting value(excess) type i.
  private section.
    data: count type i,
    threshold type i value 10.
endclass.
* All the methods of the calls are implemented
class counter implementation.
  method increment_counter.
    data diff type i.
    add 1 to count.
    if count > threshold.
      diff = count - threshold.
      raise event critical_value exporting excess = diff.
    endif.
  endmethod.
endclass.

*---------------------------------------------------------------------*
*       CLASS handler DEFINITION
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
class handler definition.
  public section.
    methods handle_excess
    for event critical_value of counter
    importing excess.
endclass.

*---------------------------------------------------------------------*
*       CLASS handler IMPLEMENTATION
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
class handler implementation.
  method handle_excess.
    write: / 'Excess is', excess.
  endmethod.
endclass.

data: r1 type ref to counter,
      r1_list type table of ref to counter,
      h1 type ref to handler.

start-of-selection.
  create object h1.
* Handler is set for the event
  set handler h1->handle_excess for all instances .

  do 5 times.
* Class is instantiated
    create object: r1.
    append r1 to r1_list.
  enddo.

  loop at r1_list into r1.

    do 20 times.
      call method r1->increment_counter.
    enddo.
    skip 1.
  endloop.

REgards,

Rich Heilman

0 Kudos
96

Now that I'm thinking about it, my last example doesn't give a clear picture, take this example where you have two instances of COUNTER, the event handler will be fired for both instances R1 and R2.



report zrich_0001.

*---------------------------------------------------------------------*
*       CLASS counter DEFINITION
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
class counter definition.
  public section.
    methods increment_counter.
    events critical_value exporting value(excess) type i.
  private section.
    data: count type i,
    threshold type i value 10.
endclass.
* All the methods of the calls are implemented
class counter implementation.
  method increment_counter.
    data diff type i.
    add 1 to count.
    if count > threshold.
      diff = count - threshold.
      raise event critical_value exporting excess = diff.
    endif.
  endmethod.
endclass.

*---------------------------------------------------------------------*
*       CLASS handler DEFINITION
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
class handler definition.
  public section.
    methods handle_excess
    for event critical_value of counter
    importing excess.
endclass.

*---------------------------------------------------------------------*
*       CLASS handler IMPLEMENTATION
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
class handler implementation.
  method handle_excess.
    write: / 'Excess is', excess.
  endmethod.
endclass.

data: r1 type ref to counter,
      r2 type ref to counter,
      h1 type ref to handler.

start-of-selection.
  create object h1.
* Handler is set for the event
  set handler h1->handle_excess for all instances .


* Class is instantiated
  create object: r1, r2.



  do 20 times.
    call method r1->increment_counter.
  enddo.
  skip 1.

  do 20 times.
    call method r2->increment_counter.
  enddo.

Regards,

RIch Heilman

Former Member
0 Kudos
96

thanks for the answers.