ALV grid list  report when selected  from  selection screen

Hi folks,
            I need to get ALV grid display in my list report when selected the interval values from  the selection screen. If I change the values in list of ALV grid it needs to be updated when I press UPDATE pushbutton. The output of list should be in ALV grid display.I need sorting ,flitering,totaling functionality in the list output.
For example if I selected BUKRS = 100 and 200 in the selection screen ,I need to display the ALV grid list in below the selection screen as ALV grid display...
Its urgent as  I am new to ALV grid functionality...
Thanks in advance..

hi raja,
check with the folllowing code.
REPORT zca0m_zca0fcstftop NO STANDARD PAGE HEADING
                                MESSAGE-ID zcsv_usrtbl_maintain.
Type pools                                                           *
TYPE-POOLS : slis.                          " Used for ALV display
Tables
TABLES: zca0fcstftop,
        dd04t,                         "R/3 DD: Data element texts
        tactt.                         "Activities that can be protected
internal tables
DATA: BEGIN OF wa_zca0fcstftop .
        INCLUDE STRUCTURE zca0fcstftop.
DATA: END OF wa_zca0fcstftop.
DATA: t_zca0fcstftop LIKE STANDARD TABLE OF wa_zca0fcstftop.
DATA: BEGIN OF i_fcode OCCURS 0,
        fcode LIKE sy-ucomm,
      END OF i_fcode.
*Record for variant selection
DATA : BEGIN OF ws_variant,
         selected TYPE c,
         variant  LIKE ltdx-variant,  "Variant name
         text     LIKE ltdxt-text,    "Variant description
       END OF ws_variant.
*Table for variant selection
data : itab_variant LIKE STANDARD TABLE OF ws_variant WITH HEADER LINE.
Variant selection pop-up global variables
DECLARATION OF TABLECONTROL 'VARIANT_CNTL' ITSELF
CONTROLS: variant_cntl TYPE TABLEVIEW USING SCREEN 0200.
LINES OF TABLECONTROL 'VARIANT_CNTL'
DATA:     g_variant_cntl_lines  LIKE sy-loopc.
DATA:grid1 TYPE REF TO  cl_gui_alv_grid ,
     g_custom_container TYPE REF TO cl_gui_custom_container.
Work fields
DATA: table_name LIKE dd02l-tabname,   "To store table name
      field_name LIKE dd03l-fieldname, "To Store Field Name
      act_auth LIKE tactz-actvt,       "To pass Activity ID
      tab_maint LIKE dd02l-tabname,    "To pass Table Name to be Maintd.
      wg_confirm_ind,                  "To trap User responses
      flag,                            "To trap changes made to an entry
      f_copy,                          "To Identify 'COPY' Command Use
      f_select,                        "To decide between Select-options
                                       " and Internal Table
      l_transaction_code LIKE tstc-tcode,
      v_langu LIKE sy-langu,
      v_repid LIKE sy-repid,
      s_variant TYPE disvariant.
DATA: ok_code LIKE sy-ucomm.
DATA:selected_rows TYPE lvc_t_row  ,
     sel_rows TYPE lvc_t_row WITH HEADER LINE.
DATA:t_lines TYPE i.
Constants                                                            *
CONSTANTS :
           c_x TYPE c VALUE 'X',             " Constant 'X'.
           c_f TYPE c VALUE 'F'.             " Constant 'F'.
Parameters and Selection Options
*Selection Screen for table maintenance
*Selection option for Plant
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-b01.
PARAMETERS:  p_werks   LIKE zca0fcstftop-werks OBLIGATORY.
SELECT-OPTIONS: s_prdfml  FOR zca0fcstftop-product_family,
                s_bmach   FOR zca0fcstftop-base_machine,
                s_factop FOR zca0fcstftop-factory_top,
                s_optval  FOR zca0fcstftop-option_value,
                s_week    FOR zca0fcstftop-week.
SELECTION-SCREEN END OF BLOCK block1.
SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE text-b02.
PARAMETERS     : p_varant LIKE ltdx-variant.          " ALV variant
SELECTION-SCREEN END OF BLOCK block2.
At selection screen                                                  *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_varant.
  PERFORM alv_variant_f4 CHANGING p_varant.
AT SELECTION-SCREEN ON p_werks .
Validating Plant on the selection screen
  PERFORM validate_plant.
Initialization
INITIALIZATION.
Check Authorization for the Transaction
Authorization Check For T Code
  SELECT tcode
     INTO l_transaction_code
     FROM tstc UP TO 1 ROWS
     WHERE pgmna = sy-repid.
  ENDSELECT.
  AUTHORITY-CHECK OBJECT 'S_TCODE'
                      ID 'TCD' FIELD l_transaction_code.
  IF sy-subrc NE 0.
    MESSAGE e001 WITH l_transaction_code.
  ENDIF.
  v_langu = sy-langu.                             " language
  v_repid = sy-repid .                            " abap Program name
Start Of Selection
START-OF-SELECTION.
  CALL SCREEN 0050.
*&      Form  validate_plant                                           *
      Validating Plant on the selection screen                       *
FORM validate_plant .
  DATA : l_werks LIKE t001w-werks.                          " Plant
  IF p_werks IS NOT INITIAL.
    SELECT SINGLE werks
        FROM t001w
        INTO l_werks
        WHERE werks EQ p_werks.
    IF sy-subrc NE 0.
      MESSAGE e100(ra) WITH text-001 .
    ENDIF.
  ENDIF.
  AUTHORITY-CHECK OBJECT 'Z_PP_PLANT'
           ID 'ACTVT' FIELD '03'
           ID 'WERKS' FIELD p_werks
           ID 'TCD' FIELD l_transaction_code.
  IF sy-subrc NE 0.
    MESSAGE e000(oo) WITH 'No authorization for plant:'(e80) p_werks.
  ENDIF.
ENDFORM.                    " validate_plant
*&      Form  get_data                                                 *
      Get data                                                       *
FORM get_data .
  SELECT * FROM zca0fcstftop
    INTO TABLE t_zca0fcstftop
    WHERE werks           = p_werks
      AND product_family IN s_prdfml
      AND base_machine   IN s_bmach
      AND factory_top    IN s_factop
      AND option_value   IN s_optval
      AND week           IN s_week.
ENDFORM.                    " get_data
*&      Form  fill_fcode
FORM fill_fcode USING    value(p_0029).
  i_fcode-fcode = p_0029.
  APPEND i_fcode.
  CLEAR i_fcode.
ENDFORM.                               " fill_fcode
*&      Module  STATUS_0100  OUTPUT
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'UPDATE'.
  CLEAR flag.
ENDMODULE.                             " STATUS_0100  OUTPUT
*&      Module  MODIFY_0100  OUTPUT
MODULE modify_0100 OUTPUT.
  IF sy-ucomm = 'CHNG' OR
       sy-ucomm = 'PICK'.
    LOOP AT SCREEN.
      CHECK screen-group1 = 'CHG'.
      screen-required = '0'.
      screen-output   = '1'.
      screen-input    = '0'.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.
Check if you are in create mode & if yes then set the screen elements
as mandatory
  IF ok_code = 'CREA'.
    LOOP AT SCREEN.
      CHECK screen-group1 = 'CHG'.
      screen-required = '1'.
      screen-output   = '1'.
      screen-input    = '1'.
      MODIFY SCREEN.
    ENDLOOP.
  ENDIF.
ENDMODULE.                             " MODIFY_0100  OUTPUT
*&      Module  Check_Exit  INPUT
      text
MODULE check_exit INPUT.
  IF ( sy-ucomm = 'BACK' OR sy-ucomm = 'CANC' OR sy-ucomm = 'EXIT' ) AND
       ( flag = 'Y' ).
    CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
      EXPORTING
        defaultoption  = 'Y'
        textline1      = text-008
        textline2      = text-009
        titel          = text-004
        cancel_display = ' '
      IMPORTING
        answer         = wg_confirm_ind.
    CASE wg_confirm_ind.
      WHEN 'J'.                                             "Yes
        sy-ucomm = 'SAVE'.
        CLEAR flag.
      WHEN 'N'.                                             "No
        sy-ucomm = 'BACK'.
        CLEAR flag.
    ENDCASE.
  ENDIF.
ENDMODULE.                             " Check_Exit  INPUT
*&      Module  Exit_0100  INPUT
      text
MODULE exit_0100 INPUT.
  SET SCREEN 0. LEAVE SCREEN.
ENDMODULE.                             " Exit_0100  INPUT
*&      Module  USER_COMMAND_0100  INPUT
      text
MODULE user_command_0100 INPUT.
  CASE sy-ucomm.
    WHEN 'SAVE'.                       "Save
    Check to see if the user has the appropriate authorization
      IF p_werks NE zca0fcstftop-werks.
      could not update - not in selection
        MESSAGE e000(oo) WITH 'Entry not within selection'.
        SET SCREEN 0. LEAVE SCREEN.
        PERFORM get_data.
      ENDIF.
      IF f_copy = 'X'.
        INSERT zca0fcstftop.
        IF sy-subrc = 0.
          MESSAGE s004.
          PERFORM initialize.
          SET SCREEN 0. LEAVE SCREEN.
          PERFORM get_data.
        ELSE.
          MESSAGE w005.
        ENDIF.
      ELSE.
        MODIFY zca0fcstftop.
        IF sy-subrc = 0.
          MESSAGE s004.
          PERFORM initialize.
          SET SCREEN 0. LEAVE SCREEN.
          PERFORM get_data.
        ELSE.
          MESSAGE w005.
        ENDIF.
      ENDIF.
      PERFORM get_data.
    WHEN 'BACK'.                       "Back
      SET SCREEN 0. LEAVE SCREEN.
    WHEN 'CANC'.                       "Cancel
      SET SCREEN 0. LEAVE SCREEN.
    WHEN OTHERS.
  ENDCASE.
  COMMIT WORK.
ENDMODULE.                             " USER_COMMAND_0100  INPUT
*&      Form  Initialize
FORM initialize.
  CLEAR :   table_name,
            field_name,
            wg_confirm_ind,
            f_copy,
            flag,
            t_zca0fcstftop,
            zca0fcstftop,
            wa_zca0fcstftop,
            i_fcode.
  REFRESH: t_zca0fcstftop.
ENDFORM.                               " Initialize
*&      Form  alv_variant_f4
      text
     <--P_VARIANT  text
FORM alv_variant_f4  CHANGING variant.
  DATA: rs_variant LIKE disvariant.
  DATA nof4 TYPE c.
  CLEAR nof4.
  LOOP AT SCREEN.
    IF screen-name = 'VARIANT'.
      IF screen-input = 0.
        nof4 = 'X'.
      ENDIF.
    ENDIF.
  ENDLOOP.
  rs_variant-report   = sy-repid.
  rs_variant-username = sy-uname.
  CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
      is_variant = rs_variant
      i_save     = 'A'
    IMPORTING
      es_variant = rs_variant
    EXCEPTIONS
      OTHERS     = 1.
  IF sy-subrc = 0 AND nof4 EQ space.
    variant = rs_variant-variant.
  ENDIF.
ENDFORM.                               " ALV_VARIANT_F4
*&      Module  STATUS_0050  OUTPUT
      text
MODULE status_0050 OUTPUT.
In this module Initialize the container and put the grid in it
  DATA:grid_layout  TYPE lvc_s_layo,
       fieldcat TYPE lvc_t_fcat,
       wa_fieldcat LIKE LINE OF fieldcat.
  PERFORM set_auth.
  SET PF-STATUS 'UPD_0050' EXCLUDING i_fcode.
  SET TITLEBAR 'UPD_0050'.
  IF g_custom_container IS INITIAL .
    CREATE OBJECT g_custom_container
       EXPORTING
          container_name = 'FTDATA'.
    CREATE OBJECT grid1
       EXPORTING
        i_parent = g_custom_container.
  ELSE.
    CALL METHOD grid1->free.
    CALL METHOD g_custom_container->free.
    CREATE OBJECT g_custom_container
       EXPORTING
          container_name = 'FTDATA'.
    CREATE OBJECT grid1
       EXPORTING
        i_parent = g_custom_container.
  ENDIF.
Every time refresh The variables
  PERFORM initialize.
  PERFORM get_data.
  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
      i_structure_name = 'ZCA0FCSTFTOP'
    CHANGING
      ct_fieldcat      = fieldcat.
  grid_layout-grid_title = text-t01.
  grid_layout-sel_mode = 'A'.
  grid_layout-stylefname = 'CT'.
  s_variant-report   = sy-repid.
  s_variant-username = sy-uname.
  s_variant-variant  = p_varant.
  CALL METHOD grid1->set_table_for_first_display
    EXPORTING
      i_structure_name = 'ZCA0FCSTFTOP'
      is_layout        = grid_layout
      is_variant       = s_variant
      i_save           = 'A'
    CHANGING
      it_outtab        = t_zca0fcstftop
      it_fieldcatalog  = fieldcat.
  Create Object to receive events and link them to handler methods.
  When the ALV Control raises the event for the specified instance
  the corresponding method is automatically called.
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_button_click FOR grid1.
ENDMODULE.                 " STATUS_0050  OUTPUT
*&      Module  USER_COMMAND_0050  INPUT
MODULE user_command_0050 INPUT.
  CALL METHOD grid1->get_selected_rows
    IMPORTING
      et_index_rows = selected_rows.
  DESCRIBE TABLE selected_rows LINES t_lines.
  IF t_lines > 1 .
    MESSAGE e048(zcsv_sfdr).
  ENDIF.
Clear Header
  CLEAR wa_zca0fcstftop.
  sel_rows[] = selected_rows .
  READ TABLE sel_rows INDEX 1.
  READ TABLE t_zca0fcstftop INTO wa_zca0fcstftop INDEX sel_rows-index.
  CASE ok_code.
    WHEN 'EXIT'.
      PERFORM exit_program.
    WHEN 'CREA'.
      CLEAR zca0fcstftop.
      ok_code = sy-ucomm.
      zca0fcstftop-werks = p_werks.
      CALL SCREEN 100.
    WHEN 'COPY'.
      MOVE wa_zca0fcstftop TO zca0fcstftop .
      CLEAR wa_zca0fcstftop.
      f_copy = 'X'.
      CALL SCREEN 100.
    WHEN 'CHNG'.
      CHECK NOT wa_zca0fcstftop IS INITIAL.
      MOVE wa_zca0fcstftop TO zca0fcstftop .
      CLEAR wa_zca0fcstftop.
      ok_code = sy-ucomm.
      CALL SCREEN 100.
    WHEN 'DELE'.
      CHECK NOT wa_zca0fcstftop IS INITIAL.
      CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
        EXPORTING
          defaultoption  = 'N'
          textline1      = text-005
          textline2      = text-006
          titel          = text-007
          cancel_display = ' '
        IMPORTING
          answer         = wg_confirm_ind.
      IF wg_confirm_ind EQ 'J'.
        DELETE zca0fcstftop FROM wa_zca0fcstftop .
        IF sy-subrc EQ 0.
          MESSAGE s004.
        ELSE.
          MESSAGE e005.
        ENDIF.
      ELSEIF wg_confirm_ind EQ 'N'.
      ENDIF.
  ENDCASE.
  CLEAR ok_code.
ENDMODULE.                 " USER_COMMAND_0050  INPUT
*&      Form  exit_program
FORM exit_program .
  CALL METHOD g_custom_container->free.
  CALL METHOD cl_gui_cfw=>flush.
  SET SCREEN 0.
  LEAVE SCREEN.
ENDFORM.                    " exit_program
*&      Form  set_auth
FORM set_auth.
  REFRESH: i_fcode.
Check authorization for change
  MOVE '02' TO act_auth.        "02 --> Change
  MOVE 'ZCA0FCSTFTOP' TO tab_maint.
  AUTHORITY-CHECK OBJECT 'ZZ:TABLMNP'
    ID 'ACTVT' FIELD act_auth
    ID 'TABLE' FIELD tab_maint.
  IF sy-subrc NE 0.
    PERFORM fill_fcode USING 'CHNG'.
  ENDIF.
Check for authorization for create
  MOVE '01' TO act_auth.        "01 --> Create
  MOVE 'ZCA0FCSTFTOP' TO tab_maint.
  AUTHORITY-CHECK OBJECT 'ZZ:TABLMNP'
    ID 'ACTVT' FIELD act_auth
    ID 'TABLE' FIELD tab_maint.
  IF sy-subrc NE 0.
    PERFORM fill_fcode USING 'CREA'.
    PERFORM fill_fcode USING 'COPY'.
  ENDIF.
Check for authorization for delete
  MOVE '06' TO act_auth.        "06 --> Delete
  MOVE 'ZCA0FCSTFTOP' TO tab_maint.
  AUTHORITY-CHECK OBJECT 'ZZ:TABLMNP'
    ID 'ACTVT' FIELD act_auth
    ID 'TABLE' FIELD tab_maint.
  IF sy-subrc NE 0.
    PERFORM fill_fcode USING 'DELE'.
  ENDIF.
ENDFORM.                    " set_auth
*&      Module  check_change  INPUT
MODULE check_change INPUT.
  flag = 'Y'.
ENDMODULE.                 " check_change  INPUT
regards,
vikas.
plz reward if helpful

Similar Messages

  • Web Dynpro ALV grid navigation problems when entry is selected

    Hi,
    We have implemented support packs 19 and 20 and following this, we are having the following side effect :
    When you click on an entry within an alv grid, it does not navigate to the next screen.  It worked fine before the service packs, please advise if you have any suggestions as to how we can get it to work again!?  Thanks in advance.
    When I click, the debug does not event go to the ON_LEAD_SELECT event.
    Edited by: James Wilson on Dec 10, 2009 3:52 PM

    Hi Samir,
    I think possibly you have other code which is relying on a lead selection being set in the context that you have provided to the ALV grid?
    And it is that code that is falling over?
    In this case I think you need to handle in that other code the possibility that the user/ALV grid will unselect all entries in the table.
    Or am I misunderstanding your issue? Please do let us know,
    Thanks,
    Chris

  • Restrict 'Executing report in background' from selection screen

    I want user to not to select option for executing report in background from Selection Screen of the program.
    i.e. 'Execute Program in Background' option in 1st menu bar tab should either be disabled OR if user clicks on it then he should get error message on selection screen itself.
    Thanks,
    Falguni

    Hi Falguni,
    Write the code based on function code SJOB in the event AT SELECTION-SCREEN. Write the following code :
    AT SELECTION-SCREEN
    CASE SY-UCOMM.
    WHEN 'SJOB'.
    MESSAGE E000 WITH 'You cannot schedule background job'.
    ENDCASE.
    Thanks & Regards,
    Faheem.

  • Adding pushbutton  in alv grid list

    hai friends,
                     i have developed an alv grid list and i place a pushbutton called 'GETEXCEL'.when i click on 'GETEXCEL' it should generate an excel sheet and it should get placed in application server.
    for the reference plz check my code also.
    the issue is when i debug, the transfer statement is getting executed then it is going to the standard program(moduel pool) and then it is not going to application server.of course excel sheet is also getting generated.can anybody find the solution for this.
    *&      Form  events_get
          text
    -->  p1        text
    <--  p2        text
    FORM events_get .
    *DATA t_event TYPE slis_t_event.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
       I_LIST_TYPE           = 0
    IMPORTING
       ET_EVENTS             = tab_events
    EXCEPTIONS
       LIST_TYPE_WRONG       = 1
       OTHERS                = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
      READ TABLE tab_events INTO wa_events WITH KEY name = 'USER_COMMAND'.
      wa_events-form = 'USER_COMMAND'.
      MODIFY tab_events FROM wa_events TRANSPORTING form WHERE name =
      wa_events-name.
      READ TABLE tab_events INTO wa_events WITH KEY name = 'PF_STATUS_SET'.
      wa_events-form = 'PF_STATUS_SET'.
      MODIFY tab_events FROM wa_events TRANSPORTING form WHERE name =
      wa_events-name.
    ENDFORM.                    " events_get
    **& Form pf_status_set
    FORM pf_status_set USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'STATUS'.
    ENDFORM.                           " pf_status_set
    **& Form user_command
    FORM user_command
    USING u_comm TYPE sy-ucomm
    r_selfield TYPE slis_selfield.
    CASE u_comm.
        WHEN 'GETEXCEL'.
          PERFORM f400_column_headings.
          PERFORM f500_generate_excel_file.
          PERFORM f600_transfer_excel_file.
      ENDCASE.
    ENDFORM.                    "user_command
    then i am passing the parameters in grid fm also for user command and set pf status.

    Hi Mahesh,
    1. No need to populate the EVENTS table in your case, just pass the Subroutine names for PF status and USER_COMMAND to GRId Display
      I_CALLBACK_PFSTATUS  = 'PF_STATUS_SET'.
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    2. make sure you pass SY-REPID/SY-CPROG  to REUSE_ALV_GRID_DISPLAY  FM

  • Can we control the output screen area of alv grid list

    Hi All,
    can we control the screen area of grid control in alv's , not using ooalv's. By default grid list is displaying in the whole screen, but i want  to display this grid list in specific area in output screen , not in full screen, how to set these screen area for this grid control. Please let me know.

    Hi,
    If you use the following parameters
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
    you will get the output in the size expected but it will be in the form of a pop up box and a blank screen at the back and user action like cancel etc will take you back to the selection screen.

  • Select from Select Drops Connection

    I am at a lost what I am doing wrong.
    When running this query it works fine ;-
    select a.invno, nvl(a.invamt,0) invamt, (select nvl(sum(payment),0) from inv_payment b
    where b.invno = a.invo) payment from inv_table a);
    Now I try to get those which invoice total does not match payment so I do this ;-
    select invno, invamt, payment from (
    select a.invno, nvl(a.invamt,0) invamt, (select nvl(sum(payment),0) from inv_payment b
    where b.invno = a.invo) payment from inv_table a)
    where invamt <> payment;
    Upon running the second select statement, sqlplus gives me end-of-communication-channel error and I have to restart sqlplus to connect again.
    Can anyone highlight where my mistake is?

    I don't have any good idea about why your query would cause an "end of communication" exception, but this query is a bit simpler and should accomplish the same thing.
    SELECT *
      FROM (
    SELECT it.invno,
           NVL(it.invamt, 0) AS invamt,
           SUM(nvl(ip.payment, 0)) AS payment
      FROM inv_table  it,
           inv_payment  ip
    WHERE ip.invno(+) = it.invno
    GROUP BY
           it.invno,
           it.invamt
    WHERE payment != invamt;

  • How to create editable ALV grid/list

    Hi,
    I want to create editable ALV grid/list so that user can modify the data in the ALV.
    And when user presses save button data will get saved in Z table.
    I dont know how to create editable ALV so could anybody please help me regarding this?
    Thanks & regards,
    Sameer Dhuke

    HI
    check the demo programs BCALV_FULLSCREEN_GRID_EDIT
    BCALV_GRID_EDIT
    BCALV_TEST_GRID_EDIT_01
    BCALV_TEST_GRID_EDITABLE
    REUSE_ALV_GRID EDITABLE
    ALV Grid editable fields
    Just to make things a bit easy
    In the layout,there is a property called edit, make it 'X' for the particular field whichever you want to make editable.
    Hope this helps,
    Suruchi
    Message was edited by:
            Suruchi Mahajan

  • Editable field in ALV GRID/LIST

    Hi All,
    I developed an alv program in which 10 rows is there. In alv grid/list first column is check box. I want 1,5 and 10th row is editable for first column (check box) while rest is not editable. Can you please give solution for same. Please tell me simple method not oops methos
    coz I have taken FM REUSE_ALV_GRID_DISPLAY or REUSE_ALV_LIST_DISPLAY.
    Thanks,
    Rakesh

    goto se38.
    BCALVEDIT*
    press F4
    many examples are there..
    BCALV_GRID_EDIT try this...

  • ALV Block list report FILTERING

    Hello All,
    I am Working on ALV Block List Report. In that report i am having two Blocks.
    if i set a filter for one block it is filtering that block.
    My requirment is like this if iam setting a filter for one block, in the second block also have the same field, then filter should be setted to the second block aslo.
    Is this possible, Can any one Help me out form this issue.
    Thanks,
    Feroz.

    Hello All,
    I am Working on ALV Block List Report. In that report i am having two Blocks.
    if i set a filter for one block it is filtering that block.
    My requirment is like this if iam setting a filter for one block, in the second block also have the same field, then filter should be setted to the second block aslo.
    Is this possible, Can any one Help me out form this issue.
    Thanks,
    Feroz.

  • Need a perfect example program for ALV GRID LIST

    first hi to all,i am new to this community.i am still in learning process of SAP.one of my friend suggeted this community and i think this is the perfect place to learn and excel my skill in SAP.so my requirement is a perfect example program for ALV GRID LIST DISPLAY.while i am trying another program,the sysntax is ok but i am not getting any output and it is not showing any error also.hope i will get an answer asap.thank you.

    Check [OO ALV Guide Simple|http://wiki.sdn.sap.com/wiki/display/ABAP/OBJECTORIENTEDALV+Guide] and [Easy Reference to ALV|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907]

  • ALV-Grid list box in Cell Event when a value is selected

    Hello to all,
    I've got a editable alv grid with a list box in one cell.
    Is there any event fired after user selection in order to update other cells?
    A workaround may be to use event "data_changed" but I think this isn't a smart way.
    Any ideas?
    Best regards
    Christian

    Hi Christian,
    I think data_changed is right one here, as this one has is recording couple "states":
    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,
    "these are fired up in different "state" of control during selection itself
    "e_onF4
    "e_onf4_before
    "e_onf4_after
    You can. however, try with handle_on_f4 . This works fine for input help, I didn't test it for listbox but should work as well. First you need to register this event with:
    DATA: lt_fields_f4 TYPE lvc_t_f4,
            ls_fields_f4 TYPE lvc_s_f4.
    "activate event F4 only for particular fields
      ls_fields_f4-fieldname = 'SEATSMAX_F'.
      ls_fields_f4-register = 'X'.
      ls_fields_f4-getbefore = 'X'.
      ls_fields_f4-chngeafter = 'X'.
      APPEND ls_fields_f4 TO lt_fields_f4.
      CALL METHOD g_alv_grid_ref->register_f4_for_fields
        EXPORTING
          it_f4 = lt_fields_f4[].
    ...and then just method handler
    METHODS: handle_on_f4 FOR EVENT onf4 OF cl_gui_alv_grid
                               IMPORTING e_fieldname e_fieldvalue er_event_data,
    SET HANDLER ...
    Regards
    Marcin

  • Splitter Problem - ALV Grid not refreshed when selected another item

    Hi Experts!!
    I have a container on screen 100 which has to be split into 3 areas. Left area ->tree, Right top area -alv grid and bottom also alv grid. I created the program without splitter and it was working fine. After I added this splitter, I see that in ALV grid, the data is not being refreshed. When double clicked on an item in tree struct, ALV grid (CL_SALV_TABLE) to be shown.. Firstly it's fine but when I double click on another item, it's not refreshing the data but is showing the same previous data.
    I have searched existing posts and implemented, but no luck.
    PFB my code:
    * In PBO of screen 100
      CREATE OBJECT go_cc_area1
        EXPORTING
          container_name              = 'CC_AREA1'
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          lifetime_dynpro_dynpro_link = 5.
      IF sy-subrc <> 0.
        MESSAGE e025 WITH sy-subrc.
      ENDIF.
      CREATE OBJECT go_splitter
        EXPORTING
          parent        = go_cc_area1
          orientation   = 1              "Vertical split
          sash_position = 40
        EXCEPTIONS
          OTHERS        = 1.
      IF sy-subrc <> 0.
      ENDIF.
      go_container_tree  = go_splitter->top_left_container.
      go_container_2 = go_splitter->bottom_right_container.
      CREATE OBJECT go_splitter_2
        EXPORTING
          parent        = go_container_2
          orientation   = 0              "Horizontal split
          sash_position = 40
        EXCEPTIONS
          OTHERS        = 1.
      IF sy-subrc <> 0.
      ENDIF.
      go_cc_area2 = go_splitter_2->top_left_container.
      go_cc_area3 = go_splitter_2->bottom_right_container.
      CREATE OBJECT go_tree
        EXPORTING
          i_parent                    = go_container_tree
          i_node_selection_mode       = cl_gui_column_tree=>node_sel_mode_single
          i_item_selection            = gc_x
          i_no_html_header            = gc_x
          i_no_toolbar                = space
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          illegal_node_selection_mode = 5
          failed                      = 6
          illegal_column_name         = 7.
        CALL METHOD go_tree->set_table_for_first_display
          EXPORTING
            i_background_id = space
            is_layout       = gs_layout
          CHANGING
            it_sort         = gt_sort
            it_outtab       = gt_tree_output
            it_fieldcatalog = gt_fieldcat_tree.
        CALL METHOD go_tree->expand_tree
          EXPORTING
            i_level = 2.
    * End - PBO 100
    *       CLASS lcl_tree_event_receiver DEFINITION
    CLASS lcl_tree_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS: handle_item_double_click
                   FOR EVENT item_double_click OF cl_gui_alv_tree_simple
                   IMPORTING fieldname
                             index_outtab
                             grouplevel.
    ENDCLASS.                    "lcl_tree_event_receiver DEFINITION
    *       CLASS lcl_tree_event_receiver IMPLEMENTATION
    CLASS lcl_tree_event_receiver IMPLEMENTATION.
      METHOD handle_item_double_click.
          IF go_alv_area2 IS BOUND.
            go_alv_area2->refresh( ).
          ENDIF.
          cl_salv_table=>factory(
            EXPORTING
              list_display   = space
              r_container    = go_cc_area2
            IMPORTING
              r_salv_table = go_alv_area2
            CHANGING
              t_table      = gt_table ).
          go_alv_area2->display( ).
      ENDMETHOD.                    "handle_item_double_click
    ENDCLASS.                    "lcl_tree_event_receiver IMPLEMENTATION
    I am facing the same problem with area 3 as well. Can somebody please help me out.
    Thanks a lot!!
    Edited by: Srinivas Kalluri on Jan 28, 2012 1:39 PM

    Hi All,
    I am still facing this problem. Can somebody please help me out?
    I created a test program wth sflight and spfli tables. Can somebody look into this and tell me where I am going wrong?
    On screen 100 i have one cust container named CC.
    When I test it, it's showing the same refresh problem. But in this test program refresh is atleast happening once.
    REPORT ztest.
    PARAMETERS: p_carrid TYPE sflight-carrid.
    CLASS lcl_tree_event_receiver DEFINITION DEFERRED.
    CONSTANTS: gc_x VALUE 'X'.
    DATA: go_cc_area1 TYPE REF TO cl_gui_custom_container,
          go_tree TYPE REF TO cl_gui_alv_tree_simple,
          go_tree_event_receiver TYPE REF TO lcl_tree_event_receiver,
          go_cc_area2 TYPE REF TO cl_gui_container,
          go_alv_area2 TYPE REF TO cl_salv_table,
          go_cc_area3 TYPE REF TO cl_gui_container,
          go_columns TYPE REF TO cl_salv_columns_table,
          go_cc_editor TYPE REF TO cl_gui_custom_container,
          go_editor TYPE REF TO cl_gui_textedit,
          go_content TYPE REF TO cl_salv_form_element,
          go_container_tree TYPE REF TO cl_gui_container,
          go_container_2 TYPE REF TO cl_gui_container,
          go_splitter TYPE REF TO cl_gui_easy_splitter_container,
          go_splitter_2 TYPE REF TO cl_gui_easy_splitter_container,
          go_cc_comp TYPE REF TO cl_gui_custom_container,
          go_alv_comp TYPE REF TO cl_salv_table.
    DATA: gt_sflight TYPE TABLE OF sflight,
          gt_data TYPE TABLE OF spfli,
          gt_fieldcat TYPE lvc_t_fcat,
          gt_sort TYPE lvc_t_sort,
          gs_sflight TYPE sflight,
          gs_layout TYPE lvc_s_layo.
    *       CLASS lcl_tree_event_receiver DEFINITION
    CLASS lcl_tree_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS: handle_item_double_click
                   FOR EVENT item_double_click OF cl_gui_alv_tree_simple
                   IMPORTING fieldname
                             index_outtab
                             grouplevel.
    ENDCLASS.                    "lcl_tree_event_receiver DEFINITION
    *       CLASS lcl_tree_event_receiver IMPLEMENTATION
    CLASS lcl_tree_event_receiver IMPLEMENTATION.
      METHOD handle_item_double_click.
        READ TABLE gt_sflight INTO gs_sflight INDEX index_outtab.
        IF sy-subrc EQ 0.
          SELECT * FROM spfli INTO TABLE gt_data WHERE connid = gs_sflight-connid.
          IF go_alv_area2 IS BOUND.
            go_alv_area2->refresh( ).
            cl_gui_cfw=>flush( ).
          ENDIF.
          cl_salv_table=>factory(
            EXPORTING
              r_container    = go_cc_area2
            IMPORTING
              r_salv_table = go_alv_area2
            CHANGING
              t_table      = gt_data ).
          go_alv_area2->display( ).
        ENDIF.
      ENDMETHOD.                    "handle_item_double_click
    ENDCLASS.                    "lcl_tree_event_receiver IMPLEMENTATION
    START-OF-SELECTION.
      CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'MAIN'.
    *  SET TITLEBAR 'xxx'.
      CREATE OBJECT go_cc_area1
        EXPORTING
          container_name              = 'CC'
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          lifetime_dynpro_dynpro_link = 5.
      IF sy-subrc <> 0.
    *    MESSAGE e025 WITH sy-subrc text-e01.
      ENDIF.
      CREATE OBJECT go_splitter
        EXPORTING
          parent            = go_cc_area1
          orientation       = 1              "Vertical split
          sash_position     = 25
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3.
      IF sy-subrc <> 0.
    *    MESSAGE e025 WITH sy-subrc text-e02.
      ENDIF.
      go_container_tree  = go_splitter->top_left_container.
      go_container_2 = go_splitter->bottom_right_container.
      CREATE OBJECT go_splitter_2
        EXPORTING
          parent            = go_container_2
          orientation       = 0              "Horizontal split
          sash_position     = 40
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3.
      IF sy-subrc <> 0.
    *    MESSAGE e025 WITH sy-subrc text-e02.
      ENDIF.
      go_cc_area2 = go_splitter_2->top_left_container.
      CREATE OBJECT go_tree
        EXPORTING
          i_parent                    = go_container_tree
          i_node_selection_mode       = cl_gui_column_tree=>node_sel_mode_single
          i_item_selection            = gc_x
          i_no_html_header            = gc_x
          i_no_toolbar                = space
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          illegal_node_selection_mode = 5
          failed                      = 6
          illegal_column_name         = 7.
      IF sy-subrc <> 0.
    *    MESSAGE e025 WITH sy-subrc text-e03.
      ENDIF.
      SELECT * FROM sflight INTO TABLE gt_sflight WHERE carrid EQ p_carrid.
        CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
          EXPORTING
            i_structure_name       = 'SFLIGHT'
            i_bypassing_buffer     = gc_x
          CHANGING
            ct_fieldcat            = gt_fieldcat
          EXCEPTIONS
            inconsistent_interface = 1
            program_error          = 2
            OTHERS                 = 3.
        IF sy-subrc <> 0.
    *      MESSAGE e025 WITH sy-subrc text-e05.
        ENDIF.
        DATA: ls_fieldcatalog TYPE lvc_s_fcat.
        LOOP AT gt_fieldcat INTO ls_fieldcatalog.
          ls_fieldcatalog-col_opt = gc_x.
          CASE ls_fieldcatalog-fieldname.
            WHEN 'CARRID'.
              ls_fieldcatalog-no_out = gc_x.
            WHEN 'CONNID'.
              ls_fieldcatalog-no_out = gc_x.
          ENDCASE.
          MODIFY gt_fieldcat FROM ls_fieldcatalog.
          CLEAR ls_fieldcatalog.
        ENDLOOP.
        DATA: ls_sort TYPE lvc_s_sort.
        ls_sort-spos = 1.
        ls_sort-fieldname = 'CARRID'.
        ls_sort-up = gc_x.
        APPEND ls_sort TO gt_sort.
        ls_sort-spos = 2.
        ls_sort-fieldname = 'CONNID'.
        ls_sort-up = gc_x.
        APPEND ls_sort TO gt_sort.
        DATA: lt_events TYPE cntl_simple_events,
              lo_l_event TYPE cntl_simple_event.
        lo_l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
        APPEND lo_l_event TO lt_events.
        lo_l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
        APPEND lo_l_event TO lt_events.
        lo_l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
        APPEND lo_l_event TO lt_events.
        lo_l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
        APPEND lo_l_event TO lt_events.
        lo_l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
        APPEND lo_l_event TO lt_events.
        lo_l_event-eventid = cl_gui_column_tree=>eventid_button_click.
        APPEND lo_l_event TO lt_events.
        lo_l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
        APPEND lo_l_event TO lt_events.
        CALL METHOD go_tree->set_registered_events
          EXPORTING
            events                    = lt_events
          EXCEPTIONS
            cntl_error                = 1
            cntl_system_error         = 2
            illegal_event_combination = 3.
    * Set Handler
        CREATE OBJECT go_tree_event_receiver.
        SET HANDLER go_tree_event_receiver->handle_item_double_click FOR go_tree.
        CALL METHOD go_tree->set_table_for_first_display
          EXPORTING
            i_background_id = space
            is_layout       = gs_layout
          CHANGING
            it_sort         = gt_sort
            it_outtab       = gt_sflight
            it_fieldcatalog = gt_fieldcat.
        CALL METHOD go_tree->expand_tree
          EXPORTING
            i_level = 2.
        IF NOT gt_sflight[] IS INITIAL.
          CALL METHOD go_tree->set_top_node
            EXPORTING
              i_index_outtab = 0.
        ENDIF.
    * Send data to frontend.
        CALL METHOD go_tree->frontend_update.
      ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
          SET SCREEN 0.
          LEAVE SCREEN.
        WHEN OTHERS.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Edited by: Srinivas Kalluri on Jan 31, 2012 4:49 PM

  • ALV grid refresh problem when I return from list-processing

    hi,
    I have made alv grid with f4 help features and i'm using row select feature.
    When i click on a button in Application toolbar, the program leaves to list processing and then return to alv gridscreen.
    Now the problem arises.
    (1)Even if i select rows and press F8, the program does not identify the rows selected and does not give me desired output.
    (2)Also, when i press F4, the selected value does not appear in the text field.
    Both the cases are working fine, if i dont press button and go to list processing.
    Please help!!

    You can use the function module as stated below -
    FORM user_command USING r_ucomm TYPE sy-ucomm
                            rs_selfield TYPE slis_selfield.
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
      IMPORTING
    ET_EXCLUDING =
    E_FLG_NO_HTML =
    E_CALLBACK_PROGRAM =
    E_REPID =
      e_grid = ref1
    ES_LAYOUT_KKBLO =
    ES_SEL_HIDE =
      CALL METHOD ref1->check_changed_data.
    This helps to get the data in the internal table refreshed as well as that on the screen so that both are in sync.
    this is generally used on some event, you can also use it otherwise.
    <b>
    Reward if useful.</b>
    Regards,
    Pritha

  • ALV GRID WITH SUMMATORIES DEPEND OF THE SELECTION

    Hi Experts.
    I have a form, in which depend of the selection, I show to user a fieldcatalog with the data (query) that the user want to see in that moment ...
    The problem is that the user want to see one field (amount, sum total (money) ...etc) with summatories, group by date, person...or other depend of the selection he has done in the select dynpro.
    How can I do it when I show the ALV??... The user don't want to use the option to make a lot of select dispositions in the ALV..., he want to see the disposition of the data depend the selection he do in the select dynpro.
    I see when I create the fieldcatalog to the ALV GRID, there is a field ... do_sum, I have marked it, in the field which I want to do a summatory but don't do anything in the ALV when display.... and don't find how indicate in the fieldcatalog the field which I wan't group by...
    Other options, that I have thought it's to make a lot of dispositions in ALV, and when display de ALV try to get the disposition that I want ... but I haven't did it.
    Thanks.

    Hi all,
    it is maybe too late to answer this question but I hope it can serve someone who bumps into this problem in the future.
    I managed to activate the functions with the following code:
    DATA alv       TYPE REF TO cl_salv_table.
    DATA: lo_functions TYPE REF TO cl_salv_functions_list.
    DATA: lo_funcs TYPE salv_t_ui_func.
    DATA: lo_func TYPE salv_s_ui_func.
      cl_salv_table=>factory(
           IMPORTING r_salv_table = alv
           CHANGING  t_table      = <fs> ).
    *   Default Functions
         lo_functions = alv->get_functions( ).
         lo_funcs = lo_functions->get_functions( ).
    * loop through all functions and enable them and set them visible.
    * here u can also activate separate functions if you check the name with the method from r_function (CL_SALV_FUNCTION->GET_NAME)
         LOOP AT lo_funcs INTO lo_func.
           lo_func-r_function->set_enable( value = 'X' ).
           lo_func-r_function->set_visible( value = 'X' ).
         ENDLOOP.
         alv->display( ).
    Cheers,
    Ilina

  • ALV Grid OO : Set Field editable for  selected rows

    Hello ABAPers,
    I used object  cl_gui_alv_grid to created ALV grid and i succed to set an editable
    field for all rows. However my request is to set it for and only for selected rows
    I could get the row index but i didn't know how to use it
    Thanks in advance
    Amine

    Hi Amine,
    I think the standard SAP sample program might help you, BCALV_EDIT_02.
    I will tell the procedure to make the selected rows editable on ALV.
    1. Add a additional field of type LVC_T_STYL in the internal table that you are displaying in the ALV. LVC_T_STYL is a actually a table type.
    2. Place a button on the ALV toolbar for EDIT/DISPLAY.
    3. Once you press the EDIT button after selecting the rows, loop through the records which you have selected (you have already said that you have the index of selected records).
    4. The table type LVC_T_STYL has fields for FIELDNAME and STYLE.
       If you have 10 fields in the internal table, then all these ten fields name should be appended to the newly added field in the internal table (LVC_T_STYL) and their style should be populated with value cl_gui_alv_grid=>mc_style_enabled.
    Regards,
    Rahul MB

Maybe you are looking for

  • Will this external drive work??? HELP

    Hi all, I wanted to know if there is any way that this hard drive works with OS X? I've read reviews that it doesnt work with Macs, but some websites state that its Mac-compatible. http://shop3.outpost.com/product/5239637 Anyone have this drive? Is t

  • Import keywords delimiter question

    In gallery mode I specify multiple keyword by clicking buttons and check boxes --no problem there.  But what is the trick to manually typing in multiple import keywords without the program concatenating them into a new unwanted keyword?   Is it some

  • HT6162 I need to install apple new version iOS 7.0

    I need to install apple new version iOS 7.0

  • Laptop not working and hard drive too

    Every time I played a game on my laptop I would get a blue screen and the error IRQL_DRIVER_NOT_LESS_OR_EQUAL (igdkmd.sys) and I looked it up online where i found a guide telling me to disable my intel hd 4000 graphics card and when i did that my com

  • Switching from G3 Powerbook to G4 iBook, need assistance!

    I am switching from a G3 Powerbook to a G4 iBook.  I have need to recover ClarisWorks and MacDraw from the G3.  I read as long as I use Panther or older I can run classic and the programs will work, is this correct?  If so, is there anything I need t