ALV Grid: event for return

Hi developers,
i'm wanna do something after a user has pressed the return button in a alv grid control. For that i need probably a event. But i can not find a proper event in the documentation. Could one of you guys help me?
Best regards christian

You should post your question in the ABAP forum

Similar Messages

  • ALV Grid: event for user return in ALV Grid Control

    Hi developers,
    i'm wanna do something after a user has pressed the return button in a alv grid control. For that i need probably a event. But i can not find a proper event in the documentation. Could one of you guys help me?
    Best regards christian

    Hi Christian
    ALV grid is an encapsulated object, so it seems there is no way, you ought to implement the data_changed event. So if you want to make bulk data input and after trigger the event by pressing the return key, you should make the ALV Grid get your changes after pressing the key but not after a cell change of a modified cell.
    To set this attribute:
    CALL METHOD gr_alvgrid->register_edit_event
         EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_enter .
    This way "data_changed" event will be triggered whenever you press the return key while editing.
    For some more information you can also refer to the tutorial <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an%20easy%20reference%20for%20alv%20grid%20control.pdf">"An Easy Reference for ALV Grid Control"</a>.
    Regards
    *--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

  • Wrong messagetype while processing in an alv grid event

    Hello,
    a brief discription of my problem:
    I am processing a standard SAP form "PERIODE_PRUEFEN" which calls the function "READ_CUSTOMIZED_MESSAGE". The routine is called inside an event-handler of the ALV Grid event 'user_command'. The messagetype is selected from a customising table 'T100C'. Despite the messagetype 'W' the program is always aborted with an 'E' message.
    What I have tried so far:
    1. I debugged the SAP standard transaction 'fb08' which runs exactly the same functions with the same values and it works.
    2. I changed the messagetype in the debugger - no success
    3. I searched the SAP notes, but theres nothing about my problem
    I guess the problem is somewhere in the ALV Grid event, because this is the only difference between the SAP standard an my program. Maybe the message is processed wrong while beeing called within an event.
    It would be great to get some useful hints to solve this problem

    Hi,
    The ABAP runtime environment handles messages according to the type declared in the MESSAGE statement and the context in which the message was sent.
    The behaviour of message type 'W' in a dialog is different from a report program.
    Run demo program DEMO_MESSAGES, select Main Program, Type 'W' and execute. You will get an error message instead of warning message.
    This behaviour is well documeneted in the on-line help for MESSAGE statement.
    Regards,
    Rao A

  • Set specific rows in ALV grid ready for input

    Hi everyone,
      I have a question about how to set specific rows in ALV grid ready for input.
      I know that I can make some columns ready for input before the ALV displayed,but I have no idea how to make specific rows displayed in the ALV ready for input.

    Hello Aaron
    For editable columns we can use the fieldcatalog (LVC_S_FCAT-EDIT = 'X') but for rows you need to define editability on cell level.
    The required steps are documented in sample report BCALV_EDIT_02. Below I point out a few crucial points:
    *§1.Extend your output table for a field, e.g., CELLTAB, that holds
    *   information about the edit status of each cell for the
    *   corresponding row (the table type is SORTED!).
    DATA: BEGIN OF gt_outtab occurs 0.  "with header line
            include structure sflight.
    DATA: celltab type LVC_T_STYL.
    DATA: END OF gt_outtab.
    *§3.Provide the fieldname of the celltab field by using field
    *   STYLEFNAME of the layout structure.
       gs_layout-stylefname = 'CELLTAB'.
       CALL METHOD grid1->set_table_for_first_display
             EXPORTING i_structure_name = 'SFLIGHT'
                       is_layout        = gs_layout
             CHANGING  it_outtab        = gt_outtab[].
    Note: in the sample report only field SEATSMAX is editable. In your case you need
    to fill CELLTAB for all fields in a row.
    *§2.After selecting data, set edit status for each row in a loop
    *   according to field SEATSMAX.
      LOOP AT gt_outtab.
        l_index = sy-tabix.
        refresh lt_celltab.
        if gt_outtab-seatsmax ge 300.
            perform fill_celltab using 'RW'
                                 changing lt_celltab.
        else.
            perform fill_celltab using 'RO'
                                 changing lt_celltab.
        endif.
    *§2c.Copy your celltab to the celltab of the current row of gt_outtab.
        INSERT LINES OF lt_celltab INTO TABLE gt_outtab-celltab.
        MODIFY gt_outtab INDEX l_index.
      ENDLOOP.
    ENDFORM.                               " SELECT_DATA_AND_INIT_STYLE
    NOTE: LVC_T_STYL is a SORTED table type. Thus, take care that you are using the
    INSERT ... INTO TABLE statement and not APPEND (because then nothing is appended
    to the CELLTAB itab).
      IF p_mode EQ 'RW'.
    *§2a.Use attribute CL_GUI_ALV_GRID=>MC_STYLE_ENABLED to set a cell
    *    to status "editable".
        l_mode = cl_gui_alv_grid=>mc_style_enabled.
      ELSE. "p_mode eq 'RO'
    *§2b.Use attribute CL_GUI_ALV_GRID=>MC_STYLE_DISABLED to set a cell
    *    to status "non-editable".
        l_mode = cl_gui_alv_grid=>mc_style_disabled.
      ENDIF.
      ls_celltab-fieldname = 'SEATSMAX'.
      ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
      INSERT ls_celltab INTO TABLE pt_celltab.
    Regards
      Uwe

  • ALV Grid event handlers

    Hello Friends;
    I have a problem with event handlers. I have defined events for double_click, data_change and hotspot_click. At first run of the program everything runs fine but when I make a change at the screen (like pressing Enter or entering a value at a screen field) the handlers seem to be called a couple of times. For example at a hotspot click I call an accounting document display and when I want to return with back button the program seems to be stuck at document display. Actually it calls event handler over and over again. How can I solve this problem? Can refreshing grid be a solution?
    Thx in advance
    Ali

    Hello Ali
    The problem is that after handling the hotspot event the current cell is still on the field with the hotspot. Thus, when you push ENTER the ALV grid checks the current cell which has a hotspot defined which, in turn, raises event HOTSPOT_CLICK.
    Therefore, you have to move the current cell to another cell that has no hotspot defined. Have a look at the implementation of the event handler method. The hotspot is on field KUNNR. After calling transaction XD03 I shift the current cell to field BUKRS.
    If you comment these lines you will see the same behaviour of the report as you described.
    *& Report  ZUS_SDN_TWO_ALV_GRIDS
    REPORT  ZUS_SDN_ALVGRID_EVENTS.
    DATA:
      gd_okcode        TYPE ui_func,
      gt_fcat          TYPE lvc_t_fcat,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid.
    DATA:
      gt_knb1          TYPE STANDARD TABLE OF knb1.
    PARAMETERS:
      p_bukrs      TYPE bukrs  DEFAULT '1000'  OBLIGATORY.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
            IMPORTING
              e_row_id
              e_column_id
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_hotspot_click.
    *   define local data
        DATA:
          ls_knb1     TYPE knb1,
          ls_col_id   type lvc_s_col.
        READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row_id-index.
        CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
        SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
        SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
        CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
    *   Set active cell to field BUKRS otherwise the focus is still on
    *   field KUNNR which will always raise event HOTSPOT_CLICK
        ls_col_id-fieldname = 'BUKRS'.
        CALL METHOD go_grid1->set_current_cell_via_id
          EXPORTING
            IS_ROW_ID    = e_row_id
            IS_COLUMN_ID = ls_col_id.
      ENDMETHOD.                    "handle_hotspot_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT        * FROM  knb1 INTO TABLE gt_knb1
             WHERE  bukrs  = p_bukrs.
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          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.
    * Create ALV grid
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_docking
        EXCEPTIONS
          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.
    * Set event handler
      SET HANDLER:
        lcl_eventhandler=>handle_hotspot_click FOR go_grid1.
    * Build fieldcatalog and set hotspot for field KUNNR
      PERFORM build_fieldcatalog_knb1.
    * Display data
      CALL METHOD go_grid1->set_table_for_first_display
        CHANGING
          it_outtab       = gt_knb1
          it_fieldcatalog = gt_fcat
        EXCEPTIONS
          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.
    * Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          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.
    * ok-code field = GD_OKCODE
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  BUILD_FIELDCATALOG_KNB1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog_knb1 .
    * define local data
      DATA:
        ls_fcat        TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'KNB1'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        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.
      READ TABLE gt_fcat INTO ls_fcat
           WITH KEY fieldname = 'KUNNR'.
      IF ( syst-subrc = 0 ).
        ls_fcat-hotspot = abap_true.
        MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
      ENDIF.
    ENDFORM.                    " BUILD_FIELDCATALOG_KNB1
    Regards
      Uwe

  • Capturing the ALV Grid Event

    Hi Experts,
    I am working on ALV Grid , Data is Displayed in Grid well , But Can Any one please tell me how can i capture the event (back,exit and cancel) which is persent on standard toolbar on ALV Gried output .
    Rgds,
    Premraj

    Hello PremRaj ,
    Please find an dummy program to capture the events below:
    TYPE-POOLS slis.
    DATA: ITAB_EVENTS TYPE slis_t_event,
          WA_EVENTS TYPE SLIS_ALV_EVENT.
    DATA: IT_END TYPE SLIS_T_LISTHEADER,
          WA_END TYPE SLIS_LISTHEADER.
    ** This function module will get all the events present in alv into internal table itab_events*
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      I_LIST_TYPE           = 0
    IMPORTING
       ET_EVENTS             = ITAB_EVENTS
    EXCEPTIONS
      LIST_TYPE_WRONG       = 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.
    ** With this read table statement itab_events is read for the desired event*+
    READ TABLE itAB_eventS INTO wa_eventS WITH KEY name = 'END_OF_LIST'.
      wa_eventS-form = 'END'.
      MODIFY itAB_eventS FROM wa_eventS INDEX sy-tabix.
      CLEAR wa_eventS.
    *Pass the ITAB_EVENTS created in this Function Module
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
        IT_EVENTS                         = ITAB_EVENTS
    IMPORTING
       E_EXIT_CAUSED_BY_CALLER           =
       ES_EXIT_CAUSED_BY_USER            =
       TABLES
         t_outtab                          = it_tab
    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.
    *READ TABLE itAB_eventS INTO wa_eventS WITH KEY name = 'END_OF_LIST'.
    wa_eventS-form = 'END'.
    MODIFY itAB_eventS FROM wa_eventS INDEX sy-tabix.
    CLEAR wa_eventS.
    *in these statements ,the second line will automatically try to call subroutine with name end.
    FORM END.
    WA_END-TYP = 'S'.
    WA_END-KEY = TEXT-004.
    WA_END-INFO = SY-DATUM.
    APPEND WA_end TO IT_END.
    CLEAR WA_END.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        it_list_commentary       = IT_END
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.
    Hope it helps you.
    Thanks Mansi
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 11:02 AM
    Edited by: MANSI  ASNANI on Jan 9, 2009 7:31 AM

  • ALV GRID - EVENT HANDLING

    Hi all,
       Please let me know how to hanldle  event handling , making a cell in editable mode ,double click and hotspot creation,colorign a single cell,calling a transatcion when clicked on hotspot in a alv grid display program (not using OO   concepts).
    Looikng forward for a positive response.
    Reagrds,
    Mohinder.

    Hi,
    You can create your own custom status and asign it to your
    ALV GRID. Here is a sample code to add custom status and handling events.
    http://www.geocities.com/mpioud/Z_DEMO_ALV_REFRESH_BUTTON.html
    Reward Points if found helpfull..
    Cheers,
    Chandra Sekhar.

  • ALV Grid Event Problem

    Hi,
    I have a dialog that contains an ALV grid and three buttons.  When the ALV grid is created, it's parent is specified as a custom container.
    Container
    data : g_custom_container type ref to cl_gui_custom_container.
    ALV Grid
    data : g_grid             type ref to cl_gui_alv_grid.
        create object g_custom_container
               exporting container_name = p_cont_name.
        create object g_grid
               exporting i_parent = g_custom_container
               I_APPL_EVENTS = 'X'.
    I would like the user to be able to just hit enter to accept the values displayed in the ALV.  My problem is that when the dialog is created, the ALV has focus so the event isn't getting to the PAI of the dialog.  If I click the mouse outside of the ALV to take focus away from the ALV, hitting the enter key does trigger the correct event in the dialog PAI.  How can I either set the focus outside of the ALV when the dialog loads, or make the ALV forward the event to the dialog.
    Thank you very much for any isight you can lend!
    John Richason

    Hi John, are you working with an editable ALV grid?  If so, the code below will allow an event to be fired when the user hits enter after the data has been changed.
               call method alv_grid->register_edit_event
                            exporting
                               i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    You then need to create an event handler to handle the event being fired when the data is changed.
    *   create Event Receiver
              create object event_receiver.
    *   handler for ALV grid
              set handler event_receiver->handle_data_changed for alv_grid.
    REgards,
    Rich Heilman

  • ALV GRID - Text for Grand Total

    Hi guys,
    In ALV Grid, i need to display the Text 'GRAND TOTAL' at the left side of the row(Yellow line).
    I have tried searching in the forum but didn't get the answer.
    Please advice.
    Thanks
    Chintu

    Hi
    <br><br>
    IF you copy and past this might not work but this is the sample code<br><br>
    <pre>
    REPORT  Y_DOWN_TIME_ENTRYSRA.
    TABLES : YDOWNTIME1.
    TYPE-POOLS : SLIS.
    *INTERNAL TABLE DECLARTION
    data : l_layout type slis_layout_alv,
           x_events type slis_alv_event,
           it_events type slis_t_event.
    DATA :ITAB LIKE YDOWNTIME1 OCCURS 0 WITH HEADER LINE .
    data :  GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          wa_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    **********************SELECTION PARAMETERS ************************
    PARAMETERS: CB1 RADIOBUTTON GROUP G1 ,
                CB2 RADIOBUTTON GROUP G1 ,
                cb3 RADIOBUTTON GROUP G1 ,
                CB4 RADIOBUTTON GROUP G1 ,
                CB5 RADIOBUTTON GROUP G1 ,
                CB6 RADIOBUTTON GROUP G1 ,
                CB7 RADIOBUTTON GROUP G1 ,
                CB8 RADIOBUTTON GROUP G1 ,
                CB9 RADIOBUTTON GROUP G1 .
               CB10 RADIOBUTTON GROUP G1,
               CB11 RADIOBUTTON GROUP G1.
    DATA : A TYPE C.
    SELECTION-SCREEN BEGIN OF BLOCK BK1 WITH FRAME TITLE TEXT-001.
      SELECT-OPTIONS :S_EQUNR         FOR  YDOWNTIME1-EQUNR ,
                      S_ERDop        FOR  YDOWNTIME1-ERDAT,
                      S_MFSTT         FOR  YDOWNTIME1-MFSTART.
      PARAMETERS :    P_SHIFT         TYPE YDOWNTIME1-SHIFT,
                      P_CHARG         TYPE YDOWNTIME1-CHARG,
                      p_COGRU         TYPE YDOWNTIME1-QMGRP,
                      P_CODE          TYPE YDOWNTIME1-COde,
                     p_name          type ydowntime1-OPNAME,
                      p_sup           TYPE YDOWNTIME1-SUPERVISOR,
                      P_MANG           TYPE YDOWNTIME1-MANG.
    SELECTION-SCREEN END OF BLOCK BK1 .
    AT SELECTION-SCREEN.
      IF CB1 EQ 'X'.
        select  * from YDOWNTIME1
             INTO  CORRESPONDING FIELDS OF TABLE   ITAB
                   where erdat in S_ERDop  .
      ELSEIF CB2 EQ 'X' .
         select  * from YDOWNTIME1
           INTO  CORRESPONDING FIELDS OF TABLE   ITAB
           where erdat in S_ERDop and  charg eq p_charg .
      ELSEIF CB3 EQ 'X' .
         select  * from YDOWNTIME1
           INTO  CORRESPONDING FIELDS OF TABLE   ITAB
           where erdat in S_ERDop and charg  eq p_charg and shift eq P_SHIFT .
      ELSEIF  CB4 EQ 'X' .
        select  * from YDOWNTIME1
           INTO  CORRESPONDING FIELDS OF TABLE   ITAB
           where  code eq p_code and  erdat in S_ERDop.
      ELSEIF  CB5 EQ 'X' .
        select  * from YDOWNTIME1
           INTO  CORRESPONDING FIELDS OF TABLE   ITAB
           where  erdat in S_ERDop and EQUNR in S_EQUNR and QMGRP eq p_COGRU.
      ELSEIF  CB6 EQ 'X' .
        select  * from YDOWNTIME1
           INTO  CORRESPONDING FIELDS OF TABLE   ITAB
           where  OPNAME eq p_name and  erdat in S_ERDop.
      ELSEIF   CB7 EQ 'X' .
        select  * from YDOWNTIME1
           INTO  CORRESPONDING FIELDS OF TABLE   ITAB
           where SUPERVISOR eq p_sup and  erdat in S_ERDop.
      ELSEIF   CB8 EQ 'X' .
        select  * from YDOWNTIME1
           INTO  CORRESPONDING FIELDS OF TABLE   ITAB
           where MANG eq p_MANG and  erdat in S_ERDop.
      ELSEIF   CB9 EQ 'X'.
        select  * from YDOWNTIME1
           INTO  CORRESPONDING FIELDS OF TABLE   ITAB
           where erdat in S_ERDop and EQUNR in S_EQUNR.
      endif.
    loop at itab.
    if itab-schno > 1.
      A = '  '.
      move A to itab-DCOR .
      move A to itab-DCCR .
      move A to itab-DCNR .
      modify itab.
    endif.
    endloop.
    perform create_fieldcat.
    data: sort type slis_sortinfo_alv,
          it_sort type  SLIS_T_SORTINFO_ALV.
    sort-fieldname = 'EQUNR'.
    sort-up = 'X'.
    sort-subtot = 'X'.
    APPEND sort to it_sort.
    sort-fieldname = 'SHIFT'.
    sort-up = 'X'.
    *sort-subtot = 'X'.
    APPEND sort to it_sort.
    l_layout-TOTALS_TEXT = 'TOTAL'.
    l_layout-SUBTOTALS_TEXT = 'SUBTOTAL'.
       CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
        i_callback_program       = sy-repid
        is_layout                = l_layout
        it_fieldcat              = gt_fieldcat
        it_events                = it_events
        it_sort                  = it_sort
      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.
    *&      Form  CREATE_FIELDCAT
          text
    -->  p1        text
    <--  p2        text
    FORM CREATE_FIELDCAT .
      DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-ROW_POS     = '1'.
      LS_FIELDCAT-COL_POS     = '1'.
      LS_FIELDCAT-FIELDNAME   = 'ERDAT'.
      LS_FIELDCAT-KEY         = ''.
      LS_FIELDCAT-OUTPUTLEN   = '12'.
    ls_fieldcat-do_sum       = 'X'.
      LS_FIELDCAT-SELTEXT_L =  'Date'.
      APPEND LS_FIELDCAT TO GT_FIELDCAT.
      clear LS_FIELDCAT .
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-ROW_POS     = '1'.
      LS_FIELDCAT-COL_POS     = '2'.
      LS_FIELDCAT-FIELDNAME   = 'UZEIT'.
      LS_FIELDCAT-KEY         = ''.
      LS_FIELDCAT-OUTPUTLEN   = '8'.
      LS_FIELDCAT-SELTEXT_L =  'Time'.
      APPEND LS_FIELDCAT TO GT_FIELDCAT.
        clear LS_FIELDCAT .
       CLEAR LS_FIELDCAT.
      LS_FIELDCAT-ROW_POS     = '1'.
      LS_FIELDCAT-COL_POS     = '2'.
      LS_FIELDCAT-FIELDNAME   = 'EQUNR'.
      LS_FIELDCAT-KEY         = ''.
      LS_FIELDCAT-OUTPUTLEN   = '8'.
      LS_FIELDCAT-SELTEXT_L =  'Equipment'.
      APPEND LS_FIELDCAT TO GT_FIELDCAT.
        clear LS_FIELDCAT .
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-ROW_POS     = '1'.
      LS_FIELDCAT-COL_POS     = '2'.
      LS_FIELDCAT-FIELDNAME   = 'CODE'.
      LS_FIELDCAT-KEY         = ''.
      LS_FIELDCAT-OUTPUTLEN   = '12'.
      LS_FIELDCAT-SELTEXT_L =  'CODE'.
      APPEND LS_FIELDCAT TO GT_FIELDCAT.
        clear LS_FIELDCAT .
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-ROW_POS     = '1'.
      LS_FIELDCAT-COL_POS     = '3'.
      LS_FIELDCAT-FIELDNAME   = 'QMGRP'.
      LS_FIELDCAT-KEY         = ''.
      LS_FIELDCAT-OUTPUTLEN   = '20'.
      LS_FIELDCAT-SELTEXT_L =  'Code Group'.
      APPEND LS_FIELDCAT TO GT_FIELDCAT.
        clear LS_FIELDCAT .
    CLEAR LS_FIELDCAT.
      LS_FIELDCAT-ROW_POS     = '1'.
      LS_FIELDCAT-COL_POS     = '3'.
      LS_FIELDCAT-FIELDNAME   = 'KURZTEXT'.
      LS_FIELDCAT-KEY         = ''.
      LS_FIELDCAT-OUTPUTLEN   = '40'.
      LS_FIELDCAT-SELTEXT_L =  'Code Text'.
      APPEND LS_FIELDCAT TO GT_FIELDCAT.
        clear LS_FIELDCAT .
       CLEAR LS_FIELDCAT.
      LS_FIELDCAT-ROW_POS     = '1'.
      LS_FIELDCAT-COL_POS     = '7'.
      LS_FIELDCAT-FIELDNAME   = 'DCOR'.
      LS_FIELDCAT-KEY         = ''.
      LS_FIELDCAT-OUTPUTLEN   = '14'.
      LS_FIELDCAT-SELTEXT_L =  'Opening Dips'.
      APPEND LS_FIELDCAT TO GT_FIELDCAT.
        clear LS_FIELDCAT .
        CLEAR LS_FIELDCAT.
      LS_FIELDCAT-ROW_POS     = '1'.
      LS_FIELDCAT-COL_POS     = '8'.
      LS_FIELDCAT-FIELDNAME   = 'DCCR'.
      LS_FIELDCAT-KEY         = ''.
      LS_FIELDCAT-OUTPUTLEN   = '14'.
      LS_FIELDCAT-SELTEXT_L =  'Closing Dips'.
      APPEND LS_FIELDCAT TO GT_FIELDCAT.
        clear LS_FIELDCAT .
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-ROW_POS     = '1'.
      LS_FIELDCAT-COL_POS     = '9'.
      LS_FIELDCAT-FIELDNAME   = 'DCNR'.
      LS_FIELDCAT-KEY         = ''.
      LS_FIELDCAT-OUTPUTLEN   = '10'.
      ls_fieldcat-do_sum       = 'X'.
      LS_FIELDCAT-SELTEXT_L =  'Net Dips'.
      APPEND LS_FIELDCAT TO GT_FIELDCAT.
        clear LS_FIELDCAT .
    CLEAR LS_FIELDCAT.
    LS_FIELDCAT-ROW_POS     = '1'.
    LS_FIELDCAT-COL_POS     = '9'.
    LS_FIELDCAT-FIELDNAME   = 'PRO'.
    LS_FIELDCAT-KEY         = ''.
    LS_FIELDCAT-OUTPUTLEN   = '10'.
    ls_fieldcat-do_sum       = 'X'.
    LS_FIELDCAT-SELTEXT_L =  'PROD IN LAC'.
    APPEND LS_FIELDCAT TO GT_FIELDCAT.
       clear LS_FIELDCAT .
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-ROW_POS     = '1'.
      LS_FIELDCAT-COL_POS     = '4'.
      LS_FIELDCAT-FIELDNAME   = 'CHARG'.
      LS_FIELDCAT-KEY         = ''.
      LS_FIELDCAT-OUTPUTLEN   = '12'.
      ls_fieldcat-do_sum       = 'X'.
      LS_FIELDCAT-SELTEXT_L =  'Batch Number'.
      APPEND LS_FIELDCAT TO GT_FIELDCAT.
        clear LS_FIELDCAT .
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-ROW_POS     = '1'.
      LS_FIELDCAT-COL_POS     = '6'.
      LS_FIELDCAT-FIELDNAME   = 'OPNAME'.
      LS_FIELDCAT-KEY         = ''.
      LS_FIELDCAT-OUTPUTLEN   = '20'.
      LS_FIELDCAT-SELTEXT_L =  'Operators Name'.
      APPEND LS_FIELDCAT TO GT_FIELDCAT.
        clear LS_FIELDCAT .
    CLEAR LS_FIELDCAT.
      LS_FIELDCAT-ROW_POS     = '1'.
      LS_FIELDCAT-COL_POS     = '6'.
      LS_FIELDCAT-FIELDNAME   = 'SUPERVISOR'.
      LS_FIELDCAT-KEY         = ''.
      LS_FIELDCAT-OUTPUTLEN   = '20'.
      LS_FIELDCAT-SELTEXT_L =  'Supervisor Name'.
      APPEND LS_FIELDCAT TO GT_FIELDCAT.
        clear LS_FIELDCAT .
         CLEAR LS_FIELDCAT.
      LS_FIELDCAT-ROW_POS     = '1'.
      LS_FIELDCAT-COL_POS     = '6'.
      LS_FIELDCAT-FIELDNAME   = 'MANG'.
      LS_FIELDCAT-KEY         = ''.
      LS_FIELDCAT-OUTPUTLEN   = '20'.
      LS_FIELDCAT-SELTEXT_L =  'Manager'.
      APPEND LS_FIELDCAT TO GT_FIELDCAT.
        clear LS_FIELDCAT .
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-ROW_POS     = '1'.
      LS_FIELDCAT-COL_POS     = '6'.
      LS_FIELDCAT-FIELDNAME   = 'SHIFT'.
      LS_FIELDCAT-KEY         = ''.
      LS_FIELDCAT-OUTPUTLEN   = '20'.
      LS_FIELDCAT-SELTEXT_L =  'Shift'.
      APPEND LS_FIELDCAT TO GT_FIELDCAT.
        clear LS_FIELDCAT .
    CLEAR LS_FIELDCAT.
      LS_FIELDCAT-ROW_POS     = '1'.
      LS_FIELDCAT-COL_POS     = '9'.
      LS_FIELDCAT-FIELDNAME   = 'MFSTART'.
      LS_FIELDCAT-KEY         = ''.
      LS_FIELDCAT-OUTPUTLEN   = '10'.
      LS_FIELDCAT-SELTEXT_L =  'Start Time'.
      APPEND LS_FIELDCAT TO GT_FIELDCAT.
        clear LS_FIELDCAT .
       CLEAR LS_FIELDCAT.
      LS_FIELDCAT-ROW_POS     = '1'.
      LS_FIELDCAT-COL_POS     = '9'.
      LS_FIELDCAT-FIELDNAME   = 'MFEND'.
      LS_FIELDCAT-KEY         = ''.
      LS_FIELDCAT-OUTPUTLEN   = '10'.
      LS_FIELDCAT-SELTEXT_L =  'End Time'.
      APPEND LS_FIELDCAT TO GT_FIELDCAT.
        clear LS_FIELDCAT .
       CLEAR LS_FIELDCAT.
      LS_FIELDCAT-ROW_POS     = '1'.
      LS_FIELDCAT-COL_POS     = '9'.
      LS_FIELDCAT-FIELDNAME   = 'DURATION'.
      LS_FIELDCAT-KEY         = ''.
      LS_FIELDCAT-OUTPUTLEN   = '10'.
      ls_fieldcat-do_sum       = 'X'.
      LS_FIELDCAT-SELTEXT_L =  'DURATION'.
      APPEND LS_FIELDCAT TO GT_FIELDCAT.
        clear LS_FIELDCAT .
        CLEAR LS_FIELDCAT.
      LS_FIELDCAT-ROW_POS     = '1'.
      LS_FIELDCAT-COL_POS     = '9'.
      LS_FIELDCAT-FIELDNAME   = 'ZUNIT'.
      LS_FIELDCAT-KEY         = ''.
      LS_FIELDCAT-OUTPUTLEN   = '10'.
      LS_FIELDCAT-SELTEXT_L =  'UNIT'.
      APPEND LS_FIELDCAT TO GT_FIELDCAT.
        clear LS_FIELDCAT .
    ENDFORM.                    " CREATE_FIELDCAT
    </pre>
    Edited by: Matt on Sep 3, 2009 12:06 PM

  • Validating in ALV grid output for double entry

    Hi All,
             I am trying to validate the ALV output while adding records to the screen.
    I need to validate if the same primary key exist while user is creating a new record in the ALV output. If the same record is entered many time ( with the same primary key), it should pop up some error and i am calling
    call method pr_data_changed->add_protocol_entry.
    But i'm not able to apply the logic for 2 fields as primary key.
    I check the method check_double_entry in program BCALV_EDIT_04. it does the same but it checks i field 'FLDATE' as primary key.
    Algorithm: Copy all entries in MT_GOOD_CELLS to a dummy table.
               During the copying procedure check if there exists
               already a line with the same Flight date.
        loop at pr_data_changed->mt_good_cells into ls_good.
          case ls_good-fieldname.
            when 'FLDATE'.
              call method pr_data_changed->get_cell_value
                          exporting
                                i_row_id = ls_good-row_id
                                i_fieldname = ls_good-fieldname
                          importing e_value = l_flightdate.
              read table lt_good_cells with key
                                value = l_flightdate
                                transporting no fields.
              if sy-subrc = 0.
    There exists already a line with the same flight date!
                call method pr_data_changed->add_protocol_entry
                             exporting
                  i_msgid = '0K' i_msgno = '000'  i_msgty = 'E'
                  i_msgv1 = text-m01
                  i_fieldname = ls_good-fieldname
                  i_row_id = ls_good-row_id.
                error_in_data = 'X'.
              else.
                ls_good-value = l_flightdate.
                append ls_good to lt_good_cells.
              endif.
          endcase.
        endloop.
    Could you pls help me how to use this logic in case where more than 1 field is primary key.
    Regards,
    Santos P

    Hi
    ALV option is available from 4.7 onwards only.
    the following needs to be followed in 4.7 to get in ALV:
    We can get the results in ALV format just by changing the IMG settings.
    Go to IMG under Materials Management -> Purchasing ->Reporting -> Maintain Purchasing Lists -> Scope of List -> Define Scope of List. Select any one option & double click. A new screen will display with lot of check boxes. in the end will find a check box for "Settings for ALV grid control. Just tick that box & save this as new name like BEST_ALV.
    regards
    Srinivas

  • Highlight the column in the ALV grid only for few entries!

    Hi all,
    I am using the FM "REUSE_ALV_GRID_DISPLAY" to dsplay the o/p of my report in ALV grid.
    Now i need to highlight 1 particluar column for only some entries(row) based on the value of the column which is to be highlighted.
    Can anyone tell me the steps to do so??

    Please make search thru this form you can find lot of threads
    For example
    https://forums.sdn.sap.com/search.jspa?threadID=&q=alvANDcellANDcolor+&objID=f50&dateRange=all&numResults=15

  • ALV Grid Display for ME2N, ME2L

    Hello,
    We have a requirement where we want the ALVGrid Display for ME2N, ME2L. When we list these in excel file it comes in very scattered manner.
    Client is looking for PO report similar to ME80FN with credit terms, GR Info etc.. I believe ECC 6.0 have ALV Grid in standard, else this can be incorporated thru OLME --- > Reporting ---> Scope of List and does not require query but I am not sure how to achieve it.
    Regards,
    Puneet

    Puneet,
    In the selection screen of ME2N or ME2L, if you will select ALV in the field SCOPE OF LIST, u will get the report in ALV format.
    To default the SCOPE OF LIST in any transaction code from BEST to ALV, please follow the below path in SPRO:
    Materials ManagementPurchasing-Reporting-Maintain Purchasing Lists-Scope of List---Define Default Values for Transactions

  • ALV grid, prevent return to line 1 column 1 after using filter button

    How can I prevent the ALV grid display from returning to line 1, column 1, after a user has modified the display using the filter or sort button ?  I know this is possible using the is_stable field when control is passed to my ALV code, but when the automatic on-screen buttons are used I can't find a way of controlling how the screen is displayed.

    Max,
    Thanks, the AFTER_USER_COMMAND event allows me access after the filter or sort button has bee npressed, but I am unable to prevent the grid from reverting to column1 line1.  By using the method GET_CURRENT_CELL I can find out the column, but it does not return me the row.   I have tried putting this column id into  SET_CURRENT_CELL_VIA_ID, as suggested by Naimesh above, and calling this from the AFTER_USER_COMMAND method, but it does not effect how the grid displays.    
    Any further advice would be very welcome.

  • Know alv grid on event click

    Hi,
    Is it possible to know the alv grid (TYPE REF TO cl_gui_alv_grid) on the event click? In fact, on a screen, I have 2 alv grids and I would like to store the alv grid name for a process at click moment.
    Thanks.
    Edited by: Xavier Couloumies on Sep 12, 2008 2:07 PM

    you might declare two differents methods for the two grids
    PUBLIC SECTION.
      METHODS:
        HANDLE_DOUBLE_CLICK
          FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
            IMPORTING E_ROW
                      E_COLUMN,
        HANDLE_DOUBLE_CLICK2
          FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
            IMPORTING E_ROW
                      E_COLUMN.
    something like that
    then , in the implementations do something like this
    METHOD HANDLE_DOUBLE_CLICK.
         PERFORM X USING GRID = '1'.
    ENDMETHOD.
    METHOD HANDLE_DOUBLE_CLICK2.
         PERFORM X USING GRID = '2'.
    ENDMETHOD.
    and do the respective validations on that form
    hope this help

  • How can I call functionality of ALV Grid by event of button outside grid?

    Hello,
    How can I call functionality of ALV Grid by event of button located outside ALV Grid? For example how to fire printing of this ALV Grid by button click elsewhere on the screen (not in toolbar of ALV Grid).
    Best regards,
    Josef Motl

    hi Motl,
    these are steps to create a button in ALV and trigger an event from it..
    1.Use the parameter i_callback_pf_status_set in the function module REUSE_ALV_GRID_DISPLAY
    i_callback_program = gd_repid
    i_callback_pf_status_set = 'SET_PF_STATUS'
    form set_pf_status using rt_extab type slis_t_extab.
    set pf-status 'NEWALVSTATUS'.
    endform.
    You have to copy the standard ALV pf stauts to 'NEWALVSTATUS' and add your button.
    2.You have to do the following to process the new button click.
    i_callback_user_command = 'USER_COMMAND'
    form user_command using i_ucomm like sy-ucomm
    is_selfield type slis_selfield.
    case i_ucomm.
    3. to copy the standard pf status to a new one.go to the ALV screen and take the menu System -> Status.  Then look for the standard pf status. Copy this to Z range and then add your new button.
    reward points if helpful
    regards
    satesh

Maybe you are looking for

  • LMS3.2 ciscoview 6.1.9 not able to install package Rtr2900.cv50.v2-0

    Hi , I m not able to install package Rtr2900.cv50.v2-0 for cisco2951 router in cisco view  .cisco2900 router is supported on LMS3.2 . Tried online as well as manual method , via - Common Services --->Software Center > Device Update. it says "there is

  • A Premiere Pro CS5.5 MESS

    Wow, I'm so overwhelmed that I don't even know where to begin.  Got a new machine and CS5.5 (upgrading from CS3).  I seem to have a horrid video card/drivers/settings issue going on and I'm stumped. First thing, when Premiere fires up my entire scree

  • IPhoto won't run

    First time user.  During program start up program attempts to update the photo libraries for the first time.  The program crashes back to the iPad home screen each time at the 3/4point with no error message. I tied uninstalling and reinstalling iPhot

  • Can you download raw image files to iPad2?

    Can you download raw image files from a compact flash card onto iPad2?

  • Loop a short flv before the live stream begins

    Hi, Using FMS 3.02 and FME 2.5 is it possible to run a looping flv that the clients can see, before the live stream begins, and when the live stream finishes, an exit flv video plays? cheers