Sie sind auf Seite 1von 4

SAPTechnical.

COM - Object oriented programming (OOP) explained with an example

Home Tips Tutorials Sample Specs Certification Q's Interview Q's Jobs Testimonials Contact Us

For Tutorials/Tips in SAP Functional areas, visit SAPFunctional.COM

Document Categories:
q q q q q q q q q q q q q q q q q

Object oriented programming (OOP) explained with an example


...Previous

ABAPTM Business Workflow LSMW SAP Script/Smart Forms eXchange Infrastructure (XI) ABAP-HR ALE & IDocs ALV BAPI BASIS BSP eCATT Object Oriented Programming SAP Query Userexits/BADIs WebDynpro for Java/ABAPTM Others

Write the required code. Similarly for SET_BALANCE

Email a Friend What's New?


q

Similarly for WITHDRAW.

q q

q q q q

q q q q q q q q q q

q q

WebDynpro for ABAP - Implementing Enhancements in a view Displaying text box and radio button using WebDynpro for ABAP The features of ABAP New Editor Creating Custom Rules for use in Workflow definition Working on Polymorphism Step-by-step creation of a BAPI Working with Menu Painter Working with import, export and change parameters of a class Insert data into the database table using classes Smart Forms - Working with Loop Designing Tables in Smart Forms Creating Search Help (Elementary and Collective) Working with Smart Styles Workflow - Purchase Order Release Strategy Loading data into infocubes Triggering workflow using BTE Ad Hoc agent assignment in Workflow Sending mails recursively, upon reaching the deadline, until the task is completed Distributing Material Master data using Standalone and Change Pointers XI - ABAP Proxy communication (Step-by-step) Defining and implementing a BADI (step-by-step with screenshots) Automatic IDOC generation whenever a PO is created/changed

Now we are almost done creating the object. Press CTRL + F3 to activate or hit the Matchstick.

We will see this in the status Now we are done building the global class we can test it. Press F8.

http://www.saptechnical.com/Tutorials/ABAP/OOP/Example2.htm (1 of 4)11/23/2007 11:12:21 AM

SAPTechnical.COM - Object oriented programming (OOP) explained with an example

Contribute? What's Hot?


LSMW Tutorials

Join the Mailing List


Enter name and email address below: Name: Email:

Subscribe

Unsubscribe

GO

Click SET_BALANCE. Write the NEW_BALANCE and press ENTER.

We come back to Initial Screen. Now click DEPOSIT.

We see the return Values now.

Now lets WITHDRAW 4000

http://www.saptechnical.com/Tutorials/ABAP/OOP/Example2.htm (2 of 4)11/23/2007 11:12:21 AM

SAPTechnical.COM - Object oriented programming (OOP) explained with an example

Now the BALANCE is 2000 Lets try withdrawing 3000 now.

We get an exception. Given below is an example code for using the global class we defined. REPORT ZGB_OOPS_BANK DATA: acct1 type ref to zaccountaa. DATA: bal type i. create object: acct1. selection-screen begin of block a. parameters: p_amnt type dmbtr, p_dpst type dmbtr, p_wdrw type dmbtr. selection-screen end of block a. start-of-selection. call method acct1->set_balance( p_amnt ). write:/ 'Set balance to ', p_amnt. bal = acct1->deposit( p_dpst ). write:/ 'Deposited ', p_dpst ,' bucks making balance to ', bal. bal = acct1->withdraw( p_wdrw ). write:/ 'Withdrew ', p_wdrw ,' bucks making balance to ', bal. This is the output.
http://www.saptechnical.com/Tutorials/ABAP/OOP/Example2.htm (3 of 4)11/23/2007 11:12:21 AM

SAPTechnical.COM - Object oriented programming (OOP) explained with an example

Google Search

Web

SAPtechnical.COM

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM Home Contribute About Us Privacy Terms Of Use Disclaimer Safe Companies: Advertise on SAPTechnical.COM | Post Job Contact Us

20062007 SAPTechnical.COM. All rights reserved. All product names are trademarks of their respective companies. SAPTechnical.COM, Inc. is in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver, and and any other SAP trademarks are registered trademarks of SAP AG in Germany and in several other countries. Every effort is made to ensure content integrity. Use information on this site at your own risk.
Graphic Design by Round the Bend Wizards

http://www.saptechnical.com/Tutorials/ABAP/OOP/Example2.htm (4 of 4)11/23/2007 11:12:21 AM

Das könnte Ihnen auch gefallen