ALV Control Sample

I have already inspected the ALV Control sample code in
BCALVEDIT*. But it is too difficult for me. Since, i'm beginner of ABAP. Is there any sample code for just insert row of data and edit field via ALV.
Finally, thank you expert !!

Hi Chun,
Check out the following code.
REPORT  ZTEST1234    MESSAGE-ID ZZ                           .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID,  "First
      G_GRID1 TYPE REF TO CL_GUI_ALV_GRID. "Second
DATA: L_VALID TYPE C,
      V_FLAG,
      V_DATA_CHANGE,
      V_ROW TYPE LVC_S_ROW,
      V_COLUMN TYPE LVC_S_COL,
      V_ROW_NUM TYPE LVC_S_ROID.
DATA: OK_CODE LIKE SY-UCOMM,
      SAVE_OK LIKE SY-UCOMM,
      G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST', "First Container
      G_CONTAINER2 TYPE SCRFNAME VALUE 'TEST1',"Second container
      GS_LAYOUT TYPE LVC_S_LAYO.
DATA:BEGIN OF  ITAB OCCURS 0,
     VBELN LIKE LIKP-VBELN,
     POSNR LIKE LIPS-POSNR,
     LFDAT like lips-vfdat,
     BOX(1),
     END OF ITAB.
      CLASS lcl_event_handler DEFINITION
CLASS LCL_EVENT_HANDLER DEFINITION .
  PUBLIC SECTION .
    METHODS:
**Hot spot Handler
    HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                      IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
**Handler to Check the Data Change
    HANDLE_DATA_CHANGED FOR EVENT DATA_CHANGED
                         OF CL_GUI_ALV_GRID
                         IMPORTING ER_DATA_CHANGED
                                   E_ONF4
                                   E_ONF4_BEFORE
                                   E_ONF4_AFTER,**Double Click Handler
    HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                                     IMPORTING E_ROW E_COLUMN ES_ROW_NO.
ENDCLASS.                    "lcl_event_handler DEFINITION
      CLASS lcl_event_handler IMPLEMENTATION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*Handle Hotspot Click
  METHOD HANDLE_HOTSPOT_CLICK .
    CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
    V_ROW  = E_ROW_ID.
    V_COLUMN = E_COLUMN_ID.
    V_ROW_NUM = ES_ROW_NO.
    MESSAGE I000 WITH V_ROW 'clicked'.
  ENDMETHOD.                    "lcl_event_handler
*Handle Double Click
  METHOD  HANDLE_DOUBLE_CLICK.
    CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
    V_ROW  = E_ROW.
    V_COLUMN = E_COLUMN.
    V_ROW_NUM = ES_ROW_NO.
    IF E_COLUMN = 'VBELN'.
      SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
      CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
    ENDIF.
    IF E_COLUMN = 'POSNR'.
      MESSAGE I000 WITH 'Click on POSNR row number '  E_ROW.
      "with this row num you can get the data
    ENDIF.
  ENDMETHOD.                    "handle_double_click
**Handle Data Change
  METHOD HANDLE_DATA_CHANGED.
    CALL METHOD G_GRID->REFRESH_TABLE_DISPLAY
      EXCEPTIONS
        FINISHED = 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.
  ENDMETHOD.                    "HANDLE_DATA_CHANGED
ENDCLASS.                    "LCL_EVENT_HANDLER IMPLEMENTATION
*&             Global Definitions
DATA:      G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
            G_HANDLER TYPE REF TO LCL_EVENT_HANDLER, "handler
            G_CUSTOM_CONTAINER1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER. "Container2
*- Fieldcatalog for First and second Report
DATA: IT_FIELDCAT  TYPE  LVC_T_FCAT,
      X_FIELDCAT TYPE LVC_S_FCAT,
      LS_VARI  TYPE DISVARIANT.
               START-OF_SELECTION
START-OF-SELECTION.
  SELECT VBELN
         POSNR
         FROM LIPS
         UP TO 20 ROWS
         INTO CORRESPONDING FIELDS OF TABLE ITAB.
END-OF-SELECTION.
  IF NOT ITAB[] IS INITIAL.
    CALL SCREEN 100.
  ELSE.
    MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
  ENDIF.
*&      Form  CREATE_AND_INIT_ALV
      text
FORM CREATE_AND_INIT_ALV .
  DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
"First Grid
  CREATE OBJECT G_CUSTOM_CONTAINER
         EXPORTING CONTAINER_NAME = G_CONTAINER1.
  CREATE OBJECT G_GRID
         EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
"Second Grid
  CREATE OBJECT G_CUSTOM_CONTAINER1
         EXPORTING CONTAINER_NAME = G_CONTAINER2.
  CREATE OBJECT G_GRID1
         EXPORTING I_PARENT = G_CUSTOM_CONTAINER1.
Set a titlebar for the grid control
  CLEAR GS_LAYOUT.
  GS_LAYOUT-GRID_TITLE = TEXT-003.
  GS_LAYOUT-ZEBRA = SPACE.
  GS_LAYOUT-CWIDTH_OPT = 'X'.
  GS_LAYOUT-NO_ROWMARK = 'X'.
  GS_LAYOUT-BOX_FNAME = 'BOX'.
  GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
  CALL METHOD G_GRID->REGISTER_EDIT_EVENT
    EXPORTING
      I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.
  CREATE OBJECT G_HANDLER.
  SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
  SET HANDLER G_HANDLER->HANDLE_DATA_CHANGED FOR G_GRID.
setting focus for created grid control
  CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
    EXPORTING
      CONTROL = G_GRID.
Build fieldcat and set editable for date and reason code
edit enabled. Assign a handle for the dropdown listbox.
  PERFORM BUILD_FIELDCAT.
Optionally restrict generic functions to 'change only'.
  (The user shall not be able to add new lines).
  PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
**Vaiant to save the layout
  LS_VARI-REPORT      = SY-REPID.
  LS_VARI-HANDLE      = SPACE.
  LS_VARI-LOG_GROUP   = SPACE.
  LS_VARI-USERNAME    = SPACE.
  LS_VARI-VARIANT     = SPACE.
  LS_VARI-TEXT        = SPACE.
  LS_VARI-DEPENDVARS  = SPACE.
  CALL METHOD G_GRID->REGISTER_EDIT_EVENT
    EXPORTING
      I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.
**Calling the Method for ALV output for First Grid
  CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
      IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
      IS_VARIANT           = LS_VARI
      IS_LAYOUT            = GS_LAYOUT
      I_SAVE               = 'A'
    CHANGING
      IT_FIELDCATALOG      = IT_FIELDCAT
      IT_OUTTAB            = ITAB[].
**Calling the Method for ALV output for Second Grid
   CALL METHOD G_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
   EXPORTING
     IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
    CHANGING
      IT_FIELDCATALOG      = IT_FIELDCAT
      IT_OUTTAB            = ITAB[].
Set editable cells to ready for input initially
  CALL METHOD G_GRID->SET_READY_FOR_INPUT
    EXPORTING
      I_READY_FOR_INPUT = 1.
ENDFORM.                               "CREATE_AND_INIT_ALV
*&      Form  EXCLUDE_TB_FUNCTIONS
      text
     -->PT_EXCLUDE text
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
Only allow to change data not to create new entries (exclude
generic functions).
  DATA LS_EXCLUDE TYPE UI_FUNC.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
  LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
  APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
*&      Form  build_fieldcat
      Fieldcatalog
FORM BUILD_FIELDCAT .
  DATA: L_POS TYPE I.
  L_POS = L_POS + 1.
  X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
  X_FIELDCAT-FIELDNAME = 'VBELN'.
  X_FIELDCAT-TABNAME = 'ITAB'.
  X_FIELDCAT-COL_POS    = L_POS.
  X_FIELDCAT-NO_ZERO    = 'X'.
  X_FIELDCAT-EDIT      = 'X'.
  X_FIELDCAT-OUTPUTLEN = '10'.
  APPEND X_FIELDCAT TO IT_FIELDCAT.
  CLEAR X_FIELDCAT.
  L_POS = L_POS + 1.
  X_FIELDCAT-SCRTEXT_M = 'Item'(025).
  X_FIELDCAT-FIELDNAME = 'POSNR'.
  X_FIELDCAT-TABNAME = 'ITAB'.
  X_FIELDCAT-COL_POS    = L_POS.
  X_FIELDCAT-OUTPUTLEN = '5'.
  APPEND X_FIELDCAT TO IT_FIELDCAT.
  CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    X_FIELDCAT-SCRTEXT_M = 'Del Date'(015).
  X_FIELDCAT-FIELDNAME = 'LFDAT'.
  X_FIELDCAT-TABNAME = 'ITAB'.
  X_FIELDCAT-COL_POS    = L_POS.
  X_FIELDCAT-OUTPUTLEN = '10'.
  APPEND X_FIELDCAT TO IT_FIELDCAT.
  CLEAR X_FIELDCAT.
  L_POS = L_POS + 1.
ENDFORM.                    " build_fieldcat
*&      Module  STATUS_0100  OUTPUT
      text
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'MAIN100'.
  SET TITLEBAR 'MAIN100'.
  IF G_CUSTOM_CONTAINER IS INITIAL.
**Initializing the grid and calling the fm to Display the O/P
    PERFORM CREATE_AND_INIT_ALV.
  ENDIF.
ENDMODULE.                 " STATUS_0100  OUTPUT
*&      Module  USER_COMMAND_0100  INPUT
      text
MODULE USER_COMMAND_0100 INPUT.
  CASE SY-UCOMM.
    WHEN 'BACK'.
      LEAVE TO SCREEN 0.
  ENDCASE.
ENDMODULE.                 " USER_COMMAND_0100  INPUT
Regards,
Amit Mishra

Similar Messages

  • ALV control ctrl-c

    Hi,
    how can i ban the functionality ctrl-c to copy data from alv control?
    I have excluded the export button, though  download is not working, thats ok.
    But ctrl-c is working. What should I do.
    Regards, Stefan

    Hi,
    It seems the question has been asked. This will direct you to that link:
    http://forums.sdn.sap.com/thread.jspa?threadID=1783988
    Hope it solves your issue.
    Regards.

  • ALV Control and Classical ALV

    Hi all,
    Please let me know the advantages and disadvantages of ALV control over Classical ALV.
    Thanks & regards,
    Naresh.

    ALV LIST Can be coded using only FMs
    ALV control  Can be coded using FMs and object oriented concepts
    ALV LIST Can be displayed hieraicharlly
    ALV GRID cannot be displayed hierarichally
    Alv grid (using oo concept) requires
    designing the screen layout .
    Hence, in one screen, we can show more
    then one alv grid
    (we cannot show more than
    one alv list on one screen)
    ALV LIST is Display Only.
    Whereas
    ALV Grid Can Be made EDITABLE for entry purpose.

  • How to refresh the ALV Control

    Hi Experts,
    I have a selection screen and ALV control in webdydnpro report. If i enter valid input values in the selection screen the ALV contol is diplaying datas correctly but when i enter invalid data in the selection screen the ALV table control values still diplaying in the previous datas. I need to Refresh the ALV contol values once the incorrect data enter in the selection screen. How can i REFRESH the ALV control in Webdynpro report. I have Refreh button in the Selection screen when you press REFRESH button the ALV table control data should be initilize  Kindly help me out this issue.
    Thanks ,
    Kumar

    Hi.
    You have a selection screen where user can enter some data, with this data you
    perform a selection and then you bind the result to the ALV, right?
    Question is how you bind the result to ALV? Do you use external context mapping
    or the set_data method ?
    So I guess you have a method where you validate the select options and if they
    are correct you perform the selction and bind the result to the node for the ALV. If
    the select options are incorrect you just need to get the node for the ALV (which contains the
    previous result )and call the invalidate method on that node which deletes all
    elements of this node and after that the ALV should be empty again.

  • DIO Line to control sampling, Multiple samples to file

    Need help in the LabView development of an external Digital input that will control the sampling of the rest of the 64 ever changing digital inputs. The BIG problem is to do multiple externally controlled sampling and write to a text file while the file is open, like (write to text file.vi)without the loop function on "automatic". Any help is greatly appreciated.

    Here are some details about my application. I am using NI PC-DIO 96 board to interface with a device that sends 4, 16 bit sets of every changing digital information and one bit as the sampling activation controller. I need to open a file and then save in one file the 4, 16 bit sets of information for X number of samples. Each sample is controlled by the one bit input from the external device. EXAMPLE. Samples are defined as 1000, Open a file, The one bit input turns on and off 1000 times sampling the 4, 16 bit sets and saving this information to the file, close file.

  • ALV Control break events

    Hi all,
    I have a requirement in ALV ,
    100 abc
    100 xyz
    using control break statement how we remove two hundreds and display output only one 100 ,names
    100 abc
        xyz.
    regrads,
    Praveen

    Hi,
    with the help of sort option you can get that. just check this sample.
    REPORT  ZTEST_ALV1                              .
    TYPE-POOLS: SLIS.
    DATA:
      LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
      LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
      LT_SORT     TYPE SLIS_T_SORTINFO_ALV,
      LS_SORT     TYPE SLIS_SORTINFO_ALV.
    DATA: BEGIN OF ITAB OCCURS 0,
           VBELN LIKE VBAK-VBELN,
           POSNR LIKE VBAP-POSNR,
          END OF ITAB.
    ITAB-VBELN  = '12345'.
    ITAB-POSNR = '10'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-VBELN = '12345'.
    ITAB-POSNR = '11'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-VBELN = '12345'.
    ITAB-POSNR = '12'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-VBELN = '12356'.
    ITAB-POSNR = '10'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-VBELN = '12356'.
    ITAB-POSNR = '11'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-VBELN = '12356'.
    ITAB-POSNR = '12'.
    APPEND ITAB.
    CLEAR ITAB.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
      EXPORTING
        I_PROGRAM_NAME         = SY-REPID
        I_INTERNAL_TABNAME     = 'ITAB'
        I_INCLNAME             = SY-REPID
      CHANGING
        CT_FIELDCAT            = LT_FIELDCAT
      EXCEPTIONS
        INCONSISTENT_INTERFACE = 1
        PROGRAM_ERROR          = 2
        OTHERS                 = 3.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LS_SORT-FIELDNAME = 'VBELN'.
    LS_SORT-UP        = 'X'.
    *ls_sort-group = 'UL'.  "using this you can get new lines
    APPEND LS_SORT TO LT_SORT.
    CLEAR LS_SORT.
    LS_SORT-FIELDNAME = 'POSNR'.
    LS_SORT-UP        = 'X'.
    *ls_sort-group = '*'."using this you get new pages
    APPEND LS_SORT TO LT_SORT.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        IT_FIELDCAT = LT_FIELDCAT
        IT_SORT     = LT_SORT
      TABLES
        T_OUTTAB    = ITAB.
    Regards
    vijay

  • Dynpro-PAI doesn't recognize actual selections in ALV-Control

    Hi Control-Framework-Experts,
    I have a Dynpro with an ALV-Grid-Control (cl_salv_table).
    You can mark rows.
    There is User-ALV-Button (cl_salv_functions_list) and
    a event-handler (EVENT added_function OF cl_salv_events),
    which find out, what rows are selected and gives a corresponding Info-message.
    Example:
    The rows 1 and 2 are selected.
    User presses the ALV-Button
    ALV-Event-Handler Method is proceeded and the following message is shown
    "Selected Rows: 1   2".
    Everything works fine.
    Now the Problem. I want to put this function to a "normal" Dynpro-Standard-Toolbar-Event.
    The PAI-Module does the same coding as the ALV-Event-Handler-Method.
    But -> The Result is outdated.
    Example:
    The rows 1 and 2 are selected.
    User presses the ALV-Button
    ALV-Event-Handler Method is proceeded and the following message is shown
    "Selected Rows: 1   2".
    Now - Only Row 1 is selected.
    +The Dynpro-Standard-Toolbar-Button is pressed. +
    The PAI-Module (user_command_0100) tries to find out the selected rows -> Result:
    "Selected Rows: 1   2". (wrong)
    The PAI-Module only shows the result of the last Event-Handler-Call.
    What is the trick to synchronize Control and Dynpro?
    Regards
    Juergen
    Here ist the coding (sorry for some german inline-comments)
    program  zschoe01.
    data:      ok_code like sy-ucomm.
    * Dynpro-CustomControl
    data: gr_cont01 type ref to cl_gui_custom_container,
          gr_alv01  type ref to cl_salv_table.
    types: begin of ts_fauf,
             aufnr type aufnr,
             text type maktx,
           end of ts_fauf.
    data: gt_fauf type table of ts_fauf,
          gs_fauf type ts_fauf.
    *       CLASS lcl_event_handler DEFINITION
    class lcl_event_handler definition.
      public section.
    *   Klassenmethoden
    *   Trick, weil man sich so das Erzeugen eines gesonderten Objekts
    *   sparen kann
        class-methods:
    *     FCODE-Behandlung innerhalb des ALV01
          handle_alv01_user_command
            for event added_function of cl_salv_events
            importing e_salv_function.
    endclass.                    "lcl_event_handler DEFINITION
    *       CLASS lcl_event_handler IMPLEMENTATION
    class lcl_event_handler implementation.
    *     FCODE-Behandlung innerhalb des ALV01
      method       handle_alv01_user_command .
        data: lr_selections type ref to cl_salv_selections,
              lt_rows type salv_t_row,
              ls_row like line of lt_rows.
        data: lv_string type string,
              lv_char(6) type c.
    * Markierte Zeilen aus ALV-Anzeige ermitteln.
        lr_selections = gr_alv01->get_selections( ).
        lt_rows = lr_selections->get_selected_rows( ).
        if sy-subrc <> 0 or lt_rows[] is initial.
          message i001(00) with 'Nothing selected'.
        else.
          case e_salv_function.
            when 'SAVE'.
              clear lv_string.
              loop at lt_rows into ls_row.
    *           Aufzählung aller markierten Zeilen in einen langen String
                write ls_row to lv_char.
                concatenate lv_string lv_char into lv_string separated by space.
              endloop.
              message i001(00) with 'Selected Rows:' lv_string.
          endcase.
        endif.
      endmethod.                    "handle_alv01_user_command
    endclass.                    "lcl_event_handler IMPLEMENTATION
    start-of-selection.
      gs_fauf-aufnr = '4711'.
      gs_fauf-text  = 'Text1'.
      append gs_fauf to gt_fauf.
      gs_fauf-aufnr = '5616'.
      gs_fauf-text  = 'Another Text'.
      append gs_fauf to gt_fauf.
      call screen 100.
    *  MODULE status_0100 OUTPUT
    module status_0100 output.
      set pf-status '0100'.
      set titlebar '0100'.
    endmodule.                 " STATUS_0100  OUTPUT
    *  MODULE init_controls OUTPUT
    module init_controls output.
      perform init_controls.
    endmodule.                    "init_controls OUTPUT
    *&      Module  exit_commands_0100  INPUT
    *       text
    module exit_commands_0100 input.
    *   -> Transaktion verlassen
      leave to screen 0.
    endmodule.                 " exit_commands_0100  INPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    module user_command_0100 input.
      case ok_code.
        when 'SAVE'.
    *     (Ctrl-S) gedrückt -> Same Coding as in lcl_event_handler
          data: lr_selections type ref to cl_salv_selections,
                lt_rows type salv_t_row,
                ls_row like line of lt_rows.
          data: lv_string type string,
                lv_char(6) type c.
    *     Markierte Zeilen aus ALV-Anzeige ermitteln.
          lr_selections = gr_alv01->get_selections( ).
          lt_rows = lr_selections->get_selected_rows( ).
          if sy-subrc <> 0 or lt_rows[] is initial.
            message i001(00) with 'Nothing selected'.
          else.
            clear lv_string.
            loop at lt_rows into ls_row.
    *          Aufzählung aller markierten Zeilen in einen langen String
              write ls_row to lv_char.
              concatenate lv_string lv_char into lv_string separated by space.
            endloop.
            message i001(00) with 'Selected Rows:' lv_string.
          endif.
      endcase.
    endmodule.                 " USER_COMMAND_0100  INPUT
    *&      Form  init_controls
    *       text
    form init_controls .
      data: lr_selections type ref to cl_salv_selections.
      data: lr_functions type ref to cl_salv_functions_list.
      data: lr_events type ref to cl_salv_events_table.
      data: lv_text             type string,
            lv_icon type string.
      if gr_cont01 is initial.
        create object gr_cont01
          exporting
    *       parent                      =
            container_name              = 'CUSTCTRL01'.
    *... §2 create an ALV table
        try.
            cl_salv_table=>factory(
              exporting
                r_container    = gr_cont01
                container_name = 'CUSTCTRL01'
              importing
                r_salv_table   = gr_alv01
              changing
                t_table        = gt_fauf ).
          catch cx_salv_msg.                                "#EC NO_HANDLER
        endtry.
    *... §3 Functions
    *... §3.1 activate ALV generic Functions
        lr_functions = gr_alv01->get_functions( ).
    *  lr_functions->set_default( abap_true ).
        lr_functions->set_all( abap_true ).
        try.
            lv_text = '__Who_is_selected?___'.
            lr_functions->add_function(
              name     = 'SAVE'
              text     = lv_text
              tooltip  = lv_text
              position = if_salv_c_function_position=>left_of_salv_functions ).
          catch cx_salv_wrong_call cx_salv_existing.
        endtry.
    *... §4.3 set the selection mode: multiple or single row selection
        lr_selections = gr_alv01->get_selections( ).
        lr_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
    *... §5 register to the events of cl_salv_table
        lr_events = gr_alv01->get_event( ).
    *... §5.1 register to the event USER_COMMAND
    **   Eventhandlermethode auch wirklich zuordnen.
    **   Achtung: Syntax! Weil Klassenmethode, Aufruf mit =>
    **   (vgl. Objekte ->)
        set handler:
          lcl_event_handler=>handle_alv01_user_command for lr_events.
        gr_alv01->display( ).
      endif.
    endform.                    " init_controls

    Well I figured out why it wasn't performing like I expected.  My logic was wrong.  Seems reasonable.
    Was I right about this part though?
    My guess is the restore
    doesn't show up because the window isn't really maximized, because I
    made it smaller to maintain proportions.
    My updated VI is attached
    Message Edited by elset191 on 09-23-2009 02:50 PM
    Tim Elsey
    LabVIEW 2010, 2012
    Certified LabVIEW Architect
    Attachments:
    Untitled 1.vi ‏25 KB

  • Alv reports sample example req..

    can anybody help me out with a simple example regarding ALV Reports.(simple ALV Reports , Blocked ALV Reports & Hierarchy ALV Reports).
    or pls send me a word document regarding the same ..to [email protected]
    response is highly appreciated..
    bye--
    Pradeepa

    Following document should get you started.
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907">An Easy Reference For ALV Grid Control.pdf</a>
    tip : if you do a <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/advancedsearch?query=alv%20grid&cat=sdn_all">search for alv grid</a> on the sdn homepage, this is the first result.
    Message was edited by:
            Dries Horions

  • 3d control sample for LabVIEW Linux

    Hello,
    is there any easy way to exchange the 3D Graph Active X Container from a LabVIEW for Windows VI into a non-Active-X control for Linux?
    I have a VI that displays a simple 3D intensity graph (intensity plotted over x-y field, imagine for instance a typical gaussian intensity distribution in 3D created by measuring 2D-intensity data) using "3D Surface.vi". The Active-X control for the 3D display allows to change the projection properties and the viewing angle. This VI is not executable in LabVIEW for Linux, as there is no Active-X in Linux. I had a look at the 3D Picture Toolkit which is available for free, but I have no idea how to display a point array in 3D easily - all examples that I have found are just geometrical bodies which are created and displayed. I also have read that LabVIEW 8.2 offers a new 3D Graph Modul based on OpenGL (my VI is LabVIEW 7.1 right now) - but my feeling is that this is also rather complicated to use and more suitable for 3D rendering of picture scenes like robotic arms or geometric bodies.
    Does somebody have a simple VI showing how to plot an intensity field over x-y, allowing to change the viewing angle (similiar to what 3D Surface.vi in Windows is capable to do)?
    Best regards,
    Gabs

    Hello Wiebe,
    thanks a lot! This is really helpful (even if I was hoping that someone has a sample VI doing exactly this as I could not imagine that I am the only one who tries to port an intensity measurement VI with 3D display to Linux). What an effort to do what under Windows is just a few mouse clicks. Why can't NI simply provide a LabVIEW-native 3D control for such tasks if they always say that their software is best for data collection, management and visualisation?.... Maybe Linux is still not so common that this was a request from many customers before.
    Anyway, again, thanks a lot for your answers and help. Best regards,
    Gabs

  • HAP_START_PAGE_POWL_UI new Buttons in the ALV Control

    Hello,
    we use the POWL-Querry for perfomance management.
    I wanna create a new button the the ALV-Table and this button should open a new WD with a PDF-File.
    I created the Button already and i see the Button in my ALV Table. But if i press the Button nothing happen.
    Do i have to customize the launchpad in the transaction LPD_CUST?
    I tried it with an enhancement in the controller of the WD
      ELSEIF ls_powl_params-value = 'zshowpdf'.
        READ TABLE event_parameters INTO ls_powl_params WITH KEY key = 'URL'.
    Create the parameter table with the required values to generate the url.
        CLEAR ls_parameters.
        ls_parameters-name = 'MODE'.
        ls_parameters-value = 'X'.
        APPEND ls_parameters TO lt_parameters.
        CLEAR ls_parameters.
        ls_parameters-name = 'WDACCESSIBILITY'.
        ls_parameters-value = wd_this->l_accessible.
        APPEND ls_parameters TO lt_parameters.
    my own WD
        CLEAR ls_parameters.
        ls_parameters-name = 'WDCONFIGURATIONID'.
        ls_parameters-value = 'ZAIF_AIP2_PDF_VIEW'.
        APPEND ls_parameters TO lt_parameters.
        wd_this->lt_params = lt_parameters.
        wd_this->url = ls_powl_params-value.
        wd_this->display_document( ).
    I hope someone can help me with this problem.
    best regards
    jens

    If you did a search of this forum using the name of the WDA app you are considering:
    [Search of forum for HAP_START_PAGE_POWL_UI_ESS|http://forums.sdn.sap.com/search.jspa?q=HAP_START_PAGE_POWL_UI_ESS&objID=f249]
    I think you would find several posts where I and other have provided this information in the past.
    Re: help in finding view corresponding to application etc.
    Please do follow the forum rules and search before posting!
    Thanks,
    Chris

  • Regarding ALV control: Tool tip for column data

    Hi Group,
    How can I give the tool tip for the data in ALV grid? For column headers I know that, but for the data in the colums how do I give the tool tip info.
    Regards,
    Kummi.

    Hello Kummi
    If you want to have a specific tooltip for an icon displayed in an ALV grid cell then you can use:
    @08<b>\Q</b> <tooltip text><b>@</b>  " shows own tooltip for icon @08@
    I am not sure if the same trick works for "normal" cell values. You may give it a try.
    Regards
      Uwe

  • ADC control samples - PTPanelSet

    I can not figure out how PTPanelSet draws scrollbar??? It would be nice to draw a scrollbar when you have table or HTML inside the panel. Can anyone assist?

    Hi Jake,
    Many thanks to your answer! I think it is very useful.
    And I still have a follow question: Could I make the difference between start time of each channel (ADC) be very small?
    For example, If the sample time interval of each ADC is 10^-6 s(according to the max sampling rat of ADC), Could I make the difference between start time of each channel (ADC) be like 10^-7 s? Would it be limited by the clock in FPGA module or the sampling clock in adapter module?
    The picture below is a indication of my question. From the picture, you can see the time offset betwen each ADC is really small (even smaller than sampling time interval).
    Thanks!
    Xingjian

  • Cursor in ALV-Controls

    Hi ABAPers!
    I'd like to use an ALV-Grid (class cl_gui_alv_grid) for a display only. Thus I don't need any cursor on the displayed list.
    But in general the upmost left cell is marked (the whole cell is marked in orange).
    How do I suppress that mark? I don't want to have any cell marked.
    Any Ideas?
    Best regards
    Torsten

    Hi Balaji!
    I tried all SEL_MODE combinations. The difference between A/B/C/D is, that when you move the cursor, the whole row is marked instead of a single cell.
    There must be another way to suppress the mark in the cell. There is nothing to choose from, so why having a cursor?
    ts.

  • Alv control breaks

    hi sap fans,
    i got one issue in alv's
    the o/p display in alv's is like this
    top-of-page: reconsilation a/c,
                         check date,
                         check no.
    o/p:  bank a/c, amount,,
    client asking me at end of bank a/c no i want a a special row with fields 'reconsilation(lable only),total no of line items,total amount of this bank account.
    regards
    udaya bhasker bandi

    Hi
    look thsi threds http://www.sdn.sap.com/irj/scn/advancedsearch?query=controlbreskin+alv
    Regards,
    Pravin

  • ALV Control: Permitted Values for STYLE in the ALV Data Transfer structure

    Does anyone know a source / reference that "de-codes" the integer value of the the field style in the structure LVC_S_DATA to something a human understands.
    Doh!! It is the binary values that are important.
    Edited by: Andrew Barnard on Sep 2, 2008 3:00 PM.

    It is the binary values that are important.
    add 32 to turn bolding on
    add 512 to turn underline on
    add 2048 to get left-justified
    and so on..

Maybe you are looking for