In the following example we have three different kinds of
parameters – importing, exporting & changing of the public method
m_exp_chn. We mention the import parameter is the selection screen input
parameter. We have declared two variables – v_exp & v_chn with values. Now
we are calling the method with mentioning of exporting parameter – v_exp (0)
& changing parameter – v_chn (1).
Inside the method m_exp_chn we have a DO – ENDDO loop for
10 times. It means the operation will continue for 10 times. Here we are
multiplying the input with 1,2,3… 10 to have a table.
REPORT zsr_test NO STANDARD PAGE
HEADING.
DATA: v_exp TYPE i VALUE 0,
v_chn TYPE i VALUE 1.
PARAMETER p_inp TYPE i.
*----------------------------------------------------------------------*
* CLASS cl_exp_chn DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_exp_chn DEFINITION.
PUBLIC SECTION.
METHODS m_exp_chn IMPORTING i_inp TYPE i
EXPORTING e_exp TYPE i
CHANGING c_chn TYPE i.
ENDCLASS. "cl_exp_chn DEFINITION
*----------------------------------------------------------------------*
* CLASS cl_exp_chn IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_exp_chn IMPLEMENTATION.
METHOD m_exp_chn.
DO 10 TIMES.
e_exp = i_inp * c_chn.
WRITE: / i_inp, '*', c_chn, '=', e_exp.
c_chn = c_chn + 1.
ENDDO.
ENDMETHOD. "m_exp_chn
ENDCLASS. "cl_exp_chn IMPLEMENTATION
START-OF-SELECTION.
DATA obj TYPE REF TO cl_exp_chn.
CREATE OBJECT obj.
CALL METHOD obj->m_exp_chn
EXPORTING
i_inp = p_inp
IMPORTING
e_exp = v_exp
CHANGING
c_chn = v_chn.
DATA: v_exp TYPE i VALUE 0,
v_chn TYPE i VALUE 1.
PARAMETER p_inp TYPE i.
*----------------------------------------------------------------------*
* CLASS cl_exp_chn DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_exp_chn DEFINITION.
PUBLIC SECTION.
METHODS m_exp_chn IMPORTING i_inp TYPE i
EXPORTING e_exp TYPE i
CHANGING c_chn TYPE i.
ENDCLASS. "cl_exp_chn DEFINITION
*----------------------------------------------------------------------*
* CLASS cl_exp_chn IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_exp_chn IMPLEMENTATION.
METHOD m_exp_chn.
DO 10 TIMES.
e_exp = i_inp * c_chn.
WRITE: / i_inp, '*', c_chn, '=', e_exp.
c_chn = c_chn + 1.
ENDDO.
ENDMETHOD. "m_exp_chn
ENDCLASS. "cl_exp_chn IMPLEMENTATION
START-OF-SELECTION.
DATA obj TYPE REF TO cl_exp_chn.
CREATE OBJECT obj.
CALL METHOD obj->m_exp_chn
EXPORTING
i_inp = p_inp
IMPORTING
e_exp = v_exp
CHANGING
c_chn = v_chn.
Now at debugging level we see that e_exp & c_chn
parameters change their values and at the same time the values of the variables
v_exp & v_chn also change (The input parameter is 10).
The program generates the following output.
6 comments:
SAP Success Factors Real Time Hands on Training in Chennai...
Don't always Depend on Training Institute Alone and so please aware of Best Trainers too..
http://thecreatingexperts.com/sap-successfactors-training-in-chennai/
If You need a Best Trainer over SAP Success Factors Means??? Please ready for an DEMO From the Trainer MR.Karthick
CONTACT:8122241286
Both Classroom/Online Training is Available!!!!!!
Best SAP Success Factors Training Institute in Chennai
http://thecreatingexperts.com/sap-successfactors-training-in-chennai/
Best SAP MM Training in Chennai
http://thecreatingexperts.com/sap-mm-training-in-chennai/
Best SAP SD Training in Chennai
http://thecreatingexperts.com/sap-sd-training-in-chennai/
http://thecreatingexperts.com/sap-hr-training-in-chennai/
Best SAP FICO Training in Chennai
http://thecreatingexperts.com/sap-fico-training-in-chennai/
Best SAP ABAP Training in Chennai
http://thecreatingexperts.com/sap-abap-training-in-chennai/
Best SAP BASIS Training in Chennai
http://thecreatingexperts.com/sap-basis-training-in-chennai/
If You need a Best Trainer in SAP Success Factors??? Then be ready for a DEMO From the Trainer MR.Karthick
CONTACT:8122241286
http://thecreatingexperts.com/sap-mm-training-in-chennai/
Both Classroom/Online Training is Available!!!!!!
Very Nice explanation of all tutorials.
Thank you sir for sharing information.
All the Best Sir.
i have one doubt can u help me guys .
exporting will act as call by reference ,
import will act as call by value...
is it correct what i am saying
i am new to ooabap please help me
sir u can provide test also after completeing all object what u provided...i think it may helpful to all because they may know the how much they learnt ...this my suggestion
Informative article. Thank you for sharing the great blog. You have done great explanation and visualization. Keep up the good work.
BEST SAP ABAP TRAINING IN HYDERABAD
Post a Comment