Edit field in OOPS ALV on button click

Hello All,
I have created an ALV using set_table_for_first_display, where one of the field is set to editable mode I have two buttons, one for save data and other to change data. Initially when the layout is displayed for first time, all the fields should be in non-editable mode and if user click on change button that particular field gets in editable mode.
How  can I achieve this?
Regards,
Sachin

Check the below code to enable or disable user input for the Edit cells...
      IF GO_GRID->IS_READY_FOR_INPUT( ) EQ 0.
* Set edit enabled cells ready for input
        CALL METHOD GO_GRID->SET_READY_FOR_INPUT
          EXPORTING
            I_READY_FOR_INPUT = 1.
      ELSE.
* Lock edit enabled cells against input
        CALL METHOD GO_GRID->SET_READY_FOR_INPUT
          EXPORTING
            I_READY_FOR_INPUT = 0.
      ENDIF.

Similar Messages

  • ALV: Right Button Click and Context Menu

    Hi Experts,
    I have to implement an ALV which should act on a right button click and show a context menu.
    Is this possible? I found only events for "on_double_click" or "on_link_click" and is it possible to show a context menu?
    Thanks in advanced.
    Best regards,
    Markus

    Hello Markus
    The relevant events are:
    CONTEXT_MENU_REQUEST
    USER_COMMAND
    Have a look at my sample report ZUS_SDN_ALV_CONTEXT_MENU_1.
    *& Report  ZUS_SDN_ALV_CONTEXT_MENU_1
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="910750"></a>
    *& Thread: ALV: Right Button Click and Context Menu
    *& Flow logic of screen 100 (no screen elements; ok_code = GD_OKCODE)
    *&    PROCESS BEFORE OUTPUT.
    *&      MODULE STATUS_0100.
    *&    PROCESS AFTER INPUT.
    *&      MODULE USER_COMMAND_0100.
    REPORT  zus_sdn_alv_context_menu_1.
    DATA:
      gd_okcode        TYPE ui_func,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_splitter      TYPE REF TO cl_gui_splitter_container,
      go_cell_top      TYPE REF TO cl_gui_container,
      go_cell_bottom   TYPE REF TO cl_gui_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid,
      go_grid2         TYPE REF TO cl_gui_alv_grid,
      gs_layout        TYPE lvc_s_layo.
    DATA:
      gt_knb1          TYPE STANDARD TABLE OF knb1,
      gt_knvv          TYPE STANDARD TABLE OF knvv.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
            IMPORTING
              e_row
              e_column
              es_row_no
              sender,
          handle_context_menu_request FOR EVENT context_menu_request
                                                     OF cl_gui_alv_grid
            IMPORTING
              e_object
              sender,
          handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
            IMPORTING
              e_ucomm
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_double_click.
    *   define local data
        DATA:
          ls_knb1      TYPE knb1.
        CHECK ( sender = go_grid1 ).
        READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
        CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
        CALL METHOD go_grid1->set_current_cell_via_id
          EXPORTING
    *        IS_ROW_ID    =
    *        IS_COLUMN_ID =
            is_row_no    = es_row_no.
    *   Triggers PAI of the dynpro with the specified ok-code
        CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DETAIL' ).
      ENDMETHOD.                    "handle_double_click
      METHOD handle_context_menu_request.
    *   define local data
        DATA: lt_fcodes    TYPE ui_funcattr,
              ls_fcode     TYPE uiattentry,
              ls_func      TYPE ui_func,
              lt_func      TYPE ui_functions.
        "   Inactivate all standard functions
        CALL METHOD e_object->get_functions
          IMPORTING
            fcodes = lt_fcodes.
        LOOP AT lt_fcodes INTO ls_fcode.
          ls_func = ls_fcode-fcode.
          APPEND ls_func TO lt_func.
        ENDLOOP.
        e_object->disable_functions( lt_func ).
    "   Add new functions
        e_object->add_separator( ).
        CALL METHOD e_object->add_function
          EXPORTING
            fcode = 'XD03'
            text  = 'Call Transaction'.
        CALL METHOD e_object->add_function
          EXPORTING
            fcode = 'DETAILS'
            text  = 'Display Details'.
      ENDMETHOD.                    "handle_context_menu_request
      METHOD handle_user_command.
    *   define local data
        DATA:
          ls_knb1   TYPE knb1,
          ls_row    TYPE lvc_s_row,
          ls_col    TYPE lvc_s_col.
        "   NOTE: in case of CL_GUI_ALV_GRID the functions of a context menu
        "         are handled in method USER_COMMAND.
        CHECK ( e_ucomm = 'XD03'      OR
                e_ucomm = 'DETAILS' ).
        CALL METHOD sender->get_current_cell
          IMPORTING
            es_row_id = ls_row
            es_col_id = ls_col.
        CASE e_ucomm.
          WHEN 'XD03'.
            READ TABLE gt_knb1 INTO ls_knb1 INDEX ls_row-index.
            SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
            SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
            CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
          WHEN 'DETAILS'.
      "       NOTE: only for the sake of simplicity the event handler method
            "             is called
            CALL METHOD lcl_eventhandler=>handle_double_click
              EXPORTING
                e_row  = ls_row
                sender = go_grid1.
          WHEN OTHERS.
        ENDCASE.
      ENDMETHOD.                    "handle_user_command
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT        * FROM  knb1 INTO TABLE gt_knb1
             WHERE  bukrs  = '1000'.
    * 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 splitter container
      CREATE OBJECT go_splitter
        EXPORTING
          parent            = go_docking
          rows              = 2
          columns           = 1
    *      NO_AUTODEF_PROGID_DYNNR =
    *      NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_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.
    * Get cell container
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = go_cell_top.
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 2
          column    = 1
        RECEIVING
          container = go_cell_bottom.
    * Create ALV grids
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_cell_top
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Set event handler
      SET HANDLER:
        lcl_eventhandler=>handle_double_click         FOR go_grid1,
        lcl_eventhandler=>handle_context_menu_request FOR go_grid1,
        lcl_eventhandler=>handle_user_command         FOR go_grid1.
      CREATE OBJECT go_grid2
        EXPORTING
          i_parent          = go_cell_bottom
        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.
    * Display data
      gs_layout-grid_title = 'Customers'.
      CALL METHOD go_grid1->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNB1'
          is_layout        = gs_layout
        CHANGING
          it_outtab        = gt_knb1
        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.
      gs_layout-grid_title = 'Customers Details (Sales Areas)'.
      CALL METHOD go_grid2->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNVV'
          is_layout        = gs_layout
        CHANGING
          it_outtab        = gt_knvv  " empty !!!
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * NOTE: dynpro does not contain any elements
      CALL SCREEN '0100'.
    * Flow logic of dynpro (does not contain any dynpro elements):
    *PROCESS BEFORE OUTPUT.
    *  MODULE STATUS_0100.
    *PROCESS AFTER INPUT.
    *  MODULE USER_COMMAND_0100.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.  " contains push button "DETAIL"
    *  SET TITLEBAR 'xxx'.
    * Refresh display of detail ALV list
      CALL METHOD go_grid2->refresh_table_display
    *    EXPORTING
    *      IS_STABLE      =
    *      I_SOFT_REFRESH =
        EXCEPTIONS
          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.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
    *   User has pushed button "Display Details"
        WHEN 'DETAIL'.
          PERFORM entry_show_details.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  ENTRY_SHOW_DETAILS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM entry_show_details .
    * define local data
      DATA:
        ld_row      TYPE i,
        ls_knb1     TYPE knb1.
      CALL METHOD go_grid1->get_current_cell
        IMPORTING
          e_row = ld_row.
      READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
      CHECK ( syst-subrc = 0 ).
      SELECT        * FROM  knvv INTO TABLE gt_knvv
             WHERE  kunnr  = ls_knb1-kunnr.
    ENDFORM.                    " ENTRY_SHOW_DETAILS
    Regards
      Uwe

  • To capture the selected rows along with edited field contents in alv report

    Dear All,
             I do have requirement where, in alv report output one field is editable and need to save the content of the edited field along with the selected rows.
             For example If there are 10 records displayed in the alv output with 20 fields.
    Out of this 20 fields one field (say XYZ) is editable. Also i have already created a new pushbutton (say ABC) on alv output. Now in the alv output if we maintain some value in the field (XYZ ) for the 2nd and 4th record and select this two records, and when clicked on the pushbutton (ABC) it has to update the DB table.
          I am using the Func Module  'REUSE_ALV_GRID_DISPLAY'. 
          Your early reply with sample code would be appreciated.
    Thanks in Advance.

    HI Naveen ,
    There is an import parameter "i_callback_program" in the function module,
    plz pass the program name to it.
    Capture the command by passing a field of type sy-ucomm to "I_CALLBACK_USER_COMMAND ".  Check the returned command and
    and program a functionality as desired.
    u can try the event double_click or at line selection. there u can use READLINE command to c if the line has been selected.
    In case it is , process the code segment.
    Regards
    Pankaj

  • SORT Not merging similar fields if there are any editable fields in the ALV

    Hi All,
    I have two issues with my OOPS ALV report.
    1) Standard sort is not working :
    Output of the report looks like this
    WBS    TEXT          Period 1  Period 2
    A           Total hours     1         1
    A           Total hours     1         1 
    A           Total COSt     1         1
    A          Total COST     1         1
    My agenda is to calculate sub total of period1 and period 2 based on fields WBS and TEXT, my output should look like
    WBS    TEXT          Period 1  Period 2
    A          Total hours         1           1
                                         1           1
    Total hours                     2           2 ( Sub total )
    A          Total COST        1         1
                                         1         1
    Total COST                    2         2 ( Sub total )
    To achieve this i pass these two fields in the sort table and pass field subtot = 'X' for TEXT field.
    It is working fine, i am getting the sub totals but the WBS field are not grouped( Even though it is a standard functionality).
    my output looks like
    WBS    TEXT          Period 1  Period 2
    A         Total hours   1         1
    A         Total hours   1         1
    Total hours               2         2 ( Sub total )
    A      Total COST      1         1
    A      Total COST      1         1
    Total COST              2         2 ( Sub total )
    I have few editable fields in my output, i came to know this issue is because of the editable fields. have anybody come across the same error.
    Please let me know how to achieve the standard sort ( Merging similar values ) functionality even if the output has editable fields.
    2) IS it possible to get two Grand total based on a field value . In my example , my TEXT field will always have value either  'Total hours' or 'Total COST'
    my output should look like this.
    WBS    TEXT          Period 1  Period 2
    A      Total hours     1         1
                                  1         1
    Total hours(A)          2         2 ( Sub total )
    A      Total COST     1         1
                                  1         1
    Total COST(A)         2         2 ( Sub total )
    B      Total hours      1         1
                                  1         1
    Total hours(B)          2         2 ( Sub total )
    B      Total COST      1         1
                                    1         1
    Total COST(B)           2         2 ( Sub total )
    GRAND TOTAL HOURS    4         4
    GRAND TOTAL COST       4         4.
    Response will be appreciated.
    Thanks & Regards,
    Rajanidhi Rajasekeran
    Edited by: Julius Bussche on Jul 14, 2008 7:39 PM

    Hi
    If I make  the editable field to non editable then sort & cell merge is happening but if I make any of the field as editable then merge is not working shall i request you the solution
    Regards-Sreeni

  • Editable field lenght in ALV - given 254 but only taking 120?

    Hi Friends,
    I have an ALV grid in OO.
    There is a editable field for remarks to be entered, and it has been mapped to a domain with CHAR254.
    Following is the fieldcat set for the column
            LS_FIELDCAT-EDIT             = 'X'.
            LS_FIELDCAT-REPTEXT      = 'Remarks'.
            LS_FIELDCAT-SCRTEXT_L  = 'Remarks'.
            LS_FIELDCAT-SCRTEXT_M = 'Remarks'.
            LS_FIELDCAT-SCRTEXT_S  = 'Remarks'.
            LS_FIELDCAT-OUTPUTLEN = 254.
            LS_FIELDCAT-INTLEN         = 254.
    but still in the report, i am able to input only 120 chars, what could be the reason?
    Appreciate if someone can help me out.
    Thanks,
    Simha

    Hi Vijay,
    Its still the same result.
    i am not able to input more than 120char.
    Same is the case when i try to enter remarks using FM POPUP_GET_VALUES when i pass a field of length 254, i am able to input only upto 124(approx) char
    What could be the prob?
    how to over come this?
    Appreciate your help.
    Regards,
    Simha.
    Edited by: Simha on Nov 17, 2008 9:18 AM

  • Create Edit Delete in Oops ALV

    Hi Experts,
    I need to create an ALV which will provide all the functionality of Create, Edit, Save and Delete records and update the Custom table accordingly.
    I want to design it as follows -
    1. Display should be in non-ediatble mode initially (because I don't want to make it completely ediatble at all times)
    2. When the user clicks Create button a new line appends at the bottom and the ALV has to be made editable, for the values to be entered at the new row appended.
    3. When the user presses Save, again the ALV goes into non-ediatble mode.
    4. When the user presses Edit Button, the ALV is open for editing and again the whole ALV is editable. After Editing, the user will select those particular lines through Box Button and Press on Save Button to enable those particular lines to be modified and saved in ALV. Again at the press of Save button, the ALV will switch to Non-modifiable view.
    5. For Deletion, select the particular line/lines through Box Button and Click on Delete.
    This is how I plan to achieve the Create, Edit, Delete Functionality.
    Can you please confirm the feasibilty of this Design, whether it is achievable.
    There is some option of dynamically changing the Field Catalogue. If it is there, I'm thinking of utilising it for switching the modes on click of Create, Edit and Save Buttons. Click/Edit --> Modifiable. Save --> Non-modifiable.
    Please do give your comments on the above functionality and feasibility. If you are knowing a different or easy approach please do share it. If you have done it then please do share it.
    Thanks & Regards
    Tanu

    Plz ask your specific requirement otherwise mosarator will block the thread...

  • Event for edit fields in Object ALV grid

    Hi community,
    I've building an ALV Grid in a SubDynpro of Tabstrip...
    Any fields are edit.
    I would like refresh my internal table at data changed of ALV object but if not assign a field at F4 event this result 
    not refresh.
    Thanks everybody,
    Antonello

    Hi Antonello Didonna,
    Use this code, its working:-
    After the user edits any records and performs an action then place this code.
    Say when user presses a button with function code 'EXECUTE', and all the changes from the output screen in ALV reflects back to internal table.
    * handle the code execution based on the function code encountered
    CASE sy-ucomm.
    * when the function code is EXECUTE then process the selected records
      WHEN 'EXECUTE'.
    * to reflect the data changed into internal table
        DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
        IF ref_grid IS INITIAL.
          CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
            IMPORTING
              e_grid = ref_grid.
        ENDIF.
        IF NOT ref_grid IS INITIAL.
          CALL METHOD ref_grid->check_changed_data.
        ENDIF.
        " now your internal table data is changed as in ALV output
        " append your code
      WHEN OTHERS.
        " your code
    ENDCASE.
    Hope this solves your problem.
    Thanks & Regards,
    Tarun Gambhir

  • Editable fields in Hierarchical ALV output

    Hi Experts,
    I have developed a report using hierarchical ALV display. I wanted to make some of the fields(in a particular column) editable in the output of Hierarchical ALV. Please provide your suggestions with examples.
    Regards,
    Rajesh

    I am not getting what u mean,.
    Coz I have done the editable property in my hierarcical ALV only...
    I have header line and correspodning item lines.
    In all header line I will make the 3rd column as editable...
    CHECK below
    *& Report  ZFIR_WRITE_OFF
    REPORT  zfir_write_off
                    NO STANDARD PAGE HEADING
                    MESSAGE-ID zles.
    TYPE-POOLS
    TYPE-POOLS:slis.
    TABLES
    TABLES: kna1, t001, zdunning_data, bsid, t052.
    INTERNAL TABLES
    To check for bukrs in selection screen
    DATA: BEGIN OF t_t001 OCCURS 0,
            bukrs TYPE t001-bukrs,
          END OF t_t001.
    To check for the customer in selection screen
    DATA: BEGIN OF t_kna1 OCCURS 0,
            kunnr TYPE kna1-kunnr,
            name1 TYPE kna1-name1,
          END OF t_kna1.
    *Data from BSID table
    DATA: BEGIN OF t_bsid OCCURS 0,
          bukrs LIKE bsid-bukrs,
          budat LIKE bsid-budat,
          kunnr LIKE bsid-kunnr,
          belnr LIKE bsid-belnr,
          zfbdt LIKE bsid-zfbdt,
          zterm LIKE bsid-zterm,
          dmbtr LIKE bsid-dmbtr,
          waers LIKE bsid-waers,
          vbeln LIKE bsid-vbeln,
          END OF t_bsid.
    *Data from ZDunning_data
    DATA: BEGIN OF t_zdunning OCCURS 0,
          belnr LIKE zdunning_data-belnr,
          kunnr LIKE zdunning_data-kunnr,
          zdef_notice_flg LIKE zdunning_data-zdef_notice_flg,
          zterm_notice_flg LIKE zdunning_data-zterm_notice_flg,
          END OF t_zdunning.
    *Data from t052 for base line days
    DATA: BEGIN OF t_t052 OCCURS 0,
          zterm LIKE t052-zterm,
          ztag1 LIKE  t052-ztag1,
          END OF t_t052.
    *with duedate and date for write off calculation
    DATA: BEGIN OF t_data OCCURS 0,
          belnr LIKE bsid-belnr,
          kunnr LIKE bsid-kunnr,
          zterm LIKE bsid-zterm,
          zfbdt LIKE bsid-zfbdt,
          ztag1 LIKE t052-ztag1,
          duedate LIKE bsid-zfbdt,
          wdate LIKE bsid-zfbdt,
          vbeln LIKE bsid-vbeln,
          dmbtr LIKE bsid-dmbtr,
          waers LIKE bsid-waers,
          budat LIKE bsid-budat,
          vbelv like vbfa-vbelv,
          Name1 like kna1-name1,
          END OF t_data.
    *Output display in ALV report
    DATA: BEGIN OF t_output OCCURS 0,
          Flag type C,
          bukrs LIKE bsid-bukrs,
          kunnr LIKE bsid-kunnr,
          vbeln LIKE bsid-vbeln,  "Invoice
          posnv like vbfa-posnv,
          wdate LIKE bsid-zfbdt,
          belnr LIKE bsid-belnr,
          dmbtr LIKE bsid-dmbtr,
          waers LIKE bsid-waers,
          budat LIKE bsid-budat,
          vbelv like vbfa-vbelv, "Contract
          name1 like kna1-name1,
          duedate like  bsid-zfbdt,
          END OF t_output.
    To get contract number for the billing document number
    DATA: BEGIN OF t_vbfa OCCURS 0,
          vbelv LIKE vbfa-vbelv,
          vbeln LIKE vbfa-vbeln,
          POSNV like vbfa-POSNV,
          END OF t_vbfa.
    data: begin of t_cust occurs 0,
          KUNNR like kna1-kunnr,
          name1 like kna1-name1,
          end of t_cust.
    data: begin of t_head occurs 0,
          VBELv like vbfa-vbelv,
          posnv like vbfa-posnv,
          VKUEGRU type ZLIST_WO_RCANCEL,
          end of t_head.
    data: begin of it_veda occurs 0,
          VBELn LIKE Veda-VBELN,
          POSNR LIKE Veda-VPOSN,
          VKUEGRU LIKE Veda-VKUEGRU,
          end of it_veda.
                            VARIABLE DECLARATION
    DATA: l_duedate  LIKE bsid-zfbdt,
          l_wdate LIKE bsid-zfbdt.
                            VARIABLE FOR ALV DISPLAY
    DATA: t_fieldcat TYPE slis_t_fieldcat_alv,
          wa_fieldcat TYPE slis_fieldcat_alv.
    DATA: t_fieldcat1 TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          wa_fieldcat1 TYPE slis_fieldcat_alv.
    DATA: t_layout TYPE slis_layout_alv.
    DATA: g_repid LIKE sy-repid.
                             SELECTION-SCREEN
    *Selection Screen Parameters for user input
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS:
    *Company Code
              p_bukrs LIKE t001-bukrs OBLIGATORY.
    SELECT-OPTIONS:
    *Customer Number
              s_kunnr FOR kna1-kunnr OBLIGATORY DEFAULT '0' TO 'ZZZZZZZZZZ'.
    PARAMETERS:
    *Write Off Date
              p_wodate TYPE sy-datum OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1 .
                            AT SELECTION-SCREEN
    *Selection Screen validation for Company code
    AT SELECTION-SCREEN ON p_bukrs.
      SELECT SINGLE bukrs FROM t001                             "#EC *
           INTO t_t001
           WHERE bukrs = p_bukrs.
      IF sy-subrc NE 0.
    *Error message for Invalid Company Code
        MESSAGE e000 WITH text-002.
      ENDIF.
    *Selection Screen Validation for Customer
    AT SELECTION-SCREEN ON s_kunnr.
      IF NOT s_kunnr IS INITIAL.
        SELECT SINGLE kunnr name1
             FROM kna1                                          "#EC *
             INTO t_kna1
             WHERE kunnr IN s_kunnr.
        IF sy-subrc NE 0.
    *Error message for Invalid Customer Number
          MESSAGE e000 WITH text-003.
        ENDIF.
      ENDIF.
    AT SELECTION-SCREEN ON p_wodate.
      IF p_wodate IS INITIAL.
        p_wodate = sy-datum.
      ENDIF.
                           INITIALIZATION
    INITIALIZATION.
      PERFORM clear_data.
                           START-OF-SELECTION
    START-OF-SELECTION.
    *Get the Accounting Document Number and base line date  from BSID
      SELECT bukrs kunnr belnr budat zfbdt zterm dmbtr waers  vbeln
                  FROM bsid
                  INTO corresponding fields of TABLE t_bsid
                 WHERE kunnr IN s_kunnr AND
                        bukrs = p_bukrs.
      IF NOT t_bsid[] IS INITIAL.
    *Get the Dunning data based on the Accounting Document Number from BSID
        SELECT  belnr kunnr zdef_notice_flg zterm_notice_flg
                    FROM zdunning_data
                    INTO TABLE t_zdunning
                    FOR ALL ENTRIES IN t_bsid
                    WHERE kunnr = t_bsid-kunnr AND
                          belnr = t_bsid-belnr AND
                          zdef_notice_flg = 'Y' AND
                          zterm_notice_flg = 'Y'.
    *Get the base line days from t052 table based on BSID data
        SELECT zterm ztag1
                    FROM t052
                    INTO TABLE t_t052
                    FOR ALL ENTRIES IN t_bsid
                    WHERE zterm = t_bsid-zterm.
    *Calculate the due date(bse line date BSID-ZFBDT + base line days
    *T052-ZTAG )
        IF NOT t_zdunning[] IS INITIAL.
    Get the customer name
        Select KUNNR NAME1 from KNA1
                  INTO table t_cust
                  for all entries in t_zdunning
                  where kunnr = t_zdunning-kunnr.
         LOOP AT t_zdunning.
          LOOP AT t_bsid.
            CLEAR t_zdunning.
            READ TABLE t_zdunning WITH KEY belnr = t_bsid-belnr
                                       kunnr = t_bsid-kunnr.
            CHECK sy-subrc = 0.
            CLEAR t_t052.
            READ TABLE t_t052 WITH KEY zterm = t_bsid-zterm.
            IF sy-subrc = 0 .
              t_data-belnr = t_zdunning-belnr.
              t_data-kunnr = t_zdunning-kunnr.
            Clear t_cust.
            read table t_cust with key kunnr = t_zdunning-kunnr.
             if sy-subrc = 0.
             t_data-name1 = t_cust-name1.
             endif.
              t_data-zterm = t_bsid-zterm.
              t_data-zfbdt = t_bsid-zfbdt.
              t_data-ztag1 = t_t052-ztag1.
              t_data-vbeln = t_bsid-vbeln.
              t_data-dmbtr = t_bsid-dmbtr.
              t_data-waers = t_bsid-waers.
              t_data-budat = t_bsid-budat.
    *calculate duedate
              CLEAR l_duedate.
              l_duedate = t_bsid-zfbdt + t_t052-ztag1.
              t_data-duedate = l_duedate.
    *calculate date for write off
              CLEAR l_wdate.
              l_wdate = l_duedate + 180.
              t_data-wdate = l_wdate.
              APPEND t_data.
              CLEAR l_wdate.
              CLEAR l_duedate.
            ENDIF.
          ENDLOOP.
        ELSE.
          MESSAGE s000 WITH text-005.
        ENDIF.
    *Check the wdate with write off date in the selection screen value.
    *If this calculated date is Greater than value enetred in selection
    *screen, display the corresponding data in ALV report.
        IF NOT t_data[] IS INITIAL.
          SELECT vbelv vbeln
          POSNV
                    FROM vbfa
                    INTO TABLE t_vbfa
                    FOR ALL ENTRIES IN t_data
                    WHERE vbeln = t_data-vbeln.
                   and
                         VBTYP_V = 'G'.
    *If reason for cancelation is there, no writeoff.
       Select VBELn VPOSN VKUEGRU from Veda
             into table it_veda
             for all entries in t_vbfa
             where vbeln = t_vbfa-vbelv.
       SELECT vbelv
          POSNV
                    FROM vbfa
                    INTO TABLE t_Head
                    FOR ALL ENTRIES IN t_data
                    WHERE vbeln = t_data-vbeln
                   and
                         VBTYP_V = 'G'.
    loop at t_head.
    clear it_veda.
    Read table it_veda with key vbeln = t_head-vbelv
                                posnr = t_head-posnv.
    if not it_veda-VKUEGRU is initial.
    Delete  t_head where vbelv = it_veda-vbeln and
                              posnv = it_veda-posnr.
    endif.
    endloop.
          LOOP AT t_data.
            IF t_data-wdate LE p_wodate.
              t_output-bukrs = p_bukrs.
              t_output-kunnr = t_data-kunnr.
              CLEAR t_vbfa.
              READ TABLE t_vbfa WITH KEY vbeln = t_data-vbeln.
              read table t_head with key vbelv = t_vbfa-vbelv
                                         posnv = t_vbfa-posnv.
              if sy-subrc = 0.
                t_output-vbelv = t_vbfa-vbelv.
                t_output-posnv = t_vbfa-posnv.
              t_output-name1 = t_data-name1.
              t_output-wdate = t_data-wdate.
              t_output-belnr = t_data-belnr.
              t_output-dmbtr = t_data-dmbtr.
              t_output-waers = t_data-waers.
              t_output-budat = t_data-budat.
              t_output-vbeln = t_data-vbeln.
              t_output-duedate  = t_data-duedate .
              APPEND t_output.
              ENDIF.
              clear t_output.
            ENDIF.
          ENDLOOP.
        ELSE.
          MESSAGE s000 WITH text-006.
        ENDIF.
    *ALV display for the output records
        IF NOT t_output[] IS INITIAL.
          PERFORM alv_display.
        ELSE.
          MESSAGE s000 WITH text-006.
        ENDIF.
      ELSE.
        MESSAGE s000 WITH text-004.
      ENDIF.
    *&      Form  clear_data
          text
    -->  p1        text
    <--  p2        text
    FORM clear_data .
      CLEAR:t_t001,
            t_kna1,
            t_bsid,
            t_zdunning,
            t_t052,
            t_data,
            t_output,
            wa_fieldcat,
            t_layout,
            t_fieldcat,
            t_vbfa.
      REFRESH:t_t001,
              t_kna1,
              t_bsid,
              t_zdunning,
              t_t052,
              t_data,
              t_output,
              t_fieldcat,
              t_vbfa.
    clear:t_head,
          it_veda.
    Refresh:t_head,
          it_veda.
    Clear T_cust.
    Refresh t_data.
    ENDFORM.                    " clear_data
    *&      Form  alv_display
          text
    -->  p1        text
    <--  p2        text
    FORM alv_display .
    *To build the field catalogue
      PERFORM build_fieldcatalog1.
      PERFORM build_fieldcatalog.
    *To build the ALV layout
      PERFORM build_layout.
    *To displayt the data in ALV report
      PERFORM display_alv_report.
    ENDFORM.                    " alv_display
    *&      Form  build_fieldcatalog
          text
    -->  p1        text
    <--  p2        text
    FORM build_fieldcatalog1 .
      REFRESH t_fieldcat1.
    CLEAR wa_fieldcat.
      wa_fieldcat-col_pos    = '1'.
      wa_fieldcat-fieldname  = 'VBELV'.
      wa_fieldcat-tabname = 'T_HEAD'.
      wa_fieldcat-seltext_l  = 'Contract Number'.
    wa_fieldcat-Checkbox = 'X'.
    wa_fieldcat-edit = 'X'.
    wa_fieldcat-no_out = 'X'.
      wa_fieldcat-outputlen  = '15'.
      APPEND wa_fieldcat TO t_fieldcat.
    CLEAR wa_fieldcat.
       wa_fieldcat-col_pos    = '2'.
      wa_fieldcat-fieldname  = 'POSNV'.
      wa_fieldcat-tabname = 'T_HEAD'.
      wa_fieldcat-seltext_l  = 'Item Number'.
      wa_fieldcat-outputlen  = '15'.
      APPEND wa_fieldcat TO t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos    = '3'.
      wa_fieldcat-fieldname  = 'VKUEGRU'.
      wa_fieldcat-edit = 'X'.
      wa_fieldcat-input = 'X'.
      wa_fieldcat-tabname = 'T_HEAD'.
    wa_fieldcat-drdn_hndl = '1'.
      wa_fieldcat-seltext_l  = 'Reason for Cancel'.
      wa_fieldcat-outputlen  = '25'.
      APPEND wa_fieldcat TO t_fieldcat.
      CLEAR wa_fieldcat.
    endform.
    FORM build_fieldcatalog .
    REFRESH t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos    = '4'.
      wa_fieldcat-fieldname  = 'KUNNR'.
      wa_fieldcat-tabname = 'T_OUTPUT'.
      wa_fieldcat-seltext_l  = 'Customer Number'.
      wa_fieldcat-outputlen  = '15'.
      APPEND wa_fieldcat TO t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos    = '5'.
      wa_fieldcat-fieldname  = 'NAME1'.
      wa_fieldcat-tabname = 'T_OUTPUT'.
      wa_fieldcat-seltext_l  = 'Customer Name'.
      wa_fieldcat-outputlen  = '30'.
      APPEND wa_fieldcat TO t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos    = '6'.
      wa_fieldcat-fieldname  = 'VBELV'.
      wa_fieldcat-tabname = 'T_OUTPUT'.
      wa_fieldcat-seltext_l  = 'Contract Number'.
      wa_fieldcat-outputlen  = '20'.
      APPEND wa_fieldcat TO t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos    = '7'.
      wa_fieldcat-fieldname  = 'VBELN'.
      wa_fieldcat-tabname = 'T_OUTPUT'.
      wa_fieldcat-seltext_l  = 'Invoice No.'.
      wa_fieldcat-outputlen  = '10'.
      APPEND wa_fieldcat TO t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos    = '8'.
      wa_fieldcat-fieldname  = 'BELNR'.
      wa_fieldcat-tabname = 'T_OUTPUT'.
      wa_fieldcat-seltext_l  = 'Acc doc Number'.
      wa_fieldcat-outputlen  = '20'.
      APPEND wa_fieldcat TO t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos    = '9'.
      wa_fieldcat-fieldname  = 'WAERS'.
      wa_fieldcat-tabname = 'T_OUTPUT'.
      wa_fieldcat-seltext_l  = 'Currency'.
      wa_fieldcat-outputlen  = '15'.
      APPEND wa_fieldcat TO t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos    = '10'.
      wa_fieldcat-fieldname  = 'DMBTR'.
      wa_fieldcat-tabname = 'T_OUTPUT'.
      wa_fieldcat-do_sum        = 'X'.   "SUM UPON DISPLAY
      wa_fieldcat-datatype = 'CURR'.
      wa_fieldcat-seltext_l  = 'Amount'.
      wa_fieldcat-outputlen  = '15'.
      APPEND wa_fieldcat TO t_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-col_pos    = '11'.
      wa_fieldcat-fieldname  = 'DUEDATE'.
      wa_fieldcat-tabname = 'T_OUTPUT'.
      wa_fieldcat-seltext_l  = 'Due Date'.
      wa_fieldcat-outputlen  = '20'.
      APPEND wa_fieldcat TO t_fieldcat.
    data: lt_dropdown type lvc_t_drop,
            ls_dropdown type lvc_s_drop.
    First listbox (handle '1').
      ls_dropdown-handle = '1'.
      ls_dropdown-value = 'KG'.
      append ls_dropdown to lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = 'G'.
      append ls_dropdown to lt_dropdown.
    call method g_grid->set_drop_down_table
               exporting it_drop_down = lt_dropdown.
    ENDFORM.                    " build_fieldcatalog
    *&      Form  build_layout
          text
    -->  p1        text
    <--  p2        text
    FORM build_layout .
      t_layout-no_input          = 'X'.
      t_layout-colwidth_optimize = 'X'.
    ENDFORM.                    " build_layout
    *&      Form  display_alv_report
          text
    -->  p1        text
    <--  p2        text
    FORM display_alv_report .
      g_repid = sy-repid.
      data g_keyinfo type SLIS_KEYINFO_ALV.
      g_keyinfo-HEADER01 = 'VBELV'.
      g_keyinfo-ITEM01 = 'VBELV'.
      g_keyinfo-HEADER02 = 'POSNV'.
      g_keyinfo-ITEM02 = 'POSNV'.
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
          i_interface_check              = 'I'
          i_callback_program             = g_repid
          i_callback_pf_status_set       = 'SET_STATUS'
          i_callback_user_command        = 'USER_COMMAND'
         is_layout                      = gs_layout
          it_fieldcat                    = t_fieldcat[]
         i_default                      = ' '
          i_save                         = 'A'
          i_tabname_header               = 'T_HEAD'
          i_tabname_item                 = 'T_OUTPUT'
         i_structure_name_header        = v_headers_table
         i_structure_name_item          = v_items_table
          is_keyinfo                     = g_keyinfo
         i_bypassing_buffer             = 'X'
        TABLES
          t_outtab_header                = t_head[]
         t_outtab_item                  = i_result
          t_outtab_item                  = t_output[]
        EXCEPTIONS
          program_error                  = 1
          OTHERS                         = 2.
      REFRESH: t_fieldcat[].
      refresh t_fieldcat1[].
    ENDFORM.                    " display_alv_report
    form SET_STATUS using extab TYPE slis_t_extab.
      SET PF-STATUS  'ZEO_S1' .
    endform.
    *&      Form  Top_Of_Page
    Top_Of_Page event in ALV
    FORM top_of_page .
      DATA: t_header TYPE slis_t_listheader,
            wa_header TYPE slis_listheader.
    Title
      wa_header-typ  = 'H'.
      wa_header-info = ' Write Off Worklist'.
      APPEND wa_header TO t_header.
      CLEAR wa_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = t_header.
    ENDFORM.                    "Top_Of_Page
    *User Command for the button
    form user_command using r_ucomm type syucomm
                              ls_selfield type SLIS_SELFIELD.
                              Break-point.
    case r_ucomm.
    when 'EXEC'.
    data: begin of lt_cancel occurs 0.
          include structure ZCANCEL.
    data  end of lt_cancel.
    Clear lt_cancel.
    Refresh lt_cancel.
         Data: ref1 type ref to cl_gui_alv_grid.
         CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
           IMPORTING
             E_GRID = ref1.
         call method ref1->check_changed_data.
          loop at t_Head where VKUEGRU is not initial.
           if ( t_HEAD-VKUEGRU  NE '1' ) or
               ( t_Head-VKUEGRU  NE '2' ) or
               ( t_head-VKUEGRU  NE '3' ).
             Clear t_head-vkuegru.
             message e000 with text-110.
           endif.
            lt_cancel-vbeln = t_head-vbelv.
            lt_cancel-posnr = t_head-posnv.
            lt_cancel-VKUEGRU = t_head-VKUEGRU.
            Append lt_cancel.
            Clear lt_cancel.
          Endloop.
           CALL FUNCTION 'ZSD_CNTR_CANCEL'
             TABLES
               zcancel       = lt_cancel.
    message s000 .
    endcase.
    endform.

  • How to disable all fields of a page on button click

    Hello, I am using JDeveloper 11.1.2.3.0
    I have a page with several fields on it. I want to have all the page fields disabled when I click a certain Button. How can I achieve this?
    If what I am asking is too difficult to achieve can you help me with an idea on how to achieve something similar?
    Thank you

    This can be achieved by using JavaScript Client API get the id's all the fields while clicking the button  and disable your Components,
    Calling Backing bean method or binded component involves server side round-trip, you can easily achieve this using simple java script in
    Client Side..
    Call this method in your Client Listener ..
    function disableFields(actionEvent) {
            var field1= AdfPage.PAGE.findComponent("field1id");
            var field2 = AdfPage.PAGE.findComponent("field2id");
            field1.setDisabled(true);
            fileld2.setDisabled(true);

  • ALV grid case-sensitive edit field

    Hello,
    i've a editable field on a alv grid.
    The field is case-sensitive in the domain.
    But when i enter a field an click rturn, the letters get uppercase.
    What's the problem?
    Best regards,
    TomSd

    Hi,
    Add the attribute  lowercase = 'X'  while preapring field catalog for this field.
    Regards,
    Gopi.
    Reward points if helpfull.

  • ALV Grid Display Editable Field Disables Zebra Style

    Hi all,
    First of all, I want to say: "I did my research." I found a post with a very similar question but not identically my case, or at least I can't solve it the same way. [Here is the reference post.|Re: Check box impact on ALV grid (Using OOPS)]
    My Goal: I have an ALV Grid which I want to display using the ZEBRA style in the layout and also make one field in the field catalog editable.
    My Issue: As soon as you make one field editable in the field catalog using the EDIT option, the ZEBRA style in the layout does not works. I also have key fields in the ALV Grid which I want to keep as KEY and which get painted dark blue.
    I can't use the individual row coloring method used in the reference link above since this overrides the blue coloring of the key fields in the ALV. I haven't gone through all the effort of individually painting each cell on the grid, and honestly I don't think it is efficient.
    My Question: Is there a way to have editable fields in the ALV Grid and keep the ZEBRA setting working?
    Please, I will really appreciate if you can read and try to understand my issue before posting incoherent solutions or answers. I don't want to waste anybody's time nor mine.

    Shiva,
    Thanks for your reply; it someway addresses what I am looking for. Unfortunately, I've already went through that reference code; it has exactly the same problem that I am facing.
    If you take that code for example, and you throw it u201Cas-isu201D in your ABAP editor you'll see that even when the ZEBRA style is being used in the layout, since the EDIT option in the field catalog is being set for field NETPR, the ZEBRA style gets lost; only the whole editable column gets white. You can go ahead and play a little bit with that piece of code and you will see what I am saying.
    Regards

  • Runtime error while trying to execute custom F4 help in OOP ALV grid.

    Dear All,
    I am trying to add custom search help for one of my column in ALV grid. I'm using OOP ALV, when i click for search help for that column, the system shows runtime error like below.
    I am new to OOP concept and tried to follow program BCALV_EDIT_03. But not getting this error occur. Please help me.
    With regards.

    Hi,
    In order to be able to provide a search help for a field in an ALV you must do the following things.
    1) The field where F4 help need to be attached needs to be made editable.
    2) Create an event handler class to handle the ONF4 event. You can refer the following code:
        CLASS lcl_alv1_handler DEFINITION.
        PUBLIC SECTION.
           "Tohandle F4 helps
           METHODS handle_f4 FOR EVENT onf4 OF cl_gui_alv_grid
                   IMPORTING e_fieldname e_fieldvalue es_row_no er_event_data
                             et_bad_cells e_display.
        ENDCLASS.
       CLASS lcl_alv1_handler IMPLEMENTATION.
          METHOD handle_f4.
    CASE e_fieldname.
         WHEN 'LIFNR'.               "Set F4 for courier vendor
             SELECT lifnr name1 FROM lfa1 INTO TABLE lt_lifnr.
           IF lt_lifnr IS NOT INITIAL.
             CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
               EXPORTING
                 retfield           = 'LIFNR'
                 window_title   = 'Vendors'
                 value_org       = 'S'
               TABLES
                 value_tab       = lt_lifnr
                 return_tab      = lt_return
               EXCEPTIONS
                 parameter_error = 1
                 no_values_found = 2
                 OTHERS          = 3.
             IF sy-subrc = 0.
               READ TABLE gt_final INTO wa_final_t INDEX es_row_no-row_id.
               IF sy-subrc = 0.
                 READ TABLE lt_return INTO wa_return INDEX 1.
                 IF sy-subrc = 0.
                   CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
                     EXPORTING
                       input  = wa_return-fieldval
                     IMPORTING
                       output = lv_lifnr.
                   wa_final_t-lifnr  = lv_lifnr.
                   MODIFY gt_final FROM wa_final_t INDEX es_row_no-row_id.
                 ENDIF.
               ENDIF.
             ENDIF.
           ENDIF.
          ENDCASE.
             CALL METHOD o_alv->refresh_table_display.
          ENDMETHOD.
       ENDCLASS.
        In the above method, GT_FINAL-LIFNR is being overwritten by the LIFNR you had selected       from F4 help. So we will call the refresh_table_display after it to see the result in the ALV.
    3) After creating the ALV object, add the fields to which the F4 has to be added. For this you
        need to declare an internal table based on  lvc_t_f4. Use the following code. Here O_ALV is    my ALV object.:
       CREATE OBJECT o_container
           EXPORTING
             container_name              = 'CUSTCON'
           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 OBJECT o_alv
           EXPORTING
             i_parent          = o_container
           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.
       CLEAR : gt_f4, wa_f4.
       wa_f4-fieldname   = 'LIFNR'.
       wa_f4-register    = 'X'.
       wa_f4-getbefore   = space.
       wa_f4-chngeafter  = space.
       APPEND wa_f4 TO gt_f4.
       Here I am assigning F4 to LIFNR field in the final internal table that is displayed using ALV.
       After this register this field for F4.
        CALL METHOD o_alv->register_f4_for_fields
           EXPORTING
              it_f4 = gt_f4.
       CREATE OBJECT o_alv_handler.
       SET HANDLER : o_alv_handler->handle_f4 FOR o_alv1.
       The object o_alv_handler is created based on the event handler class.
    I hope that this will solve your issue. Revert if this is solved.
    Rgards,
    Abijith

  • Editable Drop down in ALV

    Hi,
    I am working on the ALV report using objects (custom container
    and cl_gui_alv_grid).
    I have a drop down editable field in the alv. How can i capture the
    selected values in the dropdowns for all rows when a button is clicked on appln tool bar.
    Thanks,
    Prasad

    Hi,
    Refer demo programs:-
    BCALV_EDIT_06 --                 Dropdown Listbox at Column Level
    BCALV_EDIT_07 --                 Dropdown Listbox at Cell Level
    Also you can refer:-
    Alv Drop down filling
    Hope this helps you.
    Regards,
    Tarun

  • How to perform an autocheck event when the field changes in ALV

    Hi everybody,
    how can I build an event or something which would make my 'wa_fieldcat-checkbox' set to 'X' (auto checked) everytime an editable field in the ALV is changed manually by the user?
    I want to perform this task in order to avoid asking the user to manually check the "check box" field everytime wants to make a change, since after the user's changes in the ALV I want to sort the itab with the check box column of the edited items.
    Thanks,
    Denis M

    Hi Denis,
    For ALV a FM REUSE_ALV_GRID_DISPLAY is available.
    The FM, has events as importing option.
    SLIS_T_EVENT
    EVENT - Basically this is the FM to handle Event's. When the user needs to do
    some event operation like when double clicking the a particular field we need to
    perform some operation.   These events are captured by this FM.
    slis_ev_data_changed -- To capture user command
    slis_ev_user_command -- To capture data changed.
    Also please refer the below link in scn. This shows sample code to capture ALV grid data changed.
    http://scn.sap.com/thread/261210
    Hope this will solve the problem.
    Thanks,
    Soundarya.

  • Character length of an editable fields

    hi frnz,
       I have created an editable field in an ALV report.My client wants the character length of this editable field as 1000.I have made the data type as 'STRINGS' and length as '1000', but still in this editable field i am able to feed only upto character length of 128 not beyond this value.The text which my client wants to feed is of 950 characters. Could anyone give some solution for this
    Thanks
    Praveen

    Hi, i think you have to give intlen and outputlen in field catalog
    FIELDCAT-INTLEN = 1000.
    FIELDCAT-OUTPUTLEN = 1000.
    Please check the doc of field catalog
    [http://help.sap.com/saphelp_erp2004/helpdata/en/ff/4649a6f17411d2b486006094192fe3/content.htm]
    Regards,
    Ben

Maybe you are looking for