RE:ALV grid (oops concept)-to make selected row editable

Hi,
I have an object oriented alv which is having 5 rows of data.I have a pushbutton to make any row in editable mode.My requirement is i will select any row in oops alv grid and press
the button to make the row editable.How can i do this in oops alv.
thanks,
Alex

Hi,
Use the Link [http://www.sapdev.co.uk/reporting/alv/alvgrid_editable.htm]
Check demo pgm BCALV_EDIT_05.
*& Report ZUS_SDN_ALVGRID_EDITABLE_8
*& Description: editable ALV -> ENTER jumps to next row
*& Dynpro flow logic: no screen elements, ok_code = GD_OKCODE
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
REPORT zus_sdn_alvgrid_editable_8.
DATA:
gd_repid TYPE syst-repid,
gd_okcode TYPE ui_func,
gt_fcat TYPE lvc_t_fcat,
go_docking TYPE REF TO cl_gui_docking_container,
go_grid TYPE REF TO cl_gui_alv_grid.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1.
CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING
er_data_changed
e_onf4
e_onf4_before
e_onf4_after
e_ucomm
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_data_changed.
define local data
cl_gui_cfw=>set_new_ok_code( 'NEXT_ROW' ). " not possible on 4.6c
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'NEXT_ROW'
IMPORTING
RC =
" Triggers PAI of dynpro with ok_code = 'NEXT_ROW'
ENDMETHOD. "handle_data_changed
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
PARAMETERS:
p_bukrs TYPE bukrs DEFAULT '2000' OBLIGATORY.
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = p_bukrs.
Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Create ALV grid
CREATE OBJECT go_grid
EXPORTING
i_parent = go_docking
EXCEPTIONS
OTHERS = 5.
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
" Triggers event DATA_CHANGED when ENTER is pushed
CALL METHOD go_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter
EXCEPTIONS
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.
SET HANDLER:
lcl_eventhandler=>handle_data_changed FOR go_grid.
Build fieldcatalog and set hotspot for field KUNNR
PERFORM build_fieldcatalog_knb1.
Display data
CALL METHOD go_grid->set_table_for_first_display
CHANGING
it_outtab = gt_knb1
it_fieldcatalog = gt_fcat
EXCEPTIONS
OTHERS = 4.
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Link the docking container to the target dynpro
gd_repid = syst-repid.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ok-code field = GD_OKCODE
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
SET TITLEBAR 'xxx'.
CALL METHOD go_grid1->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.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE user_command_0100 INPUT.
go_grid->check_changed_data( ).
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
" NOTE: ENTER button alone works apparently only if the cursor
" is placed within the command window (left-upper corner)
WHEN 'ENTER' OR
'NEXT_ROW'.
PERFORM set_cursor_next_row.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form BUILD_FIELDCATALOG_KNB1
text
--> p1 text
<-- p2 text FORM build_fieldcatalog_knb1 .
define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_BUFFER_ACTIVE =
i_structure_name = 'KNB1'
I_CLIENT_NEVER_DISPLAY = 'X'
I_BYPASSING_BUFFER =
I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT gt_fcat INTO ls_fcat
WHERE ( fieldname = 'ZUAWA' ).
ls_fcat-edit = abap_true.
ls_fcat-col_opt = abap_true.
MODIFY gt_fcat FROM ls_fcat.
ENDLOOP.
ENDFORM. " BUILD_FIELDCATALOG_KNB1
*& Form SET_CURSOR_NEXT_ROW
text
--> p1 text
<-- p2 text FORM set_cursor_next_row .
define local data
DATA:
ls_row TYPE lvc_s_row,
ls_col TYPE lvc_s_col.
CALL METHOD go_grid->get_current_cell
IMPORTING
E_ROW =
E_VALUE =
E_COL =
es_row_id = ls_row
es_col_id = ls_col
ES_ROW_NO =
ADD 1 TO ls_row-index. " next row
CALL METHOD go_grid->set_current_cell_via_id
EXPORTING
is_row_id = ls_row
is_column_id = ls_col
IS_ROW_NO =
ENDFORM. " SET_CURSOR_NEXT_ROW
HTH
Regards,
Dhruv Shah

Similar Messages

  • RE:ALV grid (oops concept)

    Hi,
    I have an object oriented alv which is having 5 rows of data.I have a pushbutton to make any row in editable mode.My requirement is i will select any row in oops alv grid and press
    the button to make the row editable.How can i do this in oops alv.
    Can anyone send a sample code for this.
    Thanks in advance,
    Alex.

    See I have an internal table I_output.
    and u create a button by name  vald or ente. and then try to implement the below code.
    if u still not cleared just give me your mail id, i will send u a program i which we have the same functionality.
    WHEN 'VALD' OR 'ENTE'.
            CALL METHOD grid1->check_changed_data.
            CALL METHOD grid1->get_selected_rows
              IMPORTING
                et_index_rows = i_index_rows.
            IF i_index_rows IS INITIAL.
              MESSAGE i000 WITH 'Select Rows to be Saved'.
              EXIT.
            ENDIF.
            LOOP AT i_index_rows INTO wa_index_rows.
              CLEAR: wa_output.
              READ TABLE i_output INDEX wa_index_rows-index INTO wa_output.
              MOVE-CORRESPONDING wa_output TO wa_insert.        "#EC ENHOK
              wa_insert-changed_by = sy-uname.
              wa_insert-change_date  = sy-datum.
              wa_insert-change_time = sy-uzeit.
              APPEND wa_insert TO i_insert.
            ENDLOOP.
            CLEAR: flg_upd.”flag
            LOOP AT i_insert INTO wa_insert.
              PERFORM f0005_validate_data.
              CLEAR: wa_insert, flg_err.
            ENDLOOP.
            IF e_ucomm = 'VALD'.
              IF NOT i_insert[] IS INITIAL.
                LOOP AT i_insert INTO wa_insert.
                  UPDATE zfocp_details SET date_ack_rec = wa_insert-date_ack_rec
                                           time_ack_rec = wa_insert-time_ack_rec
                                           changed_by   = wa_insert-changed_by
                                           change_date  = wa_insert-change_date
                                           change_time  = wa_insert-change_time
                                       WHERE text = wa_insert-text
                                       AND   laufd = wa_insert-laufd
                                       AND   laufi = wa_insert-laufi
                                       AND   absbu = wa_insert-absbu
                                       AND   rzawe = wa_insert-rzawe
                                       AND   hbkid = wa_insert-hbkid
                                       AND   hktid = wa_insert-hktid
                                       AND   date_sent = wa_insert-date_sent
                                       AND   time_sent = wa_insert-time_sent.
                  IF sy-subrc = 0.
                    MESSAGE s000(zf_ebb1) WITH 'Records saved successfully'.
    Endif.

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

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

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

  • HI   ALV USING OOPS CONCEPT

    hi
    i would like to have coding for total and subtotal in alv using oops concept and (not using function module).
    also i would like to have coding for cell color and heading and footer.
    thanx in adv
    rocky

    Hi Rocky,
    please check this link
    http://www.****************/Tutorials/ALV/Total/text.htm
    While modifying field catalog , try the following.
    Field-symbols: <lfs_fieldcat> TYPE lvc_s_fcat.
    LOOP AT i_fieldcat ASSIGNING <lfs_fieldcat>.
    CASE <lfs_fieldcat>-fieldname.
    WHEN 'LOSGR'.
    <lfs_fieldcat>-coltext = text-007.
    <lfs_fieldcat>-do_sum = c_x.
    ENDCASE.
    ENDLOOP.
    Or if you want to use field symbols.
    data: total type ref to data,
    subtotal1 type ref to data.
    field-symbols <total> like gt_sflight.
    field-symbols <subtotal1> like gt_sflight.
    call method grid1->get_subtotals
    importing
    ep_collect00 = total
    ep_collect01 = subtotal1.
    assign total->* to <total>.
    assign subtotal1->* to <subtotal1>.
    Best regards,
    raam

  • How to make a row editable in a click to edit table programatically?

    I have a table in my page in which I can do inline addition as well as select and add addition (which will programatically add multiple rows). And my table is click to edit (there are few editable columns in the table).
    So, suppose if I add a row say R1 by inline addition, then this row is coming as highlighted as well as selected (i.e editable). But now suppose I add another row R2 through Select and Add (which will open a popup table from where I can select multiple rows, and clicking on OK, I will add those rows programatically in the table VO), it is coming as highlighted but it is not coming as selected i.e now R1 is selected and editable but R2 is highlighted. (I have done setCurrentRow programatically but that is only making the row highlighted and not editable. Is there any way to make the row editable also programatically?

    try setEditingMode method. See if it helps.
    http://docs.oracle.com/cd/E28389_01/apirefs.1111/e10684/oracle/adf/view/rich/component/rich/data/RichTable.html#setEditingMode_java_lang_String_

  • Regarding ALV using OOPS Concept

    Hi Experts,
    Can abody explain to me how can i disable some settings in the tool bar of ALV Grid using oops concept??

    Hi Alex,
    You can perform this step, before you call set_table_for_first_display and pass that to this call.
    **Exculude all unnecessary standard function in ALV
      PERFORM exclude_tb_functions CHANGING lt_exclude.
    CALL METHOD g_grid->set_table_for_first_display
        EXPORTING
      is_layout            = gs_layout
          is_variant           = l_variant
          i_save               = 'A'
          it_toolbar_excluding = lt_exclude
        CHANGING
          it_fieldcatalog      = gt_fieldcat
          it_sort              = gt_sort[]
          it_outtab            = it_final[].
    You can exclude all unwanted function in the subroutine.
    FORM exclude_tb_functions  CHANGING pt_exclude TYPE ui_functions.
      DATA ls_exclude TYPE ui_func.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
      APPEND ls_exclude TO pt_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
      APPEND ls_exclude TO pt_exclude.
    ENDFORM.                    " exclude_tb_functions
    This will give you complete the solution for your query.
    Thanks
    Lakshmi

  • ALV Grid OOPS error

    Hi all,
    I am using ALV oops for displaying table.
    CL_GUI_ALV_GRID->set_table_for_first_display.
    I  have cretaed an Custom Container for this.
    Now scenario is like, First i have to display normal classical report when user double click on classical report
    it will show alv grid on other screen depending on the row of report user clicks i am picking data and showing it on other screen as ALV grid.
    First time its showing correct data when i press back on ALV grid screen and came back on report screen and select other row and double click  its not showing anything ..
    Please help.
    Its required very urgently by client.
    Thanks in advance..
    Harsh

    Hi,
    Check whether the internal table in which you are passing data to the grid has the correct data.
    Do not call the method set_table_for_first_display once again.
    Instead call the method REFRESH_TABLE_DISPLAY.
    Call the method SET_TABLE_FOR_FIRST_DISPLAY only once when the ALV grid object is created.
    Call the method  flush of the class cl_gui_cfw in the PBO after the grid is displayed; after the method SET_TABLE_FOR_FIRST_DISPLAY
    Check if this works.
    Regards,
    Ankur Parab

  • ALV Grid: Cell not available for selection

    ALV GRID.
    How can I make a cell(or an entire column) not available to be selected?

    I was able to forbid users to click on cells that has got null values by:
    a) declare the column as hotspot when you are building the fieldcatalog (fieldcatalog-key  = 'X')
    b) inside the form "user_command", after reading the data inside the internal table, use something like:
    if  wa_it_alldata-accounting_doc_nbr ne space.
    processing logic
    endif.
    wa_it_alldata would be the internal table and can be prefilled by something like:
    read data table, using index of row user clicked on
            READ TABLE it_alldata_f INTO
            wa_it_alldata INDEX rs_selfield-tabindex.
    A more extensive eg can be found at: http://www.sapdevelopment.co.uk/reporting/alv/alvgrid.htm
    Let us know if you still have the problem.
    Rajib

  • Check box in ALV grid gets unselected for new selection

    Hi all,
    This is my code :
    TYPE-POOLS : slis.
    Variable
    DATA: g_repid LIKE sy-repid,
          g_title TYPE lvc_title,
          g_set_pf_stat TYPE slis_formname VALUE 'SET_PF_STATUS',
          g_user_command TYPE slis_formname VALUE 'USER_COMMAND',
          g_layout TYPE slis_layout_alv,
          g_print_alv TYPE slis_print_alv,
          g_variant LIKE disvariant,
          c_char_a(1) VALUE 'A',
          c_char_x(1) VALUE 'X',
          itab_alv_sort TYPE slis_t_sortinfo_alv,
          itab_alv_fcat TYPE slis_t_fieldcat_alv,
          fm_name type rs38l_fnam," Function Module Name
    *      l_sfctrlparams LIKE ssfctrlop, " Form Print Parameter
    *      l_sfoutopt LIKE ssfcompop,
          pri_params LIKE pri_params,
          c_x type c .
    *       Internal tables          Begin with IT_                       *
    DATA : it_fcat TYPE SLIS_T_FIELDCAT_ALV,                           "---ALV
           it_disp type table of ZLOI.
    *       Work Area for Internal tables      Begin with WA_             *
    data : wa_fcat TYPE slis_fieldcat_alv ,              "---ALV
           wa_layout           TYPE lvc_s_layo,               "---ALV
           wa_it_disp like line of it_disp.
    *       Objects                                                       *
    DATA : cref TYPE REF TO cl_gui_custom_container,          "---ALV
           gref TYPE REF TO cl_gui_alv_grid.                  "---ALV
    *        Start-of-selection
    Start-of-selection.
      perform fetch_po_det.
      perform build_fcat.
      perform alv_display.
    *&      Form  FETCH_PO_DET
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FETCH_PO_DET .
      data : it_po type table of crmd_orderadm_h,
               wa_po like line of it_po,
               wa_header type BBP_PDS_PO_HEADER_D.
      select  guid
              object_id
              DESCRIPTION
              POSTING_DATE
              CREATED_BY
      from crmd_orderadm_h
      into corresponding fields of table it_po
      where object_type = 'BUS2201'.
      loop at it_po into wa_po.
        move wa_po-object_id to wa_it_disp-ZZPONO.
        move wa_po-DESCRIPTION to wa_it_disp-ZZPODESC.
        move wa_po-posting_date to wa_it_disp-ZZPODATE.
        move wa_po-created_by to wa_it_disp-ZZPOCREATOR.
        CALL FUNCTION 'BBP_PD_PO_GETDETAIL'
          EXPORTING
            I_OBJECT_ID = wa_it_disp-zzpono
          IMPORTING
            E_HEADER    = wa_header.
        move wa_header-total_value to wa_it_disp-ZZPOVAL.
        move wa_header-currency to wa_it_disp-ZZPOCUR.
        append wa_it_disp to it_disp.
      endloop.
    *  write : wa_it_disp-zzpono.
    ENDFORM.                    " FETCH_PO_DET
    *&      Form  BUILD_FCAT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM BUILD_FCAT .
      g_repid = sy-repid.
      g_title = 'LOI details'.
      g_print_alv-no_print_listinfos = 'X'.
      g_variant-report = sy-repid.
      g_variant-variant = sy-title.
      CLEAR g_layout.
      g_layout-f2code = ' '.
      wa_layout-zebra       = 'X'.
      g_layout-flexible_key = 'X'.
      g_layout-colwidth_optimize = 'X'.
      g_layout-detail_initial_lines = 'X'.
      g_layout-box_fieldname = 'ZZCHECK'.
    *g_layout-box_tabname = 'ITAB_REPORT'.
    *Check box
      wa_fcat-fieldname = 'ZZCHECK'.
      wa_fcat-checkbox = 'X'.
      wa_fcat-outputlen = '1'.
      wa_fcat-col_pos = '1'.
      wa_fcat-edit = '1'.
      wa_fcat-seltext_m = 'No'.
      append wa_fcat to it_fcat.
    *Po no
      clear wa_fcat.
      wa_fcat-fieldname = 'ZZPONO' .
    wa_fcat-tabname = 'IT_DISP'.
    *  wa_fcat-seltext = 'Purchase Order'.
      wa_fcat-seltext_m  = 'Purchase Order'.
    *wa_fcat-seltext_s = 'Purchase Order.
    wa_fcat-icon = 'X'.
      wa_fcat-col_pos = '2'.
      wa_fcat-outputlen = 10.
      append wa_fcat to it_fcat.
    *Desc
      wa_fcat-fieldname = 'ZZPODESC' .
    wa_fcat-tabname = 'IT_DISP'.
    *wa_fcat-seltext_l = 'Description'.
      wa_fcat-seltext_m = 'Description'.
    *wa_fcat-seltext_s = 'Description'.
      wa_fcat-col_pos = '3'.
      wa_fcat-outputlen = 10.
      append wa_fcat to it_fcat.
    *Postign date
      wa_fcat-fieldname = 'ZZPODATE' .
    wa_fcat-tabname = 'IT_DISP'.
    wa_fcat-seltext_l = 'Posting Date'.
      wa_fcat-seltext_m = 'Posting Date'.
    *wa_fcat-seltext_s = 'Posting Date'.
      wa_fcat-col_pos = '4'.
      wa_fcat-outputlen = 8.
      append wa_fcat to it_fcat.
    *value
      wa_fcat-fieldname = 'ZZPOVAL' .
    wa_fcat-tabname = 'IT_DISP'.
    *wa_fcat-seltext_l = 'PO value'.
      wa_fcat-seltext_m = 'PO value'.
    *wa_fcat-seltext_s = 'PO value'.
      wa_fcat-col_pos = '5'.
      wa_fcat-outputlen = 15.
      append wa_fcat to it_fcat.
    *Currency
      wa_fcat-fieldname = 'ZZPOCUR' .
    wa_fcat-tabname = 'IT_DISP'.
    *wa_fcat-seltext_l = 'PO Currency'.
      wa_fcat-seltext_m = 'PO Currency'.
    *wa_fcat-seltext_s = 'PO Currency'.
      wa_fcat-col_pos = '6'.
      wa_fcat-outputlen = 5.
      append wa_fcat to it_fcat.
    *Creator
      wa_fcat-fieldname = 'ZZPOCREATOR' .
    wa_fcat-tabname = 'IT_DISP'.
    *wa_fcat-seltext_l = 'Buyer'.
      wa_fcat-seltext_m = 'Buyer'.
    *wa_fcat-seltext_s = 'Buyer'.
      wa_fcat-col_pos = '7'.
      wa_fcat-outputlen = 12.
      append wa_fcat to it_fcat.
    ENDFORM.                    " BUILD_FCAT
    *&      Form  ALV_DISPLAY
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM ALV_DISPLAY .
      sort it_disp by ZZPONO.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
         I_CALLBACK_PROGRAM                = g_repid
         I_CALLBACK_PF_STATUS_SET          = g_set_pf_stat
         I_CALLBACK_USER_COMMAND           = g_user_command
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
    *   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *   I_CALLBACK_HTML_END_OF_LIST       = ' '
    *   I_STRUCTURE_NAME                  =
    *   I_BACKGROUND_ID                   = ' '
          I_GRID_TITLE                      = g_title
    *   I_GRID_SETTINGS                   =
          IS_LAYOUT                         = g_layout
          IT_FIELDCAT                       = it_fcat[]
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
    *   IT_SORT                           =
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
          IS_VARIANT                        = g_variant
    *   IT_EVENTS                         =
    *   IT_EVENT_EXIT                     =
          IS_PRINT                          = g_print_alv
    *   IS_REPREP_ID                      =
    *   I_SCREEN_START_COLUMN             = 0
    *   I_SCREEN_START_LINE               = 0
    *   I_SCREEN_END_COLUMN               = 0
    *   I_SCREEN_END_LINE                 = 0
    *   I_HTML_HEIGHT_TOP                 = 0
    *   I_HTML_HEIGHT_END                 = 0
    *   IT_ALV_GRAPHICS                   =
    *   IT_HYPERLINK                      =
    *   IT_ADD_FIELDCAT                   =
    *   IT_EXCEPT_QINFO                   =
    *   IR_SALV_FULLSCREEN_ADAPTER        =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
        TABLES
          T_OUTTAB                          = it_disp[]
       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.                    " ALV_DISPLAY
    *&      Form  user_command
    *       text
    *      -->R_UCOMM      text
    *      -->RS_SELFIELD  text
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.                             "#EC CALLED
      CASE R_UCOMM.
        WHEN 'PRINT'.
          READ TABLE IT_disp INTO WA_IT_DISP WITH KEY ZZCHECK = 'X'.
          IF SY-SUBRC EQ 0.
            loop at it_DISP INTO WA_IT_DISP.
              CALL FUNCTION 'POPUP_TO_CONFIRM'
                EXPORTING
                  TEXT_QUESTION = 'Print the LOI details?'
                  TEXT_BUTTON_1 = 'Yes'
                  TEXT_BUTTON_2 = 'No'.
    *      IMPORTING
    *        ANSWER        = w_answer.
              IF SY-SUBRC  0.
              ENDIF.
    *          PERFORM CALL_SF.
            endloop.
          ENDIF.
        WHEN 'BACK'.
          LEAVE PROGRAM.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
        WHEN 'CANCEL'.
          LEAVE PROGRAM.
      ENDCASE.
      rs_selfield-refresh = 'X'.
    ENDFORM.                    "user_command
    *&      Form  set_pf_status
    *       text
    *      -->RT_EXTAB   text
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZSTANDARD' EXCLUDING rt_extab.
      SET TITLEBAR sy-tcode.
    ENDFORM.                    "set_pf_status
    Now in my ALV grid o/p i can  see the check box  but if i select one row and then try to slect another the first one gets deselected.
    Can anybody tell me what is missing?

    Hi,
    if you need just a check box for each line, try to get rid of this line from your layout.
    g_layout-box_fieldname = 'ZZCHECK'.
    SAP uses this field to store info about selected lines. Hence you click on the second check box, you select different line and the first line is erased. You can select more line by holding SHIFT + CTRL
    Cheers

  • ALV using OOPs concept

    Hi All,
    How do we create a hotspot using OOPs concept in ALV? Also tell me how to call a transaction code after doing a Hotspot click on a field.

    try factory methods like this:
    form display .
    Sort output table
      sort it_out by vbeln_vl vbeln_vf fkart.
      try.
    Using Factory classes for output display
          call method cl_salv_table=>factory
            importing
              r_salv_table = o_table
            changing
              t_table      = it_out.
          o_functions = o_table->get_functions( ).
          o_functions->set_all( abap_true ).
          To sort the table by Delivery, billing document.
          o_sorts = o_table->get_sorts( ).
          o_sorts->add_sort( columnname = 'VBELN_VL' subtotal = abap_true ).
          o_sorts = o_table->get_sorts( ).
          o_sorts->add_sort( columnname = 'VBELN_VF' subtotal = abap_true ).
    To goto transaction*
          o_cevents = o_table->get_event( ).
          create object o_levents.
          set handler o_levents->on_double_click for o_cevents.
      Catch exceptions
        catch cx_salv_msg into o_salv_msg.
          message e184 with o_salv_msg->msgv1
                            o_salv_msg->msgv2
                            o_salv_msg->msgv3
                            o_salv_msg->msgv4.
        catch cx_salv_not_found   into o_salv_not_found.
          message e184 with o_salv_not_found->object
                         o_salv_not_found->textid
                         o_salv_not_found->key
                         o_salv_not_found->method.
        catch cx_salv_data_error into  o_salv_data_error .
          message e184 with o_salv_data_error->object
                         o_salv_data_error->textid
                         o_salv_data_error->key
                         o_salv_data_error->method.
        catch cx_salv_existing into  o_salv_existing .
          message e184 with o_salv_existing->object
                         o_salv_existing->textid
                         o_salv_existing->key
                         o_salv_existing->method.
      endtry.
    Display
      o_table->display( ).
    endform.                    " display
    *&      Form  disp_line_item
    To display the delivery data using transaction VL03n*
           on double click on any row.*
    form disp_line_item  using    fp_row type salv_de_row
                                  fp_column type salv_de_column.
    Read the output table*
      read table it_out into wa_out index fp_row.
      if sy-subrc eq 0 .
        set parameter id 'VL' field wa_out-vbeln_vl.
        call transaction 'VL03N' and skip first screen. " Call transaction vl03n
      endif.
    endform.                    " disp_line_item
    Edited by: kartik tarla on Dec 15, 2008 7:35 PM

  • To populate another alv grid's field with value selected from search help

    Hi,
    I have two fields in alv grid, first column holds code and the second one holds code's description. Also I have a search help includes these two fields. The search help is attached to the first column. The requirement is, when I select a code from the search help, second column should be populated with selected code's description.
    Any help will be appreciated. Thanks..

    Hi,
    have a look into Report: BCALV_EDIT_03.
    Regards, Dieter

  • Dopdown Listbox in ALV Grid OO Concept

    Is it possible to put a dropdownlist bow for an alv grid?
    Is it possible to put different List of values for same cell of column ?
    How do we do it ?
    regards,

    Hi,
    steps..
    1. X_FIELDCAT-DRDN_HNDL = '1'. "pass this to the field you want to show as drop down
    2.
    DATA: X_OCRC LIKE LINE OF IT_OCRC.
      DATA:LT_DRAL TYPE LVC_T_DRAL,
            LS_DRAL TYPE LVC_S_DRAL.
      LOOP AT IT_OCRC INTO X_OCRC.
    * First listbox (handle '1').
        IF SY-INDEX = 1.
          LS_DRAL-HANDLE = '1'.
          LS_DRAL-VALUE =  ' '.
          LS_DRAL-INT_VALUE =  ' '.
        ELSE.
          LS_DRAL-HANDLE = '1'.
          LS_DRAL-VALUE =  X_OCRC-COMBI.
          LS_DRAL-INT_VALUE =  X_OCRC-COMBI.
        ENDIF.
        APPEND LS_DRAL TO LT_DRAL.
      ENDLOOP.
    **Setting the Drop down table for field1
      CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
        EXPORTING
          IT_DROP_DOWN_ALIAS = LT_DRAL.
    Regards
    vijay

  • Obtaining subtotals based on 2 fields.(ALV using oops concept)

    Need help on how to apply sort on 2 fields and obtain subtotals.For example if I have some records for similar tax code and some more records  for a similar tax jurisdiction (under which all tax codes come).I need to calculate subtotals for same tax code as well as same tax jurisdiction code.Currently I am able to generate subtotals by sorting on 1 field only ,using OOPs concept.How do I apply for both the fields? This is what is being done currently with regard to sorting and subtotaling : 
    METHOD set_sorts.
    lr_sorts = gr_alv_data->get_sorts( ).
    TRY.
            lr_sorts->add_sort( 'TXJCD' ). ---sorting based on tax jurisdiction
          CATCH: cx_salv_not_found,
                cx_salv_existing,
                cx_salv_data_error.
        ENDTRY.
        TRY.
            lr_sorts->add_sort( columnname = 'MSKWZ'
                                        subtotal = if_salv_c_bool_sap=>true ).
          CATCH cx_salv_data_error cx_salv_not_found
                cx_salv_existing.                          
        ENDTRY.
      ENDMETHOD.                    "set_sorts
    Thanks & Regards,
    Savitha

    Hi Savitha,
    Use the other paramenters like POSITION, SEQUENCE, SUBTOTAL for both fields like as follows. Then it will work fine.
    TRY.
    lr_sorts->add_sort( columnname = 'TXJCD'
    sequence = 1
    Position = 1
    subtotal = if_salv_c_bool_sap=>true ).
    CATCH cx_salv_data_error cx_salv_not_found
    cx_salv_existing.
    ENDTRY.
    TRY.
    lr_sorts->add_sort( columnname = 'MSKWZ'
    sequence = 2
    Position = 1
    subtotal = if_salv_c_bool_sap=>true ).
    CATCH cx_salv_data_error cx_salv_not_found
    cx_salv_existing.
    ENDTRY.

  • How to decrease the row height in ALV Grid (OOPS).

    HI Experts,
    I have displayed ALV Grid using CL_GUI_ALV_GRID=>SET_TABLE_FOR_DISPLAY.
    I want to decrease the row height and width.
    Can any one suggest how to do this?
    Regards,
    Kumar.

    Hi Kumar,
    Row height it predefined and you won't change it, but you can adjust column width.
    For that use field COL_OPT of layout structure ( type LVC_SLAYO ) to optimize all columns width, or set explicit width using field catalog, setting field OUTPUTLEN for certain column.
    Regards
    Marcin

  • ALV GRID OOPS: Output refresh from data base

    Hi All,
    I have below issue.
    I display ALV and select a row and click a button to transfer stock for the selected row.
    I used BAPI_GOODSMOVEMENT_CREATE to update and after material document got posted, the row should update its stock information.
    Is there any solution without reselecting all data?
    Regards,
    Pratyusha

    You will have to select the latest data from the DB, so prepare the 'ITAB' containing your data again (should work if you change only for this row only).
    I believe after the BAPI commit call, refresh your ALV using REFRESH_TABLE_DISPLAY, modify the itab with new data and then call SET_TABLE_FOR_FIRST_DISPLAY.
    Regards,
    Diwakar

Maybe you are looking for

  • Problem updating infoobject master data from a dso.

    Hi all, i'm updating the master data of an infoobject from another ods, the two table have the same key. When i update the infoobject with full repair i get errors about duplicate records and the data load stops, when i delete the request and launch

  • Remote sync between two RAID arrays

    We have two Xserve RAID arrays. One is here in our local office, the other at a remote site which hosts a few of our servers as well. Does anyone have any suggestions for keeping the two synced? I would like to not have to deal with tape backups in t

  • HELP with WRT160Nv2 (2 xbox one NAT)

    I have 2 xbox ones in my house connected to the WRT160Nv2 router. I have tried literally everything. Port forwarding, triggering, uPnP, static IP's, blah blah blah. From the research I've done uPnP should be the only thing necessary to run two xboxes

  • Use audio channel strip settings for instrument channel

    How can I use the library of audio channel strip settings for an an instrument channel? I use a virtual guitar (RealStrat from MusicLab) and want to apply one of those beautiful audio channel strip settings for guitars to my virtual instrument. Best,

  • Filed NH Certificate of Formation for Business Verification?

    I am in the process of enrolling for a Business iOS Developer Account. I was asked to fax in supporting documents for my business identity. One of which was stated to be allowed was the Certificate of Formation. After calling the State of NH and beca