Editor using ALV Container

Hi All,
Please anyone suggest me, how can I use text-editor in ALV container?
Means when i execute the program, i want to see editor screen.
Thanks
Amit

see
Custom Controls
A custom control is an area on a screen. You create them in the Screen Painter, and, like all other screen objects, they have a unique name. You use custom controls to embed controls. Controls are software components of the presentation server. Depending on the used SAP GUI, these are either ActiveX Controls or JavaBeans. They allow you to perform tasks, such as editing texts, locally on the presentation server. The control is driven by the application logic, which still runs on the application server.
The SAP Control Framework
The controls on the presentation server and the ABAP application programs on the application server communicate using the SAP Control Framework. The SAP Control Framework is programmed in ABAP Objects . It contains global classes that can be found in the class library under Basis ® Frontend Services. These classes encapsulate the communication between the application server and presentation server, which is implemented using Remote Function Call.
All application controls are encapsulated in a global class. You can find the SAP Basis controls in the Class Browser under Basis ® Frontend Services or Basis ® Component Integration. Programs that use controls on a screen work with the methods and events of the global classes that encapsulates them.
Container Controls
Before you can work with a custom control on a screen, you must assign a SAP Container Control to it. Container controls are instances of special global classes from the SAP Control Framework. The global class for custom controls is called CL_GUI_CUSTOM_CONTAINER. To link a custom control to a container control, pass the custom control name to the constructor of the container control when you instantiate it using CREATE OBJECT.
As well as using custom containers, you can link controls to a screen using a SAP Docking Container. This is encapsulated in the global class CL_GUI_DOCKING_CONTAINER. The SAP Docking Container does not place the control within a screen. Instead, it attaches it to one of the four edges. You can nest containers. For example, you can use the SAP Splitter Container (classes CL_GUI_EASY_SPLITTER_CONTAINER or CL_GUI_SPLITTER_CONTAINER) within other containers. This allows you to split a custom control or docking control into more than one area, allowing you to embed more than one control.
Application Controls
You must also create instances for the application controls that you want to place within your container - for example, a SAP Textedit Control (class CL_GUI_TEXTEDIT) or a SAP Tree Control (for which there is more than one global class - an example is CL_GUI_SIMPLE_TREE). When you instantiate the control, you pass a reference to the container in which you want to place it to the PARENT parameter of its constructor method. The container may be an instance of the class CL_GUI_CUSTOM_CONTAINER, but can also be an instance of one of the other SAP Container controls.
Control Methods
For information about control methods and their documentation, refer to the class definitions in the Class Builder or the SAP Library documentation. To minimize the network load between the application and presentation servers, method calls are buffered in the automation queue before being sent to the presentation server at defined synchronization points. One of the automatic synchronization points is the end of PBO processing. You can force a synchronization point in your program by calling a method that is not buffered, or by calling the static method FLUSH.
Control Events
Unlike screens, on which user interaction triggers the PAI event and control returns to the application server, user interaction on controls is not automatically passed back to the application server. If you want an event to be passed back to the application server, you must register it in your program using the special method SET_REGISTERED_EVENTS. For a list of the events that you can register for each control, refer to its wrapper class in the Class Builder. You can register two kinds of event handling using SET_REGISTERED_EVENTS:
System Events (Default)
The event is passed to the application server, but does not trigger the PAI. If you have registered an event handler method in your ABAP program for the event (using the SET HANDLER statement), this method is executed on the application server.
Within the event handler method, you can use the static method SET_NEW_OK_CODE of the global class CL_GUI_CFW to set a function code and trigger the PAI event yourself. After the PAI has been processed, the PBO event of the next screen is triggered.
The advantage of using this technique is that the event handler method is executed automatically and there are no conflicts with the automatic input checks associated with the screen. The disadvantage is that the contents of the screen fields are not transported to the program, which means that obsolete values could appear on the next screen. You can work around this by using the SET_NEW_OK_CODE method to trigger field transport and the PAI event after the event handler has finished.
Application Events
The event is passed to the application server, and triggers the PAI. The function code that you pass contains an internal identifier. You do not have to evaluate this in your ABAP program. Instead, if you want to handle the event, you must include a method call in a PAI dialog module for the static method DISPATCH of the global class CL_GUI_CFW. If you have defined an event handler method in your ABAP program for the event (using the SET HANDLER statement), the DISPATCH method calls it. After the event handler has been processed, control returns to the PAI event after the DISPATCH statement and PAI processing continues.
The advantage of this is that you can specify yourself the point at which the event is handled, and the contents of the screen fields are transported to the application server beforehand. The disadvantage is that this kind of event handling can lead to conflicts with the automatic input checks on the screen, causing events to be lost.
Related Information
For further information about controls, and in particular, help on troubleshooting and optimizing synchronization, refer to BC Controls Tutorial and BC SAP Control Framework.
Example
The following example shows the difference between system and application events.
REPORT demo_custom_control .
Declarations *****************************************************
CLASS event_handler DEFINITION.
  PUBLIC SECTION.
    METHODS: handle_f1 FOR EVENT f1 OF cl_gui_textedit
                       IMPORTING sender,
             handle_f4 FOR EVENT f4 OF cl_gui_textedit
                       IMPORTING sender.
ENDCLASS.
DATA: ok_code LIKE sy-ucomm,
      save_ok LIKE sy-ucomm.
DATA: init,
      container TYPE REF TO cl_gui_custom_container,
      editor    TYPE REF TO cl_gui_textedit.
DATA: event_tab TYPE cntl_simple_events,
      event     TYPE cntl_simple_event.
DATA: line(256) TYPE c,
      text_tab LIKE STANDARD TABLE OF line,
      field LIKE line.
DATA handle TYPE REF TO event_handler.
Reporting Events ***************************************************
START-OF-SELECTION.
  line = 'First line in TextEditControl'.
  APPEND line TO text_tab.
  line = '----
  APPEND line TO text_tab.
  line = '...'.
  APPEND line TO text_tab.
  CALL SCREEN 100.
Dialog Modules *****************************************************
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'SCREEN_100'.
  IF init is initial.
    init = 'X'.
    CREATE OBJECT:
           container EXPORTING container_name = 'TEXTEDIT',
           editor    EXPORTING parent = container,
           handle.
    event-eventid = cl_gui_textedit=>event_f1.
    event-appl_event = ' '.                     "system event
    APPEND event TO event_tab.
    event-eventid = cl_gui_textedit=>event_f4.
    event-appl_event = 'X'.                     "application event
    APPEND event TO event_tab.
    CALL METHOD: editor->set_registered_events
                 EXPORTING events = event_tab.
    SET HANDLER handle->handle_f1
                handle->handle_f4 FOR editor.
  ENDIF.
  CALL METHOD editor->set_text_as_stream
              EXPORTING text = text_tab.
ENDMODULE.
MODULE cancel INPUT.
  LEAVE PROGRAM.
ENDMODULE.
MODULE user_command_0100 INPUT.
  save_ok = ok_code.
  CLEAR ok_code.
  CASE save_ok.
    WHEN 'INSERT'.
      CALL METHOD editor->get_text_as_stream
                  IMPORTING text = text_tab.
    WHEN 'F1'.
      MESSAGE i888(sabapdocu) WITH text-001.
    WHEN OTHERS.
      MESSAGE i888(sabapdocu) WITH text-002.
      CALL METHOD cl_gui_cfw=>dispatch.
  ENDCASE.
  SET SCREEN 100.
ENDMODULE.
Class Implementations **********************************************
CLASS event_handler IMPLEMENTATION.
  METHOD handle_f1.
    DATA row TYPE i.
    MESSAGE i888(sabapdocu) WITH text-003.
    CALL METHOD sender->get_selection_pos
         IMPORTING from_line = row.
    CALL METHOD sender->get_line_text
         EXPORTING line_number = row
         IMPORTING text = field.
    CALL METHOD cl_gui_cfw=>set_new_ok_code 
         EXPORTING new_code = 'F1'.         
    CALL METHOD cl_gui_cfw=>flush.
  ENDMETHOD.
  METHOD handle_f4.
    DATA row TYPE i.
    MESSAGE i888(sabapdocu) WITH text-004.
    CALL METHOD sender->get_selection_pos
         IMPORTING from_line = row.
    CALL METHOD sender->get_line_text
         EXPORTING line_number = row
         IMPORTING text = field.
    CALL METHOD cl_gui_cfw=>flush.
  ENDMETHOD.
ENDCLASS.
The layout of screen 100 is:
The screen contains an output field field and a custom control called textedit.
The flow logic of screen 100 is:
PROCESS BEFORE OUTPUT.
  MODULE status_0100.
PROCESS AFTER INPUT.
  MODULE cancel AT EXIT-COMMAND.
  MODULE user_command_0100.
The GUI status SCREEN_100 has the functions BACK, EXIT, and CANCEL (all with type E) and the function INSERT (normal function).
There is a local class event_handler defined in the program. It contains event handler methods for the F1 and F4 events of global class CL_GUI_TEXTEDIT. When you run the program, the classes CL_GUI_CUSTOM_CONTROL, CL_GUI_TEXTEDIT, and event_handler are instantiated in the PBO of screen 100.
The container control is linked to the custom control on the screen, and the instance of the textedit control is linked to this container. The F1 and F4 events of the textedit control are registered using the SET_REGISTERED_EVENTS method to ensure that they are passed to the application server when they occur. F1 is defined as a system event, F4 as an application event. The event handler methods of the handle instance of the class event_handler are registered as handlers for the events.
Before screen 100 is displayed, the program fills the textedit control with the contents of table text_tab . The user can edit the text while the screen is displayed. If the user chooses INSERT, the PAI event is triggered and the current text from the textedit control is copied into table text_tab.
If the user chooses F1 on the textedit control, the handle_f1 method is executed. This assigns the contents of the line to the field field: The method SET_NEW_OK_CODE triggers the PAI event. It is this that ensures that the PBO is processed, and the contents of field are sent to the screen.
If the user chooses F4 on the textedit control, the PAI event is triggered. The DISPATCH method is called, and this triggers the method handle_f4. This assigns the contents of the line to the field field: Since the PAI processing continues after the event, the PBO event follows, and the field contents are transferred to the screen.
The contents of the textedit control are not passed to the internal table text_tab either after F1 or after F4. The contents of the textedit control are therefore overwritten in the PBO event with the previous contents of text_tab.
http://help.sap.com/saphelp_nw2004s/helpdata/en/2a/755b94ca5911d299af5c9604c10e27/content.htm

Similar Messages

  • How to get custom PF status in ALV using cl_salv_table (Using  a container)

    I created a screen and inside that a container.I tried for an ALV display using CL_SALV_TABLE in the cvontainer. It's working. when I opted for default PF status.It's working. But when I tried for custom PF status using SET_SCREEN_STATUS method, it's throwing some exception. But it's working if I don't use a container .
    In both the cases I copied PF status into my program from some standard program.Then added some functionality.

    I f you are using Screen and container use CLass:
    CL_GUI_ALV_CONTAINER
    CL_GUI_ALV_GRID
    METHOD-->SET_TABLE_FOR_FIRST_DISPLAY    " to display Alv.
    Create PF-STATUS in PBO of screen.
    [Change standard PF|https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/change%252balv%252bstandard%252btoolbar%252band%252brespond%252bit]
    EXCLUDE Certain buttons on standard toolbar:
    DATA: lt_exclude TYPE ui_functions,
          ls_exclude TYPE ui_func.
      ls_exclude = cl_gui_alv_grid=>mc_fc_sum.
      APPEND ls_exclude TO lt_exclude.
      CLEAR ls_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_mb_filter.
      APPEND ls_exclude TO lt_exclude.
      CLEAR ls_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_mb_sum.
      APPEND ls_exclude TO lt_exclude.
    pass lt_exclude to METHOD-->SET_TABLE_FOR_FIRST_DISPLAY
    Regards,
    Gurpreet

  • How to display 3 alv with top-of-page using splitter container

    Hi,
    I want to display 3 different alv in a single container corresponding to the 3 check boxes on selection screen.
    i.e.
    If user selects 1 check box only one alv should be displayed, if 2 checkboxes selected by user 2 alv should be displayed and same for 3.
    I cannot use 3 different containers bcoz if second checkbox is not selected then that place remains blank. So I am using single container and using splitter container dividing it into the no of rows corresponding to the no. of checkboxs selected by user.
    Now I also want to display top-of-page for each alv. Please guide me how to achieve this.
    Thanks & regards,
    Harshada

    create with some IF_ELSE conditions as i have done below. in my case the same things are required. if error table is there only then it will be displayed, else only output will be displayed.
    * First Main Container
      CREATE OBJECT obj_main1
        EXPORTING
          container_name = 'CC_CONTAINER'
          style          = cl_gui_custom_container=>ws_maximizebox.
    * create top-document
      CREATE OBJECT obj_dyndoc_id
        EXPORTING
          style = 'ALV_GRID'.
      IF pr_view EQ c_x OR pr_stat EQ c_x.
    * First Splitter Container
        CREATE OBJECT obj_splitter1
          EXPORTING
            parent  = obj_main1
            rows    = 2
            columns = 1.
    * Place obj_parent_html in First row First column
    * for Top_of_page
        CALL METHOD obj_splitter1->get_container
          EXPORTING
            row       = 1
            column    = 1
          RECEIVING
            container = obj_parent_html.
    * Place obj_container1 in Second row First column
        CALL METHOD obj_splitter1->get_container
          EXPORTING
            row       = 2
            column    = 1
          RECEIVING
            container = obj_container1.
    * Set the height of Top of page
        CALL METHOD obj_splitter1->set_row_height
          EXPORTING
            id     = 1
            height = 24.
      ELSEIF pr_email EQ c_x.
    * First Splitter Container
        CREATE OBJECT obj_splitter1
          EXPORTING
            parent  = obj_main1
            rows    = 3
            columns = 1.
    * Place obj_parent_html in First row First column
    * for Top_of_page
        CALL METHOD obj_splitter1->get_container
          EXPORTING
            row       = 1
            column    = 1
          RECEIVING
            container = obj_parent_html.
    * Place obj_container1 in First row First column
        CALL METHOD obj_splitter1->get_container
          EXPORTING
            row       = 2
            column    = 1
          RECEIVING
            container = obj_container1.
    * Place obj_container2 in Second row First column
        CALL METHOD obj_splitter1->get_container
          EXPORTING
            row       = 3
            column    = 1
          RECEIVING
            container = obj_container2.
    * Set the height of Top of page
        CALL METHOD obj_splitter1->set_row_height
          EXPORTING
            id     = 1
            height = 24.
      ENDIF.
    Please note there is no need to create a hEADER in the container, but create it for the 1st table only which is always displayed
    ags.
    Edited by: ags on Nov 4, 2009 4:49 PM
    Edited by: ags on Nov 4, 2009 4:50 PM

  • Dynamically change in size of the custom container using ALV GRID (OOPS)

    Hi Gurus!!!!
    I have an issue with the output of the report which is developed using ALV GRID (OOPS). I have used the custom container occupying full screen (Screen painter). When I execute the report using my PC the output displays report as expected in full screen. The problem is when we execute this report in 19 INCH monitor then there is always gap below the report.
    As per my understanding we should have a code to change the size of custom container dynamically.
    Please suggest some help on this.
    Thanks,
    Hemal Shah

    Hi,
    If you set the attributes, Resizing - Vertical and Horizontal for the customer container, than system will resize the size of the custome continer as per the resolution.
    Hope it helps,
    Sumana

  • OOPS ALV using Docking container

    Hi,
      I am trying to use ALV using oops concept, but the report is not displaying the ALV grid.
    {please let me know if there are any error.
    Edited by: Arunsri on Jun 3, 2010 5:42 PM
    Edited by: Rob Burbank on Jun 3, 2010 11:57 AM

    data : alv_container  type ref to cl_gui_docking_container.
    data : alv_grid       type ref to cl_gui_alv_grid.
    data : layout    type lvc_s_layo.
    data : variant type  disvariant.
    check alv_container is initial.
      CREATE OBJECT alv_container
        EXPORTING
    *     parent                      =
          repid                       = sy-repid
          dynnr                       = sy-dynnr
          side                        = alv_container->dock_at_left
    *      extension                   = 1550
    *     style                       =
    *     lifetime                    = lifetime_default
    *     caption                     =
    *     metric                      = 0
    *     ratio                       = '95'
    *     no_autodef_progid_dynnr     =
    *     name                        =
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          lifetime_dynpro_dynpro_link = 5
          OTHERS                      = 6
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    *- Make the docking container as parent to the grid
      CREATE OBJECT alv_grid
        EXPORTING
          i_parent          = alv_container
        EXCEPTIONS
          error_cntl_create = 1
          error_cntl_init   = 2
          error_cntl_link   = 3
          error_dp_create   = 4
          OTHERS            = 5.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    *  layout-zebra = 'X'.
      PERFORM build_fieldcat.
      variant-report = sy-repid.
    *- Call grid for display
      CALL METHOD alv_grid->set_table_for_first_display
        EXPORTING
          i_structure_name               = 'WT_TEST'
          is_variant                    = variant
          i_save                         = 'A'
    *      is_layout                      = layout
        CHANGING
          it_outtab                      = WT_TEST
          it_fieldcatalog                = wt_fcat_log
        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.

  • How to print check boxes in output using alv

    send me replly immediately

    hi
    Program Name: ALV ON SECONDARY LISTS            Creation: 02/01/2007*
    SAP Name    : YH634_0102007_ALV_LIST            Application:        *
    Author      : P.V.D.Veeresh Babu                Type: 1             *
    Description : This program is used to display secondary lists using *
                  ALV.                                                  *
    Inputs:                                                             *
      Tables:                                                           *
        SPFLI - Flight information                                      *
        SFLIGHT - Flight                                                *
        SBOOK   - Flight booking details                                *
      Select options:                                                   *
        N/A                                                             *
      Parameters:                                                       *
        NO                                                              *
    Outputs: secondary lists with ALV                                   *
    External Routines                                                   *
      Function Modules:                                                 *
        REUSE_ALV_LIST_DISPLAY                                          *
      Transactions    : No                                              *
      Programs        : No                                              *
    Return Codes: No                                                    *
    Ammendments:                                                        *
       Programmer        Date     Req. #            Action              *
    ================  ==========  ======  ==============================*
    type-pools: slis.
    *" Data declarations...................................................
    Data declaration of the structure to hold layout details            *
    data:
      fs_layout type slis_layout_alv.
    *" Data declarations...................................................
    Data declaration of the structure to hold spfli details             *
    data: begin of fs_spfli,
            color(4) type c,               " Color
            check    type c.               " Check box
            include  structure spfli.      " Spfli
    data  end of fs_spfli.
    *" Data declarations...................................................
    Data declaration of the structure to hold sflight details           *
    data:begin of fs_sflight,
          color(4) type c,                 " Color
          check    type c.                 " Check box
          include  structure sflight.      " Sflight
    data  end of fs_sflight.
    *" Data declarations...................................................
    Data declaration of the structure to hold sbook details             *
    data:
      fs_sbook like sbook.
    Internal table to hold list details                                 *
    data:
      t_sbook like
    standard table
           of fs_sbook.
    Internal table to hold list details                                 *
    data:
      t_sflight like
       standard table
             of fs_sflight .
    Internal table to hold spfli details                                *
    data:
    t_spfli like
    standard table
    of fs_spfli.
    fs_layout-box_fieldname = 'CHECK'.
    fs_layout-info_fieldname = 'COLOR'.
    "........Retrieving basic list data containing spfli details......."
    select *
      from spfli
      into corresponding fields of table t_spfli.
    if sy-subrc ne 0.
      message text-001 type 'I'.
    endif.                                 " IF SY-SUBRC NE 0
    ".................Calling function module for ALV..................."
    call function 'REUSE_ALV_LIST_DISPLAY'
      exporting
        i_callback_program       = sy-repid
        i_callback_pf_status_set = 'STATUS1'
        i_callback_user_command  = 'USER_COMMAND1'
        i_structure_name         = 'SPFLI'
        is_layout                = fs_layout
      tables
        t_outtab                 = t_spfli
      exceptions
        program_error            = 1
        others                   = 2.
    if sy-subrc <> 0.
      message text-002 type 'I'.
    endif.                                 " IF SY-SUBRC NE 0
    Form  STATUS1                                                     *
    This subroutine gives pf-status for spfli list                    *
         -->T_EXTAB    excluding table                                 *
    form status1 using t_extab type slis_t_extab.
      set pf-status 'STATUS1'.
    endform.                               " STATUS1
    Form  USER_COMMAND1                                               *
    This subroutine displays secondary list containing sflight details*
         -->FS_UCOMM   user command                                    *
         -->T_SELFIELD selfield                                        *
    form user_command1 using fs_ucomm type sy-ucomm
                             t_selfield type slis_selfield.
      case fs_ucomm.
        when 'SFLIGHT'.
          perform display_list2.
      endcase.                             " CASE FS_UCOMM
      t_selfield-refresh = 'X'.
    endform.                               " USER_COMMAND1
    Form  DISPLAY_LIST2                                                *
    This subroutine displays sflight details on secondary list         *
    There are no interface parameters to be passed in this subroutine  *
    form display_list2 .
      data lw_flag type i.                 " Flag
      refresh t_sflight.
      loop at t_spfli into fs_spfli.
        if fs_spfli-check = 'X'.
    "........Retrieving basic list data containing sflight details......."
          select *
            from sflight
       appending corresponding fields of table t_sflight
           where carrid eq fs_spfli-carrid
             and connid eq fs_spfli-connid.
          if sy-subrc eq 0.
            lw_flag = 1.
          endif.                           " IF SY-SUBRC EQ 0
          FS_SPFLI-CHECK = '0'.
          fs_spfli-color = 'C510'.
          modify t_spfli from fs_spfli .
        endif.                             " IF FS_SPFLI-CHECK EQ 'X'
      endloop.                             " LOOP AT T_SPFLI INTO FS_SPFLI
      if lw_flag eq 0.
        message text-003 type 'E'.
      endif.                               " IF LW_FLAG EQ 1
    ".................Calling function module for ALV..................."
      call function 'REUSE_ALV_LIST_DISPLAY'
        exporting
          i_callback_program       = sy-repid
          i_callback_pf_status_set = 'STATUS2'
          i_callback_user_command  = 'USER_COMMAND2'
          i_structure_name         = 'SFLIGHT'
          is_layout                = fs_layout
        tables
          t_outtab                 = t_sflight
        exceptions
          program_error            = 1
          others                   = 2.
      if sy-subrc <> 0.
        message text-002 type 'I'.
      endif.                               " IF SY-SUBRC NE 0
    endform.                               " DISPLAY_LIST2
    Form  STATUS2                                                     *
    This subroutine gives pf-status for secondary list.               *
         -->T_EXTAB    Excluding table                                 *
    form status2 using t_extab type slis_t_extab.
      set pf-status 'STATUS2'.
    endform.                               " STATUS2
    Form  USER_COMMAND2                                               *
    This subroutine gives secondary list containing sbook details     *
         -->FS_UCOMM   user command                                    *
         -->T_SELFIELD selfield                                        *
    form user_command2 using fs_ucomm type sy-ucomm
                             t_selfield type slis_selfield.
      case fs_ucomm.
        when 'SBOOK'.
          perform display_list3.
      endcase.                             " CASE FS_UCOMM
      t_selfield-refresh = 'X'.
    endform.                               " USER_COMMAND2
    Form  DISPLAY_LIST3                                                *
    This subroutine displays sbook details on secondary list           *
    There are no interface parameters to be passed in this subroutine  *
    form display_list3 .
      data lw_flag type i.                 " Flag
      refresh t_sbook.
      loop at t_sflight into fs_sflight.
        if fs_sflight-check eq 'X'.
    "........Retrieving basic list data containing sbook details......."
          select *
            from sbook
       appending corresponding fields of table t_sbook
           where carrid eq fs_sflight-carrid
             and connid eq fs_sflight-connid
             and fldate eq fs_sflight-fldate.
          if sy-subrc eq 0.
            lw_flag = 1.
          endif.                           " IF SY-SUBRC EQ 0
          FS_SFLIGHT-CHECK = '0'.
          fs_sflight-color = 'C910'.
          modify  t_sflight from fs_sflight.
        endif.                             " IF FS_FLIGHT-CHECK EQ 'X'
      endloop.                             " LOOP AT T_SFLIGHT INTO....
      if lw_flag eq 0.
        message text-004 type 'E'.
      endif.                               " IF LW_FLAG EQ 1
    ".................Calling function module for ALV..................."
      call function 'REUSE_ALV_LIST_DISPLAY'
        exporting
          i_structure_name = 'SBOOK'
          is_layout        = fs_layout
        tables
          t_outtab         = t_sbook
        exceptions
          program_error    = 1
          others           = 2.
      if sy-subrc <> 0.
        message text-002 type 'I'.
      endif.                               " IF SY-SUBRC NE 0
    endform.                               " DISPLAY_LIST3
    regards,
    veeresh
    null

  • Sublist by using ALV OO can not be refreshed

    Hi Gurus,
    i met with a very strange problem. i created a interactive list by using ALV OO and if you double click on one of the rows, the screen will go to a sublist which displays the detail information of the row.
    My question is every time i chose a row(double click), the program will always display the sublist of the row firstly chosen. For example:
    i have a overview list:
    10001   Micheal
    10002   Tom
    10003   Michelle
    and the sublist for 10001:
    Surname     Frank
    Givenname Micheal
    Age            18
    Gender       Male
    sublist for 10002:
    Surname     Lee
    Givenname Tom
    Age            19
    Gender       Male
    sublist for 10003:
    Surname    Williams
    Givenname Michelle
    Age            17
    Gender       Female
    at the very beginning, the program is launched, the overlist shall be displayed correctly. then if i double click on 10001, the detail information of Micheal will be displayed in a sublist correctly. after that i go back to the overview list and double click on 10002, the detail information displayed is still for Micheal instead of Tom. and no matter which row is chosen, the detail information displayed will always be :
    Surname     Frank
    Givenname Micheal
    Age            18
    Gender       Male
    Here is some of the source code
    the main program:
    INITIALIZATION.
      PERFORM f_init.
    AT SELECTION-SCREEN on p_mode.
      PERFORM f_screen_change.
    START-OF-SELECTION.
      PERFORM f_fetch_data.
    END-OF-SELECTION.
      CALL SCREEN 2000.
    The code for event double click:
    FORM handle_double_click USING i_row_id    TYPE lvc_s_row
                                   i_column_id TYPE lvc_s_col
                                   is_row_no   TYPE lvc_s_roid.
      REFRESH i_rebate_detail.
      READ TABLE i_rebate_header INDEX is_row_no-row_id.
      IF sy-subrc EQ 0.
        LOOP AT i_rebate_log_detail WHERE vkorg = i_rebate_header-vkorg
                                      AND vtweg = i_rebate_header-vtweg
                                      AND spart  = i_rebate_header-spart
                                      AND payer = i_rebate_header-payer.
          MOVE-CORRESPONDING  i_rebate_log_detail TO i_rebate_detail.
          APPEND i_rebate_detail TO i_rebate_detail.
          CLEAR i_rebate_detail.
        ENDLOOP.
        CALL SCREEN 3000.
      ENDIF.
    ENDFORM .                    "handle_double_click

    The source code for sublist display:
    FORM f_output_detail.
    * ALV Grid instance reference
      DATA:
        gr_alvgrid_detail    TYPE REF TO
                             cl_gui_alv_grid,
    * Custom container instance reference
        gr_ccontainer_detail TYPE REF TO
                             cl_gui_custom_container,
    * Field catalog table
        gt_fieldcat_detail   TYPE lvc_t_fcat,
    * Layout structure
        gs_layout_detail     TYPE lvc_s_layo.
      IF gr_alvgrid_detail IS INITIAL .
    * Creating custom container instance
        CREATE OBJECT gr_ccontainer_detail
          EXPORTING
            container_name              = 'ALV_CONTAINER_DETAIL'
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6.
        IF sy-subrc <> 0.
    *--Exception handling
        ENDIF.
    *----Creating ALV Grid instance
        CREATE OBJECT gr_alvgrid_detail
          EXPORTING
            i_parent          = gr_ccontainer_detail
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            OTHERS            = 5.
        IF sy-subrc <> 0.
    *--Exception handling
        ENDIF.
    *----Preparing field catalog.
        PERFORM f_field_catalog_detail CHANGING gt_fieldcat_detail.
    *----Preparing layout structure
        PERFORM f_layout CHANGING gs_layout_detail .
        CALL METHOD gr_alvgrid_detail->set_table_for_first_display
          EXPORTING
            is_layout = gs_layout_detail
          CHANGING
            it_outtab = i_rebate_detail[]
            it_fieldcatalog = gt_fieldcat_detail[]
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error = 2
            too_many_lines = 3
            OTHERS = 4 .
        IF sy-subrc <> 0.
    *--Exception handling
        ENDIF.
      ELSE .
        CALL METHOD gr_alvgrid_detail->refresh_table_display
          EXCEPTIONS
            finished = 1
            OTHERS = 2 .
        IF sy-subrc <> 0.
    *--Exception handling
        ENDIF.
      ENDIF.
    ENDFORM.                    " F_OUTPUT

  • Help - Editor does not contain a main type error (Eclipse)

    Hello,
    I'm trying to run a Text input program out of the Eclipse program and I keep getting this Editor does not contain a main type error - can someone help me
    here's the code
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.text.DecimalFormat;
    import java.util.Scanner;
    import uwcse.io.Input;
    public class FileInputExample {
         public static void main(String[] args) {
              // Create a Scanner to read the input file
              String fileName = new Input().readString("Input file name? ");
              System.out.println();
              Scanner scan;
              try {
                   scan = new Scanner(new File(fileName));
              } catch (FileNotFoundException e) {
                   System.out.println(fileName + " doesn't exist!");
                   return;
              // Read the file and count the number of occurences of A, B, ...
              int[] count = new int[26];
              while (scan.hasNextLine()) {
                   String line = scan.nextLine();
                   line = line.toLowerCase();
                   for (int i = 0; i < line.length(); i++) {
                        char c = line.charAt(i);
                        if (c >= 'a' && c <= 'z') {
                             count[c - 'a']++;
              scan.close();
              int length = 0;
              for (int i = 0; i < count.length; i++) {
                   length += count;
              // Display the statistics (as an histogram)
              DecimalFormat df = new DecimalFormat("0.00");
              for (int i = 0; i < count.length && length > 0; i++) {
                   double percent = count[i] * 100.0 / length;
                   String display = "" + (char) ('a' + i);
                   display += "(" + df.format(percent) + "%):\t";
                   for (int j = 1; j <= Math.round(percent); j++) {
                        display += "X";
                   System.out.println(display);
    }Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    First, note that your program uses a non-standard class, "uwcse.io.Input" which is not available to us. Normally that is a show stopper - in this case, it's not, as I was able to eliminate its use.
    Your program runs fine, so the error is an Eclipse error unrelated to Java.
    You need to ask for help at an Eclipse support site, not here, as these forums are Java language forums.

  • Need to use ALV instead of write:/ statement in this perform

    How can I use ALV within this perform instead of using Write:/ in it.
    Scroll the program. At the bottom there is use of write:/ statement.
    How to use ALV in this perform?
    FORM display_logfile .
      TYPES: BEGIN OF lt_openbal,
                bukrs TYPE bukrs,
                hkont TYPE hkont,
                augdt TYPE augdt,
                augbl TYPE augbl,
                zuonr TYPE dzuonr,
                gjahr TYPE gjahr,
                belnr TYPE belnr_d,
                buzei TYPE buzei,
                shkzg TYPE shkzg,
                dmbtr TYPE dmbtr,
             END OF lt_openbal,
             BEGIN OF lt_log2,
                hkont TYPE hkont,
                opbal TYPE dmbtr,
                exp   TYPE dmbtr,
                cap   TYPE dmbtr,
                err   TYPE dmbtr,
             END OF lt_log2,
             BEGIN OF lt_zsct_record,
                kongr TYPE ckml_kongr,
                hkont TYPE hkont,
                zcptp TYPE zdecptp,
                zerrc TYPE zdeerrc,
             END OF lt_zsct_record.
      DATA: lw_zscs_record  TYPE t_zscs_record,
            lw_zsct_record       TYPE lt_zsct_record,
            li_zsct_record         TYPE STANDARD TABLE OF lt_zsct_record,
            li_zsct_record1       TYPE STANDARD TABLE OF lt_zsct_record,
            lw_log1                  TYPE t_zscs_record,
            li_log1                   TYPE STANDARD TABLE OF t_zscs_record,
            li_temp                  TYPE STANDARD TABLE OF t_zsct_autoinv,
            li_openbal              TYPE STANDARD TABLE OF lt_openbal,
            li_openbal_mod      TYPE STANDARD TABLE OF lt_openbal,
            li_log2                   TYPE STANDARD TABLE OF lt_log2,
            li_log2_t                TYPE STANDARD TABLE OF lt_log2,
            lw_log2                 TYPE lt_log2,
            lw_log2_t               TYPE lt_log2,
            lw_openbal_mod    TYPE lt_openbal,
            lw_openbal            TYPE lt_openbal.
      i_zscs_record1 = i_zscs_record.
      DELETE i_zscs_record1 WHERE zerrf NE space.
      SORT i_error_bapi BY recid.
      SORT i_error_bdc BY recid.
      SORT i_suc_bdc BY recid.
      SORT i_suc_bapi BY recid.
      SORT i_zscs_record1 BY recid.
      LOOP AT i_zscs_record1 INTO lw_zscs_record.
        lw_log1-recid = lw_zscs_record-recid.
        lw_log1-kongr = lw_zscs_record-kongr.
        lw_log1-hkont = lw_zscs_record-hkont.
        CALL FUNCTION 'CONVERSION_EXIT_ABPSP_OUTPUT'
          EXPORTING
            input  = lw_zscs_record-projk
          IMPORTING
            output = lw_log1-projk.
        lw_log1-werks = lw_zscs_record-werks.
        lw_log1-matnr = lw_zscs_record-matnr.
        lw_log1-zcptp = lw_zscs_record-zcptp.
        lw_log1-zerrf = lw_zscs_record-zerrf.
    To  Check if the KONGR value is is equal to 'E'
        IF lw_zscs_record-kongr = c_e.
          READ TABLE i_error_bapi INTO w_error_bapi WITH KEY recid = lw_zscs_record-recid BINARY SEARCH.
          IF sy-subrc = 0.
            lw_log1-zerrc = w_error_bapi-number.
            lw_log1-zertx = w_error_bapi-message.
          ENDIF.
        ELSE.
          READ TABLE i_error_bdc INTO w_error_bdc WITH KEY recid = lw_zscs_record-recid BINARY SEARCH.
          IF sy-subrc = 0.
            lw_log1-zerrc = w_error_bdc-number.
            lw_log1-zertx = w_error_bdc-message.
          ENDIF.
        ENDIF.
    *****To Check if the KONGR value is is equal to 'E'
        IF lw_zscs_record-kongr = c_e.
          READ TABLE i_suc_bapi INTO w_suc_bapi WITH KEY recid = lw_zscs_record-recid BINARY SEARCH.
          IF sy-subrc = 0.
            lw_log1-zerrf = c_x.
    *******To check if  lw_log1-zertx = w_error_bapi-message.
          ENDIF.
        ELSE.
          READ TABLE i_suc_bdc INTO w_suc_bdc WITH KEY recid = lw_zscs_record-recid BINARY SEARCH.
          IF sy-subrc = 0.
            lw_log1-zerrf = c_x.
    ********To check if lw_log1-zertx = w_error_bdc-message.
          ENDIF.
        ENDIF.
        APPEND lw_log1 TO li_log1.
    *To clear work areas
        CLEAR: lw_log1,
               w_error_bapi,
               w_suc_bdc,
               w_suc_bapi,
               w_error_bdc,
               lw_zscs_record.
      ENDLOOP.
      IF NOT i_zscs_record1 IS INITIAL.
    *To retrieve required data from the custom table ZSCT_AUTOINV
        SELECT saknr
               fipos
               geber
               saknr_off
               fipos_off
          FROM zsct_autoinv
          INTO TABLE i_autoinv
           FOR ALL ENTRIES IN i_zscs_record1
           WHERE saknr = i_zscs_record1-hkont.
        IF sy-subrc = 0.
          SORT i_autoinv.
        ENDIF.
      ENDIF.
    Assigning I_AUTOINV data into a local internal table for further processing
      li_temp[] = i_autoinv[ ].
    Sort LI_TEMP by SAKNR
      SORT li_temp BY saknr.
    Delete adjacent duplicates from LI_TEMP comparing SAKNR
      DELETE ADJACENT DUPLICATES FROM li_temp COMPARING saknr.
    Check if LI_TEMP is initial
      IF NOT li_temp[] IS INITIAL.
    Retrieve required data from table BSIS for all the G/L accounts
        SELECT  bukrs
                hkont
                augdt
                augbl
                zuonr
                gjahr
                belnr
                buzei
                shkzg
                dmbtr
           FROM bsis
           INTO TABLE li_openbal_mod
           FOR ALL ENTRIES IN li_temp
         WHERE  bukrs = c_wfp
           AND  hkont = li_temp-saknr.
        IF sy-subrc = 0.
        ENDIF.
      ENDIF.
      SORT li_openbal_mod BY hkont.
    ****Retrieve data from table ZSCT_RECORD for further processing for
    ****all entries where ZERRF is equal to space
      IF p_prsall = c_x.
        SELECT kongr
               hkont
               zcptp
               zerrc
          FROM zsct_record                                  "#EC CI_NOFIRST
          INTO TABLE li_zsct_record
          WHERE zerrf = space.
        IF sy-subrc = 0.
    *****Delete records from LI_ZSCT_RECORD where HKONT value is equal to space
          DELETE li_zsct_record WHERE hkont EQ space.
        ENDIF.
      ELSEIF p_cstcpt = c_x.
        SELECT kongr
               hkont
               zcptp
               zerrc
          FROM zsct_record                                  "#EC CI_NOFIRST
          INTO TABLE li_zsct_record
         WHERE zerrf = space
         AND   kongr NE c_e.
        IF sy-subrc = 0.
    ******Delete records from LI_ZSCT_RECORD where HKONT value is equal to space
          DELETE li_zsct_record WHERE hkont EQ space.
        ENDIF.
      ELSEIF p_cstexp = c_x.
        SELECT kongr
               hkont
               zcptp
               zerrc
         FROM  zsct_record                                  "#EC CI_NOFIRST
         INTO TABLE li_zsct_record
         WHERE zerrf = space
         AND   kongr EQ c_e.
        IF sy-subrc = 0.
    ******Delete records from LI_ZSCT_RECORD where HKONT value is equal to space
          DELETE li_zsct_record WHERE hkont EQ space.
        ENDIF.
      ENDIF.
      LOOP AT li_openbal_mod INTO lw_openbal.
        IF lw_openbal-shkzg = c_shkzg1.
          v_todmbtr = v_todmbtr + lw_openbal-dmbtr.
        ELSEIF lw_openbal-shkzg = c_shkzg2.
          v_todmbtr = v_todmbtr - lw_openbal-dmbtr.
        ENDIF.
        AT END OF hkont.
          lw_log2-hkont = lw_openbal-hkont.           "GL account
          lw_log2-opbal = ABS( v_todmbtr ).      "Open item balance
          APPEND lw_log2 TO li_log2.
    *log record appended with GL Account and account open item balance
          CLEAR: v_todmbtr,
                 lw_openbal.
        ENDAT .
      ENDLOOP.
      SORT li_log2 BY hkont.
      LOOP AT li_log2 INTO lw_log2.
        CLEAR v_totexppe.
        CLEAR v_totcapit.
        CLEAR v_toterror.
    *Cost portion to be capitalised calculated
        LOOP AT li_zsct_record INTO lw_zsct_record
                 WHERE hkont = lw_log2-hkont AND
                  kongr NE c_e AND zerrc IS INITIAL.
          v_totcapit = v_totcapit + lw_zsct_record-zcptp.  "CC calculated
        ENDLOOP.
    *Expensed cost portion calculated
        LOOP AT li_zsct_record INTO lw_zsct_record WHERE
                hkont = lw_log2-hkont        AND
                kongr = c_e AND zerrc IS INITIAL .
          v_totexppe = v_totexppe + lw_zsct_record-zcptp.  "ECP calculated
        ENDLOOP.
    *Errors calculated
        LOOP AT li_zsct_record INTO lw_zsct_record WHERE
                hkont = lw_log2-hkont AND
                zerrc IS NOT INITIAL .
          v_toterror = v_toterror + lw_zsct_record-zcptp.  "Errors calculated
        ENDLOOP.
        lw_log2-exp = v_totexppe.           "Expensed cost portion
        lw_log2-cap = v_totcapit.           "Cost capitalised
        lw_log2-err = v_toterror.           "Errors
    *Cost portion capitalised expensed and errors in calculation are
    *trans ported for related GL accont
        MODIFY li_log2 FROM lw_log2
        TRANSPORTING exp cap err.
      ENDLOOP.
      LOOP AT li_log2_t INTO lw_log2_t.
        MODIFY li_log2 FROM lw_log2_t TRANSPORTING opbal WHERE hkont = lw_log2_t-hkont.
        CLEAR : lw_log2_t.
      ENDLOOP.
      WRITE:/1(15) text-018,sy-datum.             "SESSION DATE:
      SKIP 2.
    For printing the hear level of the output log
      WRITE:/1(16)   text-003,                     "Record ID number
             20(11)  text-004,                     "Reason Code
             34(10)  text-005,                     "GL Account
             47(12)  text-006,                     "Project Code
             62(5)   text-007,                     "Plant
             70(9)   text-008,                     "Commodity
             82(25)  text-009,                     "Cost portion To be posted
             110(12) text-010,                     "Success Flag
             125(10) text-011,                     "Error Code
             138(50) text-012.                     "Error TXT
      SKIP.
      LOOP AT li_log1 INTO lw_log1.
        WRITE:/1(16)   lw_log1-recid,
               20(11)  lw_log1-kongr,
               34(10)  lw_log1-hkont,
               47(12)  lw_log1-projk,
               62(5)   lw_log1-werks,
               70(9)   lw_log1-matnr,
               82(25)  lw_log1-zcptp,                       "#EC UOM_IN_MES
               110(12) lw_log1-zerrf,
               125(10) lw_log1-zerrc,
               138(80) lw_log1-zertx.
        CLEAR:lw_log1.
      ENDLOOP.
      SKIP 2.
      IF NOT li_log2 IS INITIAL.
        ULINE.
        WRITE:/1(16)  text-013,                  "GL ACCOUNT CODE
               20(17) text-014,                  "OPEN ITEM BALANCE
               40(21) text-015,                  "EXPENSED COST PORTION
               64(24) text-016,                  "CAPITALIZED COST PORTION
               92(20) text-017.                  "ERRORS.
        LOOP AT li_log2 INTO lw_log2.
          WRITE:/1(16)   lw_log2-hkont,
                 20(17)  lw_log2-opbal,                
                 40(21)  lw_log2-exp,                      
                 64(24)  lw_log2-cap,                     
                 92(20)  lw_log2-err.                     
          CLEAR:lw_log2.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " DISPLAY_LOGFILE

    hi,
    You need to use FM 'REUSE_ALV_LIST_DISPLAY' for this purpose. For using this FM, you need to create a field catlog which will contain all information about the coloumns you want to display for example their position, their text etc.
    Below there is a small demo for achiving this.
    TYPE-POOLS:slis.
    DATA : i_fieldcat TYPE slis_t_fieldcat_alv.
    TYPES: BEGIN OF ty_itab1,
           vbeln LIKE vbap-vbeln,
           posnr LIKE vbap-posnr,
           werks LIKE vbap-werks,
           lgort LIKE vbap-lgort,
           END OF ty_itab1.
    DATA: itab1 TYPE TABLE OF ty_itab1.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
    SELECT-OPTIONS: s_vbeln FOR vbak-vbeln.
    SELECTION-SCREEN END OF  BLOCK b1.
    START-OF-SELECTION.
      PERFORM select_data.
    END-OF-SELECTION.
    PERFORM display.
    FORM select_data .
      SELECT vbeln
         posnr
         werks
         lgort
         INTO CORRESPONDING  FIELDS OF TABLE itab1
         FROM vbap
         WHERE  vbeln IN s_vbeln.
      IF sy-subrc <> 0.
        MESSAGE 'Enter The Valid Sales Document Number'(t04) TYPE 'I'.
        EXIT.
      ENDIF.
    ENDFORM.
      IF alv_list = 'X'.
        PERFORM build_fieldcat TABLES i_fieldcat[]
                               USING :
    *-Output-field Table      Len  Ref fld Ref tab Heading    Col_pos
       'VBELN'       'ITAB1'     10   'VBAP'  'VBELN'    ''            1,
       'POSNR'       'ITAB1'     6    'VBAP'  'POSNR'    ''            2,
       'WERKS'       'ITAB1'     4    'VBAP'  'WERKS'    ''            3,
       'LGORT'       'ITAB1'     4    'VBAP'  'LGORT'    ''            4.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            i_callback_program       = sy-repid
           i_callback_pf_status_set = c_pf_status
            i_callback_user_command  = 'USER_COMMAND '
           it_events                = t_alv_events[]
            it_fieldcat              = i_fieldcat[]
          TABLES
            t_outtab                 = itab1[]
          EXCEPTIONS
            program_error            = 1
            OTHERS                   = 2.
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    FORM build_fieldcat TABLES  fpt_fieldcat TYPE slis_t_fieldcat_alv
                        USING   fp_field     TYPE slis_fieldname
                                fp_table     TYPE slis_tabname
                                fp_length    TYPE dd03p-outputlen
                                fp_ref_tab   TYPE dd03p-tabname
                                fp_ref_fld   TYPE dd03p-fieldname
                                fp_seltext   TYPE dd03p-scrtext_l
                                fp_col_pos   TYPE sy-cucol.
    *-- Local data declaration
      DATA:   wl_fieldcat TYPE slis_fieldcat_alv.
    *-- Clear WorkArea
      wl_fieldcat-fieldname       = fp_field.
      wl_fieldcat-tabname         = fp_table.
      wl_fieldcat-outputlen       = fp_length.
      wl_fieldcat-ref_tabname     = fp_ref_tab.
      wl_fieldcat-ref_fieldname   = fp_ref_fld.
      wl_fieldcat-seltext_l       = fp_seltext.
      wl_fieldcat-col_pos         = fp_col_pos.
    *-- Update Field Catalog Table
      APPEND wl_fieldcat  TO  fpt_fieldcat.
    ENDFORM.

  • Creat icon to display no of entries in ALV container

    HI,
    I have to display no of records on push button type icon,
    it should directly display no of entries like'50 hits'.Need not to give any function code,we need not to click push button,it should display like text on button,
    button should be added in alv  container tool bar.
    I am giving output in alv on subscreen

        HANDLE_TOOLBAR
            FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID
                IMPORTING E_OBJECT E_INTERACTIVE.
    define gloabal variable to populate the no of records.and use the variable
      METHOD HANDLE_TOOLBAR.
        DATA: LS_TOOLBAR  TYPE STB_BUTTON.
    * append a separator to normal toolbar
        CLEAR LS_TOOLBAR.
        MOVE 3 TO LS_TOOLBAR-BUTN_TYPE.
        APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
    * append an icon to to save data
        CLEAR LS_TOOLBAR.
        MOVE 'TOTAL' TO LS_TOOLBAR-FUNCTION.
    <b>    MOVE ICON_SYSTEM_SAVE TO LS_TOOLBAR-ICON. "Choose your Icon</b>
        MOVE 'Save' TO LS_TOOLBAR-QUICKINFO.
    <b>    MOVE V_VAR  TO LS_TOOLBAR-TEXT.</b>
        MOVE ' '  TO LS_TOOLBAR-DISABLED.
        APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
        CLEAR LS_TOOLBAR.
    * append a separator to normal toolbar
        CLEAR LS_TOOLBAR.
        MOVE 3 TO LS_TOOLBAR-BUTN_TYPE.
        APPEND LS_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
         ENDMETHOD.                    "handle_toolbar
    Before creating the ALV GRID object try to populate the variable V_VAR with no of records.
    obvious you need to set the handler to appear in the toolbar.
    Regards
    vijay

  • Using ALV as a search Help

    Has anyone used ALV as a search help presentation/selection method.  I'm thinking, in a simplistic sense, it would be just creating an itab and presenting it on a grid in a container on a new screen called by an exit....
    Probably too simple, huh?    Pointers to any snippets that implement this would be welcome. 
    (additionally, might have a need to save user layouts of this info as well)
    Thoughts, comments, pitfalls.... ?
    Thanks...
    ...Mike

    Hey Michael a working example I just made for some1
    thought u might be interested
    Q. i_checkbox_fieldname = 'CHECKBOX'
    A. If the table output in the popup has checkboxes at the beginning of the rows (e.g. for multiple selection), the internal table must contain a field containing the value of the checkbox.
    Assign the name of this field to the parameter I_CHECKBOX_FIELDNAME.
    Q. i_tabname = 'TLINE'
    A.  This is the name of ur input help internal table
    Q. it_fieldcat = fieldcat[]
    A  The table u gonna display has to have a fieldcat.
    Q. it_excluding = extab[].
    A. In case u wanna exclude some functions.
    Below is a working example, paste it in se38 and activate.
    !!! Warning SAVE IT AS A LOCAL OBJECT !!!
    report ztests1.
    type-pools: slis.
    data: index type i.
    data: l_kunnr like kna1-kunnr.
    data: input(10) type c,
           text(4) type c,
           text1(5) type c.
    data: begin of itab occurs 10,
           kunnr like kna1-kunnr,
           name1 like kna1-name1,
          end of itab.
    data: e_exit.
    data: fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    parameter: p_kunnr(10) type c.
    at selection-screen on value-request for p_kunnr.
      select kunnr name1 up to 10 rows
        from kna1
        into table itab.
      fieldcat-tabname = 'ITAB'.
      fieldcat-fieldname = 'KUNNR'.
      fieldcat-seltext_m = 'Cust'.
      fieldcat-ddictxt = 'M'.
      fieldcat-outputlen = 10.
      APPEND fieldcat.
      CLEAR fieldcat.
      fieldcat-tabname = 'ITAB'.
      fieldcat-fieldname = 'NAME1'.
      fieldcat-seltext_m = 'Cust Name'.
      fieldcat-ddictxt = 'M'.
      fieldcat-outputlen = 30.
      APPEND fieldcat.
      CLEAR fieldcat.
        CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
          EXPORTING
            I_TITLE                       = 'Customer Selection'
          I_SELECTION                   = 'X'
          I_ALLOW_NO_SELECTION          =
          I_ZEBRA                       = ' '
          I_SCREEN_START_COLUMN         = 0
          I_SCREEN_START_LINE           = 0
          I_SCREEN_END_COLUMN           = 0
          I_SCREEN_END_LINE             = 0
          I_CHECKBOX_FIELDNAME          =
          I_LINEMARK_FIELDNAME          =
          I_SCROLL_TO_SEL_LINE          = 'X'
            i_tabname                     = 'ITAB'
          I_STRUCTURE_NAME              =
            IT_FIELDCAT                   = fieldcat[]
          IT_EXCLUDING                  =
          I_CALLBACK_PROGRAM            =
          I_CALLBACK_USER_COMMAND       =
          IS_PRIVATE                    =
          IMPORTING
          ES_SELFIELD                   =
            E_EXIT                        = e_exit
          tables
            t_outtab                      = itab
        EXCEPTIONS
          PROGRAM_ERROR                 = 1
          OTHERS                        = 2
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.

  • ALV Grid( How to calculate percentage) using alv gridfunctional module.

    Dear Gurus,
    In my report first coulmn and second column are sales and margin but third coulmn is margin%. now at last of report i want to display total sales and total margin and overall margin percentage. I am able to do total of sales and margin by using standard functionality of grid. I need to know to calculate overall percentage. I am not using alv oops method . I am using fucntional modules .
    Thanks in advance.
    Regards
    Dave

    Hi Devendra shrama,
    Percentage calculation in ALV
    The following method is a bit of a mission but it
    seems to be the only way around this at the moment.
    Also it only works with an ALV Grid not an ALV List.
    You have to take over the total lines manually.
    1. In the ALV output tab add extra fields that are the
    same as those on which you are sorting and contain the
    same values.
    2. In the Field Catalog you must add these fields but
    they must be hidden i.e. no_out = 'X'.
    3. These fields must be included in the Sort Catalog
    with subtot = 'X'.
    4. In order to handle the final total line in your
    layout for the ALV you must set field no_totalline'X' because you are going to be taking this over as
    well.
    5. Create a form called SUBTOTAL_TEXT or similar
    structured as follows:
    form subtotal_text using ep_subtot_line like
    output_tab
    es_subtottxt type
    slis_subtot_text.
    In this form you will do the percentage calculation
    again at total level. The structure ep_subtot_line
    will contain a field for each of the fields in your
    output_tab i.e. ep_subtot_line-sales,
    ep_subtot_line-cost and ep_subtot_line-margin. Put the
    margin calculation into ep_subtot_line-margin.
    6. In the eventtab that you pass to the ALV_GRID
    function module you must create a record with the
    field name = 'SUBTOTAL_TEXT' and the field form = the
    name of the form you created in step 5 above.
    This works OK.
    i hope it helps you.Happy solving.
    thanks
    karthik

  • Table Maintenance Generator via program using ALV OO concept

    Hi All,
    I have a requriement to update the table using OO ALV i.e table maintenance generator program.
    My Z table have three fields say.. NEW status, old status and flag.
    I have to dispaly the records of the Z table in Matrix format.
    for example the records of the Z table is
    New status
    Old status
    Flag
    N1
    O11
    F11
    N1
    O12
    F12
    N1
    O13
    F13
    N2
    O21
    F21
    N2
    O22
    F22
    N2
    O23
    F23
    N3
    O31
    F31
    N3
    O32
    F32
    N3
    O33
    F33
    My program have to display the records of the table in matrix format  i.e
    |   .....       |    O11    |  O12  |  O13   |  O21  |  O22   |   O23  |  O31   |   O32  |  O33 | ..
    |     N1    |     F11     |    F12     |  F13     |    .....   |  .....       |  ....        |  .....      |   .......     |   ....    | ..   ____________________________________________________________________________________   
    |    N2     |     .....     |  ......      | .......      |   F21   |   F22     |  F23      |   ...        |   .....       | ......   | .
    |     N3    |     ......   |   .....      | .......   .  |  .......   |  .......     | ....         |   F31     |    F32      |  F33   |   
    The ALV display is dynamic i.e it depends upon the no. of records in the table...
    My headings( Row heading and Column heading )  will be the value  from table... and the user should be able to change the Flag ... For example when the user change the Flag  'F21'  to say 'X',
    |   .....       |    O11    |  O12  |  O13   |  O21  |  O22   |   O23  |  O31   |   O32  |  O33 | ..
    |     N1    |     F11     |    F12     |  F13     |    .....   |  .....       |  ....        |  .....      |   .......     |   ....    | ..   ____________________________________________________________________________________   
    |    N2     |     .....     |  ......      | .......      |   X       |   F22     |  F23      |   ...       |   .....       | ......    | .
    |     N3    |     ......   |   .....      | .......   .   |  .......  |  .......     | ....       |   F31      |    F32     |   F33    | .  
    In the Z table  the record  is
                     N2          O21        F21
    should be changed to
                    N2          O21        X
    I tried using ALV oo concept....but  I can able to display the output as like it is in table ....Not like the one above format....
    Can you please help me to resolve it?
    Thanx in advance
    Sangeetha
    Edited by: sangeetha s k on Dec 16, 2008 7:42 AM
    Edited by: sangeetha s k on Dec 16, 2008 7:50 AM
    Edited by: sangeetha s k on Dec 16, 2008 8:04 AM

    Hi,
    Go through Following Menu Path
    Tcode SE11-> Table Name-> Change.
    Utilities-> Table Maintance Generator->Create Maintance.
    On Same Screen go to Menu Environment->Modification->Events
    Create New Event e.g. 05 , Enter Form Routine Name.
    Go to Editor.
    and Put Your Logic
    e.g.
    FORM FILL_DEFAULT.
    * Actual Logic for how to get materials list.
    ENDFORM.   

  • Capture ALV container event and change data in screen header

    Hi,
    I have a REPORT calling a custom screen with a header section and an ALV container displaying ITEMS.
    <b>Situation:</b>
    If I use the FILTER button on the ALV container, it works fine but I wish to capture the details, so that I can change my header data accordingly.
    <b>Example</b>
    e.g : Suppose the ALV container on the screen displays 4 lines of data.
       So my header area displays '4' as the no of items displayed
    Now when I use FILTER button on the ALV container, it then dispalys only '2' lines of data as per the filter criteria. Now how do I capture this details so that my header now displays 2 instead of 4.
    Basically I want my HEADER data to get refreshed whenever I use the filter button to change the number of data lines dispalyed.
    Hope I make some sense with the example.
    Appreciate if you gurus could help ..
    Thanks and Regards
    RK

    Can you post your code.
    Regards,
    Rich Heilman

  • Splitter ALV container + 2 layout definitions

    Hello,
    I wrote an ALV report using splitter container. In the upper part of my report I need to define a layout , and another one for the bottom part.
    Also in my selection screen there are 2 parametrets for the upper and the lower layouts.
    I have 1 problems :
    B. when I use F4 functionalty from the selection screen for the upper part I get also layout of the lower part, and the samefor the lower part .
    attach is a part of the code.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_lay01.
      PERFORM f4_layouts USING if_salv_c_layout=>restrict_none CHANGING p_lay01.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_lay02.
      PERFORM f4_layouts_sec USING if_salv_c_layout=>restrict_none CHANGING p_lay02.
    FORM f4_layouts   USING i_restrict TYPE salv_de_layout_restriction
                      CHANGING c_layout TYPE disvariant-variant.
      DATA: ls_layout TYPE salv_s_layout_info,
            ls_key    TYPE salv_s_layout_key.
      ls_key-report = sy-repid.
      ls_layout = cl_salv_layout_service=>f4_layouts(
        s_key    = ls_key
        restrict = i_restrict ).
      c_layout = ls_layout-layout.
    ENDFORM.                    " F4_LAYOUTS
    FORM f4_layouts_sec   USING i_restrict TYPE salv_de_layout_restriction
                 CHANGING c_layout TYPE disvariant-variant.
      DATA: ls_layout TYPE salv_s_layout_info,
            ls_key    TYPE salv_s_layout_key.
      ls_key-report = sy-repid.
      ls_layout = cl_salv_layout_service=>f4_layouts(
        s_key    = ls_key
        restrict = i_restrict ).
      c_layout = ls_layout-layout.
    ENDFORM.                    "
    screen 100.
    CREATE OBJECT g_custom
        EXPORTING
          container_name = 'CONTAINER'.
      CREATE OBJECT o_splitter
        EXPORTING
          parent  = g_custom
          rows    = 2
          columns = 1.
      CALL METHOD o_splitter->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = o_grid1.
      CALL METHOD o_splitter->get_container
        EXPORTING
          row       = 2
          column    = 1
        RECEIVING
          container = o_grid2.
      cl_salv_table=>factory( EXPORTING r_container    = o_grid1
                             IMPORTING r_salv_table   = gr_table1
                             CHANGING  t_table        = gt_printout_main ).
      cl_salv_table=>factory( EXPORTING r_container    = o_grid2
                              IMPORTING r_salv_table   = gr_table2
                              CHANGING  t_table        = lt_printout_second ).
    cl_salv_table=>factory( IMPORTING r_salv_table = gr_table
                              CHANGING  t_table = gt_alv_data1 ). "<tb> ).
      lr_layout = gr_table1->get_layout( ).
      lu_layout = gr_table2->get_layout( ).
    *... §4.1 set the Layout Key
      ls_key-report = sy-repid.
      lr_layout->set_key( ls_key ).
      lu_layout->set_key( ls_key ).
    *... §4.2 set usage of default Layouts
      lr_layout->set_default( abap_true ).
      lu_layout->set_default( abap_true ).
    *... §4.3 set Layout save restriction
      lr_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
      gs_test-layout    = p_lay01.
      lr_layout->set_initial_layout( gs_test-layout ).
      lu_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
      gs_test-layout    = p_lay02.
      lu_layout->set_initial_layout( gs_test-layout ).
    lr_layout  = gr_table2->get_layout( ).
    lr_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
    *... §4.1 set the Layout Key
    ls_key-report = sy-repid.
    CONCATENATE ls_key-report 'SEC' INTO ls_key-report.
    lr_layout->set_key( ls_key ).
    lr_layout->set_default( abap_true ).
    gs_test-layout  = p_lay02.
    lr_layout->set_initial_layout( gs_test-layout ).
      lr_events = gr_table1->get_event( ).
      lu_events = gr_table2->get_event( ).
      CREATE OBJECT ge_events.
      SET HANDLER ge_events->on_user_command FOR lr_events.
      SET HANDLER ge_events->on_double_click FOR lr_events.
      CREATE OBJECT gu_events.
      SET HANDLER gu_events->on_user_command FOR lu_events.
    SET HANDLER gu_events->on_double_click FOR lu_events.
      lr_selections = gr_table1->get_selections( ).
      lr_selections->set_selection_mode( if_salv_c_selection_mode=>multiple ).
      lu_selections = gr_table2->get_selections( ).
      lu_selections->set_selection_mode( if_salv_c_selection_mode=>multiple ).
      lr_columns = gr_table1->get_columns( ).
    lr_columns->set_optimize( abap_true ).
      lu_columns = gr_table2->get_columns( ).
    lu_columns->set_optimize( abap_true ).
      PERFORM create_toolbar.
      PERFORM set_zebra_pattern.
      PERFORM set_columns_technical USING lr_columns lu_columns.
      PERFORM sort.
      PERFORM add_button_to_pf_status.
    *-> Display the grid, for this we use the DISPLAY method
      CALL METHOD gr_table1->display.
      CALL METHOD gr_table2->display.
    Please advise.
    Thanks
    Yifat

    Hi Ifat
    to access layouts for tab and bottom independantly, use the 'HANDLE' element of is_variant as follows
    at selection-screen on value-request for p_tvar.           
      is_variant-report = sy-repid.                           
      is_variant-handle = 'TOP'.                              
      call function 'REUSE_ALV_VARIANT_F4'                  
        exporting                                           
          is_variant                = is_variant            
          i_save                    = 'A'                   
          i_display_via_grid        = 'X'
        importing                                             
          es_variant                = is_variant              
        exceptions                                            
          not_found                 = 1                       
          program_error             = 2                       
          others                    = 3                       
      if sy-subrc <> 0.                                      
      else.                                                  
        p_tvar = is_variant-variant.                         
      endif.                                                 
    at selection-screen on value-request for p_bvar.         
      is_variant-report = sy-repid.                          
      is_variant-handle = 'BOT'.                             
      call function 'REUSE_ALV_VARIANT_F4'                   
        exporting                                            
          is_variant                = is_variant             
          i_save                    = 'A'                    
          i_display_via_grid        = 'X'
        importing                                           
          es_variant                = is_variant            
        exceptions                                          
          not_found                 = 1                     
          program_error             = 2                     
          others                    = 3                     
      if sy-subrc <> 0.                                      
      else.                                                  
        p_bvar = is_variant-variant.                         
      endif.                                                 
    Regards
    Joel

Maybe you are looking for

  • Error message with a script sending emails to multiple recipients.

    Hi all, I am very new with powershell scripting and I want to request your attention and help on this issue. I am getting this error message "Send-MailMessage: An invalid character was found in the mail header: ','" given by this script: Param ( [str

  • File sharing with Leopard through dial up modem on Performa 6400

    There are some really important files that i need to get off my Macintosh Performa 6400 (running 8.6) but the only connection that my iMac G5 (running 10.5.4) and the performa share is the dial up modem. I can't get an internet connection on the perf

  • BPEL Sync process vs Async process

    Hi All, I am bit confusing with Sync and Async BPEL processes Can I invoke another BPEL process in whatever way(Sync/Async) I want without considering whether invoked process is Sync or Async or Invoking remote BPEL processes( Sync / Async ) depends

  • TS3249 iphoto 9.4.2 wont edit photos-scattered immages of previous pics apear?

    since i found a pic on internet and imported it on iphoto, my iphoto started to have problrms: 1, i cant open it 2. i cant edit pics(scattered and grey area appears+of previously looked at items-docs, pics, ) i tried all repairs suggested by help men

  • Serious Firewire Meltdown

    I'm working on a film right now, with four different drives - two Lacie D2s, and two Western Digital MyBooks. A couple of weeks ago, something very strange started happening - the firewire cards on every computer we use stop working. It's not just th