OOABAP

Hi Experts,
what is the exact difference between ABAP & OOABAP?
what is the need for OOABAP?
<b>points will be rewarded if helpful.</b>

Hi,
Look at this article <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3e59b790-0201-0010-88aa-bc8a7f95f6fb">Why use ABAP Objects</a>
Using Abap OO you :
Save time reusing your source code.
Extends the programs without make great changing's.
etc...
Good look.
Marcelo Ramos

Similar Messages

  • End-of-page in OOABAP Reports

    Hi,
    I'm displaying a list in a grid using OOABAP Global classes.
    1)Could anyone post how to handle the end-of-page events in this case.
    2) Also in this case I've to code for Interactive Reporting, So also please say how to handle this parallelly for the upcoming basic lists of the same report.
    <<don't post stupid questions>>
    Edited by: Vijay Babu Dudla on Nov 18, 2008 9:16 PM

    Why are opening separates thread on all issues which all are related to BASIC ALV concepts?
    At-New using ALV  Function Modules
    New-page  issue in OOABAP Report
    At New in OOABAP Report
    Continue with one thread and search in SCN there are many examples are there with code.

  • Not triggering PBO in OOABAP ALV grid

    Hi all.
    I want to create drop down for Document type BSART.for that iam using OOABAP but my program is not triggering PBO module itself.I have seen so many examples but iam unable to fetch data.what are the changes i have to do here.i have reduced some code here.i have written my final internal table select query before this stataement.
    loop at it_git_final into wa_git_final.
    APPEND wa_git_final TO it_git_final.
    ENDLOOP.
    *Call to ALV
      CALL SCREEN 600.
    MODULE status_0600 OUTPUT.
    SET PF-STATUS 'DISP'.
    SET TITLEBAR 'ALVF4'.
    ENDMODULE.                 " STATUS_0600  OUTPUT
    calling the PBO module ALV_GRID.
    MODULE pbo OUTPUT.
    *Creating objects of the container
      *  SET field for ALV
      if g_custom_container is initial.
      perform create_and_init_alv changing it_git_final
                                             gt_fieldcat.
    PERFORM alv_build_fieldcat.
      endif.
      * Set ALV attributes FOR LAYOUT
    PERFORM alv_report_layout.
       CHECK NOT c_alvgd IS INITIAL.
    Call ALV GRID
       CALL METHOD c_alvgd->set_table_for_first_display
        EXPORTING
          is_layout                     = it_layout
          i_save                        = 'A'
        CHANGING
          it_outtab                     = it_git_final
          it_fieldcatalog               = it_fcat
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
       ENDMODULE.                 " PBO  OUTPUT
          MODULE PAI INPUT                                              *
    MODULE pai INPUT.
       ENDMODULE.                    "pai INPUT
    *subroutine to build fieldcat
    FORM alv_build_fieldcat changing pt_fieldcat type lvc_t_fcat..
       DATA lx_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'IT_GIT_FINAL'
        CHANGING
          ct_fieldcat      = gt_fieldcat.
    * To assign dropdown in the fieldcataogue
    LOOP AT gt_fieldcat INTO lx_fcat.
       DATA : lx_fcat TYPE lvc_s_fcat.
      lx_fcat-row_pos   = '1'.
      lx_fcat-col_pos   = '1'.
    lx_fcat-fieldname = 'CHECK1'.
    lx_fcat-ref_field = 'CHECK1'
      lx_fcat-EDIT = 'X'.
      lx_fcat-coltext = 'Check Box'.
    lx_fcat-seltext = text-c01.
    APPEND lx_fcat TO Gt_fieldcat.
    CLEAR lx_fcat.
    lx_fcat-row_pos   = '1'.
      lx_fcat-col_pos   = '15'.
      lx_fcat-fieldname = 'BSART'.
      lx_fcat-ref_field = 'BSART'.
      lx_fcat-ref_table = 'T161P'.
      lx_fcat-coltext = 'Document Type'.
    lx_fcat-drdn_hndl = '1'.
      lx_fcat-outputlen = 15.
      lx_fcat-edit = 'X'.
      append  lx_fcat to gt_fieldcat.
      CLEAR lx_fcat.
       DATA: lt_dropdown TYPE lvc_t_drop,
            ls_dropdown TYPE lvc_s_drop.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '01 ZFC Vesselchart Contract'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '02 ZQTY QTY Contract(SESA)'.
      APPEND ls_dropdown TO lt_dropdown.   ls_dropdown-handle = '1'.
    *method to display the dropdown in ALV
      CALL METHOD g_grid->set_drop_down_table
        EXPORTING
          it_drop_down = lt_dropdown.
    LOOP AT it_fcat INTO lx_fcat.
        CASE lx_fcat-fieldname.
    To assign dropdown in the fieldcataogue
          WHEN 'BSART'.
            lx_fcat-drdn_hndl = '1'.
            lx_fcat-outputlen = 15.
            MODIFY it_fcat FROM lx_fcat.
        ENDCASE.
      ENDLOOP.
          endform.
    form ALV_OUTPUT .
    *Create object for container
    CREATE OBJECT g_custom_container
            EXPORTING container_name = 'CCONT'.
    *create object for grid
    CREATE OBJECT g_grid
            EXPORTING i_parent = g_custom_container.
      CALL METHOD g_grid->set_table_for_first_display
        EXPORTING
          is_layout       = it_layout
        CHANGING
          it_fieldcatalog = gt_fieldcat
          it_outtab       = it_git_final.
    endform.                    " ALV_OUTPUT
    form ALV_REPORT_LAYOUT .
      it_layout-cwidth_opt = 'X'.
      it_layout-col_opt = 'X'.
      it_layout-zebra = 'X'.
    endform.                    " ALV_REPORT_LAYOUT
    form CREATE_AND_INIT_ALV  changing p_it_git_final
                                       p_gt_fieldcat.
      create object g_custom_container
             exporting container_name = g_container.
      create object g_grid
             exporting i_parent = g_custom_container.
    endform.

    Hello Raj
      Actually all the code is described in PBO module, so you need to invoke this module in PBO when defining the screen.
    For example, access transaction SE51, start in Change mode and inser line
        MODULE PBO.
    Then activate the object
    Best regards
    Carlos Machad o

  • At New in OOABAP Report

    Hi,
    Could anyone post solution for the given below issue.
    I have to handle control break command 'AT NEW' in ALV Reports using Global Classes(OOABAP), If possible with a small sample code which is more relative.

    Read first this documentation [ALV Grid Control (BC-SRV-ALE)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf] and then elaborate a little more on your actual requirement.
    Also perform some [search at sdn|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=%22atNEW%22OO+ALV&adv=false&sortby=cm_rnd_rankvalue#] and please don't post too many threads.
    Regards

  • ALV using OOABAP  fieldnames changing in the selection screen

    Hi
    I am new to OOABAP.Here is the requirement.
    I need to create a ALV report, in the selection screen field label can change and it needs to display in ALV report. selection screen contains 4 checkboxes. based on selection hide the columns in ALV display.
    Can anyone help me in this?
    Thanks
    sapien

    u build field cat "at selection-screen event.
    LET S_A, S_B, S_C, S_D BE THE SELECTION SCREEN FIELD.
    AT SELECTION-SCREEN.
    PERFORM BUILD_FIELDCAT USING S_A S_B S_C S_D.
    form build_fieldcat using s_a type ... s_b type .... so on
    if s_a = 'X'.
    FIELDCAT-FIELDNAME = '......'.
    append fieldcat.
    if s_b = 'X'.
    FIELDCAT-FIELDNAME = '......'.
    append fieldcat.
    IF S_C = 'X'.
    FIELDCAT-FIELDNAME = '......'.
    append fieldcat.
    IF S_D = 'X'.
    FIELDCAT-FIELDNAME = '......'.
    append fieldcat.

  • OOABAP Report

    Are there any GOOD standard programs / REPORTS to refer for OOABAP done already in SAP ?
    Rgds,
    Ö

    Hi
    ABAP Objects is a new concept in R/3 Release 4.0. The term has two meanings. On the one hand, it stands for the entire ABAP runtime environment. On the other hand, it represents the object-oriented extension of the ABAP language.
    The following is a simple example shows the object-oriented aspect of function groups in the simple case of a counter.
    Suppose we have a function group called COUNTER:
    Create an abap program with this code :-
    FUNCTION-POOL COUNTER.
    DATA COUNT TYPE I.
    FUNCTION SET_COUNTER.
    Local Interface IMPORTING VALUE(SET_VALUE)
      COUNT = SET_VALUE.
    ENDFUNCTION.
    FUNCTION INCREMENT_COUNTER.
      ADD 1 TO COUNT.
    ENDFUNCTION.
    FUNCTION GET_COUNTER.
    Local Interface: EXPORTING VALUE(GET_VALUE)
      GET_VALUE = COUNT.
    ENDFUNCTION.
    End of program code
    The function group has a global integer field COUNT, and three function modules, 
    - SET_COUNTER, 
    - INCREMENT_COUNTER, and 
    - GET_COUNTER, that work with the field. 
    Two of the function modules have input and output parameters. These form the data interface of the function group.
    Any ABAP program can then work with this function group. For example:
    REPORT ZABAPOO.
    DATA NUMBER TYPE I VALUE 5.
    CALL FUNCTION 'SET_COUNTER' EXPORTING SET_VALUE = NUMBER.
    DO 3 TIMES.
      CALL FUNCTION 'INCREMENT_COUNTER'.
    ENDDO.
    CALL FUNCTION 'GET_COUNTER' IMPORTING GET_VALUE = NUMBER.
    WRITE: / 'After processing NUMBER is :- ', NUMBER.
    End of program code
    After this section of the program has been processed, the program variable NUMBER will have the value 8.
    The program itself cannot access the COUNT field in the function group. Operations on this field are fully encapsulated in the function module. The program can only communicate with the function group by calling its function modules.
    Regards,
    Santosh

  • New-page  issue in OOABAP Report

    Hi,
    I'm displaying a list in a grid using OOABAP Global classes.
    Could anyone please  post how to handle the New-page event in this case(In case of OOABAP Reports).

    Read first this documentation [ALV Grid Control (BC-SRV-ALE)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf] and then elaborate a little more on your actual requirement.
    Also perform some [search at sdn|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=%22newPAGE%22OO+ALV&adv=false&sortby=cm_rnd_rankvalue#] and please don't post too many threads.
    Regards

  • I want to learn more about OOABAP(Object Oriented ABAP)

    Hi All,
    Please could anybody help me in sending some of material or suggestion in learning(Exploring) the Object Oriented ABAP. Right now I am an ABAP/4 Developer.
    Please if anybody having any such material please send it to my mail-id i.e <u>[email protected]</u> or else please tell me the resources to learn the OOABAP please.
    Now I have to work on that project. Thanks in advance.
    By
    ASHOK
    If anything PDF format material please could you upload to my mail ID <u>[email protected]</u>
    Message was edited by: ashok vanga

    Hi ashok,
    check this link....
    http://www.intelligententerprise.com/channels/applications/feature/archive/heymann.jhtml?_requestid=304802
    http://www.henrikfrank.dk/abapuk.html
    http://sap.ittoolbox.com/documents/document.asp?i=982
    reward points for helpfull answers and close the thread if your question is solved.
    regards,
    venu.

  • Report programming using OOABAP

    hi sdns,
    I have learnt OOABAP.
    and now i am trying to implement those concepts in report programming.
    can anyone provide me some good stuff for practicing them.
    I want Excercises or else if any one have PDFs do mail me to [email protected]
    Please do support me in this regard.
    points awarded fastly.
    Thanks & Regards,
    Lokesh@EDS.

    Hi,
    Check this,
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    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.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com.
    http://www.sapgenie.com/abap/OO/index.htm
    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://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    some more materials.
    Go through the following Documents Links & Materials for ABAP Objects
    check the below links lot of info and examples r there
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/sap.user72/blog/2005/05/10/a-small-tip-for-the-beginners-in-oo-abap
    /people/ravikumar.allampallam/blog/2005/02/11/abap-oo-in-action
    /people/thomas.jung3/blog/2005/09/08/oo-abap-dynpro-programming
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    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.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    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://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    these links
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    1) http://www.erpgenie.com/sap/abap/OO/index.htm
    2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/2007/07/09/understandingABAPObjects&
    Thanks,
    Reward If Helpful.

  • Difference between ooabap and java

    eventhough both java and ooabap are oops languages there may be some difference between them as c++ and java in using the oops concepts or may be there is an advantage in using ooabap than java .
                                                            any one pls  reply to the above asked question.
    <REMOVED BY MODERATOR>
    Edited by: rahul nuthi on Feb 26, 2008 1:10 PM
    Edited by: Alvaro Tejada Galindo on Feb 26, 2008 11:19 AM

    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.
    Example:
    REPORT sapmz_hf_alv_grid .
    Type pool for icons - used in the toolbar
    TYPE-POOLS: icon.
    TABLES: zsflight.
    To allow the declaration of o_event_receiver before the
    lcl_event_receiver class is defined, decale it as deferred in the
    start of the program
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    G L O B A L I N T E R N A L T A B L E S
    *DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
    To include a traffic light and/or color a line the structure of the
    table must include fields for the traffic light and/or the color
    TYPES: BEGIN OF st_sflight.
    INCLUDE STRUCTURE zsflight.
    Field for traffic light
    TYPES: traffic_light TYPE c.
    Field for line color
    types: line_color(4) type c.
    TYPES: END OF st_sflight.
    TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
    DATA: gi_sflight TYPE tt_sflight.
    G L O B A L D A T A
    DATA: ok_code LIKE sy-ucomm,
    Work area for internal table
    g_wa_sflight TYPE st_sflight,
    ALV control: Layout structure
    gs_layout TYPE lvc_s_layo.
    Declare reference variables to the ALV grid and the container
    DATA:
    go_grid TYPE REF TO cl_gui_alv_grid,
    go_custom_container TYPE REF TO cl_gui_custom_container,
    o_event_receiver TYPE REF TO lcl_event_receiver.
    DATA:
    Work area for screen 200
    g_screen200 LIKE zsflight.
    Data for storing information about selected rows in the grid
    DATA:
    Internal table
    gi_index_rows TYPE lvc_t_row,
    Information about 1 row
    g_selected_row LIKE lvc_s_row.
    C L A S S E S
    CLASS lcl_event_receiver DEFINITION.
    PUBLIC SECTION.
    METHODS:
    handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
    IMPORTING
    e_object e_interactive,
    handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
    IMPORTING e_ucomm.
    ENDCLASS.
    CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
    METHOD handle_toolbar.
    Event handler method for event toolbar.
    CONSTANTS:
    Constants for button type
    c_button_normal TYPE i VALUE 0,
    c_menu_and_default_button TYPE i VALUE 1,
    c_menu TYPE i VALUE 2,
    c_separator TYPE i VALUE 3,
    c_radio_button TYPE i VALUE 4,
    c_checkbox TYPE i VALUE 5,
    c_menu_entry TYPE i VALUE 6.
    DATA:
    ls_toolbar TYPE stb_button.
    Append seperator to the normal toolbar
    CLEAR ls_toolbar.
    MOVE c_separator TO ls_toolbar-butn_type..
    APPEND ls_toolbar TO e_object->mt_toolbar.
    Append a new button that to the toolbar. Use E_OBJECT of
    event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.
    This class has one attribute MT_TOOLBAR which is of table type
    TTB_BUTTON. The structure is STB_BUTTON
    CLEAR ls_toolbar.
    MOVE 'CHANGE' TO ls_toolbar-function.
    MOVE icon_change TO ls_toolbar-icon.
    MOVE 'Change flight' TO ls_toolbar-quickinfo.
    MOVE 'Change' TO ls_toolbar-text.
    MOVE ' ' TO ls_toolbar-disabled.
    APPEND ls_toolbar TO e_object->mt_toolbar.
    ENDMETHOD.
    METHOD handle_user_command.
    Handle own functions defined in the toolbar
    CASE e_ucomm.
    WHEN 'CHANGE'.
    PERFORM change_flight.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMETHOD.
    ENDCLASS.
    S T A R T - O F - S E L E C T I O N.
    START-OF-SELECTION.
    SET SCREEN '100'.
    *& Module USER_COMMAND_0100 INPUT
    MODULE user_command_0100 INPUT.
    CASE ok_code.
    WHEN 'EXIT'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    *& Module STATUS_0100 OUTPUT
    MODULE status_0100 OUTPUT.
    DATA:
    For parameter IS_VARIANT that is sued to set up options for storing
    the grid layout as a variant in method set_table_for_first_display
    l_layout TYPE disvariant,
    Utillity field
    l_lines TYPE i.
    After returning from screen 200 the line that was selected before
    going to screen 200, should be selected again. The table gi_index_rows
    was the output table from the GET_SELECTED_ROWS method in form
    CHANGE_FLIGHT
    DESCRIBE TABLE gi_index_rows LINES l_lines.
    IF l_lines > 0.
    CALL METHOD go_grid->set_selected_rows
    EXPORTING
    it_index_rows = gi_index_rows.
    CALL METHOD cl_gui_cfw=>flush.
    REFRESH gi_index_rows.
    ENDIF.
    Read data and create objects
    IF go_custom_container IS INITIAL.
    Read data from datbase table
    PERFORM get_data.
    Create objects for container and ALV grid
    CREATE OBJECT go_custom_container
    EXPORTING container_name = 'ALV_CONTAINER'.
    CREATE OBJECT go_grid
    EXPORTING
    i_parent = go_custom_container.
    Create object for event_receiver class
    and set handlers
    CREATE OBJECT o_event_receiver.
    SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
    SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
    Layout (Variant) for ALV grid
    l_layout-report = sy-repid. "Layout fo report
    Setup the grid layout using a variable of structure lvc_s_layo
    Set grid title
    gs_layout-grid_title = 'Flights'.
    Selection mode - Single row without buttons
    (This is the default mode
    gs_layout-sel_mode = 'B'.
    Name of the exception field (Traffic light field) and the color
    field + set the exception and color field of the table
    gs_layout-excp_fname = 'TRAFFIC_LIGHT'.
    gs_layout-info_fname = 'LINE_COLOR'.
    LOOP AT gi_sflight INTO g_wa_sflight.
    IF g_wa_sflight-paymentsum < 100000.
    Value of traffic light field
    g_wa_sflight-traffic_light = '1'.
    Value of color field:
    C = Color, 6=Color 1=Intesified on, 0: Inverse display off
    g_wa_sflight-line_color = 'C610'.
    ELSEIF g_wa_sflight-paymentsum => 100000 AND
    g_wa_sflight-paymentsum < 1000000.
    g_wa_sflight-traffic_light = '2'.
    ELSE.
    g_wa_sflight-traffic_light = '3'.
    ENDIF.
    MODIFY gi_sflight FROM g_wa_sflight.
    ENDLOOP.
    Grid setup for first display
    CALL METHOD go_grid->set_table_for_first_display
    EXPORTING i_structure_name = 'SFLIGHT'
    is_variant = l_layout
    i_save = 'A'
    is_layout = gs_layout
    CHANGING it_outtab = gi_sflight.
    End of grid setup
    Raise event toolbar to show the modified toolbar
    CALL METHOD go_grid->set_toolbar_interactive.
    Set focus to the grid. This is not necessary in this
    example as there is only one control on the screen
    CALL METHOD cl_gui_control=>set_focus EXPORTING control = go_grid.
    ENDIF.
    ENDMODULE. " STATUS_0100 OUTPUT
    *& Module USER_COMMAND_0200 INPUT
    MODULE user_command_0200 INPUT.
    CASE ok_code.
    WHEN 'EXIT200'.
    LEAVE TO SCREEN 100.
    WHEN'SAVE'.
    PERFORM save_changes.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0200 INPUT
    *& Form get_data
    FORM get_data.
    Read data from table SFLIGHT
    SELECT *
    FROM zsflight
    INTO TABLE gi_sflight.
    ENDFORM. " load_data_into_grid
    *& Form change_flight
    Reads the contents of the selected row in the grid, ans transfers
    the data to screen 200, where it can be changed and saved.
    FORM change_flight.
    DATA:l_lines TYPE i.
    REFRESH gi_index_rows.
    CLEAR g_selected_row.
    Read index of selected rows
    CALL METHOD go_grid->get_selected_rows
    IMPORTING
    et_index_rows = gi_index_rows.
    Check if any row are selected at all. If not
    table gi_index_rows will be empty
    DESCRIBE TABLE gi_index_rows LINES l_lines.
    IF l_lines = 0.
    CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
    EXPORTING
    textline1 = 'You must choose a line'.
    EXIT.
    ENDIF.
    Read indexes of selected rows. In this example only one
    row can be selected as we are using gs_layout-sel_mode = 'B',
    so it is only ncessary to read the first entry in
    table gi_index_rows
    LOOP AT gi_index_rows INTO g_selected_row.
    IF sy-tabix = 1.
    READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
    ENDIF.
    ENDLOOP.
    Transfer data from the selected row to screenm 200 and show
    screen 200
    CLEAR g_screen200.
    MOVE-CORRESPONDING g_wa_sflight TO g_screen200.
    LEAVE TO SCREEN '200'.
    ENDFORM. " change_flight
    *& Form save_changes
    Changes made in screen 200 are written to the datbase table
    zsflight, and to the grid table gi_sflight, and the grid is
    updated with method refresh_table_display to display the changes
    FORM save_changes.
    DATA: l_traffic_light TYPE c.
    Update traffic light field
    Update database table
    MODIFY zsflight FROM g_screen200.
    Update grid table , traffic light field and color field.
    Note that it is necessary to use structure g_wa_sflight
    for the update, as the screen structure does not have a
    traffic light field
    MOVE-CORRESPONDING g_screen200 TO g_wa_sflight.
    IF g_wa_sflight-paymentsum < 100000.
    g_wa_sflight-traffic_light = '1'.
    C = Color, 6=Color 1=Intesified on, 0: Inverse display off
    g_wa_sflight-line_color = 'C610'.
    ELSEIF g_wa_sflight-paymentsum => 100000 AND
    g_wa_sflight-paymentsum < 1000000.
    g_wa_sflight-traffic_light = '2'.
    clear g_wa_sflight-line_color.
    ELSE.
    g_wa_sflight-traffic_light = '3'.
    clear g_wa_sflight-line_color.
    ENDIF.
    MODIFY gi_sflight INDEX g_selected_row-index FROM g_wa_sflight.
    Refresh grid
    CALL METHOD go_grid->refresh_table_display.
    CALL METHOD cl_gui_cfw=>flush.
    LEAVE TO SCREEN '100'.
    ENDFORM. " save_changes
    chk this blog
    /people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid
    /message/4447073#4447073 [original link is broken]
    Difference between ABAP an OOABAP
    http://en.wikipedia.org/wiki/Comparison_of_ABAP_and_Java
    hope it will help you
    regards
    sreelatha gullapalli

  • Required  OOABAP and BSP documents

    Hi All,
    i am begineer in OOABAP.
    i Required OOABAP and BSP documents.
    my requirement is on BSP.
    Please send those documents to this mailID.
    [email protected]
    Thanks
    Naresh

    Hi naresh,
    thanks for ur responce. just now i found one link on BSP's
    link is [http://****************/Tutorials/BSP/BSPMainPage.htm]
    please go through this link u found nuber of example with screen shots ,ok .hope this will help u lot. pls reward point
    any queries revert me ok. happy surffing ....
    Regards
    fareedas

  • Exceptions concept in ooabap

    hi i am hari ,
    in ooabap how to raise and catch the exceptions in class,
    if any documents u have plz send to me about OOABAP.

    Hi
    Check this Program
    REPORT  YSUBCLASS_EXCEPTION_3.
    CLASS cx_my_exception DEFINITION
        INHERITING FROM CX_STATIC_CHECK.
    ENDCLASS.
    CLASS cx_my_exception IMPLEMENTATION.
    ENDCLASS.
    CLASS C1 DEFINITION.
      PUBLIC SECTION.
        METHODS: m1 raising cx_my_exception .
    ENDCLASS.
    CLASS c1 IMPLEMENTATION.
      METHOD m1.
       RAISE EXCEPTION TYPE cx_my_exception.
      ENDMETHOD.
    ENDCLASS.
    DATA: ex TYPE REF TO cx_my_exception,
          oref TYPE REF TO c1.
    START-OF-SELECTION.
    TRY.
       CREATE OBJECT oref.
       oref->m1( ).
      CATCH cx_my_exception INTO ex.
        write:/5 'My Exception caught'.
    ENDTRY.
    OUTPUT
    My exception caught

  • OOABAP Grid display

    Hi all,
    I have a problem in displaying a grid in using OOABAP.
    myrequirement is once display output using OOABAP and after displaying my ALV output if i select a particular row and click
    my custom button (which i created in application tool bar) that record only display the output.
    my problem is after displaying my output i select the row and that particular row is not displaying.
    i checked my internal table it has only one row but it will display all the records please help me.
    Thanks,

    Check this WIKI by Joyjit:
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/display%2btotal%2btext%2bin%2boo-alv
    Regards,
    Naimesh Patel

  • OOABAP displaying grid.

    Hi all,
    I have a problem in displaying a grid in using OOABAP.
    myrequirement is once display output using OOABAP  and after displaying my ALV output if i select a particular row and click
    my custom button (which i created in application tool bar) that record only display the output.
    my problem is after displaying my output i select the row and that particular row is not displaying.
    i checked my internal table it has only one row but it will display all the records please help me.
    Thanks,

    Hi,
    Please post ABAP related question in ABAP forum instead of here.
    To answer your question, have you called refresh method after you updated the internal table?

  • Question on Logic of seperation in OOAbap-Selection screen

    Hello guys
    I like to ask you one question i found and get your ideas.
    If you look at the codes for creating an ALV
    it always recommends you to seperate logic and business layer etc..
    this is the new way of creating an ALV
    So you have  a model view and a controller
    I implemented that following useful resources.
    So that there s class called view
    and the selection screen gets called from there inside the method
    like
        call SELECTION-SCREEN 100.
         IF sy-subrc EQ 0.
         ENDIF.
    But one issue when you execute the report and press GO BACK standard button it doesnot come back to your selection screen but way to your code.
    Is there a get around to that?
    here is the code below:
    Header 1
    *& Report  ZZ_SOLEN_FIRST
    REPORT ZZ_SOLEN_FIRST.
    DATA: gv_vbeln type vbap-Vbeln.
    ***Screen
    SELECTION-SCREEN: BEGIN OF SCREEN 100 TITLE t-004.
    SELECTION-SCREEN: BEGIN OF block aa WITH FRAME TITLE t-001.
    SELECT-OPTIONS: s_vbeln FOR gv_vbeln.
    SELECTion-SCREEN: END OF block aa.
    SELECTion-SCREEN: END OF SCREEN 100.
    *****DATA Layer
    class lcl_data DEFINITION.
       PUBLIC SECTION.
         TYPES: BEGIN OF ty_out,
           vbeln type vbap-vbeln,
           posnr type vbap-posnr,
           matnr type vbap-matnr,
           vkorg type vbak-vkorg,
           END OF ty_out
         TYPES: tt_out TYPE STANDARD TABLE OF ty_out.
         TYPES: gr_vbeln TYPE RANGE OF vbap-vbeln.
         DATA: gt_output TYPE tt_out.
         methods: constructor,
                  select_data IMPORTING VALUE(rs_vbeln) TYPE gr_vbeln.
    ENDclass.
    class lcl_data IMPLEMENTATION.
       method constructor.
         clear GT_OUTPUT.
       ENDMETHOD.
       method select_data.
         DATA: lt_vbak type SORTED TABLE OF vbak WITH UNIQUE KEY vbeln.
         FIELD-SYMBOLS: <lfs_output> like LINE OF gt_output,
                        <lfs_vbak> like LINE OF lt_vbak
         select vbeln posnr matnr from vbap
           INto TABLE
            GT_OUTPUT
           where vbeln in S_VBELN
         IF sy-SUBRC EQ 0.
           select * from vbak
             INTO TABLE lt_vbak
             FOR ALL ENTRIES IN  GT_OUTPUT
             where vbeln = GT_OUTPUT-vbeln
           LOOP AT gt_output ASSIGNING <lfs_output>.
             READ TABLE lt_vbak ASSIGNING <lfs_vbak>
             with TABLE KEY vbeln = <lfs_output>-vbeln.
             IF sy-Subrc eq 0.
               <lfs_output>-vkorg = <lfs_vbak>-VKORG.
             ENDIF.
           ENDLOOP.
         ENDIF.
       ENDMETHOD.
    ENDCLASS.
    ****Display
    class lcl_view DEFINITION.
       PUBLIC SECTION.
         methods: start RETURNING VALUE(rv_true) type abap_bool.
         METHODS: display CHANGING it_data TYPE STANDARD TABLE.
    ENDCLASS.
    class lcl_view IMPLEMENTATION.
       METHOD start.
         call SELECTION-SCREEN 100.
         IF sy-subrc EQ 0.
           rv_true = abap_true.
         ENDIF.
       endmethod.
       method display.
         DATA: lo_salv_table type REF TO CL_SALV_TABLE,
               lt_columns TYPE SALV_T_COLUMN_REF.
         FIELD-SYMBOLS: <lfs_columns> like LINE OF lt_columns.
         CL_SALV_TABLE=>FACTORY(
    *    exporting
    *      LIST_DISPLAY   = IF_SALV_C_BOOL_SAP=>FALSE    " ALV Displayed in List Mode
    *      R_CONTAINER    =     " Abstract Container for GUI Controls
    *      CONTAINER_NAME =
           importing
             R_SALV_TABLE   = lo_salv_table    " Basis Class Simple ALV Tables
           changing
             T_TABLE        = it_data
    *    catch CX_SALV_MSG.    " ALV: General Error Class with Message
         lt_columns = lo_salv_table->GET_COLUMNS( )->GET( ).
    *    LOOP AT  lt_columns ASSIGNING <lfs_columns>.
    *    break developer.
    *    ENDLOOP.
         lo_salv_table->DISPLAY( ).
       ENDMETHOD.
    ENDCLASS.
    class lcl_controller DEFINITION.
       PUBLIC SECTION.
         methods: main.
    ENDCLASS.
    class lcl_controller IMPLEMENTATION.
       method main.
         DATA: lo_view type REF TO lcl_view,
               lo_data TYPE REF TO LCL_DATA .
         CREATE OBJECT: lo_data, lo_view.
         break developer.
         IF lo_view->START( ) Eq abap_true.
    **get the data
           lo_data->SELECT_DATA( s_vbeln[] ).
           lo_view->DISPLAY(
             changing
               IT_DATA = lo_data->GT_OUTPUT
         ENDIF.
       ENDMETHOD.
    ENDCLASS.
    INITIALIZATION.
    START-OF-SELECTION.
       break developer.
       DATA: lo_controller type REF TO lcl_controller.
       CREATE OBJECT lo_controller.
       lo_controller->MAIN( ).

    Here is the complete code that works fine!!!
    Thanks to your ideas:
    OO ALV
    *& Report  ZZ_SOLEN_FIRST
    REPORT ZZ_SOLEN_FIRST.
    DATA: gv_vbeln type vbap-Vbeln.
    ***Screen
    SELECTION-SCREEN: BEGIN OF SCREEN 100 TITLE t-004.
    SELECTION-SCREEN: BEGIN OF block aa WITH FRAME TITLE t-001.
    SELECT-OPTIONS: s_vbeln FOR gv_vbeln.
    SELECTion-SCREEN: END OF block aa.
    SELECTion-SCREEN: END OF SCREEN 100.
    *****DATA Layer
    class lcl_data DEFINITION.
       PUBLIC SECTION.
         TYPES: BEGIN OF ty_out,
           vbeln type vbap-vbeln,
           posnr type vbap-posnr,
           matnr type vbap-matnr,
           vkorg type vbak-vkorg,
           END OF ty_out
         TYPES: tt_out TYPE STANDARD TABLE OF ty_out.
         TYPES: gr_vbeln TYPE RANGE OF vbap-vbeln.
         DATA: gt_output TYPE tt_out.
         methods: constructor,
                  select_data IMPORTING VALUE(rs_vbeln) TYPE gr_vbeln.
    ENDclass.
    class lcl_data IMPLEMENTATION.
       method constructor.
         clear GT_OUTPUT.
       ENDMETHOD.
       method select_data.
         DATA: lt_vbak type SORTED TABLE OF vbak WITH UNIQUE KEY vbeln.
         FIELD-SYMBOLS: <lfs_output> like LINE OF gt_output,
                        <lfs_vbak> like LINE OF lt_vbak
         select vbeln posnr matnr from vbap
           INto TABLE
            GT_OUTPUT
           where vbeln in S_VBELN
         IF sy-SUBRC EQ 0.
           select * from vbak
             INTO TABLE lt_vbak
             FOR ALL ENTRIES IN  GT_OUTPUT
             where vbeln = GT_OUTPUT-vbeln
           LOOP AT gt_output ASSIGNING <lfs_output>.
             READ TABLE lt_vbak ASSIGNING <lfs_vbak>
             with TABLE KEY vbeln = <lfs_output>-vbeln.
             IF sy-Subrc eq 0.
               <lfs_output>-vkorg = <lfs_vbak>-VKORG.
             ENDIF.
           ENDLOOP.
         ENDIF.
       ENDMETHOD.
    ENDCLASS.
    ****Display
    class lcl_view DEFINITION.
       PUBLIC SECTION.
         methods: start RETURNING VALUE(rv_return_flag) type abap_bool.
         METHODS: display CHANGING it_data TYPE STANDARD TABLE.
    ENDCLASS.
    class lcl_view IMPLEMENTATION.
       METHOD start.
         call SELECTION-SCREEN 100.
         IF sy-subrc EQ 0.
           rv_return_flag = abap_true.
         ENDIF.
       endmethod.
       method display.
         DATA: lo_salv_table type REF TO CL_SALV_TABLE,
               lt_columns TYPE SALV_T_COLUMN_REF.
         FIELD-SYMBOLS: <lfs_columns> like LINE OF lt_columns.
         CL_SALV_TABLE=>FACTORY(
    *    exporting
    *      LIST_DISPLAY   = IF_SALV_C_BOOL_SAP=>FALSE    " ALV Displayed in List Mode
    *      R_CONTAINER    =     " Abstract Container for GUI Controls
    *      CONTAINER_NAME =
           importing
             R_SALV_TABLE   = lo_salv_table    " Basis Class Simple ALV Tables
           changing
             T_TABLE        = it_data
    *    catch CX_SALV_MSG.    " ALV: General Error Class with Message
         lt_columns = lo_salv_table->GET_COLUMNS( )->GET( ).
    *    LOOP AT  lt_columns ASSIGNING <lfs_columns>.
    *    break developer.
    *    ENDLOOP.
         lo_salv_table->DISPLAY( ).
       ENDMETHOD.
    ENDCLASS.
    class lcl_controller DEFINITION.
       PUBLIC SECTION.
         methods: main.
    ENDCLASS.
    class lcl_controller IMPLEMENTATION.
       method main.
         DATA: lo_view type REF TO lcl_view,
               lo_data TYPE REF TO LCL_DATA .
         CREATE OBJECT: lo_data, lo_view.
         break developer.
    *    while lo_view->START( ) eq abap_true.
    ***get the data
    *      lo_data->SELECT_DATA( s_vbeln[] ).
    *      lo_view->DISPLAY(
    *        changing
    *          IT_DATA = lo_data->GT_OUTPUT
    *    ENDWHILE.
         do.
           if lo_view->START( ) eq abap_true.
    ***get the data
             lo_data->SELECT_DATA( s_vbeln[] ).
             lo_view->DISPLAY(
               changing
                 IT_DATA = lo_data->GT_OUTPUT
           else.
             return.
           ENDIF.
         ENDDO.
       ENDMETHOD.
    ENDCLASS.
    class lcl_test_submit DEFINITION.
       PUBLIC SECTION.
         TYPES: tr_vbeln TYPE RANGE OF vbap-vbeln.
         data: lt_list type table_abaplist.
         methods: test_submit IMPORTING VALUE(ir_vbeln) type tr_vbeln
                              EXCEPTIONS submit_failed
                                         no_data_found
    ENDCLASS.
    class lcl_test_submit IMPLEMENTATION.
       method test_submit.
      submit ZZ_SOLEN_FIRST
       with s_vbeln in ir_vbeln
       exporting list to memory and return
    ***Get the list from the memory
        call function 'LIST_FROM_MEMORY'
           tables
             listobject = lt_list
           exceptions
             not_found  = 1
             others     = 2.
         if sy-subrc <> 0.
           raise submit_failed.
         endif.
         if lt_list is initial.
           raise no_data_found.
         endif.
       ENDMETHOD.
    ENDCLASS.
    INITIALIZATION.
    START-OF-SELECTION.
       break developer.
       DATA: lo_controller type REF TO lcl_controller.
    ****Testing the Main
       CREATE OBJECT lo_controller.
       lo_controller->MAIN( ).

Maybe you are looking for