OOPS ABAP- METHODS USING TABLE TYPES



                      METHODS USING TABLE TYPES

TABLE PARAMETER

     1. In the methods, we don’t have any option for specifying internal tables directly.
     2.Whereas in function modules, we have an option by name TABLE where we can specify
     The internal tables directly.           
     3. Tables are absolute in OO-ABAP.
     4. That’s why this option is not available.
      5. If we want to use tables parameters, then we need to create a table type in data dictionary.

       Steps to create a table type

       Go to se11 Tcode.
       Give the data type as zkna1_t.
       Click on the button ‘create’.

 

 

       Give short description.
       Give the line type as kna1





       Save & activate.
       The table type is created.

       Creating a method using table types:

        Go to se24 Tcode.
        Give the class name.


 
 

        Click on ‘methods’ tab.
        Define a method as below.
        GET_CUST_LIST    Instance   Public





        Click on the ‘parameters’ button.
        Define the parameters as below.




                        IM_LAND1  IMPORTING  TYPE  KNA1-LAND1.
                         EX_KNA1  EXPORTING  TYPE  ZKNA1_T.

       Write the below code.




 


 

       Using the method in the program