Wednesday, 3 October 2012
What’s an ALV field catalog?
In order to display some tabular data in an ALV, the ALV needs some information about the columns/ fields which will be displayed in the ALV. Field catalog is basically the internal table which carries information about each of the columns/ fields with which ALV has to deal with. It need not necessarily contain information about each of the columns/ fields in the data table used as data source of ALV. Only the fields which are important for display or of some technical use for ALV need to be informed to ALV through field catalog.
Friday, 6 July 2012
Difference between CALL TRANSACTION and SESSION Method
Call Transaction method
|
Classical or session method
|
In this method, the ABAP/4 program uses the call transaction <T-code > using <bdc_tab> mode <mode> update <update > method.
|
In this method, ABAP/4 program read the external data that is to be entered to the SAP system and stores the data in the batch input session.
When the prgm has finished creating the session, we can run the session thro the TC SM35. This method involves FM like BDC_OPEN,BDC_INSERT,BDC_CLOSE
|
In ‘Call Transaction’, the transactions are triggered at the time of processing itself and so the ABAP program must do the error handling.
|
Whereas in Batch Input Sessions, the ABAP
program creates a session with all the transactional data, and this session can be viewed, scheduled and processed (using Transaction SM35) at a later time. The latter technique has a built-in error processing mechanism too. |
Synchronous Processing
|
Asynchronous Processing
|
We can update the database both synchronously and asynchronously. We can specify the mode in the program.
|
Synchronous Database update.
During processing, no transaction is started until the previous transaction has been written to the database.
|
No batch input processing log
|
Detailed Log will be generated for all the sessions
|
While execution it starts from the first.
|
While executing it wont start from the first. It will start from the place where it ends with error.
|
Faster than session method
|
Not as fast as call transaction method
|
Wednesday, 4 July 2012
Friday, 8 June 2012
RUN Commands for Windows
Program Run Command
Accessibility Controls = access.cpl
Accessibility Wizard = accwiz
Add Hardware Wizard = hdwwiz.cpl
Add/Remove Programs = appwiz.cpl
Administrative Tools = control admintools
Adobe Acrobat ( if installed ) = acrobat
Adobe Distiller ( if installed ) = acrodist
Adobe ImageReady ( if installed ) = imageready
Adobe Photoshop ( if installed ) = photoshop
Automatic Updates = wuaucpl.cpl
Basic Media Player = mplay32
Bluetooth Transfer Wizard = fsquirt
Calculator = calc
Ccleaner ( if installed ) = ccleaner
C: Drive = c:
Certificate Manager = cdrtmgr.msc
Character Map = charmap
Check Disk Utility = chkdsk
Clipboard Viewer = clipbrd
Command Prompt = cmd
Command Prompt = command
Component Services = dcomcnfg
Computer Management = compmgmt.msc
Compare Files = comp
Control Panel = control
Create a shared folder Wizard = shrpubw
Date and Time Properties = timedate.cpl
DDE Shares = ddeshare
Device Manager = devmgmt.msc
Direct X Control Panel ( if installed ) = directx.cpl
Direct X Troubleshooter = dxdiag
Disk Cleanup Utility = cleanmgr
Disk Defragment = dfrg.msc
Disk Partition Manager = diskmgmt.msc
Display Properties = control desktop
Display Properties = desk.cpl
Display Properties (w/Appearance Tab Preselected ) = control color
Dr. Watson System Troubleshooting Utility = drwtsn32
Driver Verifier Utility = verifier
Ethereal ( if installed ) = ethereal
Event Viewer = eventvwr.msc
Files and Settings Transfer Tool = migwiz
File Signature Verification Tool = sigverif
Findfast = findfast.cpl
Firefox = firefox
Folders Properties = control folders
Fonts = fonts
Fonts Folder = fonts
Free Cell Card Game = freecell
Game Controllers = joy.cpl
Group Policy Editor ( xp pro ) = gpedit.msc
Hearts Card Game = mshearts
Help and Support = helpctr
Hyperterminal = hypertrm
Hotline Client = hotlineclient
Iexpress Wizard = iexpress
Indexing Service = ciadv.msc
Internet Connection Wizard = icwonn1
Internet Properties = inetcpl.cpl
Internet Setup Wizard = inetwiz
IP Configuration (Display Connection Configuration) = ipconfig /all
IP Configuration (Display DNS Cache Contents) = ipconfig /displaydns
IP Configuration (Delete DNS Cache Contents) = ipconfig /flushdns
IP Configuration (Release All Connections) = ipconfig /release
IP Configuration (Renew All Connections) = ipconfig /renew
IP Configuration (Refreshes DHCP & Re-Registers DNS) = ipconfig /registerdns
IP Configuration (Display DHCP Class ID) = ipconfig /showclassid
IP Configuration (Modifies DHCP Class ID) = ipconfig /setclassid
Java Control Panel ( if installed ) = jpicpl32.cpl
Java Control Panel ( if installed ) = javaws
Keyboard Properties = control keyboard
Local Security Settings = secpol.msc
Local Users and Groups = lusrmgr.msc
Logs You Out of Windows = logoff
Malicious Software Removal Tool = mrt
Microsoft Access ( if installed ) = access.cpl
Microsoft Chat = winchat
Microsoft Excel ( if installed ) = excel
Microsoft Diskpart = diskpart
Microsoft Frontpage ( if installed ) = frontpg
Microsoft Movie Maker = moviemk
Microsoft Management Console = mmc
Microsoft Narrator = narrator
Microsoft Paint = mspaint
Microsoft Powerpoint = powerpnt
Microsoft Word ( if installed ) = winword
Microsoft Syncronization Tool = mobsync
Minesweeper Game = winmine
Mouse Properties = control mouse
Mouse Properties = main.cpl
MS-Dos Editor = edit
MS-Dos FTP = ftp
Nero ( if installed ) = nero
Netmeeting = conf
Network Connections = control netconnections
Network Connections = ncpa.cpl
Network Setup Wizard = netsetup.cpl
Notepad = notepad
Nview Desktop Manager ( if installed ) = nvtuicpl.cpl
Object Packager = packager
ODBC Data Source Administrator = odbccp32
ODBC Data Source Administrator = odbccp32.cpl
On Screen Keyboard = osk
Opens AC3 Filter ( if installed ) = ac3filter.cpl
Outlook Express = msimn
Paint = pbrush
Password Properties = password.cpl
Performance Monitor = perfmon.msc
Performance Monitor = perfmon
Phone and Modem Options = telephon.cpl
Phone Dialer = dialer
Pinball Game = pinball
Power Configuration = powercfg.cpl
Printers and Faxes = control printers
Printers Folder = printers
Private Characters Editor = eudcedit
Quicktime ( if installed ) = quicktime.cpl
Quicktime Player ( if installed ) = quicktimeplayer
Real Player ( if installed ) = realplay
Regional Settings = intl.cpl
Registry Editor = regedit
Registry Editor = regedit32
Remote Access Phonebook = rasphone
Remote Desktop = mstsc
Removable Storage = ntmsmgr.msc
Removable Storage Operator Requests = ntmsoprq.msc
Resultant Set of Policy ( xp pro ) = rsop.msc
Scanners and Cameras = sticpl.cpl
Scheduled Tasks = control schedtasks
Security Center = wscui.cpl
Services = services.msc
Shared Folders = fsmgmt.msc
Sharing Session = rtcshare
Shuts Down Windows = shutdown
Sounds Recorder = sndrec32
Sounds and Audio = mmsys.cpl
Spider Solitare Card Game = spider
SQL Client Configuration = clicongf
System Configuration Editor = sysedit
System Configuration Utility = msconfig
System File Checker Utility ( Scan Immediately ) = sfc /scannow
System File Checker Utility ( Scan Once At Next Boot ) = sfc /scanonce
System File Checker Utility ( Scan On Every Boot ) = sfc /scanboot
System File Checker Utility ( Return to Default Settings) = sfc /revert
System File Checker Utility ( Purge File Cache ) = sfc /purgecache
System File Checker Utility ( Set Cache Size to Size x ) = sfc /cachesize=x
System Information = msinfo32
System Properties = sysdm.cpl
Task Manager = taskmgr
TCP Tester = tcptest
Telnet Client = telnet
Tweak UI ( if installed ) = tweakui
User Account Management = nusrmgr.cpl
Utility Manager = utilman
Volume Serial Number for C: = label
Volume Control = sndvol32
Windows Address Book = wab
Windows Address Book Import Utility = wabmig
Windows Backup Utility ( if installed ) = ntbackup
Windows Explorer = explorer
Windows Firewall = firewall.cpl
Windows Installer Details = msiexec
Windows Magnifier = magnify
Windows Management Infrastructure = wmimgmt.msc
Windows Media Player = wmplayer
Windows Messenger = msnsgs
Windows Picture Import Wizard (Need camera connected) = wiaacmgr
Windows System Security Tool = syskey
Windows Script host settings = wscript
Widnows Update Launches = wupdmgr
Windows Version ( shows your windows version ) = winver
Windows XP Tour Wizard = tourstart
Wordpad = write
Zoom Utility = igfxzoom
Accessibility Controls = access.cpl
Accessibility Wizard = accwiz
Add Hardware Wizard = hdwwiz.cpl
Add/Remove Programs = appwiz.cpl
Administrative Tools = control admintools
Adobe Acrobat ( if installed ) = acrobat
Adobe Distiller ( if installed ) = acrodist
Adobe ImageReady ( if installed ) = imageready
Adobe Photoshop ( if installed ) = photoshop
Automatic Updates = wuaucpl.cpl
Basic Media Player = mplay32
Bluetooth Transfer Wizard = fsquirt
Calculator = calc
Ccleaner ( if installed ) = ccleaner
C: Drive = c:
Certificate Manager = cdrtmgr.msc
Character Map = charmap
Check Disk Utility = chkdsk
Clipboard Viewer = clipbrd
Command Prompt = cmd
Command Prompt = command
Component Services = dcomcnfg
Computer Management = compmgmt.msc
Compare Files = comp
Control Panel = control
Create a shared folder Wizard = shrpubw
Date and Time Properties = timedate.cpl
DDE Shares = ddeshare
Device Manager = devmgmt.msc
Direct X Control Panel ( if installed ) = directx.cpl
Direct X Troubleshooter = dxdiag
Disk Cleanup Utility = cleanmgr
Disk Defragment = dfrg.msc
Disk Partition Manager = diskmgmt.msc
Display Properties = control desktop
Display Properties = desk.cpl
Display Properties (w/Appearance Tab Preselected ) = control color
Dr. Watson System Troubleshooting Utility = drwtsn32
Driver Verifier Utility = verifier
Ethereal ( if installed ) = ethereal
Event Viewer = eventvwr.msc
Files and Settings Transfer Tool = migwiz
File Signature Verification Tool = sigverif
Findfast = findfast.cpl
Firefox = firefox
Folders Properties = control folders
Fonts = fonts
Fonts Folder = fonts
Free Cell Card Game = freecell
Game Controllers = joy.cpl
Group Policy Editor ( xp pro ) = gpedit.msc
Hearts Card Game = mshearts
Help and Support = helpctr
Hyperterminal = hypertrm
Hotline Client = hotlineclient
Iexpress Wizard = iexpress
Indexing Service = ciadv.msc
Internet Connection Wizard = icwonn1
Internet Properties = inetcpl.cpl
Internet Setup Wizard = inetwiz
IP Configuration (Display Connection Configuration) = ipconfig /all
IP Configuration (Display DNS Cache Contents) = ipconfig /displaydns
IP Configuration (Delete DNS Cache Contents) = ipconfig /flushdns
IP Configuration (Release All Connections) = ipconfig /release
IP Configuration (Renew All Connections) = ipconfig /renew
IP Configuration (Refreshes DHCP & Re-Registers DNS) = ipconfig /registerdns
IP Configuration (Display DHCP Class ID) = ipconfig /showclassid
IP Configuration (Modifies DHCP Class ID) = ipconfig /setclassid
Java Control Panel ( if installed ) = jpicpl32.cpl
Java Control Panel ( if installed ) = javaws
Keyboard Properties = control keyboard
Local Security Settings = secpol.msc
Local Users and Groups = lusrmgr.msc
Logs You Out of Windows = logoff
Malicious Software Removal Tool = mrt
Microsoft Access ( if installed ) = access.cpl
Microsoft Chat = winchat
Microsoft Excel ( if installed ) = excel
Microsoft Diskpart = diskpart
Microsoft Frontpage ( if installed ) = frontpg
Microsoft Movie Maker = moviemk
Microsoft Management Console = mmc
Microsoft Narrator = narrator
Microsoft Paint = mspaint
Microsoft Powerpoint = powerpnt
Microsoft Word ( if installed ) = winword
Microsoft Syncronization Tool = mobsync
Minesweeper Game = winmine
Mouse Properties = control mouse
Mouse Properties = main.cpl
MS-Dos Editor = edit
MS-Dos FTP = ftp
Nero ( if installed ) = nero
Netmeeting = conf
Network Connections = control netconnections
Network Connections = ncpa.cpl
Network Setup Wizard = netsetup.cpl
Notepad = notepad
Nview Desktop Manager ( if installed ) = nvtuicpl.cpl
Object Packager = packager
ODBC Data Source Administrator = odbccp32
ODBC Data Source Administrator = odbccp32.cpl
On Screen Keyboard = osk
Opens AC3 Filter ( if installed ) = ac3filter.cpl
Outlook Express = msimn
Paint = pbrush
Password Properties = password.cpl
Performance Monitor = perfmon.msc
Performance Monitor = perfmon
Phone and Modem Options = telephon.cpl
Phone Dialer = dialer
Pinball Game = pinball
Power Configuration = powercfg.cpl
Printers and Faxes = control printers
Printers Folder = printers
Private Characters Editor = eudcedit
Quicktime ( if installed ) = quicktime.cpl
Quicktime Player ( if installed ) = quicktimeplayer
Real Player ( if installed ) = realplay
Regional Settings = intl.cpl
Registry Editor = regedit
Registry Editor = regedit32
Remote Access Phonebook = rasphone
Remote Desktop = mstsc
Removable Storage = ntmsmgr.msc
Removable Storage Operator Requests = ntmsoprq.msc
Resultant Set of Policy ( xp pro ) = rsop.msc
Scanners and Cameras = sticpl.cpl
Scheduled Tasks = control schedtasks
Security Center = wscui.cpl
Services = services.msc
Shared Folders = fsmgmt.msc
Sharing Session = rtcshare
Shuts Down Windows = shutdown
Sounds Recorder = sndrec32
Sounds and Audio = mmsys.cpl
Spider Solitare Card Game = spider
SQL Client Configuration = clicongf
System Configuration Editor = sysedit
System Configuration Utility = msconfig
System File Checker Utility ( Scan Immediately ) = sfc /scannow
System File Checker Utility ( Scan Once At Next Boot ) = sfc /scanonce
System File Checker Utility ( Scan On Every Boot ) = sfc /scanboot
System File Checker Utility ( Return to Default Settings) = sfc /revert
System File Checker Utility ( Purge File Cache ) = sfc /purgecache
System File Checker Utility ( Set Cache Size to Size x ) = sfc /cachesize=x
System Information = msinfo32
System Properties = sysdm.cpl
Task Manager = taskmgr
TCP Tester = tcptest
Telnet Client = telnet
Tweak UI ( if installed ) = tweakui
User Account Management = nusrmgr.cpl
Utility Manager = utilman
Volume Serial Number for C: = label
Volume Control = sndvol32
Windows Address Book = wab
Windows Address Book Import Utility = wabmig
Windows Backup Utility ( if installed ) = ntbackup
Windows Explorer = explorer
Windows Firewall = firewall.cpl
Windows Installer Details = msiexec
Windows Magnifier = magnify
Windows Management Infrastructure = wmimgmt.msc
Windows Media Player = wmplayer
Windows Messenger = msnsgs
Windows Picture Import Wizard (Need camera connected) = wiaacmgr
Windows System Security Tool = syskey
Windows Script host settings = wscript
Widnows Update Launches = wupdmgr
Windows Version ( shows your windows version ) = winver
Windows XP Tour Wizard = tourstart
Wordpad = write
Zoom Utility = igfxzoom
Friday, 25 May 2012
OPP'S Examples programs
When class implementation is done at the end of the program like
forms of a perform, no need of start of selection
******** Begin of Program one on OOP's*****************
----------------------------------------------------------------------*
CLASS tax DEFINITION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS tax DEFINITION.
PUBLIC SECTION.
DATA : salary TYPE p DECIMALS 2 VALUE '50000'.
METHODS: calc_tax IMPORTING sal TYPE p
EXPORTING tax_amt TYPE p.
ENDCLASS. "tax DEFINITION
----------------------------------------------------------------------*
CLASS tax IMPLEMENTATION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS tax IMPLEMENTATION.
METHOD calc_tax.
sal = salary.
tax_amt = sal / 10.
ENDMETHOD. "calc_tax
ENDCLASS. "tax IMPLEMENTATION
START-OF-SELECTION.
DATA : taxamt TYPE p.
DATA : salary TYPE p VALUE '10025606511'.
DATA: obj1 TYPE REF TO tax.
CREATE OBJECT : obj1.
CALL METHOD: obj1->calc_tax EXPORTING sal = salary
IMPORTING tax_amt = taxamt.
WRITE: / 'Tax amount is ', taxamt.
******** End of Program one on OOP's*****************
When class implementation is done at the end of the program like
forms of a perform, no need of start of selection
******** Begin of Program 2 on OOP's*****************
----------------------------------------------------------------------*
CLASS tax DEFINITION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS tax DEFINITION.
PUBLIC SECTION.
DATA : salary TYPE p DECIMALS 2 VALUE '50000'.
METHODS: calc_tax IMPORTING sal TYPE p
EXPORTING tax_amt TYPE p.
ENDCLASS. "tax DEFINITION
START-OF-SELECTION.
DATA : taxamt TYPE p.
DATA : salary TYPE p VALUE '10025606511'.
DATA: obj1 TYPE REF TO tax.
CREATE OBJECT : obj1.
CALL METHOD: obj1->calc_tax EXPORTING sal = salary
IMPORTING tax_amt = taxamt.
WRITE: / 'Tax amount is ', taxamt.
----------------------------------------------------------------------*
CLASS tax IMPLEMENTATION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS tax IMPLEMENTATION.
METHOD calc_tax.
sal = salary.
tax_amt = sal / 10.
ENDMETHOD. "calc_tax
ENDCLASS. "tax IMPLEMENTATION
******** End of Program 2 on OOP's*****************
******** Begin of Program 3 on OOP's*****************
----------------------------------------------------------------------*
CLASS tax DEFINITION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS c1 DEFINITION.
PUBLIC SECTION.
DATA : salary TYPE p DECIMALS 2 VALUE '50000'.
METHODS: m1.
ENDCLASS. "tax DEFINITION
----------------------------------------------------------------------*
CLASS c2 DEFINITION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS c2 DEFINITION INHERITING FROM c1.
PUBLIC SECTION.
METHODS: m2.
ENDCLASS. "c2 DEFINITION
----------------------------------------------------------------------*
CLASS tax IMPLEMENTATION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS c1 IMPLEMENTATION.
METHOD m1.
WRITE: / 'This is the method in class 1'.
ENDMETHOD. "calc_tax
ENDCLASS. "tax IMPLEMENTATION
----------------------------------------------------------------------*
CLASS c2 IMPLEMENTATION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS c2 IMPLEMENTATION.
METHOD m2.
WRITE : / 'this is the method in class c2'.
ENDMETHOD. "m1
ENDCLASS. "c2 IMPLEMENTATION
START-OF-SELECTION.
DATA : obj1 TYPE REF TO c1,
obj2 TYPE REF TO c2.
CREATE OBJECT: obj1, obj2.
CALL METHOD : obj1->m1 , obj2->m2 , obj2->m1.
******** End of Program 3 on OOP's*****************
******** Begin of Program 4 on OOP's*****************
----------------------------------------------------------------------*
CLASS tax DEFINITION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS c1 DEFINITION.
PUBLIC SECTION.
DATA : salary TYPE p DECIMALS 2 VALUE '50000'.
METHODS: m1.
ENDCLASS. "tax DEFINITION
----------------------------------------------------------------------*
CLASS c2 DEFINITION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS c2 DEFINITION INHERITING FROM c1.
PUBLIC SECTION.
METHODS: m2.
ENDCLASS. "c2 DEFINITION
----------------------------------------------------------------------*
CLASS tax IMPLEMENTATION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS c1 IMPLEMENTATION.
METHOD m1.
WRITE: / 'This is the method in class 1'.
ENDMETHOD. "calc_tax
ENDCLASS. "tax IMPLEMENTATION
----------------------------------------------------------------------*
CLASS c2 IMPLEMENTATION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS c2 IMPLEMENTATION.
METHOD m2.
WRITE : / 'this is the method in class c2'.
ENDMETHOD. "m1
ENDCLASS. "c2 IMPLEMENTATION
START-OF-SELECTION.
DATA : obj1 TYPE REF TO c1,
obj2 TYPE REF TO c2.
CREATE OBJECT: obj1, obj2.
CALL METHOD : obj1->m1 , obj2->m2 , obj2->m1.
******** End of Program 4 on OOP's*****************
***********************************************************************************
THis is for the static keyword, this is implemented using CLASS-
******** Begin of Program 5 on OOP's*****************
----------------------------------------------------------------------*
CLASS tax DEFINITION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS c1 DEFINITION.
PUBLIC SECTION.
CLASS-DATA: assign_value(10) TYPE c.
DATA : salary TYPE p DECIMALS 2 VALUE '50000'.
METHODS: m1.
CLASS-METHODS: cm1.
ENDCLASS. "tax DEFINITION
----------------------------------------------------------------------*
CLASS c2 DEFINITION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS c2 DEFINITION INHERITING FROM c1.
PUBLIC SECTION.
METHODS: m2.
ENDCLASS. "c2 DEFINITION
----------------------------------------------------------------------*
CLASS tax IMPLEMENTATION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS c1 IMPLEMENTATION.
METHOD m1.
WRITE: / 'This is the method in class 1'.
ENDMETHOD. "m1
METHOD cm1. " static method.
DATA : name(10) TYPE c VALUE 'Bharat'.
assign_value = name. " we don't get error here because assign_value is a static data type
salary = '4555'. This gives error because static methods
WRITE: / ' This is inside the static method and variable name', name.
ENDMETHOD. "m1
ENDCLASS. "tax IMPLEMENTATION
----------------------------------------------------------------------*
CLASS c2 IMPLEMENTATION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS c2 IMPLEMENTATION.
METHOD m2.
WRITE : / 'this is the method in class c2'.
ENDMETHOD. "m1
ENDCLASS. "c2 IMPLEMENTATION
START-OF-SELECTION.
DATA : obj1 TYPE REF TO c1,
obj2 TYPE REF TO c2.
CREATE OBJECT: obj1, obj2.
CALL METHOD : obj1->m1 , obj2->m2 , obj2->m1.
CALL METHOD: obj1->cm1 , c1=>cm1 , obj2->cm1.
c1=>assign_value = 'Country'.
obj1->assign_value = 'India'.
WRITE: / c1=>assign_value.
WRITE: / obj1->assign_value.
WRITE: / ' Test'.
******** End of Program 5 on OOP's*****************
********* **************** **************** **************** ****************
Best program in which a method is called in the implementation of another method of the same class.
********* Begin of Program 6 on OOP's*****************
CLASS c1 DEFINITION.
PUBLIC SECTION.
METHODS : m1 IMPORTING inp1 TYPE i
EXPORTING out1 TYPE i,
m2 IMPORTING inp2 TYPE i
EXPORTING out2 TYPE i.
ENDCLASS. "c1 DEFINITION
&---------------------------------------------------------------------*
& Class (Implementation) c1
&---------------------------------------------------------------------*
Text
----------------------------------------------------------------------*
CLASS c1 IMPLEMENTATION.
METHOD m1.
out1 = inp1.
ENDMETHOD. "m1
METHOD m2.
CALL METHOD : m1 EXPORTING inp1 = inp2
IMPORTING out1 = out2.
ENDMETHOD. "m2
ENDCLASS. "c1
START-OF-SELECTION.
DATA : number TYPE i.
DATA : obj1 TYPE REF TO c1.
CREATE OBJECT OBJ1.
CALL METHOD: obj1->m2 EXPORTING inp2 = '10'
IMPORTING out2 = number.
WRITE : number.
********* End of Program 6 on OOP's*****************
***********************************************************************************************
program to demonstrate constructor
********** Begin of Program 7 on OOP's*****************
CLASS c1 DEFINITION.
PUBLIC SECTION.
METHODS: constructor.
ENDCLASS. "c1 DEFINITION
----------------------------------------------------------------------*
CLASS c1 IMPLEMENTATION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS c1 IMPLEMENTATION.
METHOD constructor.
The constructor method name should be constructor only.
WRITE : / ' The constructor has been called automatically'.
ENDMETHOD. "constructor
ENDCLASS. "c1 IMPLEMENTATION
START-OF-SELECTION.
DATA : obj TYPE REF TO c1.
create OBJECT obj.
********** End of Program 8 on OOP's*****************
***********************************************************************************************
program to demonstrate static constructor and instance constructor
********** Begin of Program8 on OOP's*****************
CLASS c1 DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: class_constructor.
ENDCLASS. "c1 DEFINITION
----------------------------------------------------------------------*
CLASS c1 IMPLEMENTATION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS c1 IMPLEMENTATION.
METHOD class_constructor.
WRITE : / ' The constructor has been called automatically'.
ENDMETHOD. "constructor
ENDCLASS. "c1 IMPLEMENTATION
START-OF-SELECTION.
DATA : obj TYPE REF TO c1.
CREATE OBJECT obj.
********** End of Program8 on OOP's*****************
**********************************************************************************
Inheritance
********** Begin of Program 9 ******************
CLASS c1 DEFINITION.
PUBLIC SECTION.
DATA: name1 TYPE c LENGTH 30 VALUE 'bharat'.
METHODS: m1 , "IMPORTING nam TYPE c
EXPORTING nam1 TYPE c.
m2.
ENDCLASS. "c1 DEFINITION
----------------------------------------------------------------------*
CLASS c1 IMPLEMENTATION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS c1 IMPLEMENTATION.
METHOD m1.
CONCATENATE nam 'Good' INTO nam1 SEPARATED BY space.
WRITE:/ ' This is a method in super class c1.'.
ENDMETHOD. "m1
METHOD m2.
WRITE: / ' This is the method 2 of the super class c1.'.
ENDMETHOD. "m2
ENDCLASS. "c1 IMPLEMENTATION
----------------------------------------------------------------------*
CLASS s1 DEFINITION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS s1 DEFINITION INHERITING FROM c1.
PUBLIC SECTION.
METHODS m1 REDEFINITION.
METHODS: sm1.
ENDCLASS. "s1 DEFINITION
----------------------------------------------------------------------*
CLASS s1 IMPLEMENTATION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS s1 IMPLEMENTATION.
METHOD sm1.
CALL METHOD super->m1.
WRITE: / ' This is a method in subclass SM1'.
ENDMETHOD. "sm1
ENDCLASS. "s1 IMPLEMENTATION
START-OF-SELECTION.
DATA : obj1 TYPE REF TO c1.
DATA : objs1 TYPE REF TO s1.
CREATE OBJECT : obj1 , objs1.
CALL METHOD : objs1->sm1.
CALL METHOD : objs1->m1,objs1->m2.
CALL METHOD objs1->m1.
**********End of program 9******************
CLASS counter DEFINITION.
PUBLIC SECTION.
METHODS: set IMPORTING value(set_value) TYPE i,
increment,
get EXPORTING value(get_value) TYPE i.
PROTECTED SECTION.
DATA count TYPE i.
ENDCLASS. "counter DEFINITION
----------------------------------------------------------------------*
CLASS counter IMPLEMENTATION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS counter IMPLEMENTATION.
METHOD set.
count = set_value.
ENDMETHOD. "set
METHOD increment.
ADD 1 TO count.
ENDMETHOD. "increment
METHOD get.
get_value = count.
ENDMETHOD. "get
ENDCLASS. "counter IMPLEMENTATION
----------------------------------------------------------------------*
CLASS counter_ten DEFINITION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS counter_ten DEFINITION INHERITING FROM counter.
PUBLIC SECTION.
METHODS increment REDEFINITION.
DATA count_ten.
ENDCLASS. "counter_ten DEFINITION
----------------------------------------------------------------------*
CLASS counter_ten IMPLEMENTATION
----------------------------------------------------------------------*
----------------------------------------------------------------------*
CLASS counter_ten IMPLEMENTATION.
METHOD increment.
DATA modulo TYPE i.
CALL METHOD super->increment.
WRITE / count.
modulo = count MOD 10.
IF modulo = 0.
count_ten = count_ten + 1.
WRITE count_ten.
ENDIF.
ENDMETHOD. "increment
ENDCLASS. "counter_ten IMPLEMENTATION
DATA: count TYPE REF TO counter,
number TYPE i VALUE 5.
START-OF-SELECTION.
CREATE OBJECT count TYPE counter_ten.
CALL METHOD count->set
EXPORTING
set_value = number.
DO 20 TIMES.
CALL METHOD count->increment.
ENDDO.
Subscribe to:
Posts (Atom)