‎2010 Sep 30 11:06 AM
Hi epert,
I am new for abap objects and i am trying to change the standard program.Please refer below.
CLASS a DEFINITION.
CLASS-METHODS b.
METHODS: constructor.
METHODS: my,
name.
ENDCLASS. "A DEFINITION
CLASS a IMPLEMENTATION.
METHOD b.
DATA screen TYPE REF TO a.
CREATE OBJECT screen.
ENDMETHOD. "B
METHOD constructor.
CALL METHOD : me->my.
ENDMETHOD. "Constructor
ENDCLASS. "A IMPLEMENTATION
START-OF-SELECTION.
CALL METHOD a=>b.How it is possbile for me to pass a internal table to the method MY. I have internal table and i need to assign to the method MY.
Please guide me. standard program DEMO_ABAP_OBJECTS_SPLIT_SCREEN
Edited by: Matt on Sep 30, 2010 4:47 PM - added tags
Edited by: Matt on Sep 30, 2010 4:49 PM
‎2010 Sep 30 11:49 AM
>
> How it is possbile for me to pass a internal table to the method MY.
Hello,
You have to create a formal parameter for the method MY & pass your internal table to it:
Something like this:
Class A definition.
class-methods B.
methods: constructor.
methods: my IMPORTING im_itab TYPE <line type of your internal table>,
name.
Endclass.In your CONSTRUCTOR pass the Internal Table value:
Method Constructor.
call method me->my EXPORTING im_tab = itab[].
endmethod.BR,
Suhas
‎2010 Sep 30 11:49 AM
>
> How it is possbile for me to pass a internal table to the method MY.
Hello,
You have to create a formal parameter for the method MY & pass your internal table to it:
Something like this:
Class A definition.
class-methods B.
methods: constructor.
methods: my IMPORTING im_itab TYPE <line type of your internal table>,
name.
Endclass.In your CONSTRUCTOR pass the Internal Table value:
Method Constructor.
call method me->my EXPORTING im_tab = itab[].
endmethod.BR,
Suhas
‎2010 Sep 30 5:53 PM
>
> In your CONSTRUCTOR pass the Internal Table value:
>
Method Constructor. > call method me->my EXPORTING im_tab = itab[]. > endmethod.>
In classes, we don't have the header line. So, there is no need to pass the "body" by []. Internal table name is enough to pass the data... Specifying it without the brackets avoids the confusion...
Regards,
Naimesh Patel
‎2010 Sep 30 5:56 PM
‎2010 Oct 01 7:41 AM
Hi Suhas Saha.
Really thanks for your reply and i am trying my level best to try and error due i m new to this abap objects.
But i have question.
Is it possible to pass the itab[] from CALL METHOD a=>b.This is because my internal table is coming from other place.
I mean not in the class.
Basically it is coming from the screen 100 or main screen or previous screen.
Please advice if i am doing a mistake.
HI Matt. Thanks a lot and i will follow your guide.
Thank a lot everyone.
‎2010 Oct 01 9:11 AM
You define your CLASS-METHOD (also known as a static method) to have parameters, exactly in the way that Suhas showed you for method "my".
CLASS-METHODS b IMPORTING it_data TYPE <type of your internal table>.I suggest your read carefully, again, the documentation on the various keywords - CLASS-METHODS, METHODS etc.
‎2010 Oct 01 9:14 AM
HI Matt and Suhas Saha,
I have done it. I used Sahas Saha tips and i did some search in SDN.
I got. It is good start for me in abap objects.
Thanks a lot everyone Matt and Suhas Saha.
I will close this thread.
‎2010 Sep 30 3:51 PM
Can I suggest that you get into the habit, right now, of using meaningful class, method and attribute names.