Set cusor in alv grid

Hello friends,
          How to set cusor in a particular cell of an alv grid.
Thanks
Suga prasad.N

try this method of the grid SET_CURRENT_CELL_ID ,
by passing ROW_ID and COL_ID in it .
Or   SET_FOCUS methode to set cursor on a particular cell

Similar Messages

  • How to set variant for ALV grid from ABAP

    Hello,
    I have a program which displays some data with ALV grid. Then after some operation I would like to set different layout for the grid, but not by choosing it manually but by the program. I thought that it would be enough to use the method SET_VARIANT, so I'm setting DISVARIANT structure properly, using SET_VARIANT method and after that I'm calling REFRESH_TABLE_DISPLAY but layout is not changed. What else should I do? Is that possible?
    Best regards,
    Marcin

    Hi,
    Check this
    * While declaring select-options
    parameters: p_vari        like ltdx-variant.  " Layout
    * then add the following code in
    at selection-screen on value-request for p_vari.
      perform f_variant_f4 using p_vari.
    * Code for f_variant_f4
    form f_variant_f4 using  p_vari.
    * private variables
      data : v_exit    type c.
      clear gs_variantt.
      v_variant_save = 'U'.
      call function 'LVC_VARIANT_F4'
        exporting
          is_variant    = gs_variant
          i_save        = v_variant_save
        importing
          e_exit        = v_exit
          es_variant    = gs_variantt
        exceptions
          not_found     = 1
          program_error = 2
          others        = 3.
      if sy-subrc ne c_0.
        message i999(yscc) with text-064.    " No Layout Available for F4
      endif.
      if v_exit is initial.
        gs_variant-variant = gs_variantt-variant.
        p_vari             = gs_variantt-variant.
      endif.
    endform.                                 " F_variant_f4
    * In PBO
        call method grid1->set_table_for_first_display
          exporting
            is_layout                     = gs_layout
            is_variant                    = gs_variant
            i_save                        = 'A'
            it_toolbar_excluding          = i_exclude[]
          changing
            it_outtab                     = i_output[]
            it_fieldcatalog               = i_fieldcat[]
          exceptions
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            others                        = 4.

  • Set cursor in ALV grid output

    Hi guys,
    I generated a report which gives out put in ALV grid.
    In the ALV grid output, I have some editable fields.
    Lets suppose, there are some editable fields with no data in it.
    I have userdefined pushbutton in Application toolbar, when I press the pushbutton the cursor should go to the empty field in the ALV grid output.
    Can this be possible through SET CURSOR statement?
    Thanks,
    Shivaa......

    Hi,
        You can set the cursor field on the output list that too for the output fields which are vissible on the screen only.
    syntax
    SET CURSOR 11 3.   ---> 11Coloumn and 3 line
    for dynamically setting cursor, first you have to search for the empty fields then set the cursor dynamically.
    look at this help document it might be helpful
    http://help.sap.com/saphelp_nw70/helpdata/EN/9f/dba47e35c111d1829f0000e829fbfe/content.htm
    Regards
    Bala KRishna

  • SET parameter on ALV grid with container

    Hi,
    I need to SET PARAMETER ID to acess the transaction CJ40, in an ALV grid program with screen container for the ALV.
    I'm using a method handle_double_click to select a line and pass the value to the parameter ID like this:
      METHOD handle_double_click.
        DATA: l_project TYPE prps-pspnr.
        READ TABLE it_out INDEX e_row-index INTO wa_out.
        CHECK sy-subrc = 0.
        WRITE wa_out-pspnr TO l_project.
        SET PARAMETER ID 'PRD' FIELD l_project.
        CALL TRANSACTION 'CJ40' AND SKIP FIRST SCREEN.
        CLEAR wa_out-pspnr.
      ENDMETHOD.                           "handle_double_click
    But this doesn't work. No value at all is passed to the transaction.
    What is missing?
    Thanks in advance,
    Rui

    Parameter ID PSP is attached to the Project Definition field.
    SET PARAMETER ID 'PSP' FIELD l_project.
    CALL TRANSACTION 'CJ40' AND SKIP FIRST SCREEN.
    Regards,
    Naimesh Patel

  • Set Cursor on ALV Grid

    i am trying to set the cursor on an ALV Grid display so that the field can be editted....
    LOOP AT lt_fieldnames INTO ls_fieldnames.
        IF NOT ls_fieldnames-colortab IS INITIAL.
          ls_row_no-row_id       = sy-tabix.
          ls_column_id-fieldname = 'VALUE'.
          EXIT.
        ENDIF.
      ENDLOOP.
    *--- Set focus to cell that contains error
    CALL METHOD grid_editmsg->set_current_cell_via_id
      EXPORTING
           is_column_id = ls_column_id
           is_row_no    = ls_row_no 
    the field is highlighted but i still have to click in the field to edit the contents....
    is there a method/fm i can use that makes the field directly editable????

    I also searched for this and i find a solution.
    CALL METHOD cl_gui_control=>set_focus
         EXPORTING
           control = gref_grid_menge.
    So even if this post is very old, probably it can help other devs to go further!

  • How to Set Checkbox of ALV Grid Dark on Display Mode

        ABAP experts, I want to switch between display mode and edit mode for some columns of ALV Grid. So I set "LVC_S_FCAT-EDIT" "X" for the columns which need to switch mode, and use method "SET_READY_FOR_INPUT" to switch.
        Currently, the function of switch mode has been achieved. But icons of checkbox columns are light but not dark when display mode, although the columns can't be edited. (Please refer to the image below.) I want to make checkbox columns dark as other columns on display mode.
        I tried to use "CL_GUI_ALV_GRID=>MC_STYLE_ENABLED" and "CL_GUI_ALV_GRID=>MC_STYLE_DISABLED", but failed. I also studied sample program "BCALV_EDIT_05" which is related to checkbox in ALV Grid, and compared my program with this program. But I still have not found problems.
        Help me solve this problem, please.
        Part of my codes are as follows.
        Part 1:
    IF iv_is_create_group = abap_true OR iv_is_edit_group = abap_true.
           set_enable( iv_flag = 1 ).
           LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.
             CLEAR ls_celltab.
             IF <lfs_acct_group_item>-celltab IS INITIAL.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'CHECK_BOX'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'XPORE'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
             ELSE.
               LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.
                 <lfs_celltab>-style = cl_gui_alv_grid=>mc_style_enabled.
               ENDLOOP.
             ENDIF.
           ENDLOOP.
         ELSE.
           set_enable( iv_flag = 0 ).
           LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.
             IF <lfs_acct_group_item>-celltab IS INITIAL.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'CHECK_BOX'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'XPORE'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
             ELSE.
               LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.
                 <lfs_celltab>-style = cl_gui_alv_grid=>mc_style_disabled.
               ENDLOOP.
             ENDIF.
           ENDLOOP.
         ENDIF.
         CALL METHOD gr_grid->refresh_table_display
    *      EXPORTING
    *        is_stable      =
    *        i_soft_refresh =
           EXCEPTIONS
             finished       = 1
             OTHERS         = 2
         IF sy-subrc <> 0.
    *     Implement suitable error handling here
         ENDIF.
        Part 2:
    METHOD set_enable.
         gr_grid->set_ready_for_input(
             i_ready_for_input = iv_flag
    ENDMETHOD.

    Hi Liu,
        Please go through the below code.
    *& Report  YEDIT_DISPLAY
    REPORT  YEDIT_DISPLAY.
    TABLES : VBAK.
    TYPE-POOLS SLIS.
    TYPES : BEGIN OF TY_VBAK,
              VBELN TYPE VBAK-VBELN,
             END OF TY_VBAK,
             BEGIN OF TY_FINAL,
               BOX TYPE C,
               VBELN TYPE VBAK-VBELN,
             END OF TY_FINAL.
    DATA : IT_VBAK TYPE TABLE OF TY_VBAK,
            WA_VBAK TYPE TY_VBAK,
            IT_FINAL TYPE TABLE OF TY_FINAL,
            WA_FINAL TYPE TY_FINAL,
            IT_FCAT TYPE TABLE OF SLIS_FIELDCAT_ALV,
            WA_FCAT TYPE SLIS_FIELDCAT_ALV.
    START-OF-SELECTION.
       PERFORM FETCH_DATA.
       PERFORM FCAT_DATA.
       PERFORM DISPLAY.
    *&      Form  FETCH_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FETCH_DATA .
       SELECT VBELN INTO TABLE IT_VBAK FROM VBAK UP TO 10 ROWS.
       LOOP AT IT_VBAK INTO WA_VBAK.
         WA_FINAL-VBELN = WA_VBAK-VBELN.
         APPEND WA_FINAL TO IT_FINAL.
         CLEAR : WA_FINAL , WA_VBAK.
       ENDLOOP.
    ENDFORM.                    " FETCH_DATA
    *&      Form  FCAT_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FCAT_DATA .
       WA_FCAT-COL_POS = 1.
       WA_FCAT-FIELDNAME = 'BOX'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'BOX'.
       wa_fcat-checkbox = 'X'.
       WA_FCAT-EDIT = 'X'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
       WA_FCAT-COL_POS = 2.
       WA_FCAT-FIELDNAME = 'VBELN'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'Sales Document'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
    ENDFORM.                    " FCAT_DATA
    *&      Form  DISPLAY
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY .
       CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                = SY-REPID
    *   I_CALLBACK_PF_STATUS_SET          = ' '
        I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
          IT_FIELDCAT                       = IT_FCAT
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
         TABLES
           T_OUTTAB                          = IT_FINAL
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
       IF SY-SUBRC <> 0.
    * Implement suitable error handling here
       ENDIF.
    ENDFORM.                    " DISPLAY
    FORM USER_COMMAND USING UCOMM TYPE SY-UCOMM
                             RTAB TYPE slis_selfield.
       CASE UCOMM.
         WHEN '&IC1'.
           MESSAGE 'SUCESSFUL' TYPE 'S'.
         WHEN '&DATA_SAVE'.
           PERFORM FIL_FCAT.
           PERFORM DISPLAY1.
         WHEN 'BACK'.
           LEAVE TO SCREEN 0.
         WHEN OTHERS.
           LEAVE TO SCREEN 0.
       ENDCASE.
    ENDFORM.
    *&      Form  FIL_FCAT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FIL_FCAT .
    CLEAR IT_FCAT.
       WA_FCAT-COL_POS = 1.
       WA_FCAT-FIELDNAME = 'BOX'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'BOX'.
       wa_fcat-checkbox = 'X'.
    **  WA_FCAT-EDIT = 'X'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
       WA_FCAT-COL_POS = 2.
       WA_FCAT-FIELDNAME = 'VBELN'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'Sales Document'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
    ENDFORM.                    " FIL_FCAT
    *&      Form  DISPLAY1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY1 .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                = SY-REPID
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
          IT_FIELDCAT                       = IT_FCAT
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
         TABLES
           T_OUTTAB                          = IT_FINAL
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
       IF SY-SUBRC <> 0.
    * Implement suitable error handling here
       ENDIF.
    ENDFORM.                    " DISPLAY1
    Here i written code under the SAVE button , if requires you create your own status and apply.
    Regards,
    Krishna

  • Hi, how to set printer to alv grid, please check my code

    Hi,
    Iam giving my code, please observe...
    DEFAULT PRINTER NAME "A909".
    NOW IAM SETTING OT "LP01".
    GS_PRINT-PRINT = 'X'.
    P_PRINTR = 'LP01'.
    CALL FUNCTION 'UPDATE_DEFAULT_PRINTPARAMS'
    EXPORTING
    USER = SY-UNAME
    DESTINATION = P_PRINTR
    IMMEDIATELY = ' '
    RELEASE = 'X'
    NEW_LIST_ID = 'X'.
    SY-BATCH = 'X'
    CALL METHOD GO_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    I_BUFFER_ACTIVE =
    I_BYPASSING_BUFFER =
    I_CONSISTENCY_CHECK = G_CONSISTENCY_CHECK
    I_STRUCTURE_NAME = 'KNA1'
    IS_VARIANT = GS_VARIANT
    I_SAVE = 'A'
    I_DEFAULT = 'X'
    IS_LAYOUT = GS_LAYOUT
    IS_PRINT = GS_PRINT
    IT_SPECIAL_GROUPS =
    IT_TOOLBAR_EXCLUDING = GT_EXCLUDE
    IT_HYPERLINK =
    IT_ALV_GRAPHICS =
    IT_EXCEPT_QINFO =
    IR_SALV_ADAPTER =
    CHANGING
    IT_OUTTAB = ITAB2[]
    IT_FIELDCATALOG = GT_FIELDCAT
    IT_SORT =
    IT_FILTER =
    EXCEPTIONS
    INVALID_PARAMETER_COMBINATION = 1
    PROGRAM_ERROR = 2
    TOO_MANY_LINES = 3
    others = 4
    After running this program iam getting the default printer spool request number 'A909', Iam not getting printing form 'LP01'.
    Need is to send the print to given printer (LP01), here printer may varry accoring to the selection. So nee is to set the printer that which has choosen.
    Please give me the valuble solution as early as possible.
    Please solve this as early as possible.

    Hi Ravi,
    You can choose for the print version to be created as a PostScript file instead of a PDF document. The PostScript file is then sent directly to a printer of your choice
    If you do not specify an output device here, a PDF file is generated and displayed on the screen.
    You use the methods of the interface class IF_SALV_WD_PDF_SETTINGS for this (implementing class CL_SALV_WD_CONFIG_TABLE).
    <b>Function</b>                      <b>Method</b>
    Set ALV output to be printed immediately -->  SET_PRINT_IMMEDIATE
    Check whether the ALV output is to be printed immediately --> GET_PRINT_IMMEDIATE
    Set printer -->  SET_PRINTER
    Get printer --> GET_PRINTER
    See the below for SAP link
    http://help.sap.com/saphelp_nw04s/helpdata/en/43/27472def40601ee10000000a422035/content.htm
    see the thread also
    Re: How to set the printer in set_table_for_first_display
    mark all the helpful answers
    Regards
    Sudheer

  • Problem while setting PF_status in ALV Grid Display

    Hi,
    i have a final internal table with first field as a check box. I have delete button on application tool-bar, with usercommand and pf status defined for it.
    Once the output is displayed  i should have the option of checking the line (check box) and delete then records from the list.
    problem here is once i check the box and click on delete button is not getting deleted. but instead if i check the box and double click on the line(ie f2 fuctionality) and then click on refresh, then the records are getting deleted.
    i have not provided and pf status for f2 functionality, by default its getting activated before the delete fuctionality is called. 
    i have attached my code below.
    DATA : fk_events   TYPE slis_t_event,
           f_user_command TYPE slis_formname VALUE 'USER_COMMAND',
           f_status TYPE slis_formname VALUE 'STANDARD_SP01',
           fieldnam(10) TYPE c.
    DATA:  gs_layout TYPE slis_layout_alv.
    DATA: ls_event TYPE slis_alv_event.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
      EXPORTING
        i_list_type = 0
      IMPORTING
        et_events   = fk_events.
    READ TABLE fk_events INTO ls_event WITH KEY name = slis_ev_user_command
    IF sy-subrc = 0.
      MOVE f_user_command TO ls_event-form.
      MODIFY fk_events FROM ls_event TRANSPORTING form WHERE name =
    ls_event-name.
    ENDIF.
    READ TABLE fk_events INTO ls_event WITH KEY name =
                              slis_ev_pf_status_set
    IF sy-subrc = 0.
      MOVE f_status TO ls_event-form.
      MODIFY fk_events FROM ls_event TRANSPORTING form WHERE name =
    ls_event-name.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       i_callback_program                 = 'ZWR_SECOND_TO_CREATION1'
    i_callback_pf_status_set          =  f_status
       i_callback_user_command           =  f_user_command
       it_fieldcat                        = gt_fieldcat[]
       it_events                         = fk_events[]
      TABLES
        t_outtab                          = gt_final[]
    EXCEPTIONS
       program_error                     = 1
       OTHERS                            = 2.
    FORM user_command USING r_comm TYPE sy-ucomm
                            rs_selfield TYPE slis_selfield.
      fieldnam = rs_selfield-fieldname.
      CASE r_comm.
        WHEN  'DELETE''.
          LOOP AT gt_final INTO gk_final.
    IF gk_final-del_sat = 'X'.
              DELETE gt_final WHERE vbeln = gk_final-vbeln.
            ENDIF.
            rs_selfield-refresh = 'X'.
    ENDLOOP.
        WHEN OTHERS.
          EXIT.
      ENDCASE.
    FORM standard_sp01 USING  extab TYPE slis_t_extab.
      SET PF-STATUS 'RAM' EXCLUDING extab.  " For PF-Status
    ENDFORM.                    "STANDARD_SP01
    i wud be very thankful if someone cud help me
    thanx
    ram

    Hi,
    i have a final internal table with first field as a check box. I have delete button on application tool-bar, with usercommand and pf status defined for it.
    Once the output is displayed  i should have the option of checking the line (check box) and delete then records from the list.
    problem here is once i check the box and click on delete button is not getting deleted. but instead if i check the box and double click on the line(ie f2 fuctionality) and then click on refresh, then the records are getting deleted.
    i have not provided and pf status for f2 functionality, by default its getting activated before the delete fuctionality is called. 
    i have attached my code below.
    DATA : fk_events   TYPE slis_t_event,
           f_user_command TYPE slis_formname VALUE 'USER_COMMAND',
           f_status TYPE slis_formname VALUE 'STANDARD_SP01',
           fieldnam(10) TYPE c.
    DATA:  gs_layout TYPE slis_layout_alv.
    DATA: ls_event TYPE slis_alv_event.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
      EXPORTING
        i_list_type = 0
      IMPORTING
        et_events   = fk_events.
    READ TABLE fk_events INTO ls_event WITH KEY name = slis_ev_user_command
    IF sy-subrc = 0.
      MOVE f_user_command TO ls_event-form.
      MODIFY fk_events FROM ls_event TRANSPORTING form WHERE name =
    ls_event-name.
    ENDIF.
    READ TABLE fk_events INTO ls_event WITH KEY name =
                              slis_ev_pf_status_set
    IF sy-subrc = 0.
      MOVE f_status TO ls_event-form.
      MODIFY fk_events FROM ls_event TRANSPORTING form WHERE name =
    ls_event-name.
    ENDIF.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       i_callback_program                 = 'ZWR_SECOND_TO_CREATION1'
    i_callback_pf_status_set          =  f_status
       i_callback_user_command           =  f_user_command
       it_fieldcat                        = gt_fieldcat[]
       it_events                         = fk_events[]
      TABLES
        t_outtab                          = gt_final[]
    EXCEPTIONS
       program_error                     = 1
       OTHERS                            = 2.
    FORM user_command USING r_comm TYPE sy-ucomm
                            rs_selfield TYPE slis_selfield.
      fieldnam = rs_selfield-fieldname.
      CASE r_comm.
        WHEN  'DELETE''.
          LOOP AT gt_final INTO gk_final.
    IF gk_final-del_sat = 'X'.
              DELETE gt_final WHERE vbeln = gk_final-vbeln.
            ENDIF.
            rs_selfield-refresh = 'X'.
    ENDLOOP.
        WHEN OTHERS.
          EXIT.
      ENDCASE.
    FORM standard_sp01 USING  extab TYPE slis_t_extab.
      SET PF-STATUS 'RAM' EXCLUDING extab.  " For PF-Status
    ENDFORM.                    "STANDARD_SP01
    i wud be very thankful if someone cud help me
    thanx
    ram

  • How to control edit checks on alv grid fields

    I have set up an alv grid that allows for user input. 
    The fields are defined from the data dictionary. 
    Edit checks are happening on all fields, but I would like to turn that off for some fields. 
    How is that controlled?
    Regards!

    u need to define ur own field catalog for this purpose, for the fields for which u want to set check box, add property like this
      X_FIELDCAT-FIELDNAME = 'LIFNR'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-SELTEXT_L  = 'VENDOR'.
      X_FIELDCAT-NO_ZERO    = 'X'.
      X_FIELDCAT-OUTPUTLEN  = 10.
      X_FIELDCAT-COL_POS    = 1.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      X_FIELDCAT-FIELDNAME = 'BUKRS'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-CHECKBOX = 'X'.
      X_FIELDCAT-SELTEXT_L  = 'COMPANY'.
      X_FIELDCAT-NO_ZERO    = 'X'.
      X_FIELDCAT-OUTPUTLEN  = 4.
      X_FIELDCAT-COL_POS    = 2.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
        CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
          EXPORTING
            I_PROGRAM_NAME         = SY-REPID
            I_INTERNAL_TABNAME     = 'IT_FINAL'
            I_INCLNAME             = SY-REPID
          CHANGING
            CT_FIELDCAT            = IT_FIELDCAT
          EXCEPTIONS
            INCONSISTENT_INTERFACE = 1
            PROGRAM_ERROR          = 2
            OTHERS                 = 3.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            I_CALLBACK_PROGRAM = SY-REPID
            IS_LAYOUT          = L_LAYOUT
            IT_FIELDCAT        = IT_FIELDCAT
          TABLES
            T_OUTTAB           = IT_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.
    u can even check program BCALV_EDIT_05, award points if found helpful

  • Selecting both - Column and Rows in ALV Grid

    Hi All,
    I am developing a module pool in which in a ALV Grid Display the user wants to select multiple rows and multiple columns.
    How to set this in ALV grid? Right now I can set selection of multiple rows but once user clicks on column the rows are deselected and the column gets selected.
    Similarly when user selects on one column and clicks on another column the previous selected column gets deselected.
    Is there any way to do this in ALV Grid?
    Thanks,
    Rashmi.
    PS: I am using OO ALV for this development.

    Hi Andrey,
    I know this. I was just trying to find out if there is some other alternative to this.
    Anyways, this seems to be the only choice.
    Thanks,
    Rashmi.

  • How to set a selected checkbox in output internal table of oops ALV grid

    Hi All,
    i have a checkbox as first column in my ALV grid output using oops alv, when i select some checkbox, that rows have to be selected and i need to process only selected rows in user command.
    i have given the below code also in fieldcatolg.
    f_fldcat-fieldname = 'checkbox'.
    f_fldcat-tabname ='gi_output'
    f_fldcat-checkbox = 'X'.
    f_fldcat-edit = 'X'.
    but the checkbox is not getting set in internal table when i select some checkboxes.
    can anybody explain y the checkbox in internal table not getting set?
    Thanks,
    Srilakshmi.

    Hi,
    i tried already whatever u said, but still not resolved.Pasted my code below..can u please look into it.
    MODULE pbo OUTPUT.
      PERFORM init_container.
      PERFORM prepare_field_catalog.
      PERFORM prepare_layout.
      PERFORM display_output.
    ENDMODULE.                 " PBO  OUTPUT
    *&      Module  PAI  INPUT
          text
    MODULE pai INPUT.
       DATA: lt_rows TYPE lvc_t_row.
      CASE gv_okcode.
        WHEN gc_exit OR gc_back OR gc_canc. " Finish program
          LEAVE PROGRAM.
          when 'PRINT'.
           CALL METHOD gv_grid->get_selected_rows
                     IMPORTING et_index_rows = lt_rows.
            CALL METHOD cl_gui_cfw=>flush.
      ENDCASE.
    ENDMODULE.                 " PAI  INPUT
    *&      Form  INIT_CONTAINER
          text
    FORM init_container .
      CREATE OBJECT gv_custom_container
        EXPORTING
          container_name = gc_container.
      CREATE OBJECT gv_grid
        EXPORTING
          i_parent = gv_custom_container.
      CREATE OBJECT gv_document
        EXPORTING
          style = 'ALV_GRID'.
    *&      Form  PREPARE_FIELD_CATALOG
          text
    FORM prepare_field_catalog .
      PERFORM fill_catalog USING:
    'Table Name'   'Field Name' 'NoZero'   'sel-text'
      'GI_OUTPUT'  'CHECKBOX'   ' '           text-013  'X',
      'GI_OUTPUT'  'KUNNR'      'X'           text-003  ' ',
      'GI_OUTPUT'  'NAME1'      ' '           text-004  ' ',
      'GI_OUTPUT'  'BELNR'      'X'           text-005  ' ',
      'GI_OUTPUT'  'BLART'      ' '           text-006  ' ',
      'GI_OUTPUT'  'BUDAT'      ' '           text-007  ' ',
      'GI_OUTPUT'  'BLDAT'      ' '           text-008  ' ',
      'GI_OUTPUT'  'DMBTR'      ' '           text-009  ' ',
      'GI_OUTPUT'  'WAERS'      ' '           text-010  ' '.
    ENDFORM.                    " PREPARE_FIELD_CATALOG
    *&      Form  FILL_CATALOG
          text
    FORM fill_catalog  USING    fv_tabname
                                fv_fldname
                                fv_nozero
                                fv_seltxt
                                fv_checkbox.
      DATA f_fldcat TYPE lvc_s_fcat.
      f_fldcat-fieldname     = fv_fldname.
      f_fldcat-tabname       = fv_tabname.
      f_fldcat-no_zero       = fv_nozero.
      f_fldcat-coltext       = fv_seltxt.
      f_fldcat-checkbox      = fv_checkbox.
      IF fv_checkbox = gc_x.
        f_fldcat-edit = gc_x.
      ENDIF.
      APPEND f_fldcat TO gi_fieldcat.
    ENDFORM.                    " FILL_CATALOG
    *&      Form  PREPARE_LAYOUT
          text
    FORM prepare_layout .
      gs_layout-info_fname = 'COL'.
      gs_layout-cwidth_opt = gc_x.
      gs_layout-zebra      = gc_x.
      gs_layout-no_toolbar = gc_x.
      gs_layout-no_rowmark = '1'.
      gs_layout-sel_mode = 'A'.
    ENDFORM.                    " PREPARE_LAYOUT
    *&      Form  DISPLAY_OUTPUT
          text
    FORM display_output .
      CALL METHOD gv_grid->set_table_for_first_display
        EXPORTING
          is_layout       = gs_layout
        CHANGING
          it_outtab       = gi_output
          it_fieldcatalog = gi_fieldcat.
      CREATE OBJECT event_receiver.
      SET HANDLER event_receiver->handle_user_command FOR gv_grid.
    CALL METHOD cl_gui_control=>set_focus EXPORTING control = gv_grid.
    ENDFORM.                    " DISPLAY_OUTPUT

  • Set cursor alv grid (not using objects)

    I got a question on ALV GRID (not using objects), please let me know if you have pointers. Thanks.
    Output has 2 screens both has different contents. The output is generated using internal table1 and 2 and using FM  'REUSE_ALV_GRID_DISPLAY_LVC'  (both screen use same FM).
    First screen has multiple pages of output (say 10 pages). User scrolled page 5 and line 10 of first screen and then double clicked it takes to screen #2. After completion of screen #2, the back arrow should get back to page 5 and line 10 of screen #1. Currently the back arrow gets to screen#1 page 1 and line 1. How to remember the cursor position in alv grid and instruct the cursor to go there?
    Appreciate the input.
    Note: I tried "set cursor line n" with "Scroll" command but no luck. http://help.sap.com/saphelp_nw70/helpdata/EN/9f/dba47e35c111d1829f0000e829fbfe/content.htm

    Thanks for the inputs.
    FYI, I got it implemented using method  CALL METHOD <ref.var. to CL_GUI_ALV_GRID > ->set_current_cell_via_id
    The method is called by 'REUSE_ALV_GRID_DISPLAY_LVC' form 'PF_STATUS_SET' when the ALV grid output is presented each time.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
        EXPORTING
          i_bypassing_buffer       = 'X'
          i_callback_program       = gc_repid
          i_callback_pf_status_set = 'PF_STATUS_SET'
          i_callback_user_command  = 'USER_COMMAND'
          is_layout_lvc            = lwa_layout
          it_fieldcat_lvc          = git_fc_lvc
          i_default                = ' '
        TABLES
          t_outtab                 = git_data
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      FORM alv_event_pf_status_set USING rt_extab                
                                 TYPE slis_t_extab.
      DATA lo_ref1 TYPE REF TO cl_gui_alv_grid.
    *Get the reference to class "lo_ref1" for the ALV report
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = lo_ref1.
    *set the focus of cursor in ALV
      CALL METHOD lo_ref1->set_current_cell_via_id
        EXPORTING
          is_row_no = gv_row. "row number where you want to focus the cursor
      ENDFORM.

  • Setting Font Color and Bold Property in ALV Grid

    I have a requirement to set the font in particular ALV Cells  in red color.
    Also this font (text) has to be set to Bold.
    I know how to set cell coloring in ALV Grid, but have no idea regarding how to set font color.
    Could please give me an idea/code segment/suggestion.
    Thank You!

    Please refer this post
    Coloring of ROWS in ALV tree

  • Set editable/non-editable checkbox in alv grid

    Hi all,
    How to set a checkbox in alv grid in editable/non-editable. i am using alv gird display function module for this. i tried to used method  cl_gui_alv_grid=>mc_style_disabled. but its not working. is it possible to have this functionality in grid? please help. thanks in advance.

    Hi,
    Try like this.
    CALL METHOD gr_alvgrid->set_table_for_first_display
    EXPORTING
    I_BUFFER_ACTIVE =
    I_CONSISTENCY_CHECK =
    I_STRUCTURE_NAME =
    IS_VARIANT =
    I_SAVE =
    I_DEFAULT = 'X'
    is_layout = gs_layout
    IS_PRINT =
    IT_SPECIAL_GROUPS =
    IT_TOOLBAR_EXCLUDING =
    IT_HYPERLINK =
    CHANGING
    it_outtab = gt_list[]
    it_fieldcatalog = gt_fieldcat
    IT_SORT =
    IT_FILTER =
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    OTHERS = 4
    regards
    Rajesh kumar

  • GET/SET ALV GRID scrollbar

    Hi you,
    after a refresh we want to restore all settings done in the ALV grid.
    The grid control provides methods for getting and setting the FRONTEND_FIELDCATALOG, FILTER_CRITERIA, FRONTEND_LAYOUT, FRONTEND_PRINT and SELECTED_CELLS settings.
    Imagine the user scrolled down the list without selecting any cell. Is it possible to determine (and possibly restore) this?
    TIA,
    Regards,
    Clemens

    Hi,
    Try this...
    when calling the REFRESH_TABLE_DISPLAY method..pass
    IS_STABLE-row = 'X' and
    IS_STABLE-col = 'X'.
    Thanks
    Naren

Maybe you are looking for

  • BI publisher returning data very slowly

    Hi BI gurus, I have quite afew reports in BI publisher that pulled a huge volume of data ( transactional data from OLTP systems). My clients want these data in excel format. Now the problem I am facing right now is that, when the report query is ran,

  • New Task Bar Control for Yahoo! Music Engi

    Thought those of you who use Yahoo! Music Engine would like to check out a free task bar control for the player. I found this buried in the Yahoo Forums from early July. I was trying to find a remote that wouldn't shut down everytime I clicked my mou

  • Exchange Rate from SAP table

    Hi Any idea where can I extract out the exchange rate other then EKKO, as I'm in the mid of creating my own  PO report. I would like the exchange rate to be captured in the LIV instead of the PO. Any idea?

  • Question mark appears during startup

    i recently got a new hard drive installed and now every time i start up my macbook, a blinking question mark within a folder appears for a second or two before the apple logo. dont notice any difficulties or symptoms of problems, but i remember the b

  • Voice recognition in labview

    Hy Everyone I am new to labview. My project consists of voice recognition elevator system. my first task is to go ahead with voice recognition. I really need help. Regards kunal Solved! Go to Solution.