Welcome To My BLOG

This site is to give a brief idea for the abap learners who are looking for some real time programs .It consists of collection of programs from my side . I hope these programs are very much used for all of the learners. Please check the links for any information in ABAP.
Please vote for my Blog. And please input me on this mail addrssess.Email me

Share this link with your friends

http://www.rebtel.com/u/15163104576

For every friend who signs up using this link and makes a payment, we'll give you 8 €!


Monday, December 13, 2010

OOPS:Method with one import parameter/ only one non-optional parameter

This program has a class, C1 with a method: meth1. This method has only one import parameter (input1). Look at the method implementation for details. The main purpose of this program is to demonstrate the different ways of calling a method with single import parameter.
------------------------------------------------------------------------------------------
REPORT YSUBDEL.

CLASS C1 DEFINITION.
PUBLIC SECTION.
DATA: NUM TYPE I VALUE 5.
METHODS: METH1 IMPORTING INPUT1 TYPE I .
ENDCLASS.

CLASS C1 IMPLEMENTATION.
METHOD: METH1.
num = NUM * INPUT1 .
WRITE:/5 NUM .
num = 5.
ENDMETHOD.
ENDCLASS.


START-OF-SELECTION.
DATA: OREF1 TYPE REF TO C1.
CREATE OBJECT: OREF1.
* Different ways of calling the method with one import parameter
CALL METHOD OREF1->METH1 EXPORTING INPUT1 = 4.
CALL METHOD OREF1->METH1( INPUT1 = 5 ).
CALL METHOD OREF1->METH1( 6 ).

Output 20
25
30

No comments: