Regarding  methods  in oops

hi
sap guru's
can  anybody give   some  simple sample  classes  containg  methods,
inheritance,    very urgent
Regards
Spanadana

Hi spandana,
Class Definition
      CLASS main DEFINITION
CLASS main DEFINITION.
  PUBLIC SECTION.
    METHODS add_data IMPORTING i_data TYPE i.
    METHODS get_data EXPORTING e_data TYPE char20.
    CLASS-METHODS print IMPORTING value TYPE char20.
  PRIVATE SECTION.
    DATA atribute TYPE char01.
ENDCLASS.
Class Implementation
      CLASS main IMPLEMENTATION
CLASS main IMPLEMENTATION.
  METHOD add_data.
    ADD i_data TO atribute.
  ENDMETHOD.
  METHOD get_data.
    CONCATENATE 'Atribute value' atribute
                               INTO r_data SEPARATED BY space.
  ENDMETHOD.
  METHOD print.
    WRITE value.
  ENDMETHOD.
ENDCLASS.
Creation Object
DATA: object_reference TYPE REF TO main.
DATA: var type char20.
Instance Creation
CREATE OBJECT object_reference.
Calling Methods
CALL METHOD object_reference->add_data( i_data = 3 ).
var = object_reference->get_data(  ).
CALL METHOD main=>print EXPORTING value = var.
The atribute value is printed
" Atribute value 3 "
For more refer Wiki ->Abap developments->abap objects-->beginer examples
Regards,
Shiva K

Similar Messages

  • Regarding  constructors in  oops

    hi
    sap gurus
    hw to  view the constructors in  class builder..& also tell  hw  to use construcotrs in  oops abap
    with  example..
    hw can i  find  out  the   parameters for the  constructor in   stanadard class.
    Regards
    Spanadna

    >
    spandana wrote:
    > hi
    >
    > sap gurus
    >
    >  hw to  view the constructors in  class builder..& also tell  hw  to use construcotrs in  oops abap
    > with  example..
    > hw can i  find  out  the   parameters for the  constructor in   stanadard class.
    >
    >
    > Regards
    >
    > Spanadna
    This should have been posted in the ABAP Objects section...
    If you look at the class in SE24, you may see a method called "CONSTRUCTOR".  If you set your cursor on the constructor, and click on the PARAMETERS button, you'll see the parameters.  These are always input parameters.  A constructor can have zero, one or many parameters.  Some may be optional.
    You can also tell the parameters of a constructor by using the Create object pattern (Pattern button in the ABAP editor, ABAP Objects Patterns, Create object ).
    If you don't see a CONSTRUCTOR method in SE24, it means that the class does not have an explicit constructor.  In this case, CREATE OBJECT still returns an object reference, but there's no code run in the class at creation, and there are no parameters.
    matt

  • Calling Public Method in OOP.

    Hello All,
    How to call a Public method in one using the object of the other class.
    The second class doesn't inherit the first class.
    Thanx and Regards,
    SampathKumar.

    Got the solution.

  • Regarding method used in alv

    hi,
    i am new to this forum,can anybody tell mme which method is more efficient in ALV REPORT:-
    1.)  DECLARING TYPES AND WORK AREAS
                     OR
    2.)  DECLARING INTERNAL TABLE AND PASSING IT IN FUNCTIONS.
    PLZZZ ANY BODY GIVE EXAMPLE OF 2 ND OPTION AS I  HAD MADE REPORT  BUT D OUTLOOK SEEMS TO BE OUTDATED AS COMPARE TO 1ST METHOD.

    Hello and Welcome,
    As far as i have worked...there is no such categorisation as using
    1.) DECLARING TYPES AND WORK AREAS
    OR
    2.) DECLARING INTERNAL TABLE AND PASSING IT IN FUNCTIONS.
    Each has there own set of plus and minus points..we do a mix of all the above to suit the requirements given..sort of (1) AND (2)
    eg:
    Declaring types:The main advantage is that unless you do a 'data' initialisation no memory is used and you can create multiple objects of the same structure if we are using types..so in short with types we can also create a work area as well as an internal table
    Types : Begin of demo_types,
                date type sy-datum,
                screen type sy-dynnr,
               end of demo_types.
    data : Internal_table1 type table of demo_types with header line.
    data : Internal_table2 type table of demo_types.
    data : work_area     type demo_types.
    we can declare internal table with header line if the choice is not to use a separate work area for instance while looping which can be done as
    loop at internal table ....endloop...."with headerline
    loop at internal table into workarea...endloop...."without/with header line
    <u><i><b>so ---> if you have large data with complex calculations we need all of what you have mentioned in points 1 and 2....If there is a specifIC doubt ..please revert back..and reward if helpful..to encourage more healthy answers to the query
    the query is very general and the more and more you work on a report...the choice will come naturally...just in case you need more examples in ALV please refer the following programs(go to se38 -> BCALV* -> F4 --> you have list of ALV programs</b></i></u>
    ]BCALV_EDIT_01        Switch on and off the ready-for-input status of the entire grid
    BCALV_EDIT_02                  Define ready-for-input status at cell level
    BCALV_EDIT_03                  Verification of modified cells
    BCALV_EDIT_04                  Delete and append rows
    BCALV_EDIT_05                  Checkboxes
    BCALV_EDIT_06                  Dropdown Listbox at Column Level
    BCALV_EDIT_07                  Dropdown Listbox at Cell Level
    BCALV_EDIT_08                  Integrate Non-Standard F4 Help
    BCALV_GRID_01                  Processing Print Events
    BCALV_GRID_02                  Display Detail List in Dialog Box Container
    BCALV_GRID_03                  Detail List in Dialog Window
    BCALV_GRID_04                  Display Exceptions (LEDs or Traffic Lights)
    BCALV_GRID_05                  Add a Self-Defined Button to the Toolbar
    BCALV_GRID_06                  Define Self-Defined Context Menu
    BCALV_GRID_07                  Define a Menu in the Toolbar
    BCALV_GRID_08                  Define a Menu with Default Pushbutton
    BCALV_GRID_09                  Saving Options for Layouts
    BCALV_GRID_10                  Load a layout before list display
    BCALV_GRID_11                  Test for new layout function modules
    Regards
    Byju

  • Regarding ALV using OOPS Concept

    Hi Experts,
    Can abody explain to me how can i disable some settings in the tool bar of ALV Grid using oops concept??

    Hi Alex,
    You can perform this step, before you call set_table_for_first_display and pass that to this call.
    **Exculude all unnecessary standard function in ALV
      PERFORM exclude_tb_functions CHANGING lt_exclude.
    CALL METHOD g_grid->set_table_for_first_display
        EXPORTING
      is_layout            = gs_layout
          is_variant           = l_variant
          i_save               = 'A'
          it_toolbar_excluding = lt_exclude
        CHANGING
          it_fieldcatalog      = gt_fieldcat
          it_sort              = gt_sort[]
          it_outtab            = it_final[].
    You can exclude all unwanted function in the subroutine.
    FORM exclude_tb_functions  CHANGING pt_exclude TYPE ui_functions.
      DATA ls_exclude TYPE ui_func.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
      APPEND ls_exclude TO pt_exclude.
    ENDFORM.                    " exclude_tb_functions
    This will give you complete the solution for your query.
    Thanks
    Lakshmi

  • Regarding methods

    Hi all,
    My requirement is I an entering data into 3 text fields. And when i am performing action(Clicking a button) I want to display the text which i have entered in the three text box into next screen Container. So how can i display that.One of my friend suggested me to use Set_text_as_r3table and Get_text_as_r3table to store the data and retreive the date from the Database table.And try. But i am not getting the class in which i can find this methods. Can any one help me out in solving this problem. Or if any other method is plz suggest me .
    Thanx in Advance,
    Murthy

    HI,
    you can use 'EXPORT' and 'IMPORT' to get your work done.
    in first screen 'EXPORT' the fields to abap memory and in second screen PBO 'IMPORT' fields to get value and display them in screen.
    <b>IN first screen PAI do this.</b>
    data: text_field(50).
    EXPORT text_field TO MEMORY ID 'MID'.
    <b>IN second screen PBO do this.</b>
    data: text_field(50).
    IMPORT text_field FROM MEMORY ID 'MID'.
    Regards,

  • Regarding SAP ABAP OOPS

    Hi ALL,
    Could anybody give some oops concepts in ABAP with examples.
    Thanks & Regards
    SAIJAYA

    Just take case if you want to access element from node in context ...such code by wizard Appears ....
    DATA:
    zobj_bbp_ior_util TYPE REF TO zcl_bbp_ior_util,
    node_ztiornode TYPE REF TO if_wd_context_node,
    elem_ztiornode TYPE REF TO if_wd_context_element,
    stru_ztiornode TYPE zsior.
    navigate from <CONTEXT> to <ZTIORNODE> via lead selection
    node_ztiornode = wd_context->get_child_node( name = if_request_ior=>wdctx_ztiornode ).
    get element via lead selection
    elem_ztiornode = node_ztiornode->get_element( 1 ).

  • Regarding method calling

    Hi All,
    If I have a main method in Java which returns int
    public static int main(String args[])
    then at the time of compiling the program we don�t get any compilation error, but at run time why a java.lang.NoSuchMethodError occurs?
    My another question is also similar with the above one.
    Let say I have 2 class, one is TestClass1.java and TestClass2.java
    // TestClass1
    class TestClass1
         public static void main(String[] args)
              TestClass2 testClass2 = new TestClass2();
              testClass2.testMethod();
    // TestClass2
    class TestClass2
         public void testMethod()
              System.out.println("I am in testMethod of TestClass2");
              //return 1;
    We are calling testMethod() of TestClass2 from TestClass1. After compiling these 2 program if I execute the TestClass1 program then it runs perfectly. Now if I change the return type of testMethos() and compile only TestClass2 not the TestClass1 and run TestClass1 then an exception is thrown from main that is also java.lang.NoSuchMethodError. Is this related with the previous problem any more?
    Regards,
    Gourab

    We are calling testMethod() of TestClass2 from
    TestClass1. After compiling these 2 program if I
    execute the TestClass1 program then it runs
    perfectly. Now if I change the return type of
    testMethos() and compile only TestClass2 not the
    TestClass1 and run TestClass1 then an exception is
    thrown from main that is also
    java.lang.NoSuchMethodError. Is this related with the
    previous problem any more? Yes. You're replacing the signature of an existing method with one that doesn't exist. So it crashes...
    And it's not an exception, it's a full error.

  • Problem in GET_CURRENT_CELL method in oops ALV GRID

    Hi,
      I got output records int eh ALV GRID and i have a one push button in the report. When i select any CELL(say 5 row) in ALV GRID and click on this push Button, it should display me the Row number (row number = 5). I have used the GET_CURRENT_CELL. when I execute the report and select one cell (5 row cell )and click on push button, it is giving me the Row number(row number =  5) correctly. Again when i choose the cell (say 8 record)second time, it should display give the row number = 8 but always it is giving me the First row number .
    Get selected row
      PERFORM get_selected_row CHANGING l_sel_row.
    FORM get_selected_row  CHANGING p_l_sel_row.
      DATA: li_sel_row TYPE i,             "Selected row
            lv_rowid   TYPE lvc_s_row.
    Query which row was selected.
      CALL METHOD grid_brr_main->get_current_cell
        IMPORTING
          e_row     = li_sel_row
          es_row_id = lv_rowid.
      MOVE lv_rowid-index TO p_l_sel_row.
    ENDFORM.                    " get_selected_row
    Regards,
    Deepthi.

    Hi,
    Probably the data is not getting refreshed.
    Please call the following methods.
    REFRESH_TABLE_DISPLAY in PBO.
    Call this method only if the grid has been created and called once using SET_TABLE_FOR_FIRST_DISPLAY.
    As follows:-
    If grid is initial.
    call method grid-set_table_for_first_display
    else
    call method grid->REFRESH_TABLE_DISPLAY.
    endif.
    In the PAI.
    call the following method.
    grid->CHECK_CHANGED_DATA
    So that the data changes are transferred.
    Regards,
    Ankur Parab
    Edited by: Ankur Parab on Jun 4, 2009 5:18 PM

  • Regarding BAPI   and OOPS ABAP  Basic Study Material...................

    Hi....Can u please  send me  any  Basic Study material of  BAPI 's  and  OOP's ABAP
    to my email id  [email protected] ...
    thanks in advance......

    Hi,
    Check these links:
    for BAPI's
    http://www.sappoint.com/abap/bapiintro.pdf
    http://www.sappoint.com/abap/bapiprg.pdf
    http://www.sappoint.com/abap/bapiactx.pdf
    http://www.sappoint.com/abap/bapilst.pdf
    http://www.sappoint.com/abap/bapiexer.pdf
    http://service.sap.com/ale
    http://service.sap.com/bapi
    list of all bapis
    http://www.planetsap.com/LIST_ALL_BAPIs.htm
    BAPI-step by step
    http://www.sapgenie.com/abap/bapi/example.htm
    ooops abap:
    Have a look at below link and go to page 1291. It will give you good info abt OO ABAP.
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
    Also have a look at below links:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    Please do check transaction ABAPDOCU to learn more about ABAP OO. There are lots of examples and explanations there. Also, do check sapgenie.com for more examples(under their ABAP OO link).
    A very good option would be "ABAP Objects" written by Horst Keller.
    Regards

  • How to find all the methods in oops

    Hi all,
    is there any way to find all the methods of all class in a single screen j(ust like using t.code se37 we can find all the fm created)
    sathish

    Hi,
    1.Go to the class builder(SE24).
    2.Type the class name[eg..cl_gui_alv_grid]
    3.You will see a tab called methods.Click that.In that,you can view all the methods.Place the cursor in a method and click parameter tab.You can find the parameters for the method.
    Kindly reward points by clicking the star on the left of reply,if it helps.

  • Please help regarding method/function sign up validation with mysql jdbc.

    HI guys,
    I am have been fixing this problem for days, hope that someone could help me find the bug on my code.
    I have 3 files:
    1.WithAuth.java - for database jdbc mysql connection
    2.WithAuthMet.java - method that will read any variables that will be passed to it. this method is waiting for two variables, a and b. a for userName and b for userPassword.
    3.WithAuthTest.java - the testing class, this is where i declare my sample control data to test the database connection and query.
    here's the actual codes:
    WithAuth.java
    package com.Auth;
    public class WithAuth {
        static String userName = "root";
        static String userPassword = "";
        static String databaseUrl = "jdbc:mysql://localhost:3306/javatowebservice";
        static String userQuery = "select * from userlogin";
    }WithAuthMet.java
    - this is where the error is and where I messed up.
    package com.Auth;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;
    public class WithAuthMet extends WithAuth {
        public void connect(String a, String b)throws Exception{       
            //try {
                Class.forName ("com.mysql.jdbc.Driver").newInstance ();               
                Connection conn = DriverManager.getConnection (databaseUrl, userName, userPassword);
                Statement stat = conn.createStatement();   
                String query = userQuery;
                ResultSet result = stat.executeQuery(query);
                System.out.println("Result(s): ");
                  while (result.next ()){
                      int i = result.getInt("userId");
                      String name=result.getString("userName");
                      String password=result.getString("userPassword");
                          //System.out.println("test data:"+a);
                      if(a.equals(name.equals("userName"))&& b.equals(password.equals("userPassword"))){
                                System.out.println("User is Valid");
                            else{
                                System.out.println("You are not a Valid User");
                                System.out.println("test data:"+name);
                                System.out.println("test data:"+password);
                                System.out.println("test data:"+a);
                                System.out.println("test data:"+b);
                      //conn.close();
                   // }catch(Exception e){
                    //System.out.println("Exception is ;"+e);
                    //System.out.println("Exception is ;");
    //                if(a.equals(name.("userName"))
    //                    && password.equals(password.equals("userPassword"))){
    //                    System.out.println("User is Valid");
    //                else{
    //                    System.out.println("You are not a Valid User");
    } WithAuthTest.java
    package com.Auth;
    public class WithAuthTest extends WithAuthMet{
        public static void main(String[] args) throws Exception{
            WithAuthMet CTD = new WithAuthMet();   
            String a = "dan";
            String b = "password";
            //CTD.connect(String name,String password);
            CTD.connect(a, b);
            //return connect;
    }please help.

    yakultyakultyakult wrote:
    WithAuthMet.java
    - this is where the error is and where I messed up.
    package com.Auth;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;
    public class WithAuthMet extends WithAuth {
    public void connect(String a, String b)throws Exception{       
    //try {
    Class.forName ("com.mysql.jdbc.Driver").newInstance ();               
    Connection conn = DriverManager.getConnection (databaseUrl, userName, userPassword);
    Statement stat = conn.createStatement();   
    String query = userQuery;
    ResultSet result = stat.executeQuery(query);
    System.out.println("Result(s): ");
    while (result.next ()){
    int i = result.getInt("userId");
    String name=result.getString("userName");
    String password=result.getString("userPassword");
    //System.out.println("test data:"+a);
    if(a.equals(name.equals("userName"))&& b.equals(password.equals("userPassword"))){
    System.out.println("User is Valid");
    else{
    System.out.println("You are not a Valid User");
    System.out.println("test data:"+name);
    System.out.println("test data:"+password);
    System.out.println("test data:"+a);
    System.out.println("test data:"+b);
    //conn.close();
    // }catch(Exception e){
    //System.out.println("Exception is ;"+e);
    //System.out.println("Exception is ;");
    //                if(a.equals(name.("userName"))
    //                    && password.equals(password.equals("userPassword"))){
    //                    System.out.println("User is Valid");
    //                else{
    //                    System.out.println("You are not a Valid User");
    This is one line that is wrong
                       if(a.equals(name.equals("userName"))&& b.equals(password.equals("userPassword"))){You have 'a' and 'b which are Strings
    and you are comparing them [using equals()] with the boolean return from another set of equals() invocations.
    String equals boolean will always be false (well, maybe not if the String is "TRUE" or "FALSE" - and you would need some more boilerplate to make that work).

  • Regarding methods in webdynpro

    Hi,
       I am new to webdynpro.I am familiar with creating view,attributes etc.
      Can any one give an idea on wat these wd_context->get_child_node( name = `DATA` ).
    elem_data = node_data->get_element(  ).
    OR
    node_ui = wd_context->get_child_node( name = `UI` ).
      elem_ui = node_ui->get_element(  ). etc  do.
    What does these mean or can any one provide documentation on wat these do.

    hi ,
    Go through this link.
    node_ui = wd_context->get_child_node( name = `UI` ). is creating the reference to the root node.
    elem_ui = node_ui->get_element( ). etc do. creating the reference to the node which is next to the rootnode.
    Web Dynpro ABAP Demonstration Videos
    /people/thomas.jung/blog/2006/06/20/web-dynpro-abap-demonstration-videos
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/28113de9-0601-0010-71a3-c87806865f26?rid=/webcontent/uuid/fed073e5-0901-0010-4eb4-c9882aac7b11 [original link is broken]
    http://help.sap.com/saphelp_erp2005/helpdata/en/a5/1a1e3e7181b60ae10000000a114084/frameset.htm

  • ALV OOPS report - Need help

    Hi Friends,
    I just want to convert a normal alv grid report to ALV OOPS report using classes,methods and objects, can you please help me on it.
    *I have sent a sample ALV grid report program.
    REPORT  YSDB_ALV_ECC NO STANDARD PAGE HEADING LINE-SIZE 260 LINE-COUNT 58.
    TABLES:
                    VBRK,
                    VBRP.
    TYPE-POOLS: SLIS.
    TYPES:
                  BEGIN OF Y_VBRK_STRUCT ,
                        VBELN TYPE VBRK-VBELN,
                        FKART TYPE VBRK-FKART,
                        FKDAT TYPE VBRK-FKDAT,
                        BUKRS TYPE VBRK-BUKRS,
                        NETWR TYPE VBRK-NETWR,
                  END OF Y_VBRK_STRUCT.
    TYPES:
                     BEGIN OF Y_VBRP_STRUCT,
                            VBELN TYPE VBRP-VBELN,
                            POSNR TYPE VBRP-POSNR,
                            MATNR TYPE VBRP-MATNR,
                            FKIMG TYPE VBRP-FKIMG,
                            AUBEL TYPE VBRP-AUBEL,
                            KOSTL TYPE VBRP-KOSTL,
                            PS_PSP_PNR TYPE VBRP-PS_PSP_PNR,
                            ARKTX TYPE VBRP-ARKTX,
                     END OF Y_VBRP_STRUCT.
    TYPES:
                  BEGIN OF Y_DISPLAY_STRUCT,
                        VBELN TYPE VBRK-VBELN,
                        FKART TYPE VBRK-FKART,
                        FKDAT TYPE VBRK-FKDAT,
                        BUKRS TYPE VBRK-BUKRS,
                        NETWR TYPE VBRK-NETWR,
                        POSNR TYPE VBRP-POSNR,
                        MATNR TYPE VBRP-MATNR,
                        FKIMG TYPE VBRP-FKIMG,
                        AUBEL TYPE VBRP-AUBEL,
                        KOSTL TYPE VBRP-KOSTL,
                        PS_PSP_PNR TYPE VBRP-PS_PSP_PNR,
                        ARKTX TYPE VBRP-ARKTX,
                  END OF Y_DISPLAY_STRUCT .
    DATA: W_INDEX LIKE SY-TABIX.
    DATA:  W_FIELDCATALOG TYPE SLIS_FIELDCAT_ALV.
    DATA:  T_FIELDCATALOG1 TYPE SLIS_T_FIELDCAT_ALV.
    DATA:  W_REPID TYPE SY-REPID.
    DATA: T_VBRK_ITAB TYPE STANDARD TABLE OF Y_VBRK_STRUCT .
    DATA: T_VBRP_ITAB TYPE STANDARD TABLE OF Y_VBRP_STRUCT .
    DATA: T_DISPLAY_ITAB TYPE STANDARD TABLE OF Y_DISPLAY_STRUCT.
    DATA: E_DISPLAY TYPE Y_DISPLAY_STRUCT.
    SELECT-OPTIONS S_VBELN FOR VBRK-VBELN.
    SELECT-OPTIONS S_BUKRS FOR VBRK-BUKRS.
    SELECT-OPTIONS S_FKDAT FOR VBRK-FKDAT.
    START-OF-SELECTION.
      PERFORM F_GET_DATA1.
      PERFORM F_PROCESS_DATA.
      PERFORM F_FIELDCATLOG.
      PERFORM F_DISPLAY_DATA.
      PERFORM F_CLEAR_FIELDS.
    *&      Form  get_data1
          text
    FORM F_GET_DATA1 .
      SELECT VBELN  FKART FKDAT BUKRS NETWR
        FROM VBRK
        INTO  TABLE T_VBRK_ITAB
       WHERE BUKRS IN S_BUKRS
         AND FKDAT IN S_FKDAT
         AND VBELN IN S_VBELN.
      IF SY-SUBRC NE 0.
        FREE: T_VBRK_ITAB.
      ENDIF.
      IF NOT T_VBRK_ITAB IS INITIAL.
        SELECT VBELN POSNR MATNR FKIMG AUBEL
               KOSTL PS_PSP_PNR ARKTX
          FROM VBRP
          INTO TABLE T_VBRP_ITAB
          FOR ALL ENTRIES IN T_VBRK_ITAB
         WHERE VBELN EQ T_VBRK_ITAB-VBELN.
        IF SY-SUBRC NE 0.
          FREE: T_VBRK_ITAB.
        ENDIF.
      ENDIF.
    ENDFORM.                                                    " GET_DATA1
          text
    -->  p1        text
    <--  p2        text
    FORM F_PROCESS_DATA .
      SORT T_VBRK_ITAB  BY VBELN.
      SORT T_VBRP_ITAB  BY VBELN.
      CLEAR: W_INDEX.
      UNASSIGN <FS_STRUCT1>.
      UNASSIGN <FS_STRUCT2>.
      LOOP AT T_VBRK_ITAB ASSIGNING <FS_STRUCT1>.
        READ TABLE T_VBRP_ITAB ASSIGNING <FS_STRUCT2> WITH KEY VBELN = <FS_STRUCT1>-VBELN BINARY SEARCH.
        IF SY-SUBRC EQ 0.
          MOVE  SY-TABIX TO W_INDEX.
          WHILE SY-SUBRC  IS INITIAL AND <FS_STRUCT1>-VBELN = <FS_STRUCT2>-VBELN.
    *Header Items Moving
            MOVE:
                   <FS_STRUCT1>-FKART TO E_DISPLAY-FKART,
                   <FS_STRUCT1>-FKDAT TO E_DISPLAY-FKDAT,
                   <FS_STRUCT1>-BUKRS TO E_DISPLAY-BUKRS,
                   <FS_STRUCT1>-NETWR TO E_DISPLAY-NETWR.
    *Line items Moving
            MOVE: <FS_STRUCT2>-VBELN TO E_DISPLAY-VBELN,
                  <FS_STRUCT2>-POSNR TO E_DISPLAY-POSNR,
                  <FS_STRUCT2>-MATNR TO E_DISPLAY-MATNR,
                  <FS_STRUCT2>-FKIMG TO E_DISPLAY-FKIMG,
                  <FS_STRUCT2>-AUBEL TO E_DISPLAY-AUBEL,
                  <FS_STRUCT2>-KOSTL TO E_DISPLAY-KOSTL,
                  <FS_STRUCT2>-PS_PSP_PNR TO E_DISPLAY-PS_PSP_PNR,
                  <FS_STRUCT2>-ARKTX TO E_DISPLAY-ARKTX.
            APPEND E_DISPLAY TO T_DISPLAY_ITAB.
            CLEAR  E_DISPLAY.
                      ADD 1 TO W_INDEX.
            READ TABLE T_VBRP_ITAB ASSIGNING <FS_STRUCT2> INDEX  W_INDEX.
            IF SY-SUBRC NE 0.
              EXIT.
            ENDIF.
          ENDWHILE.
        ENDIF.
      ENDLOOP.
    ENDFORM.                                                    " GET_DATA3
    *&      Form  Fieldcatlog
          text
    -->  p1        text
    <--  p2        text
    FORM F_FIELDCATLOG .
      W_FIELDCATALOG-FIELDNAME = TEXT-001.
      W_FIELDCATALOG-SELTEXT_L = TEXT-002.
      MOVE : 1 TO W_FIELDCATALOG-COL_POS,
             20 TO W_FIELDCATALOG-OUTPUTLEN.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
      CLEAR W_FIELDCATALOG.
      W_FIELDCATALOG-FIELDNAME = TEXT-003.
      W_FIELDCATALOG-SELTEXT_L = TEXT-004.
      MOVE : 2 TO W_FIELDCATALOG-COL_POS,
               20 TO W_FIELDCATALOG-OUTPUTLEN.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
      CLEAR W_FIELDCATALOG.
      W_FIELDCATALOG-FIELDNAME = TEXT-005.
      W_FIELDCATALOG-SELTEXT_L = TEXT-006.
      MOVE : 3 TO W_FIELDCATALOG-COL_POS,
              20 TO W_FIELDCATALOG-OUTPUTLEN.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
      CLEAR W_FIELDCATALOG.
      W_FIELDCATALOG-FIELDNAME = TEXT-007.
      W_FIELDCATALOG-SELTEXT_L = TEXT-008.
      MOVE : 4 TO W_FIELDCATALOG-COL_POS,
             20 TO W_FIELDCATALOG-OUTPUTLEN.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
      CLEAR W_FIELDCATALOG.
      W_FIELDCATALOG-FIELDNAME = TEXT-009.
      W_FIELDCATALOG-SELTEXT_L = TEXT-010.
      MOVE : 5 TO W_FIELDCATALOG-COL_POS,
              20 TO W_FIELDCATALOG-OUTPUTLEN.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
      CLEAR W_FIELDCATALOG.
      W_FIELDCATALOG-FIELDNAME = TEXT-011.
      W_FIELDCATALOG-SELTEXT_L = TEXT-012.
      MOVE : 6 TO W_FIELDCATALOG-COL_POS,
             20 TO W_FIELDCATALOG-OUTPUTLEN.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
      CLEAR W_FIELDCATALOG.
      W_FIELDCATALOG-FIELDNAME = TEXT-013.
      W_FIELDCATALOG-SELTEXT_L = TEXT-014.
      MOVE : 7 TO W_FIELDCATALOG-COL_POS,
            20 TO W_FIELDCATALOG-OUTPUTLEN.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
      CLEAR W_FIELDCATALOG.
      W_FIELDCATALOG-FIELDNAME = TEXT-015.
      W_FIELDCATALOG-SELTEXT_L = TEXT-016.
      MOVE : 8 TO W_FIELDCATALOG-COL_POS,
             20 TO W_FIELDCATALOG-OUTPUTLEN.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
      CLEAR W_FIELDCATALOG.
      W_FIELDCATALOG-FIELDNAME = TEXT-017.
      W_FIELDCATALOG-SELTEXT_L = TEXT-018.
      MOVE : 9 TO W_FIELDCATALOG-COL_POS,
             20 TO W_FIELDCATALOG-OUTPUTLEN.
      APPEND W_FIELDCATALOG TO T_FIELDCATALOG1.
      CLEAR W_FIELDCATALOG.
    ENDFORM.                    " Fieldcatlog
    *&      Form  DISPLAY_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM F_DISPLAY_DATA .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM     = W_REPID
          I_CALLBACK_TOP_OF_PAGE = 'AAAAAAAAADDAADA' "TEXT-021
          I_GRID_TITLE           = TEXT-020
          IT_FIELDCAT            = T_FIELDCATALOG1
        TABLES
          T_OUTTAB               = T_DISPLAY_ITAB.
      IF SY-SUBRC NE 0.
        EXIT.
      ENDIF.
      CLEAR: W_REPID.
      CLEAR: T_FIELDCATALOG1.
    ENDFORM.                    " DISPLAY_DATA
    *&      Form  F_Clear_fields
          text
    -->  p1        text
    <--  p2        text
    FORM F_CLEAR_FIELDS .
      FREE: T_VBRK_ITAB.
      FREE: T_VBRP_ITAB.
      FREE: T_DISPLAY_ITAB.
      CLEAR: W_FIELDCATALOG.
    ENDFORM.                    " F_Clear_fields
    Regards
    Dinesh

    In ALV oops,
    1. You need screen on which you must create a custom container. - screen 100
    2. In PBO of 100, create module for displaying ALV
    MODULE DISPLAY_ALV OUTPUT
    PERFORM CREATE_CONTAINER "IN WHICH YOU USE THE CREATE OBJECT METHOD OF CL_GUI_CUSTOM_CONTAINER
    PERFORM CREATE_ALV "IN WHICH YOU USE CREATE_OBJECT METHOD OF CL_GUI_ALV_GRID.
    PERFORM PREPARE_FIELDCAT "creating fcat using LVC_S_FCAT structure
    PERFORM DISPLAY "here you use the SET_TABLE_FOR_FIRST_DISPLAY method of CL_GUI_ALV_GRID class,
    where you provide the internal table name and fieldcat internal table
    ENDMODULE

  • Oops in abap

    •     Create an ABAP program (e.g. an executable program).
    •     Define a (local) class CL_FLIGHT_DATA that cannot be instantiated outside the class and contains a private internal table attribute of line type SPFLI, which is filled during instance construction from database table SPFLI with the flights of a specific carrier.
    •     Define the following (local) friends of CL_FLIGHT_DATA:
    o     CL_FLIGHT_DATA_FACTORY with a static method CREATE that creates an instance of CL_FLIGHT_DATA and returns the reference.
    o     CL_FLIGHT_DATA_GET with a static method GET_CONNECTION that accesses the internal table in a specific instance of CL_FLIGHT_DATA and returns the data for a specific flight connection.
    o     CL_FLIGHT_DATA_... what you want ...
    •     Test the package, e.g. during START-OF-SELECTION, by creating an instance of CL_FLIGHT_DATA and getting a flight into a structure. Use the short forms of CALL METHOD.

    Hi
    OOPs ABAP uses Classes and Interfaces which uses Methods and events.
    If you have Java skills it is advantage for you.
    There are Local classes as well as Global Classes.
    Local classes we can work in SE38 straight away.
    But mostly it is better to use the Global classes.
    Global Classes or Interfaces are to be created in SE24.
    SAP already given some predefined classes and Interfaces.
    This OOPS concepts very useful for writing BADI's also.
    So first create a class in SE 24.
    Define attributes, Methods for that class.
    Define parameters for that Method.
    You can define event handlers also to handle the messages.
    After creation in each method write the code.
    Methods are similar to ABAP PERFORM -FORM statements.
    After the creation of CLass and methods come to SE38 and create the program.
    In the program create a object type ref to that class and with the help of that Object call the methods of that Class and display the data.
    see the links below, Understand them and start developing.
    chk out the links below:
    General Tutorial for OOPS
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
    Have a look at these links for OO ABAP.
    http://www.sapgenie.com/abap/OO/
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    SDN Series:
    https://www.sdn.sap.com/irj/sdn/developerareas/abap?rid=/webcontent/uuid/35eaef9c-0b01-0010-dd8b-e3b0f9ed7ccb [original link is broken]
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
    Basic concepts of OOPS
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b6cae890-0201-0010-ef8b-f970a9c41d47
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1591ec90-0201-0010-3ba8-cdcd500b17cf
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
    http://www.henrikfrank.dk/abapuk.html
    http://www.erpgenie.com/abap/OO/
    Reward points for useful Answers
    Regards
    Anji

Maybe you are looking for

  • BUG: Power Manager fails to autostart

    Alright, this topic is a continuation of my conversation with Lenovo support on Twitter, as it has been a while and we were unable to resolve this problem. Until recently I had Windows 7 x86 running perfectly normal with a number of ThinkVantage tool

  • Itunes crashes every time i attempt to open it

    everytime i attempt to open itunes it crashes. ive tried every mmethod i could find including the new user acount and all of the other wide troubleshooting methods reccomended by apple. help please?

  • AC3 with QT

    Hi, I AHVE QUTION IF CAN I MAKE QT MOVIE WITH AC3 FILE . i have qt movie file and ac3 file how can i make one qt movie with ac3 file can some help me please !!!! MASTER-DVD from ISRAEL

  • Prepaid Question

    I don't know if im in the right place or not but oh well.  I have new $50 a month unlimited plan but being a truck mechanic my phones gettin roughed up pretty fast.  Is there anyway I can buy one of the G'zOne phones outright and use it on the prepai

  • Distribute Forms

    Is there a way to manually upload a form I created in livecycle for distribution. I cannot distribute directly from livecycle because of firewall issues. But the form is now located in my acrobat.com file center. I need to distribute it and this is m