Calling a transaction in alv grid

hi friends,
             can anyone tell me how i could call a transaction se11 in an alv grid display.i want both in double clicking and by using a button.

Hi,
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
i_callback_user_command = 'USER_COMMAND1' <-------
is_layout = wa_layout
it_fieldcat = i_fcat
i_default = c_chk
i_save = c_save
is_variant = wa_variant
it_events = i_events
is_print = wa_print
TABLES
t_outtab = i_table
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
LEAVE LIST-PROCESSING.
ENDIF.
Form user_command1 using rs_selfield type slis_selfield
u_comm like sy-ucomm.
case '%IC1'.
When '...'.
endcase.
Hope this solves your purpose.
Award points if it helps.
-Gaurang

Similar Messages

  • Calling a Transaction from ALV Grid Using OO method

    Hi,
    My requirement is as follows....
    I have an ALV grid with columns such as PO no., GR no., Invoice no., etc...
    When I double click on any of these cells it should take me to the respective Transaction (say ME23n for PO no.) with the cell content as input in the transaction.
    Thanks and Regards,
    Navaneeth

    Hi,
      then u can write the code in HANDLE_DOUBLE_CLICK method
    CLASS LCL_EVENT_RECEIVER DEFINITION.
      PUBLIC SECTION.
        METHODS:
    *method used for double click
        HANDLE_DOUBLE_CLICK
            FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                IMPORTING E_ROW E_COLUMN,
    ENDCLASS.                    "LCL_EVENT_RECEIVER DEFINITION
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
    *implementation of the method double click
    *when document no is double clicked in ALV GRID , its value is sent to
    *transaction FPE3 and the corresponding values of the document are
    *displayed
      METHOD HANDLE_DOUBLE_CLICK.
        CLEAR WA_WRT_OFF_FLDS.
        IF E_COLUMN = 'OPBEL'.
          READ TABLE ITAB INTO WA_IAB INDEX E_ROW-INDEX.
               set parameter....
               call transaction...
          endif.
           ENDMETHOD.                    "handle_double_click
    *method to remove unwanted icons from toolbar
    endclass.

  • Calling smartform and displaying ALV grid in ABAP WEBDYNPRO

    Hi all,
    I am new to ABAP web dynpro.I ahve few custom reports which are simple ALV list reports which I now need to convert to ABAP web dynpro application .
    For one particular report,based on the selection screen input,I need to display the ALV list and when I select the records from the ALV list,I need to call a smartform on clik of a push button.
    My questions:
    1. Im using 'REUSE_ALV_GRID_DISPLAY' FM  to display the o/p in my report.Is there any similar FM in webdynpro ABAP which will display my list in ALV GRID in my web dynpro application??/
    2. How to call a smartfrm in ALV grid in web dynpro??
    Edited by: abap_1000 on Jan 9, 2011 6:09 PM

    Hi,
    You can search SDN, there are several posts available. Just to get some idea, you can check --
    [Beginneru00B4s questions on WDA ALV;
    [Reg ALV Display;
    For clicking event on ALV --
    [Reg Row Data fetching on click in ALV;
    For ALV display on WDA --
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/101df93f-4b5c-2910-14aa-9eb0338c2110?quicklink=index&overridelayout=true]
    Thanks.
    Kumar Saurav.

  • Call Transaction in ALV GRID Display

    Hi All,
    i have an ALV list .( list of Invoices) i want to call  trans.
    VF03 from clicking the line .
    i have also used User Command, events  in ALV function .
    as mention below , but cant able to call transaction.
    in ALV line is selected but not working or moves to another Tcode as VF03 with parameter id .
    please help me in this , if any body can ?
    thanks in advance
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_INTERFACE_CHECK        = G_INTERFACE_CHECK
          I_CALLBACK_PROGRAM       = GV_REPID
          IT_FIELDCAT              = GT_FIELDCAT[]
          I_DEFAULT                = 'X'
          I_SAVE                   = 'A'
          IS_LAYOUT                = LAYOUT_IN
          IS_VARIANT               = VARIANT_DETAIL
          IT_EVENTS                = EVENTCAT
         I_CALLBACK_PF_STATUS_SET = 'SET_STATUS'
          I_CALLBACK_USER_COMMAND  = USER_COMMAND
          I_GRID_TITLE             = 'Tax Report : GRN'
        I_CALLBACK_TOP_OF_PAGE   = 'page_header'
        I_BACKGROUND_ID          = 'ALV_BACKGROUND'
        IS_PRINT                 = ALV_PRINT
        IMPORTING
          ES_EXIT_CAUSED_BY_USER   = LS_EXIT_BY_USER
      TABLES
        T_OUTTAB                 = IT_VBRP
      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-SGV4.
      ENDIF.
    Nitin

    HI,
    check the sample code which call the transaction VA02.
    type-pools: slis.
    types: BEGIN OF TY_KNA1,
    KUNNR TYPE KUNNR,
    NAME1 TYPE NAME1,
    ORT01 TYPE ORT01,
    END OF TY_KNA1.
    TYPES: BEGIN OF TY_VBAK,
    VBELN TYPE VBELN,
    ERNAM TYPE ERNAM,
    ERDAT TYPE ERDAT,
    NETWR TYPE NETWR,
    WAERK TYPE WAERK,
    END OF TY_VBAK.
    *&--WORK AREA & TABLE DECLARATION--
    DATA: W_KNA1 TYPE TY_KNA1.
    DATA: T_KNA1 TYPE STANDARD TABLE OF TY_KNA1 INITIAL SIZE 1.
    DATA: W_VBAK TYPE TY_VBAK.
    DATA: T_VBAK TYPE STANDARD TABLE OF TY_VBAK INITIAL SIZE 1.
    *&--FIELDCAT TABLE & WORK AREA--
    DATA: W_FCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: T_FCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA: W_FCAT1 TYPE SLIS_FIELDCAT_ALV.
    DATA: T_FCAT1 TYPE SLIS_T_FIELDCAT_ALV.
    *&--EVENT TABLE AND WORK AREA--
    DATA: W_EVENTS TYPE SLIS_ALV_EVENT.
    DATA: T_EVENTS TYPE SLIS_T_EVENT.
    DATA: W_EVENTS1 TYPE SLIS_ALV_EVENT.
    DATA: T_EVENTS1 TYPE SLIS_T_EVENT.
    *&--COMMENT TABLE & WORK AREA--
    DATA: W_COMMENT TYPE SLIS_LISTHEADER.
    DATA: T_COMMENT TYPE SLIS_T_LISTHEADER.
    DATA: W_COMMENT1 TYPE SLIS_LISTHEADER.
    DATA: T_COMMENT1 TYPE SLIS_T_LISTHEADER.
    APPENDING FCAT -
    W_FCAT-COL_POS = 1.
    W_FCAT-FIELDNAME = 'KUNNR'.
    W_FCAT-SELTEXT_M = 'CUST. NO'.
    W_FCAT-HOTSPOT = 'X'. "HOT SPOT HAND SYMBOL
    W_FCAT-EMPHASIZE = 'C119'. "FOR COLORING THE COLUMN 1
    APPEND W_FCAT TO T_FCAT.
    CLEAR W_FCAT.
    W_FCAT-COL_POS = 2.
    W_FCAT-FIELDNAME = 'NAME1'.
    W_FCAT-SELTEXT_M = 'CUST. NAME'.
    APPEND W_FCAT TO T_FCAT.
    W_FCAT-COL_POS = 3.
    W_FCAT-FIELDNAME = 'ORT01'.
    W_FCAT-SELTEXT_M = 'CITY'.
    APPEND W_FCAT TO T_FCAT.
    W_FCAT1-COL_POS = 1.
    W_FCAT1-FIELDNAME = 'VBELN'.
    W_FCAT1-SELTEXT_M = 'ORDER NO'.
    W_FCAT1-EMPHASIZE = 'C519'.
    APPEND W_FCAT1 TO T_FCAT1.
    CLEAR W_FCAT.
    W_FCAT1-COL_POS = 2.
    W_FCAT1-FIELDNAME = 'ERNAM'.
    W_FCAT1-SELTEXT_M = 'NAME OF PARTY'.
    APPEND W_FCAT1 TO T_FCAT1.
    W_FCAT1-COL_POS = 3.
    W_FCAT1-FIELDNAME = 'ERDAT'.
    W_FCAT1-SELTEXT_M = 'DATE'.
    APPEND W_FCAT1 TO T_FCAT1.
    W_FCAT1-COL_POS = 4.
    W_FCAT1-FIELDNAME = 'NETWR'.
    W_FCAT1-SELTEXT_M = 'ORDER VALUE'.
    APPEND W_FCAT1 TO T_FCAT1.
    W_FCAT1-COL_POS = 5.
    W_FCAT1-FIELDNAME = 'WAERK'.
    W_FCAT1-SELTEXT_M = 'CURRENCY'.
    APPEND W_FCAT1 TO T_FCAT1.
    *&--APPEND COMMENTRY--
    W_COMMENT-TYP = 'H'.
    W_COMMENT-INFO = 'CUSTOMER DETAILS'.
    APPEND W_COMMENT TO T_COMMENT.
    CLEAR W_COMMENT.
    *&--APPEND EVENTS TABLE--
    W_EVENTS-NAME = 'TOP_OF_PAGE'.
    W_EVENTS-FORM = 'TOPPAGE'.
    APPEND W_EVENTS TO T_EVENTS.
    W_EVENTS-NAME = 'USER_COMMAND'.
    W_EVENTS-FORM = 'SUB2'.
    APPEND W_EVENTS TO T_EVENTS.
    W_EVENTS1-NAME = 'TOP_OF_PAGE'.
    W_EVENTS1-FORM = 'TOPPAGE1'.
    APPEND W_EVENTS1 TO T_EVENTS1.
    CLEAR W_EVENTS1.
    W_EVENTS1-NAME = 'USER_COMMAND'.
    W_EVENTS1-FORM = 'SUB3'.
    APPEND W_EVENTS1 TO T_EVENTS1.
    SELECT-OPTIONS: CUSTNO FOR W_KNA1-KUNNR.
    SELECT KUNNR
    NAME1
    ORT01 FROM KNA1 INTO TABLE T_KNA1
    WHERE KUNNR IN CUSTNO.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    *I_BACKGROUND_ID =
    I_GRID_TITLE = 'CUSTOMER DETAILS'
    IT_FIELDCAT = T_FCAT
    IT_EVENTS = T_EVENTS
    TABLES
    T_OUTTAB = T_KNA1 .
    FORM TOPPAGE.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = T_COMMENT
    I_LOGO = 'LOGO_ALV'.
    ENDFORM. "END OF TOPPAGE SUB.
    FORM SUB2 USING UCOMM LIKE SY-UCOMM FIELDS1 TYPE SLIS_SELFIELD.
    READ TABLE T_KNA1 INTO W_KNA1 INDEX FIELDS1-TABINDEX.
    SELECT VBELN
    ERNAM
    ERDAT
    NETWR
    WAERK
    FROM VBAK
    INTO TABLE T_VBAK
    WHERE KUNNR = W_KNA1-KUNNR.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    *I_BACKGROUND_ID =
    I_GRID_TITLE = 'LIST OF ORDERS'
    IT_FIELDCAT = T_FCAT1
    IT_EVENTS = T_EVENTS1
    TABLES
    T_OUTTAB = T_VBAK.
    ENDFORM. "END OF SUB2.
    FORM TOPPAGE1.
    *&--APPEND COMMENTRYOF SECONDRY SCREEN--
    W_COMMENT1-TYP = 'H'.
    W_COMMENT1-INFO = 'LIST OF ORDERS'.
    APPEND W_COMMENT1 TO T_COMMENT1.
    W_COMMENT1-TYP = 'S'.
    W_COMMENT1-KEY = 'CUSTOMER'.
    W_COMMENT1-INFO = W_KNA1-KUNNR.
    APPEND W_COMMENT1 TO T_COMMENT1.
    CLEAR W_COMMENT.
    W_COMMENT1-TYP = 'A'.
    W_COMMENT1-INFO = W_KNA1-NAME1.
    APPEND W_COMMENT1 TO T_COMMENT1.
    CLEAR W_COMMENT1.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = T_COMMENT1
    I_LOGO = 'LOGO_ALV'
    REFRESH T_COMMENT1.
    ENDFORM. "END OF TOPPAGE1
    FORM SUB3 USING UCOMM LIKE SY-UCOMM FIELDS1 TYPE SLIS_SELFIELD.
    READ TABLE T_VBAK INTO W_VBAK INDEX FIELDS1-TABINDEX.
    SET PARAMETER ID 'VBAk' FIELD W_VBAK-VBELN.
    CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
    ENDFORM.
    reward if useful.
    thanks and regards.

  • CALL ING TRANSACTION THROUGH ALV

    hi,
    any one can help me.
    i created one ALV interactive report.i want  in that first report when i click a record, it will go to the transaction MM01.
    pls any one can explain with code.

    HI
    see this report
    when you double click on any lne
    it wil take you to a TRANSACTIon
    *& Report  ZTEST_ALV_LOGO
    REPORT  ztest_alv_logo.
    TYPE-POOLS : slis.
    *ALV Formatting tables /structures
    DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: gt_events   TYPE slis_t_event.
    DATA: gs_layout   TYPE slis_layout_alv.
    DATA: gt_page     TYPE slis_t_listheader.
    DATA: gs_page     TYPE slis_listheader.
    DATA: v_repid     LIKE sy-repid.
    *ALV Formatting work area
    DATA: w_fieldcat TYPE slis_fieldcat_alv.
    DATA: w_events   TYPE slis_alv_event.
    DATA: gt_bsid TYPE TABLE OF bsid WITH HEADER LINE.
    INITIALIZATION.
      PERFORM build_events.
      PERFORM build_page_header.
    START-OF-SELECTION.
    *perform build_comment.     "top_of_page - in initialization at present
      SELECT * FROM bsid INTO TABLE gt_bsid UP TO 10 ROWS.
    *perform populate_for_fm using '1' '3' 'BUKRS' '8' 'GT_BSID' 'Whee'.
    *USING = Row, Column, Field name, display length, table name, heading
    *OR
      PERFORM build_fieldcat.
      gs_layout-zebra = 'X'.
    *top of page event does not work without I_callback_program
      v_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program                = v_repid
          i_structure_name                  = 'BSID'
       i_background_id                   = 'ALV_BACKGROUND'
          i_grid_title                      = 'This is the grid title'
      I_GRID_SETTINGS                   =
          is_layout                         = gs_layout
          it_fieldcat                       = gt_fieldcat[]
          it_events                         = gt_events[]
        TABLES
          t_outtab                          = gt_bsid.
    Form..............:  populate_for_fm
    Description.......:  Populates fields for function module used in ALV
    FORM populate_for_fm USING p_row
                               p_col
                               p_fieldname
                               p_len
                               p_table
                               p_desc.
      w_fieldcat-row_pos      = p_row.          "Row Position
      w_fieldcat-col_pos      = p_col.          "Column Position
      w_fieldcat-fieldname    = p_fieldname.    "Field name
      w_fieldcat-outputlen    = p_len.          "Column Lenth
      w_fieldcat-tabname      = p_table.        "Table name
      w_fieldcat-reptext_ddic = p_desc.         "Field Description
      w_fieldcat-input        = '1'.
      APPEND w_fieldcat TO gt_fieldcat.
      CLEAR w_fieldcat.
    ENDFORM.                    " populate_for_fm
    *&      Form  build_events
    FORM build_events.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = gt_events.
      READ TABLE gt_events
                 WITH KEY name =  slis_ev_user_command
                 INTO ls_event.
      IF sy-subrc = 0.
        MOVE slis_ev_user_command TO ls_event-form.
        APPEND ls_event TO gt_events.
      ENDIF.
      READ TABLE gt_events
                 WITH KEY name =  slis_ev_top_of_page
                 INTO ls_event.
      IF sy-subrc = 0.
        MOVE slis_ev_top_of_page TO ls_event-form.
        APPEND ls_event TO gt_events.
      ENDIF.
    ENDFORM.                    " build_events
    *&      Form  USER_COMMAND
    When user command is called it uses 2 parameters. The itab
    passed to the ALV is in whatever order it currently is on screen.
    Therefore, you can read table itab index rs_selfield-tabindex to get
    all data from the table. You can also check r_ucomm and code
    accordingly.
    FORM user_command USING  r_ucomm     LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      READ TABLE gt_bsid INDEX rs_selfield-tabindex.
    error checking etc.
      SET PARAMETER ID 'KUN' FIELD gt_bsid-kunnr.
      CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
    ENDFORM.                    "user_command
    *&      Form  top_of_page
    Your own company logo can go here if it has been saved (OAOR)
    If the logo is larger than the size of the headings in gt_page,
    the window will not show full logo and will have a scroll bar. Thus,
    it is a good idea to have a standard ALV header if you are going to
    use logos in your top of page.
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = gt_page
          i_logo             = 'ENJOYSAP_LOGO'.
    ENDFORM.                    "top_of_page
    *&      Form  build_fieldcat
    *Many and varied fields are available here. Have a look at documentation
    *for FM REUSE_ALV_LIST_DISPLAY and REUSE_ALV_FIELDCATALOG_MERGE
    FORM build_fieldcat.
      w_fieldcat-fieldname  = 'BUDAT'.
      w_fieldcat-seltext_m  = 'Dte pst'.
      w_fieldcat-ddictxt(1) = 'M'.
      w_fieldcat-edit = 'x'.
    Can change the position of fields if you do not want them in order
    of the DDIC or itab
    w_fieldcat-row_pos = '1'.
    w_fieldcat-col_pos = '10'.
      APPEND w_fieldcat TO gt_fieldcat.
      CLEAR w_fieldcat.
    ENDFORM.                    " build_fieldcat
    *&      Form  build_page_header
          gt_page is used in top of page (ALV subroutine - NOT event)
          *H = Header, S = Selection, A = Action
    FORM build_page_header.
    For Headers, Key is not printed and is irrelevant. Will not cause
    a syntax error, but is not used.
      gs_page-typ  = 'H'.
      gs_page-info = 'Header 1'.
      APPEND gs_page TO gt_page.
      gs_page-typ  = 'H'.
      gs_page-info = 'Header 2'.
      APPEND gs_page TO gt_page.
    For Selections, the Key is printed (bold). It can be anything up to 20
    bytes. It gets printed in order of code here, not by key value.
      gs_page-typ  = 'S'.
      gs_page-key  = 'And the winner is:'.
      gs_page-info = 'Selection 1'.
      APPEND gs_page TO gt_page.
      gs_page-typ  = 'S'.
      gs_page-key  = 'Runner up:'.
      gs_page-info = 'Selection 2'.
      APPEND gs_page TO gt_page.
    For Action, Key is also irrelevant.
      gs_page-typ  = 'A'.
      gs_page-info = 'Action goes here'.
      APPEND gs_page TO gt_page.
    ENDFORM.                    " build_page_header

  • Call transaction from alv

    i am calling a transaction from alv i want to select the check boxes on th called transaction and go to the next screen how do i do that

    Hello Chandan
    You have to handle the DOUBLE_CLICK event either in your callback form routine (FM-based ALV) or event handler method for event USER_COMMAND (ABAP-OO based ALV).
    If you call the transaction directly you will not have the authority check for this transaction. If you need this, you can use function module <b>ABAP4_CALL_TRANSACTION</b> instead.
    If you want to open the transaction in a new window you can use the static method <b>CL_RECA_GUI_SERVICES=>CALL_TRANSACTION</b> (no authority check!).
    Regards
    Uwe

  • ALV Grid - Display/change Problem

    Hi Guys,
    I have a peculiar problem. I have developed a Module pool application containing two screens. In the first screen I have a input field and 2 buttons for display and change. When I enter the value and press Displaythe second screen is called which shows an ALV grid in the respective display mode. But If I come back and press change I could not get the change mode for the ALV grid still it remains in the Display mode. Again if rerun the transaction and press change it shows the ALV grid in change mode but if we press back and choose display then it is not getting changed still remains as such. In all at the first run what ever the mode is chosen it remains stationery. I am using OOALV and i have tried flushing the container, grid and also refreshing the ALV. But could not trace the problem. If you guys have worked or can put some inputs please reply back.
    Jagath.

    Please find the attached code...
    from the first screen 100 i am assigning the flag w_display or w_change based on the okcode. in the second screen 200 PBO i have the following code:
    MODULE status_0200 OUTPUT.
      SET PF-STATUS 'STAT200'.
      SET TITLEBAR 'TIT200'.
      if w_display eq 'X'.
      perform grid_display.
      else.
      perform grid_change.
      endif.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    Now in perform display I have the following code:
    form grid_display .
    Set the Fieldcatalog.
      REFRESH t_fieldcat.
      PERFORM get_field_catalog.
    set the Layout.
      CLEAR wa_layout.
      wa_layout-cwidth_opt = 'X'.
    wa_layout-stylefname = 'CELLTAB'.
    set the Variant
      w_variant-report = sy-repid.
    Create the Instance for container
      IF lcl_custom_disp IS INITIAL.
        CREATE OBJECT lcl_custom_disp
          EXPORTING
           PARENT                      =
            container_name              = 'CONTAINER1'
          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.
    create the object for ALV grid
        CREATE OBJECT lcl_grid_disp
          EXPORTING
            i_parent          = lcl_custom_disp
          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.
    Create the object for events
        CREATE OBJECT lcl_events.
        SET HANDLER lcl_events->handle_top_of_list FOR lcl_grid_disp.
    Display the  ALV.
        CALL METHOD lcl_grid_disp->set_table_for_first_display
          EXPORTING
            is_variant                    = w_variant
            i_save                        = ' '
            is_layout                     = wa_layout
          CHANGING
            it_outtab                     = t_final[]
            it_fieldcatalog               = t_fieldcat
          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.
      ELSE.
    Refresh the ALV grid
        CALL METHOD lcl_grid_disp->refresh_table_display
       EXPORTING
         IS_STABLE      =
         I_SOFT_REFRESH =
          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.
      ENDIF.
    endform.                    " grid_display
    In the perform change the same code is followed for different object with the fieldcatalog  is changed to edit based on flag.
    Set the Fieldcatalog.
      REFRESH t_fieldcat.
      PERFORM get_field_catalog.
    set the Layout.
      CLEAR wa_layout.
      wa_layout-cwidth_opt = 'X'.
    wa_layout-stylefname = 'CELLTAB'.
    set the Variant
      w_variant-report = sy-repid.
    Create the Instance for container
      IF lcl_custom_chng IS INITIAL.
        CREATE OBJECT lcl_custom_chng
          EXPORTING
           PARENT                      =
            container_name              = 'CONTAINER1'
          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.
    create the object for ALV grid
        CREATE OBJECT lcl_grid_chng
          EXPORTING
            i_parent          = lcl_custom_chng
          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.
    Create the object for events
        CREATE OBJECT lcl_events.
        SET HANDLER lcl_events->handle_top_of_list FOR lcl_grid_chng.
        SET HANDLER lcl_events->handle_data_changed FOR lcl_grid_chng.
        SET HANDLER lcl_events->handle_data_changed_finished FOR lcl_grid_chng.
    Display the  ALV.
        CALL METHOD lcl_grid_chng->set_table_for_first_display
          EXPORTING
            is_variant                    = w_variant
            i_save                        = ' '
            is_layout                     = wa_layout
          CHANGING
            it_outtab                     = t_final[]
            it_fieldcatalog               = t_fieldcat
          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.
      ELSE.
    Refresh the ALV grid
        CALL METHOD lcl_grid_chng->refresh_table_display
       EXPORTING
         IS_STABLE      =
         I_SOFT_REFRESH =
          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.
      ENDIF.
    Please let me know if you require some more inputs?
    Jagath

  • ALV GRID - Handling selected rows? Sorting in OUTTAB is different from ALV

    Dear Experts ,
    I have a transaction with ALV grid. I have defined several application specific functions to the ALV grid tool bar. My requirement is to handle the ALV tool bar functions only for the selected rows.
    Code snippet:
    DATA:
    LS_GRID_DS TYPE TYS_DS.
    TYPES: BEGIN OF TYS_DS.
    INCLUDE   TYPE TYS_ALVGRID.
    TYPES: STRUCNAME LIKE DD02L-TABNAME.
    TYPES: PRETAB    TYPE ZTAB_T,
           OUTTAB    TYPE ZTAB_T,
           OUTTAB_HIDDEN TYPE ZTAB_T,
           OUTTAB_SUM TYPE ZTAB_T,
           OUTTAB_ROLLBACK TYPE ZTAB_T,
           END OF TYS_DS.
      LOOP AT ls_grid_ds-marked_rows INTO ss_index_split
           WHERE rowtype IS INITIAL.
    ( Marked rows is correctly giving the row numbers of the highlighted rows)
    READ TABLE ls_grid_ds-outtab INTO ss_sel_rows_ds_split
                   INDEX ss_index_split-index.
    ISSUE : Sorting in ls_grid_ds-outtab internal table is different from ALV Grid display.
    Hence, though ls_grid_ds-marked_rows giving correct rows, I am not able to handle the my requirement correctly.
    Why sorting in gs_grid_ds-outtab is different from ALV display? How can they made in sync?
    Thank you in Advance.
    Sravan.
    Edited by: Raja Sravan on Jan 16, 2009 1:13 AM

    Hello Raja
    The OUTTAB is usually in sync with the display on the frontend grid control because it is a CHANGING parameter (of method SET_TABLE_FOR_FIRST_DISPLAY).
    Question: Do you "feed" ls_grid_ds-outtab to the parameter IT_OUTTAB of method SET_TABLE_FOR_FIRST_DISPLAY?
    If not then it is obvious why you get discrepancies.
    Regards
      Uwe

  • How to use two ALV grids in a single program (pl read below for details)?

    Please read thoroughly::
    I have an ALV report using REUSE_ALV_GRID_DISPLAY.
    On the output of this report, when I click on a "change" button, a couple of columns should be made editable.
    I achieved this by modifying the fieldcatalog and triggering the output with another REUSE_ALV_GRID_DISPLAY.
    When I click on the back button of this second report, it is still taking me to the first one.
    How to over come this?
    Note:
    I used custom containers etc but the default buttons on the container are not controllable. I added custom buttons but could not suppress the default ones. So I did not pursue this much even though this is more comfortable to use.
    I am not able to get into the code in debug to see how the default buttons like COPY, INSERT ROW etc are working.
    Can any body throw some inputs into this?
    Thanks,
    Ven.

    >I achieved this by modifying the fieldcatalog and triggering the >output with another REUSE_ALV_GRID_DISPLAY.
    >When I click on the back button of this second report, it is still >taking me to the first one.
    >How to over come this?
    For this there is a solution
    i am thinking you are using user_command and calling the second time ALV Grid if so check this.
    form user_command using r_ucomm type sy-ucomm selfield type slis_selfield.
    case r_ucomm.
    when 'CHANGE'.
    selfield-exit = 'X'.   "use this , this will solve the problem
    "i hope you are calling the Function here
    endform.

  • Add column with preq number to ALV grid in me53n

    hi all,
    i am trying to add column with preq number (BANFN) to ALV with preq items in ME53N. it is not available in column set, when trying to add by "change layout" button - i dont understand why, when the strcucture MEREQ3211GRID contains it :-(
    i also tried to add new field ZZBANFN into the structure CI_EBANMEM and after that, i could add the new field to ALV through change layout, but it was empty of course. so i implemented EXIT_SAPLMEREQ_001 from MEREQ001, but ZZBANFN is still empty, because this exit is not called when opening ME53N, but when clicking on tab "customer data" in preq item detail.
    how to solve this? is there any exit that is called before displaying the ALV grid?

    Here is some more detail. I included my code from the Enhancement.
    ENHANCEMENT-POINT MM06EFPO_POT_AUFBAUEN_02 SPOTS ES_MM06EFPO_POT_AUFBAUEN INCLUDE BOUND.
       ENHANCEMENT 1  Z_MM06EFPO_POT_AUFBAUEN_1.    "active version
      SELECT SINGLE zz_old_material FROM mara
        INTO pot-zz_old_material
        WHERE matnr = pot-matnr.
    ENDENHANCEMENT.
    You will also need to change the layout in Item Overview to bring your field in.

  • ALV Grid Calling Transaction Code

    Hello Everybody
    Can anyone help me about my problem in using ALV Grid calling a transaction code...?Here is the sample code below..
           IF rs_selfield-fieldname = 'BELNR'.
            SET PARAMETER ID 'BLN' FIELD  rs_selfield-value.
            CALL TRANSACTION 'FB03'  AND SKIP FIRST SCREEN.
          ENDIF.
    the main problem is how can I set my parameter id for company since
    my rs_field-value is for the column BELNR ( document # field only)
    it returns error when i set this code since i have no value to pass for rs_selfield for company code
            SET PARAMETER ID 'BUK' FIELD 
    Help
    thanks in advance
    aVaDuDz

    Hi,
    *"Table declarations...................................................
    TABLES:
      rbkp,                                " Document Header Invoice receipt
      rseg,                                " Document Item: Incoming Invoice
      eban,                                " Purchase Requisition
      t001w.                               " Plants/Branches
    *"Selection screen elements............................................
    PARAMETERS:
      p_gjahr LIKE rbkp-gjahr.             " Fiscal Year
    SELECT-OPTIONS:
      s_belnr FOR rbkp-belnr,              " Document number of an invoice
      s_bldat FOR rbkp-bldat,              " Document Date in Document
      s_budat FOR rbkp-budat,              " Posting Date in the Document
      s_werks FOR rseg-werks.              " Plant
    *" Data declarations...................................................
    Work variables                                                      *
    DATA:
      w_flag1  TYPE c VALUE '0',           " Flag variable 1
      w_flag2  TYPE c VALUE '0',           " Flag variable 2
      w_index1 TYPE sy-tabix.              " Index variable
    Field String to hold Document Header Invoice receipt                *
    DATA:
      BEGIN OF fs_rbkp,
        belnr TYPE rbkp-belnr,             " Document number of an invoice
        gjahr TYPE rbkp-gjahr,             " Fiscal Year
        bldat TYPE rbkp-bldat,             " Posting Date in the Document
        budat TYPE rbkp-budat,             " Posting Date in the Document
        lifnr TYPE rbkp-lifnr,             " Different invoicing party
      END OF fs_rbkp,
    Internal table to hold Document Header Invoice receipt              *
      t_rbkp LIKE STANDARD TABLE OF fs_rbkp.
    Field String to hold Document Item: Incoming Invoice                *
    DATA:
      BEGIN OF fs_rseg,
        belnr TYPE rseg-belnr,             " Document number of an invoice
        ebeln TYPE rseg-ebeln,             " Purchasing Document Number
        wrbtr TYPE rseg-wrbtr,             " Amount in document currency
      END OF fs_rseg,
    Internal table to hold Document Item: Incoming Invoice              *
    t_rseg LIKE STANDARD TABLE OF fs_rseg.
    Field String to hold Purchase Requisition                           *
    DATA:
      BEGIN OF fs_eban,
        banfn TYPE eban-banfn,             " Purchase requisition number
        ernam TYPE eban-ernam,             " Person who Created the Object
        afnam TYPE eban-afnam,             " Name of requisitioner/requester
        badat TYPE eban-badat,             " Requisition (request) date
        ebeln TYPE eban-ebeln,             " Purchase order number
      END OF fs_eban,
    Internal table to hold Purchase Requisition                         *
      t_eban LIKE STANDARD TABLE OF fs_eban.
    Field String to hold Desired Data                                   *
    DATA:
      BEGIN OF fs_final,
        ebeln TYPE rseg-ebeln,             " Purchasing Document Number
        banfn TYPE eban-banfn,             " Purchase requisition number
        badat TYPE eban-badat,             " Requisition (request) date
        bldat TYPE rbkp-bldat,             " Posting Date in the Document
        lifnr TYPE rbkp-lifnr,             " Different invoicing party
        wrbtr TYPE rseg-wrbtr,             " Amount in document currency
        afnam TYPE eban-afnam,             " Name of requisitioner/requester
        ernam TYPE eban-ernam,             " Name of Person who Created the
                                           " Object
      END OF fs_final,
    Internal table to hold Desired Data                                 *
      t_final LIKE STANDARD TABLE OF fs_final.
                          INITIALIZATION                                *
    INITIALIZATION.
      p_gjahr = sy-datum+0(4).
                          AT SELECTION-SCREEN EVENT                     *
    AT SELECTION-SCREEN.
      IF s_belnr IS INITIAL OR s_bldat IS INITIAL OR s_budat IS INITIAL.
        MESSAGE ' (Invoice) Add Creation Date .' TYPE 'E'.
      ENDIF.                               " IF S_BELNR...
                          AT SELECTION-SCREEN ON FIELD EVENT            *
    AT SELECTION-SCREEN ON s_werks.
      SELECT SINGLE werks                  " Plant
        FROM t001w
        INTO t001w
       WHERE werks IN s_werks.
      IF sy-subrc NE 0.
        MESSAGE 'Invalid plant' TYPE 'E'.
      ENDIF.                               " IF SY-SUBRC NE 0.
                          START-OF-SELECTION EVENT                      *
    START-OF-SELECTION.
      PERFORM get_purchaserequistion.
      LOOP AT t_rseg INTO fs_rseg.
        READ TABLE t_rbkp INTO fs_rbkp WITH KEY belnr = fs_rseg-belnr
                                                        BINARY SEARCH.
        IF sy-subrc EQ 0.
          READ TABLE t_eban INTO fs_eban WITH KEY ebeln = fs_rseg-ebeln
                                                        BINARY SEARCH.
          IF sy-subrc EQ 0.
            IF fs_rbkp-bldat LE fs_eban-badat.
              DELETE t_rseg INDEX sy-tabix.
            ENDIF.                         " IF FS_RBKP-BLDAT...
          ENDIF.                           " IF SY-SUBRC EQ 0
        ENDIF.                             " IF SY-SUBRC EQ 0
      ENDLOOP.                             " LOOP AT T_RSEG...
      LOOP AT t_rbkp INTO fs_rbkp.
        WHILE w_flag1 EQ '0'.
          READ TABLE t_rseg INTO fs_rseg WITH KEY belnr = fs_rbkp-belnr
                                                          BINARY SEARCH.
          w_index1 = sy-tabix.
          IF sy-subrc EQ 0.
            WHILE w_flag2 EQ '0'.
              READ TABLE t_eban INTO fs_eban WITH KEY ebeln = fs_rseg-ebeln
                                                              BINARY SEARCH.
              IF sy-subrc EQ 0.
                fs_final-bldat = fs_rbkp-bldat.
                fs_final-lifnr = fs_rbkp-lifnr.
                fs_final-ebeln = fs_rseg-ebeln.
                fs_final-wrbtr = fs_rseg-wrbtr.
                fs_final-banfn = fs_eban-banfn.
                fs_final-badat = fs_eban-badat.
                fs_final-afnam = fs_eban-afnam.
                fs_final-ernam = fs_eban-ernam.
                APPEND fs_final  TO t_final.
                CLEAR fs_final.
                DELETE t_eban INDEX sy-tabix .
              ELSE.
                w_flag2 = '1'.
                DELETE t_rseg INDEX w_index1.
              ENDIF.                       " IF SY-SUBRC EQ 0
            ENDWHILE.                      " WHILE W_FLAG2...
            w_flag2 = '0'.
          ELSE.
            w_flag1 = '1'.
          ENDIF.                           " IF SY-SUBRC EQ 0
        ENDWHILE.                          " WHILE W_FLAG1...
        w_flag1 = '0'.
      ENDLOOP.                             " LOOP AT T_RBKP...
      CLASS lcl_event_receiver DEFINITION DEFERRED.
    Declare reference variables to the ALV grid and the container
      DATA :
        cust_con TYPE scrfname VALUE 'BCALVC_TOOLBAR_D100_C1',
        cont_on_dialog TYPE scrfname VALUE 'BCALVC_TOOLBAR_D101_C1',
        ref1 TYPE REF TO cl_gui_custom_container,
        ref2 TYPE REF TO cl_gui_alv_grid,
        event_receiver TYPE REF TO lcl_event_receiver,
        fcat    TYPE lvc_t_fcat,
        wa      TYPE lvc_s_fcat,
        wa_layo TYPE lvc_s_layo.
      CALL SCREEN 200.
    class lcl_event_receiver: local class to define and handle own
    *functions......................................................
    Definition:
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
        handle_toolbar
            FOR EVENT toolbar OF cl_gui_alv_grid
                IMPORTING e_object e_interactive,
        handle_user_command
            FOR EVENT user_command OF cl_gui_alv_grid
                IMPORTING e_ucomm.
      PRIVATE SECTION.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    class lcl_event_receiver (Implementation)
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_toolbar.
    In event handler method for event TOOLBAR: Append own functions
      by using event parameter E_OBJECT.
        DATA: ls_toolbar  TYPE stb_button.
    E_OBJECT of event TOOLBAR is of type REF TO CL_ALV_EVENT_TOOLBAR_SET.
    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 show booking table
        CLEAR ls_toolbar.
        MOVE 'PORDER' TO ls_toolbar-function.
        MOVE icon_employee TO ls_toolbar-icon.
        MOVE 'Show Bookings' TO ls_toolbar-quickinfo.
        MOVE 'PONUMBER' TO ls_toolbar-text.
        MOVE ' ' TO ls_toolbar-disabled.
        APPEND ls_toolbar TO e_object->mt_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.
    append an icon to show booking table
        CLEAR ls_toolbar.
        MOVE 'PREQUISITION' TO ls_toolbar-function.
        MOVE icon_employee TO ls_toolbar-icon.
        MOVE 'Show Bookings' TO ls_toolbar-quickinfo.
        MOVE 'PRNUMBER' TO ls_toolbar-text.
        MOVE ' ' TO ls_toolbar-disabled.
        APPEND ls_toolbar TO e_object->mt_toolbar.
      ENDMETHOD.                           " handle_toolbar
      METHOD handle_user_command.
    *Event handler method for event USER_COMMAND:
        CASE e_ucomm.
          WHEN 'PORDER'.
            CALL TRANSACTION 'ME23N'.
          WHEN 'PREQUISITION'.
            CALL TRANSACTION 'ME53N'.
        ENDCASE.
      ENDMETHOD.                           " handle_user_command
    ENDCLASS.                              " lcl_event_receiver
    *& Module STATUS_0200 OUTPUT
    text
    MODULE status_0200 OUTPUT.
      SET PF-STATUS 'GUI'.
      SET TITLEBAR 'TITLE'.
      IF sy-ucomm = 'BACK'.
        LEAVE PROGRAM.
      ENDIF.
      PERFORM form_fcat.
      PERFORM form_layo.
      IF ref1 IS INITIAL.
        CREATE OBJECT ref1
        EXPORTING
    PARENT = ref1
        container_name = 'CUST_CON'
    STYLE =
    LIFETIME = lifetime_default
    REPID =
    DYNNR =
    NO_AUTODEF_PROGID_DYNNR =
        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.
      ENDIF.
      IF ref2 IS INITIAL.
        CREATE OBJECT ref2
        EXPORTING
    I_SHELLSTYLE = 0
    I_LIFETIME =
        i_parent = ref1
    I_APPL_EVENTS = space
    I_PARENTDBG =
    I_APPLOGPARENT =
    I_GRAPHICSPARENT =
    I_NAME =
        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.
        CALL METHOD ref2->set_table_for_first_display
    EXPORTING
    I_BUFFER_ACTIVE =
    I_BYPASSING_BUFFER =
    I_CONSISTENCY_CHECK =
    I_STRUCTURE_NAME =
    IS_VARIANT =
    I_SAVE =
    I_DEFAULT = 'X'
    is_layout = wa_layo
    IS_PRINT =
    IT_SPECIAL_GROUPS =
    IT_TOOLBAR_EXCLUDING =
    IT_HYPERLINK =
    IT_ALV_GRAPHICS =
    IT_EXCEPT_QINFO =
        CHANGING
        it_outtab = t_final
        it_fieldcatalog = fcat
    IT_SORT =
    IT_FILTER =
       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.
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_user_command FOR ref2.
        SET HANDLER event_receiver->handle_toolbar FOR ref2.
    *Call method 'set_toolbar_interactive' to raise event TOOLBAR.
        CALL METHOD ref2->set_toolbar_interactive.
      ENDIF.
    ENDMODULE.                             " STATUS_0200 OUTPUT
    Form FORM_FCAT                                                     *
    text                                                               *
    FORM form_fcat.
      CLEAR fcat.
      CLEAR wa.
      wa-fieldname = 'EBELN'.
      wa-col_pos = 1.
      wa-scrtext_l = ' PURCHASE ORDER NUMBER'.
      APPEND wa TO fcat.
      CLEAR wa.
      wa-fieldname = 'BANFN'.
      wa-col_pos = 2.
      wa-scrtext_l = 'PURCHASE REQUISITION NUMBER'.
      APPEND wa TO fcat.
      CLEAR wa.
      wa-fieldname = 'BADAT'.
      wa-col_pos = 3.
      wa-scrtext_l = 'PR CREATION DATE'.
      APPEND wa TO fcat.
      CLEAR wa.
      wa-fieldname = 'BLDAT'.
      wa-col_pos = 4.
      wa-scrtext_l = 'INVOICE DATE'.
      APPEND wa TO fcat.
      CLEAR wa.
      wa-fieldname = 'LIFNR'.
      wa-col_pos = 5.
      wa-scrtext_l = 'VENDOR NUMBER'.
      APPEND wa TO fcat.
      wa-fieldname = 'WRBTR'.
      wa-col_pos = 6.
      wa-do_sum  = 'X'.
      wa-scrtext_l = ' PO AMOUNT'.
      APPEND wa TO fcat.
      wa-fieldname = 'AFNAM'.
      wa-col_pos = 7.
      wa-scrtext_l = 'REQUISITIONER'.
      APPEND wa TO fcat.
      wa-fieldname = 'ERNAM'.
      wa-col_pos = 8.
      wa-scrtext_l = 'PR CREATOR'.
      APPEND wa TO fcat.
    ENDFORM.                               " FORM_FCAT
    Module USER_COMMAND_0200 INPUT                                      *
    text                                                                *
    MODULE user_command_0200 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                             " USER_COMMAND_0200 INPUT
         FORM FORM_LAYO                                                *
    There are no interface parameters to be passed to this subroutine.*
    FORM form_layo.
      CLEAR wa_layo.
      wa_layo-zebra = 'X'.
      wa_layo-grid_title = 'GRID TITLE'.
      wa_layo-no_toolbar = 'X'.
    ENDFORM.                               " FORM_LAYO
         FORM GET_PURCHASEREQUISITION                                   *
    This subroutine selects all the Purchase requisitions from table   *
    EBAN for all the selected Invoices based on the Purchase orders.   *
    There are no interface parameters to be passed to this subroutine. *
    FORM get_purchaserequistion.
      SELECT belnr                         " Document number of an invoice
             gjahr                         " Fiscal Year
             bldat                         " Posting Date in the Document
             budat                         " Posting Date in the Document
             lifnr                         " Different invoicing party
        FROM rbkp
        INTO TABLE t_rbkp
       WHERE belnr IN s_belnr
         AND gjahr EQ p_gjahr
         AND bldat IN s_bldat
         AND budat IN s_budat.
      IF NOT t_rbkp[] IS INITIAL.
        SELECT belnr                       " Document number of an invoice
               ebeln                       " Purchasing Document Number
               wrbtr                       " Amount in document currency
          FROM rseg
          INTO TABLE t_rseg
           FOR ALL ENTRIES IN t_rbkp
         WHERE belnr EQ t_rbkp-belnr
           AND werks IN s_werks.
      ENDIF.                               " IF NOT t_rbkp[] IS INITIAL...
      IF NOT t_rseg[] IS INITIAL.
        SELECT banfn
               ernam
               afnam
               badat
               ebeln
          FROM eban
          INTO CORRESPONDING FIELDS OF TABLE t_eban
           FOR ALL ENTRIES IN t_rseg
         WHERE ebeln EQ t_rseg-ebeln.
      ENDIF.                               " IF NOT t_rseg[] IS INITIAL...
    ENDFORM.                               " GET_PURCHASEREQUISITION
    reward points if helpful.
    regards,
    kiran kumar k.

  • Alv grid - call transaction 'ME22N' and reflect the change made in alv grid

    Hi,
    <u>Scenario</u>
    I have an alv list which has fields Purchase document no. (EBELN) and Item delivery date (EINDT). EBELN field is hot spot enabled. when i click on that transaction 'ME22' is called. I have done this using USER_COMMAND subroutine.the code is given.
          FORM USER_COMMAND                                             *
    Call transaction ME22N on clicking Document number                 *
    FORM USER_COMMAND USING F_UCOMM LIKE SY-UCOMM
                    I_SELFIELD TYPE SLIS_SELFIELD.
      DATA: F_SUBRC LIKE SY-SUBRC,
            s_arseg like G_T_PORD. "the internal table used is G_T_PORD
      CASE F_UCOMM.
        WHEN '&IC1'.
          IF i_selfield-fieldname = 'EBELN'.
            READ TABLE G_T_PORD INDEX i_selfield-tabindex INTO s_arseg.
            SET PARAMETER ID 'BES' FIELD s_arseg-ebeln.
            CALL TRANSACTION 'ME22N' AND SKIP FIRST SCREEN.
          ENDIF.
      ENDCASE.
    endform.
    <u>Requirement</u>
    After calling the transaction, If the user changes the Item delivery date (EINDT) at the ME22 transaction screen, the new date needs to be reflected in the ALV grid.
    Plz help it is very urgent.

    The first method (using selfield-refresh = 'X'.) didn't work as the internal table doesnt get modified when the user make changes in Item delivery date(EINDT) at ME22 transaction screen. The 2nd method is OO,which can't be used in my case.
    I tried calling the subroutine for populating the itab (G_T_PORD) and the subroutine for displaying the alv grid immediately after calling ME22N transaction. Still it is not reflecting the new date in the output alv. The code is given below.
          FORM USER_COMMAND                                             *
    Call transaction ME22N on clicking Document number                 *
    FORM USER_COMMAND USING F_UCOMM LIKE SY-UCOMM
                    I_SELFIELD TYPE SLIS_SELFIELD.
      DATA: F_SUBRC LIKE SY-SUBRC,
            s_arseg like G_T_PORD.
      CASE F_UCOMM.
        WHEN '&IC1'.
          IF i_selfield-fieldname = 'EBELN'.
            READ TABLE G_T_PORD INDEX i_selfield-tabindex INTO s_arseg.
            SET PARAMETER ID 'BES' FIELD s_arseg-ebeln.
            CALL TRANSACTION 'ME22N' AND SKIP FIRST SCREEN.
          ENDIF.
      ENDCASE.
            refresh G_T_PORD.
            perform F1000_POPULATE_PO.
            perform F2000_DISPLAY_PO .
    endform.

  • How to create command button called 'Remarks' and Check box in ALV GRID?

    Hi, Experts,
    Requirement is: in the ALVE GRID report output, user select a record by clicking the check box and pressing the button 'Remarks' it will take me into other transaction from the output list.
    Please help me out.
    Reward points.
    Sekhar

    Hi Chandra Shekar,
    Check the following sample program. 2 things to remember.
    1. Check the callback subroutine PF_STATUS_SET and create PF status for the program.and also ur REMARKS button in the application tool. Comments are made every where wherever those are needed. After creating Pf status execute the report.
    2.Once you select records by selecting checkboxes, u have to press on Refresh button( that is there on application toolbar), then only for selected records, CHECK field in the internal is updated. After that press on REMARKS button .
      REPORT zvenkat_alv_grid.
      TABLES:t001.
      "Types
      TYPES:
            BEGIN OF t_1001,
              check TYPE c,
              bukrs TYPE t001-bukrs,
              butxt TYPE t001-butxt,
              ort01 TYPE t001-ort01,
              land1 TYPE t001-land1,
            END OF t_1001.
      "Work area
      DATA:
            w_t001 TYPE t_1001.
      "Internal table
      DATA:
            i_t001 TYPE STANDARD TABLE OF t_1001.
      " ALV Declarations
    * Types Pools
      TYPE-POOLS:
         slis.
    * Types
      TYPES:
         t_fieldcat         TYPE slis_fieldcat_alv,
         t_events           TYPE slis_alv_event,
         t_layout           TYPE slis_layout_alv.
    * Workareas
      DATA:
         w_fieldcat         TYPE t_fieldcat,
         w_events           TYPE t_events,
         w_layout           TYPE t_layout.
    * Internal Tables
      DATA:
         i_fieldcat         TYPE STANDARD TABLE OF t_fieldcat,
         i_events           TYPE STANDARD TABLE OF t_events.
    *&    start of selection
      START-OF-SELECTION.
        PERFORM get_data.
    *&    end-of-selection.
      END-OF-SELECTION.
        PERFORM build_fieldcatlog.
        PERFORM build_events.
        PERFORM build_layout.
        PERFORM list_display.
    *&      Form  get_data
      FORM get_data .
        SELECT bukrs
               butxt
               ort01
               land1
          FROM t001
          INTO CORRESPONDING FIELDS OF TABLE i_t001
          UP TO 30 ROWS.
      ENDFORM.                    " get_data
    *&      Form  build_fieldcatlog
      FORM build_fieldcatlog .
        CLEAR:w_fieldcat,i_fieldcat[].
        PERFORM build_fcatalog USING:
                 'CHECK' 'I_T001' ' ',
                 'BUKRS' 'I_T001' 'BUKRS',
                 'BUTXT' 'I_T001' 'BUTXT',
                 'ORT01' 'I_T001' 'ORT01',
                 'LAND1' 'I_T001' 'LAND1'.
      ENDFORM.                    "BUILD_FIELDCATLOG
    *&      Form  BUILD_FCATALOG
      FORM build_fcatalog USING l_field l_tab l_text.
        w_fieldcat-fieldname      = l_field.
        w_fieldcat-tabname        = l_tab.
        w_fieldcat-seltext_m      = l_text.
        IF  l_field = 'CHECK'..
          w_fieldcat-checkbox = 'X'.
          w_fieldcat-edit     = 'X'.
        ENDIF.
        APPEND w_fieldcat TO i_fieldcat.
        CLEAR w_fieldcat.
      ENDFORM.                    " build_fieldcatlog
    *&      Form  build_events
    *       text
      FORM build_events.
        CLEAR :
              w_events, i_events[].
        w_events-name = 'TOP_OF_PAGE'."Event Name
        w_events-form = 'TOP_OF_PAGE'."Callback event subroutine
        APPEND w_events TO i_events.
        CLEAR  w_events.
        w_events-name = 'USER_COMMAND' .
        w_events-form = 'USER_COMMAND' .
        APPEND w_events TO i_events.
        CLEAR w_events.
        w_events-name = 'PF_STATUS_SET' .
        w_events-form = 'PF_STATUS_SET' .
        APPEND w_events TO i_events.
        CLEAR w_events.
      ENDFORM.                    "build_events
    *&      Form  build_layout
      FORM build_layout .
        w_layout-colwidth_optimize = 'X'.
        w_layout-zebra             = 'X'.
      ENDFORM.                    " build_layout
    *&      Form  list_display
      FORM list_display .
        DATA:
              l_program TYPE sy-repid.
        l_program = sy-repid.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program = l_program
            is_layout          = w_layout
            it_fieldcat        = i_fieldcat
            it_events          = i_events
          TABLES
            t_outtab           = i_t001
          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.
      ENDFORM.                    " list_display
    *&      Form  top_of_page
      FORM top_of_page.
        DATA :
         li_header TYPE slis_t_listheader,
         w_header  LIKE LINE OF li_header.
        DATA:
              l_date TYPE char10.
        WRITE sy-datum TO l_date.
        w_header-typ  = 'H'.
        CONCATENATE sy-repid ':' 'From Date' l_date INTO w_header-info SEPARATED BY space.
        APPEND w_header TO li_header.
        CLEAR w_header.
        w_header-typ  = 'S'.
        w_header-info = sy-title.
        APPEND w_header TO li_header.
        CLEAR w_header.
        w_header-typ  = 'A'.
        w_header-info = sy-uname.
        APPEND w_header TO li_header.
        CLEAR w_header.
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
            it_list_commentary = li_header.
      ENDFORM.                    "top_of_page
    *&      Form  pf_status_set
      FORM pf_status_set    USING extab TYPE slis_t_extab.
        "Procedure to set own pf-status.
        "1.Goto Transaction code SE41
        "2.give program = SAPLKKBL and status = STANDARD_FULLSCREEN.
        "3.Click on Application toolbar STATUS button
        "4.Give ur program name Status name that is to be used in the program using SET pf-status statement
        "5.Create ur button REMARKS.
        SET PF-STATUS 'STATUS1' EXCLUDING extab.
      ENDFORM.                    "pf_status_set
    *&      Form  user_command
      FORM user_command USING ucomm LIKE sy-ucomm
                        selfield TYPE slis_selfield.
        CASE ucomm .
          WHEN 'REMARKS'."When u click on remarks button.
            LOOP AT i_t001 INTO w_t001 WHERE check = 'X'.
              WRITE :/ w_t001-bukrs, 'Checked'.
            ENDLOOP.
        ENDCASE.
      ENDFORM.                    "user_command
    I hope that it helps u .
    Regards,
    Venkat.O

  • Need help for hotspot linking from an ALV Grid to another transaction

    Hi all,
    I have to make a field in an ALV Grid link to a transaction. I activated the hotspot for the field in the field catalog and created a 'User_command' that i call in the REUSE_ALV_GRID_DISPLAY, but when i click on the hotpsot, it doesnot take me to the transaction. Please provide some help.
    Here is the code:
    *Internal table and work area for field catalog
    DATA: i_fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv,
              wa_fieldcat TYPE slis_fieldcat_alv,
              v_repid LIKE sy-repid,
              wa_layout TYPE slis_layout_alv,
              i_event TYPE slis_t_event,
    internal table and work area for subtotals
            i_sort TYPE STANDARD TABLE OF slis_sortinfo_alv,
            wa_sort TYPE slis_sortinfo_alv.
      PERFORM prepare_fieldcatalog.
      PERFORM prepare_layout.
      PERFORM prepare_subtotal.
      PERFORM display_alv.
    FORM display_alv .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
       i_callback_program               = v_repid
       i_callback_pf_status_set          = 'STATUS'
       i_callback_user_command           = 'USER_COMMAND'
        is_layout                         = wa_layout
        it_fieldcat                       = i_fieldcat
       IT_SORT                           = i_sort
       it_events                         = i_event
        TABLES
          t_outtab                          = i_final
    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.
    ENDFORM.                    " display_alv
    *&      Form  prepare_fieldcatalog
    FORM prepare_fieldcatalog .
      PERFORM f_build USING:
        c_bukrs text-011,
        c_gjahr text-012,
        c_lifnr text-013,
        c_ebeln text-014,
        c_ebelp text-015,
        c_dmbtr text-016,
        c_hkont text-017,
        c_wrbtr text-018,
        c_wmwst text-019,
        c_mwskz text-020,
        c_text1 text-021,
        c_kbetr text-022,
        c_spcode text-023.
    ENDFORM.                    " prepare_fieldcatalog
    *&      Form  f_build
    FORM f_build  USING    p_c_fieldname TYPE slis_fieldname
                           p_text TYPE c.
      CLEAR wa_fieldcat.
      CASE p_c_fieldname.
        WHEN c_dmbtr OR c_wrbtr OR c_wmwst.
          wa_fieldcat-do_sum = 'x'.
      ENDCASE.
      IF p_c_fieldname = c_ebeln.
        wa_fieldcat-hotspot = 'X'.
      ENDIF.
      wa_fieldcat-fieldname = p_c_fieldname.
      wa_fieldcat-seltext_m = p_text.
      APPEND wa_fieldcat TO i_fieldcat.
    ENDFORM.                    " f_build
    *&      Form  prepare_layout
    FORM prepare_layout .
      wa_layout-info_fieldname = c_rowcolor.
    wa_layout-f2code = '<F2CODE>'.
    *APPEND wa_layout to i_layout.
    ENDFORM.                    " prepare_layout
    *&      Form  USER_COMMAND
    FORM user_command USING r_ucomm LIKE sy-ucomm
                                   rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN c_back OR c_canc OR c_exit.
          LEAVE TO SCREEN 0.
        WHEN c_click.
          READ TABLE i_final INTO wa_final INDEX rs_selfield-tabindex .
          IF sy-subrc EQ 0.
            IF rs_selfield-fieldname EQ c_ebeln.
              SET PARAMETER ID c_bes FIELD wa_final-ebeln.
              CALL TRANSACTION c_me23n AND SKIP FIRST SCREEN.
            ENDIF.
          ENDIF.
      ENDCASE.
    ENDFORM.                    " USER_COMMAND
    *&      Form  status
    FORM status  USING    p_extab TYPE slis_t_extab.
      SET PF-STATUS c_standard.
    ENDFORM.                    " status
    *&      Form  prepare_subtotal
    FORM prepare_subtotal .
      wa_sort-spos = c_10.
      wa_sort-fieldname = c_mwskz.
      wa_sort-subtot = 'X'.
      wa_sort-up = 'X'.
      APPEND wa_sort TO i_sort.
    ENDFORM.                    " prepare_subtotal

    Hi,
    Check this example..
    TYPE-POOLS: slis.
    DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: BEGIN OF wa_ekko,
    ebeln like ekko-ebeln,
    ekorg like ekko-ekorg,
    ekgrp like ekko-ekgrp,
    END OF wa_ekko.
    DATA: v_repid TYPE syrepid.
    v_repid = sy-repid.
    DATA it_ekko LIKE STANDARD TABLE OF wa_ekko WITH HEADER LINE.
    SELECT * UP TO 100 ROWS
    FROM ekko
    INTO CORRESPONDING FIELDS OF TABLE it_ekko.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
         EXPORTING
              i_program_name     = v_repid
              i_internal_tabname = 'WA_EKKO'
              i_inclname         = v_repid
         CHANGING
              ct_fieldcat        = gt_fieldcat.
    have hotspot for a PO.
    DATA: s_fieldcat LIKE LINE OF gt_fieldcat.
    s_fieldcat-hotspot = 'X'.
    MODIFY gt_fieldcat FROM s_fieldcat TRANSPORTING hotspot
           WHERE fieldname = 'EBELN'.
    Pass the program.
    v_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
              i_callback_program      = v_repid
              it_fieldcat             = gt_fieldcat
              i_callback_user_command = 'USER_COMMAND'
         TABLES
              t_outtab                = it_ekko.
          FORM display_detail                                           *
    -->  UCOMM                                                         *
    -->  SELFIELD                                                      *
    FORM user_command USING ucomm LIKE sy-ucomm
    selfield TYPE slis_selfield.
      IF ucomm = '&IC1'.
        READ TABLE it_ekko INDEX selfield-tabindex.
        IF sy-subrc = 0.
          SET PARAMETER ID 'BES' FIELD it_ekko-ebeln.
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDIF.
    ENDFORM.
    Thanks,
    Naren

  • Calling Transaction from ALV using OO Method

    Hi,
    My requirement is as follows....
    I have an ALV grid with columns such as month wise Total of a GL account  say JAN, feb etc...
    When I double click on any of these cells it should take me to the respective Transaction (say FBL3n for the GL account and the company code) . I am able to track the GL account for which the total is displayed and company code is one of my selection criteria. In the main screen of the FBL3N we have to enter the posting date and i also want the Radio button against "all items', presently default is against 'Open Items'. So how can i proceed.
    Thanks and Regards,
    Namit

    DATA gr_event_handler TYPE REF TO lcl_event_handler . .. ..
    *--Creating an instance for the event handler
    CREATE OBJECT gr_event_handler .
    *--Registering handler methods to handle ALV Grid events
    SET HANDLER gr_event_handler->handle_double_click FOR gr_alvgrid .
    CLASS lcl_event_handler IMPLEMENTATION .
    *Handle Double Click
    METHOD handle_double_click .
    PERFORM handle_double_click USING e_row e_column es_row_no .
    ENDMETHOD .
    CLASS lcl_event_handler DEFINITION
    *Double-click control
    Methods:
    handle_double_click
          FOR EVENT double_click OF cl_gui_alv_grid
            IMPORTING e_row e_column
               i_fieldrows      TYPE lvc_t_row.
               w_fieldrows LIKE LINE OF i_fieldrows,
      CALL METHOD o_alvgrid->get_selected_rows
                 IMPORTING
                 et_index_rows = i_fieldrows.
      LOOP AT i_fieldrows INTO w_fieldrows.
        READ TABLE i_batch INTO w_block INDEX w_fieldrows-index.
    if sy-subrc = 0.
    *       CLASS LCL_EVENT_RECEIVER DEFINITION
    CLASS LCL_EVENT_RECEIVER DEFINITION.
    * Event receiver definitions for ALV actions
      PUBLIC SECTION.
        CLASS-METHODS:
    * Row Double click for dirll down.
           HANDLE_DOUBLE_CLICK
             FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                IMPORTING E_ROW
                          E_COLUMN
                          ES_ROW_NO.
    ENDCLASS.
    * Implementation
    * Every event handler that is specified below should also be set after
    * the object has been created.  This is done in the PBO processing.
    * with the following command
    * SET HANDLER oEventreceiver->handle_toolbar FOR o_Alvgrid.
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
    *&      Method handle_double_click
    * This method is called when the user double clicks on a line to drill
    * down.
    * The following are exported from the ALV
    * LVC_S_ROW
    * LVC_S_COL
    * LVC_S_ROID
      METHOD HANDLE_DOUBLE_CLICK.
    * The double click drill down processing should be
    * coded in the form below.
       PERFORM F9007_HANDLE_DOUBLE_CLICK USING E_ROW
                                               E_COLUMN
                                               ES_ROW_NO.
      ENDMETHOD.
    ENDCLASS.
    *&      Form  F9007_HANDLE_DOUBLE_CLICK
    * This form is called when the user double clicks on a line to drill
    * down.
    *      -->P_E_ROW_ID    - Row ID  text
    *      -->P_E_COLUMN_ID - Column ID
    *      -->P_ES_ROW_NO   - Row number
    FORM f9007_handle_double_click USING p_row
                                         p_column
                                         p_row_no.
      DATA: lw_output LIKE LINE OF i_output.
    * RG:16/11/2004 - Start of Changes
    * Need to check that a subtotal or grand total line has not been
    * double-clicked, otherwise the report will produce a short dump!
      check p_row+0(1) is initial.
    * RG:16/11/2004 - End of Changes
      READ TABLE i_output INDEX p_row INTO lw_output.
      CASE p_column.
        WHEN 'KNUMA'.
          IF NOT lw_output-knuma IS INITIAL.
            SET PARAMETER ID 'VBO' FIELD lw_output-knuma.
            CALL TRANSACTION 'VBO3' AND SKIP FIRST SCREEN.
          ENDIF.
        WHEN 'VBAK_VBELN'.
         IF NOT lw_output-vbak_vbeln IS INITIAL.
          SET PARAMETER ID 'AUN' FIELD lw_output-vbak_vbeln.
            CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
          ENDIF.
        WHEN 'VBRK_VBELN'.
          IF NOT lw_output-vbrk_vbeln IS INITIAL.
            SET PARAMETER ID 'VF' FIELD lw_output-vbrk_vbeln.
            CALL TRANSACTION 'VF03' AND SKIP FIRST SCREEN.
          ENDIF.
      ENDCASE.
    ENDFORM.                    " F9007_HANDLE_DOUBLE_CLICK

Maybe you are looking for

  • Can't delete file from macbook pro...

    I recently bought a new macbook pro (2.3 GHZ, i5, 4gb ram...) and began to download some torrents. I was converting one movie file to play on my iphone but I cancelled the conversion because I realized the picture quality of the movie wasn't that gre

  • WHICH CLASS type of 4GB microSDHC does 5610XM supp...

    1. Any microSD(T-Flash)more than 2GB is known as "microSDHC". 2. A 4GB microSDHC has three(3)class types, which are Class 2, Class 4 and Class 6. 3. 5610XM can support microSDHC upto 4GB. Seems that there is no mention in the manual regarding to the

  • How to schedule a WebI Report for the list of users that it contains in it

    I have a WebI Report in BOXIr2 which contains the list of Employees Details (Employee Name, Mail ID, Emp Code) who had missed their timesheet for the week, Please let me know Is their a way that i can send mail notification through BO report Scheduli

  • Thunderbolt Display Didn't Show Anything!

    I recently got Boxee. I connected to Thunderbolt Display 2nd port, but it's not working! I connected like this: Mac Mini (2011) --> Thunderbolt Display built-in port Boxee --> (HDMI to mini DisplayPort cable) --> Thunderbolt Display 2nd port The Thun

  • KDE : slow font rendering

    Hi everyone ! I'm completely new to Arch (coming from Ubuntu) and was really amazed at how fast my system could get and how easy it was to set it up. I only have one problem left (apart from the missing japanese fonts) : When anti-aliasing is turned