Display alv grids in selection screen based on the user event

Hi All,
I am workign on displaying ALV in same selection screen.I am able to display the ALV in selection screen.
But i have 2 buttons in my selection screen 'Create' and 'change'.
When i click on create i need  with some type of data and when i click on 'change' my alv grid another type of data.Ex: if i click on crate mara data should be dispalyed when i click on change makt table data should be dispalyed and also i have user defined buttons are in my grids.
So i have used 2 containers to dispaly to different data.I am able to display the perfectly but the problem is first time when i click on create the grid is displaying when i click on change button  the create alv grid is displaying down and change data is dispalying up.
I need only one alv grid at a time.Can anybody please let me know how can i do this.
Thanks,
Taragini

Hello,
Also I would suggest if it is relevant data maintain in one interntal table and show/hide based on condition
through fieldcatalog (NO_OUT) parameter.
Thanks

Similar Messages

  • Return from ALV  Grid to Selection screen

    hi,
    I want to go back from ALV grid to selection screen.
    I am using the following code:
    WHEN 'BACK'.
    CALL METHOD grid1->refresh_table_display.
    CALL METHOD grid1->free.
    CALL METHOD custom_container1->free.
    CALL SELECTION-SCREEN 1000.
    it is working,but when i press BACK button from selection screen to program it is showing ERROR IN FLUSH 4 Error.
    Also I tried with method FLUSH
    WHEN 'BACK'.
    CALL METHOD grid1->refresh_table_display.
    CALL METHOD grid1->free.
    CALL METHOD custom_container1->free.
    CALL METHOD cl_gui_cfw=>flush.
    it's still showing same Error.
    Please help on this.
    Regards,
    Sankar

    Hi,
    My grid name is grid1.
    I tried with :
    DATA grid1 TYPE REF TO cl_gui_alv_grid.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
    e_grid = grid1.
    CALL METHOD grid1->check_changed_data.
    CALL METHOD grid1->refresh_table_display.
    LEAVE TO SCREEN 0.
    Even, I tried with declaring another grid : grid2
    DATA grid1 TYPE REF TO cl_gui_alv_grid.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
    e_grid = grid1.
    CALL METHOD grid1->check_changed_data.
    CALL METHOD grid1->refresh_table_display.
    LEAVE TO SCREEN 0.
    In both cases, I am getting the following Error : OBJECTS_OBJREF_NOT_ASSIGNED

  • Changing the selection screen based on the option in list box option

    Hi Experts,
    I have a list box parameter in my selection screen,
    i have four options and i am changing my selection screen based the option selected.
    see my code below,
    at selection-screen output.
      GS_VRM_VALUES-KEY = '1'.
      GS_VRM_VALUES-TEXT = TEXT-S02.
      APPEND GS_VRM_VALUES TO GT_VRM_VALUES.
      GS_VRM_VALUES-KEY = '2'.
      GS_VRM_VALUES-TEXT = TEXT-S03.
      APPEND GS_VRM_VALUES TO GT_VRM_VALUES.
      GS_VRM_VALUES-KEY = '3'.
      GS_VRM_VALUES-TEXT = TEXT-S04.
      APPEND GS_VRM_VALUES TO GT_VRM_VALUES.
      GS_VRM_VALUES-KEY = '4'.
      GS_VRM_VALUES-TEXT = TEXT-S05.
      APPEND GS_VRM_VALUES TO GT_VRM_VALUES.
      CLEAR: GS_VRM_VALUES.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          ID                    = 'P_DROP'
          VALUES                = GT_VRM_VALUES
      EXCEPTIONS
        ID_ILLEGAL_NAME       = 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.
    LOOP AT SCREEN .
        CASE P_DROP .
          WHEN '1'.
            IF SCREEN-GROUP1 = 'M2' OR
              SCREEN-GROUP1 = 'M3' OR SCREEN-GROUP1 = 'M4'.
              SCREEN-INPUT = 0.
             SCREEN-ACTIVE = 0.
              screen-invisible = 1.
              MODIFY SCREEN.
            ENDIF.
          WHEN '2'.
            IF SCREEN-GROUP1 = 'M3' OR SCREEN-GROUP1 = 'M4'.
              SCREEN-INPUT = 0.
             SCREEN-ACTIVE = 0.
              screen-invisible = 1.
              MODIFY SCREEN.
            ENDIF.
          WHEN '3'.
            IF SCREEN-GROUP1 = 'M2' OR
                SCREEN-GROUP1 = 'M4' .
              SCREEN-INPUT = 0.
             SCREEN-ACTIVE = 0.
              screen-invisible = 1.
              MODIFY SCREEN.
            ENDIF.
          WHEN '4'.
            IF SCREEN-GROUP1 = 'M2' OR
            SCREEN-GROUP1 = 'M3'.
              SCREEN-INPUT = 0.
             SCREEN-ACTIVE = 0.
              screen-invisible = 1.
              MODIFY SCREEN.
            ENDIF.
          WHEN OTHERS.
            IF SCREEN-GROUP1 = 'M2' OR
               SCREEN-GROUP1 = 'M3' OR SCREEN-GROUP1 = 'M4'.
              SCREEN-INPUT = 0.
             SCREEN-ACTIVE = 0.
          screen-invisible = 1.
              MODIFY SCREEN.
            ENDIF.
        ENDCASE.
      ENDLOOP.
    my problem is when i change the option in the list box, the particular modify group ie, the screen is getting changed only after i press enter, So please suggest me how i can change the screen without pressing enter.

    Hi,
    without using VRM_SET_VALUES...you just create one data element by going se11....create one domain for it...now give the values in the "value range" tab....and at the time of declaration just write ..
    PARAMETERS var1 TYPE <your created data element>
                        AS LISTBOX VISIBLE LENGTH 20
                        USER-COMMAND onli
                        DEFAULT <one value>.
    You will get the same effect as list box....and make it mandatory..
    Arunima

  • How to add a field to the selection screen and when the user enters ...

    hi all,
    can any one plesase send the code of how to add a field to seletiion screen and when the user enters in the field , it should be store in the database table , the table is MKPF and the field is BKTXT.  Thanks.

    Hi Kripa,
       If u r using PNP ldb then the screen u will get is the screen for that ldb and if u want to add some more fields then u define using selection-screen..as follows
    SELECTION-SCREEN BEGIN OF BLOCK mysel WITH FRAME TITLE text-111.
    PARAMETERS: n_in_en  RADIOBUTTON GROUP g1,
                q_ev  RADIOBUTTON GROUP g1.
    SELECTION-SCREEN END OF BLOCK mysel.
    SELECTION-SCREEN BEGIN OF BLOCK mysel1 WITH FRAME TITLE text-222.
    PARAMETERS: r_date TYPE sy-datum DEFAULT sy-datum.
    SELECTION-SCREEN END OF BLOCK mysel1.
    SELECTION-SCREEN BEGIN OF BLOCK mysel2 WITH FRAME TITLE text-333.
    PARAMETERS:f_ver(3) TYPE c DEFAULT 1,
               c_no(10) TYPE c DEFAULT '9D0161',
               u_id(15) TYPE c,
               password(15) TYPE c,
               r_email(30) TYPE c DEFAULT PARAMETERS: s_not TYPE c AS CHECKBOX.
    PARAMETERS:t_run TYPE c  AS CHECKBOX.
    SELECTION-SCREEN END OF BLOCK mysel2.
    SELECTION-SCREEN BEGIN OF BLOCK mysel3 WITH FRAME TITLE text-444.
    SELECTION-SCREEN BEGIN OF BLOCK mysel4 WITH FRAME TITLE text-555.
    PARAMETERS: p_ser  RADIOBUTTON GROUP g2,
    a_ser  RADIOBUTTON GROUP g2.
    SELECTION-SCREEN END OF BLOCK mysel4.
    SELECTION-SCREEN BEGIN OF BLOCK mysel5 WITH FRAME TITLE text-666.
    PARAMETERS:p_path TYPE string.
    SELECTION-SCREEN END OF BLOCK mysel5.
    SELECTION-SCREEN END OF BLOCK mysel3.
    u will get this additional screen after the screen of ldb.
    I hope this will help u..
    Thanks & Regards
    Ashu Singh.

  • Display input field on selection screen based on condition

    Hi,
    I have a report with selection with no of  input fields and a checkbox .I want to hide  few i/p fileds based on checkbox i/p.
    If the checkbox = 'X',then only those fields should apper on screen for input.
    how do we get this on sel screen.
    thanks in advance.

    Hi,
    you can use this code as reference.
    Here, depens on check box, in the next screen resepective select options will be displayed.
    You can use this logic for your requirement.
    REPORT Z50871_SELECTOPS_DYNAMIC.
    PARAMETERS : CH_EBELN AS CHECKBOX,
    CH_VBELN AS CHECKBOX.
    DATA: V_EBELN TYPE EKKO-EBELN,
    V_VBELN TYPE VBAK-VBELN.
    SELECTION-SCREEN BEGIN OF SCREEN 100.
    SELECT-OPTIONS : EBELN FOR V_EBELN MODIF ID G1,
    VBELN FOR V_VBELN MODIF ID G2.
    SELECTION-SCREEN END OF SCREEN 100 .
    AT SELECTION-SCREEN OUTPUT.
    IF SY-DYNNR = 100.
    IF CH_EBELN = 'X' AND
    CH_VBELN = ''.
    LOOP AT SCREEN.
    IF SCREEN-GROUP1 EQ 'G1'.
    SCREEN-ACTIVE = '1'.
    ELSE.
    SCREEN-ACTIVE = '0'.
    ENDIF.
    MODIFY SCREEN.
    ENDLOOP.
    ELSEIF CH_VBELN = 'X' AND
    CH_EBELN = '' .
    LOOP AT SCREEN.
    IF SCREEN-GROUP1 EQ 'G2'.
    SCREEN-ACTIVE = '1'.
    ELSE.
    SCREEN-ACTIVE = '0'.
    ENDIF.
    MODIFY SCREEN.
    ENDLOOP.
    ELSEIF CH_EBELN = 'X' AND CH_VBELN = 'X'.
    LOOP AT SCREEN.
    IF SCREEN-GROUP1 EQ 'G1'
    OR SCREEN-GROUP1 EQ 'G2' .
    SCREEN-ACTIVE = '1'.
    ENDIF.
    MODIFY SCREEN.
    ENDLOOP.
    ENDIF.
    ENDIF.
    AT SELECTION-SCREEN.
    IF SY-DYNNR = 1000.
    IF CH_EBELN = 'X' OR CH_VBELN = 'X'.
    CALL SELECTION-SCREEN 100.
    ELSE.
    MESSAGE I000(Z50871MSG) WITH 'Please select atleast one checkbox'.
    ENDIF.
    ENDIF.
    Regards
    Sandeep Reddy

  • Displaying Plant as F4 option in the selection screen according to the User Authorization

    Hi all,
    In the selection screen, I need to display the list of plants as F4 search help that the user has authorization.
    How I need to check from the table.
    Please provide me the exact table name where I can get the list of plants that the user has authorization.
    Thanks in Advance.
    Regards,
    karthik

    Hi Madan,
    Thanks for your reply.
    As of now Plant entered in selection screen is validated for authorization like below.
    authority-check object 'M_MATE_WRK'
          id 'ACTVT' field '02'
          id 'WERKS' field p_werks.
       if sy-subrc <> 0.
         message text-010 type c_e.
         exit.
       endif.
    But they are in need of Plants in F4.
    Regards,
    Karthik

  • How to gray out certain fields on the selection screen based on the radio b

    HI All,
      I have an ALV report. On the selection screen I have 2 radio buttons ..for eg..A and B.
    When radio button A(its on by default) is on..certain fields not relevant to this should be grayed out. Similarly when radio button B is on, certain fields should be grayed out.
    I did the AT SELECTION SCREEN OUTPUT and also did the
    LOOP AT SCREEN....ENDLOOP logic. The logic works but when I click the radio button B...the screen fields automatically does not gray out. I have to press ENTER and then its grays out.
    I know a USER_COMMAND needs to be attached.
    Can anyone give me a step by step details of how to do this. I truly appreciate it. if a screen painter thing is required..please give me the tcode and step by step detail to do this.
    Thanks

    Try this one too:
    REPORT ztest.
    TABLES: mara,
            bkpf.
    CONSTANTS:
                  c_pos(3) TYPE c VALUE 'POS',
                  c_acc(3) TYPE c VALUE 'ACC',
                  c_all(3) TYPE c VALUE 'ALL',
                  c_x TYPE c VALUE 'X'.
    The Selection Screen Definition
    SELECTION-SCREEN BEGIN OF BLOCK b_0 WITH FRAME TITLE text-000.
    SELECT-OPTIONS: s_mara FOR mara-matnr.
    SELECTION-SCREEN END OF BLOCK b_0.
    SELECTION-SCREEN BEGIN OF BLOCK b_1 WITH FRAME TITLE text-037.
    PARAMETER: rb_all RADIOBUTTON GROUP rb1 USER-COMMAND rad default 'X',
               rb_acc RADIOBUTTON GROUP rb1.
    SELECTION-SCREEN END OF BLOCK b_1.
    SELECTION-SCREEN BEGIN OF BLOCK b_2 WITH FRAME TITLE text-011. "Acct
    SELECT-OPTIONS:   s_blrtc1 FOR bkpf-blart MODIF ID acc,
                      s_blrti1 FOR bkpf-blart MODIF ID acc.
    SELECTION-SCREEN END OF BLOCK b_2.
    SELECTION-SCREEN BEGIN OF BLOCK b_3 WITH FRAME TITLE text-011. "Acct
    SELECT-OPTIONS:   s_blrtc2 FOR bkpf-blart MODIF ID all,
                      s_blrti2 FOR bkpf-blart MODIF ID all,
                      s_blrtv2 FOR bkpf-blart MODIF ID all.
    SELECTION-SCREEN END OF BLOCK b_3.
    AT SELECTION-SCREEN OUTPUT
    AT SELECTION-SCREEN OUTPUT.
      PERFORM f0200_screenfield_hide_logic.
    initialization.
      PERFORM f0200_screenfield_hide_logic.
          FORM f0200_screenfield_hide_logic                             *
    FORM f0200_screenfield_hide_logic.
      LOOP AT SCREEN.
        IF rb_acc = c_x.
          IF screen-group1 = c_all.
            screen-active = 0.
          ELSE.
            screen-active = 1.
          ENDIF.
        ENDIF.
        MODIFY SCREEN.
        IF rb_all = c_x.
          IF screen-group1 = c_acc.
            screen-active = 0.
          ELSE.
            screen-active = 1.
          ENDIF.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    ENDFORM.                    " F0200_SCREENFIELD_HIDE_LOGIC

  • How to get values of selection screen fields in the POV event

    I have two radio buttons r1,r2 and a field file_name on  selection screen.
    I have written At selection screen on value-request for the field file_name. Based on the selection of radio buttons I have to display different screens when f4 for field_name is pressed.
    Unfortunately the values of r1 or r2 are not populated in the AT selection screen on value-request event.
    Can any one tell me if there is a way to obtain the values of r1 or r2 in the AT selection  screen on value-request event.

    Hi..
    Try out this.
    REPORT  ZH_TEST4                                .
    CONSTANTS : c_x                TYPE char01 VALUE 'X',
                c_rg1(4)        TYPE c      VALUE 'RG1',
                c_gr2(3)        TYPE c      VALUE 'GR2',
                c_gr3(3)        TYPE c      VALUE 'GR3',
                c_zero          TYPE n      VALUE '0',
                c_neg(2)        TYPE c      VALUE '-1'.
    data: w_sscrfields_ucomm1   TYPE sscrfields-ucomm.
    SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    PARAMETERS       : p_back   RADIOBUTTON GROUP rg1
                                     USER-COMMAND pc,
                       p_fore   RADIOBUTTON GROUP rg1
                                          DEFAULT 'X'.
    SELECTION-SCREEN : END OF BLOCK blk1.
    SELECTION-SCREEN : BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
    PARAMETERS : p_phif LIKE rlgrap-filename  MODIF ID gr2,
                 p_ahif LIKE rlgrap-filename  MODIF ID gr3.
    SELECTION-SCREEN : END OF BLOCK blk2.
    AT SELECTION-SCREEN OUTPUT.
      IF p_fore EQ c_x.
        w_sscrfields_ucomm1 = c_rg1.
      ELSE.
        w_sscrfields_ucomm1 = space.
      ENDIF.
      LOOP AT SCREEN.
        IF w_sscrfields_ucomm1 EQ space.
          IF screen-group1 = c_gr2.
            screen-active = c_zero.
          ENDIF.
        ELSE.
          IF screen-group1 = c_gr3.
            screen-active = c_zero.
          ENDIF.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    also try out function module POPUP_WITH_TABLE_DISPLAY.
    Plz reward points if this helps by clicking on star!1
    Good Luck!!
    Cheers,
    Rajeev

  • Need to have pop up window in selection screen and capture the user action.

    Hello Friends,
                         I have a requirement, that need to show a pop up window after execution, and to get the action from user using a Push button.
    I create a selection screen and a sub screen as window.
    After user execute from the selection screen, I am popping up this window.
    Window contains some input values to be entered and push button to identify the user action.
    I try to capture the user action using sy-ucomm, but it does not hold any value when user press the button.
    How to overcome this issue.
    Here is the definition of the window.
    Pop Up Window for getting values
    SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW TITLE title .
    PARAMETER : p_vdate LIKE t9aa01-validfrom,
                p_dcggt LIKE t9aa01-hkont,
                p_dcgst1 LIKE t9aa01-hkont,
                p_dcgst2 LIKE t9aa01-hkont,
                p_na LIKE t9aa01-hkont.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 20.
    SELECTION-SCREEN PUSHBUTTON 2(10) text-001 USER-COMMAND SVE.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF SCREEN 500.
    Cheers,
    Senthil
    Edited by: Senthil on Jan 7, 2008 11:03 AM

    Hi,
    Try using the below code.
           data : w_var type string.
           CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
             EXPORTING
              DEFAULTOPTION        = 'Y'
               textline1            = 'test '
             TEXTLINE2            = ' '
               titel                = 'check'
             START_COLUMN         = 25
             START_ROW            = 6
             CANCEL_DISPLAY       = 'X'
            IMPORTING
              ANSWER               = w_var.
                     if w_var = 'J'.
                     else.
                     endif.
    Comments : J indicates Yes and N indicates No
    Regards,
    Jeswanth

  • Problem in displaying Alv grid output  using oops........

    hi,
    i have two problems in displaying ALV grid output Using Oops.
    1) How to modify the fieldcatalog after we getting a field catalog using general FM.
    2) initialy it is displaying 13 fields but there are 63 fields .
       eventhough we chage the layout to 63 fields it is displaying only 13 fields , these 13 fields may be different based on our selection but count  of displayed fileds are same . how can display 63 fields at a time .

    Hi,
    You can chnage using below code:
    loop at gt_fieldcat.
    if <gt_fieldcat-field_name> = 'FIELDNAME'.
    endif.
    modify gt_fieldcat.
    clear gt_fieldcat.
    endloop.
    Make sure that all the field should not have no_out = 'X' and tech = 'X'.
    Thanks,
    Sriram Ponna.

  • Re-Displaying ALV Grid

    This is a follow-up to a question I posed earlier regarding my inability to get the ALV grid to display with a new table name.
    Can anyone tell me what I need to do to get it to re-display with the new table name?
    To use it, you enter a table name in the editor screen.  Screens 100 and 200 are just custom containers with no other attributes.
    Thanks (and points) for any help!
    PROGRAM zz_temp.
    TYPES: BEGIN OF type_text_lines,
      line(2048) TYPE c,
    END OF type_text_lines.
    DATA: g_editor             TYPE REF TO cl_gui_textedit,
          g_r_editor_container TYPE REF TO cl_gui_custom_container,
          g_r_alv_grid         TYPE REF TO cl_gui_alv_grid ,
          g_r_alv_container TYPE REF TO cl_gui_custom_container ,
          g_container          TYPE scrfname VALUE 'ALV_CUSTOM_CONTROL_0200' ,
          g_t_text_lines       TYPE TABLE OF type_text_lines,
          g_t_fcat             TYPE lvc_t_fcat,
          g_ok_code            TYPE sy-ucomm,
          g_save_ok            TYPE sy-ucomm,
          g_repid              TYPE sy-repid,
          l_tab(20)            TYPE c.
    FIELD-SYMBOLS <struc>  TYPE ANY.
    FIELD-SYMBOLS <tab>    TYPE table.
    DATA s_ref             TYPE REF TO data.
    DATA t_ref             TYPE REF TO data.
    START-OF-SELECTION.
      CALL SCREEN 100.
    FORM runsql.
      CONCATENATE LINES OF g_t_text_lines INTO l_tab.
      CREATE DATA s_ref      TYPE (l_tab).
      CREATE DATA t_ref      TYPE TABLE OF (l_tab).
      ASSIGN t_ref->*    TO <tab>.
      SELECT * FROM (l_tab) INTO TABLE <tab>.
      CALL SCREEN 200.
    ENDFORM."
    MODULE pbo OUTPUT.
      CASE sy-dynnr.
        WHEN '0100'.
          IF g_editor IS INITIAL.
            SET PF-STATUS 'MAIN100'.
            g_repid = sy-repid.
            CREATE OBJECT g_r_editor_container
            EXPORTING
              container_name = 'TEXTEDITOR1'
            EXCEPTIONS
              cntl_error = 1
              cntl_system_error = 2
              create_error = 3
              lifetime_error = 4
              lifetime_dynpro_dynpro_link = 5.
            CREATE OBJECT g_editor
            EXPORTING
              parent = g_r_editor_container
              wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
            EXCEPTIONS
              OTHERS = 1.
          ENDIF.
        WHEN '0200'.
          PERFORM create_alv_grid.
      ENDCASE.
    ENDMODULE."
    MODULE pai INPUT.
      g_save_ok = g_ok_code.
      CASE g_save_ok.
        WHEN 'BACK'.
        WHEN 'EXIT'.
        WHEN 'CANCEL'.
          PERFORM exit_program.
        WHEN 'RUNSQL'.
          CALL METHOD g_editor->get_text_as_r3table
            IMPORTING
              table  = g_t_text_lines
            EXCEPTIONS
              OTHERS = 1.
          PERFORM runsql.
      ENDCASE.
    ENDMODULE."
    FORM create_field_catalog.
      DATA: l_structure_name LIKE  dd02l-tabname.
      CLEAR g_t_fcat.
      l_structure_name = l_tab.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = l_structure_name
          i_bypassing_buffer     = 'X'
        CHANGING
          ct_fieldcat            = g_t_fcat
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
    ENDFORM."
    FORM create_alv_grid.
      DATA:        l_s_layout      TYPE lvc_s_layo.
      CLEAR: g_r_alv_container,
             g_r_alv_grid.
      PERFORM create_field_catalog.
      CREATE OBJECT g_r_alv_container
             EXPORTING container_name = g_container.
      CREATE OBJECT g_r_alv_grid
             EXPORTING i_parent = g_r_alv_container.
      CALL METHOD g_r_alv_grid->set_table_for_first_display
        EXPORTING
          is_layout          = l_s_layout
          i_bypassing_buffer = 'X'
        CHANGING
          it_outtab          = <tab>
          it_fieldcatalog    = g_t_fcat.
      CALL METHOD g_r_alv_grid->refresh_table_display.
    ENDFORM."
    FORM exit_program.
      CALL METHOD cl_gui_cfw=>flush
        EXCEPTIONS
          OTHERS = 1.
      LEAVE PROGRAM.
    ENDFORM."

    Hello Bjorn
    I would recommend a few changes:
    (1) Create the container and ALV grid instance for screen '200' only once (in a PBO module of screen '200' using a switch:
    CHECK ( g_r_alv_container IS INITIAL ).
    (2) Call method SET_TABLE_FOR_FIRST_DISPLAY in a PBO module of screen '200'. Perhaps add a "flush" to this PBO module, too.
    Regards
       Uwe

  • 2 alv grids in 1 screen with 2 different header

    Hi All,
    I have a requirement where in I need to display 2 alv grids in 1 screen and each has its own set of header information. If anybody has come across such a requirement then pls send the code. I can do this using BLOCKED list alv but I want to do in grids.
    Thanks in advance.
    Sutapa Sengupta

    thr u go with code..
    Code listing for: Z_011_ALV_GRID_EVENT
    Description: EXAMPLE OF ALV GRID CONTROL
    SCREEN 101 : FLOW LOGIC
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0101.
    MODULE GET_DATA.
    MODULE CREATE_OBJECTS.
    MODULE SHOW_ALV.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0101.
    MODULE POOL Z_011_ALV_GRID_EVENT
    PROGRAM Z_011_ALV_GRID_EVENT.
    CLASS CL_EVENT_HANDLER DEFINITION
    CLASS CL_EVENT_HANDLER DEFINITION.
    PUBLIC SECTION.
    METHODS: ON_DOUBLE_CLICK FOR EVENT
    DOUBLE_CLICK OF CL_GUI_ALV_GRID
    IMPORTING ES_ROW_NO E_COLUMN,
    ON_RIGHT_CLICK FOR EVENT
    RIGHT_CLICK OF CL_GUI_ALV_GRID.
    ENDCLASS. "CL_EVENT_HANDLER DEFINITION
    CLASS CL_EVENT_HANDLER IMPLEMENTATION
    CLASS CL_EVENT_HANDLER IMPLEMENTATION.
    METHOD ON_DOUBLE_CLICK.
    DATA: TEXT TYPE STRING,
    ES_ROW_STRING TYPE STRING.
    ES_ROW_STRING = ES_ROW_NO-ROW_ID.
    CONCATENATE 'ROW : ' ES_ROW_STRING 'COLUMN : '
    E_COLUMN-FIELDNAME INTO TEXT SEPARATED BY SPACE.
    MESSAGE TEXT TYPE 'I'.
    ENDMETHOD. "ON_DOUBLE_CLICK
    METHOD ON_RIGHT_CLICK.
    MESSAGE 'RIGHT MOUSE BUTTON HAS CLICKED !!!' TYPE 'I'.
    ENDMETHOD. "ON_RIGHT_CLICK
    ENDCLASS. "CL_EVENT_HANDLER IMPLEMENTATION
    INCLUDE PROGRAMS
    INCLUDE Z_011_ALV_GRID_EVENT_TOP. " Global Data
    INCLUDE Z_011_ALV_GRID_EVENT_O01. " PBO-Modules
    INCLUDE Z_011_ALV_GRID_EVENT_I01. " PAI-Modules
    INCLUDE Z_011_ALV_GRID_EVENT_F01. " FORM-Routines
    TOP INCLUDE Z_011_ALV_GRID_EVENT_TOP
    TYPES AND DATA DECLARATION
    TABLES: SFLIGHT.
    DATA: OK_CODE TYPE SY-UCOMM,
    IT_SFLIGHT TYPE STANDARD TABLE OF SFLIGHT,
    R_HANDLER TYPE REF TO CL_EVENT_HANDLER,
    R_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
    R_GRID TYPE REF TO CL_GUI_ALV_GRID.
    PBO INCLUDE Z_011_ALV_GRID_EVENT_O01
    Module SHOW_ALV OUTPUT
    MODULE SHOW_ALV OUTPUT.
    CHECK OK_CODE IS INITIAL.
    CALL METHOD R_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    I_STRUCTURE_NAME = 'SFLIGHT'
    CHANGING
    IT_OUTTAB = IT_SFLIGHT.
    ENDMODULE. " SHOW_ALV OUTPUT
    Module GET_DATA OUTPUT
    MODULE GET_DATA OUTPUT.
    CHECK OK_CODE IS INITIAL.
    PERFORM GET_DATA
    USING
    SFLIGHT-CARRID.
    ENDMODULE. " GET_DATA OUTPUT
    Module CREATE_OBJECTS OUTPUT
    MODULE CREATE_OBJECTS OUTPUT.
    IF R_HANDLER IS NOT BOUND. "CHECKS WHETHER A REFERENCE
    "VARIABLE CONTAINS VALID REFERENCE
    CREATE OBJECT R_HANDLER.
    ENDIF.
    IF R_CONTAINER IS NOT BOUND. "CHECKS WHETHER A REFERENCE
    "VARIABLE CONTAINS VALID REFERENCE
    CREATE OBJECT R_CONTAINER
    EXPORTING
    CONTAINER_NAME = 'CC_ALV'.
    ENDIF.
    IF R_GRID IS NOT BOUND.
    CREATE OBJECT R_GRID
    EXPORTING
    I_PARENT = R_CONTAINER.
    SET HANDLER R_HANDLER->ON_DOUBLE_CLICK
    R_HANDLER->ON_RIGHT_CLICK FOR ALL INSTANCES
    ENDIF.
    ENDMODULE. " CREATE_OBJECTS OUTPUT
    Module STATUS_0101 OUTPUT
    MODULE STATUS_0101 OUTPUT.
    SET PF-STATUS 'Z_010_STATUS'.
    "SET TITLEBAR 'xxx'.
    ENDMODULE. " STATUS_0101 OUTPUT
    PAI INCLUDE Z_011_ALV_GRID_EVENT_I01
    Module USER_COMMAND_0101 INPUT
    MODULE USER_COMMAND_0101 INPUT.
    CASE OK_CODE .
    WHEN 'SEARCH'.
    PERFORM GET_DATA
    USING
    SFLIGHT-CARRID.
    CALL METHOD R_GRID->REFRESH_TABLE_DISPLAY.
    WHEN 'EXIT'.
    LEAVE PROGRAM.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0101 INPUT
    FORM INCLUDE Z_011_ALV_GRID_EVENT_F01
    FORM : GET_DATA
    Created : 26.03.2008 12:34:09
    FORM GET_DATA USING VALUE(P_CARRID) TYPE SFLIGHT-CARRID.
    IF P_CARRID IS INITIAL.
    SELECT * FROM SFLIGHT INTO CORRESPONDING
    FIELDS OF TABLE IT_SFLIGHT.
    ELSE.
    SELECT * FROM SFLIGHT INTO CORRESPONDING
    FIELDS OF TABLE IT_SFLIGHT WHERE CARRID = P_CARRID.
    ENDIF.
    ENDFORM. "GET_DATA

  • Hide some cells while displaying ALV GRID !

    Hi guyz!
        Back with lill query,
        While displaying ALV GRID using REUSE_ALV_GRID... FMs ,i need to hide
        some cells by default, when the lists is generated.But those cells should
        be  availble to be displayed by the user from ALV layout settings.
        Please advise
    Thanks
    jahan

    Hi, Check for fm documentation.
    Only relevant if layout parameter
    LAYOUT-GET_SELINFOS of IMPORTING structure IS_LAYOUT is set.
    Complex type for modifying information displayed on the selection dialog box:
    mode:              'R' = Only entries passed in internal table
                              IS_SEL_HIDE-T_ENTRIES are output on
                              the dialog box. Selection information
                              obtained by the list tool by reading the
                              selection screen again (only if the report
                              is called with selection screen) are
                              replaced by the entries passed.
                       'S' = The selection information obtained by the
                              list tool by reading the selection screen
                              of the calling report again, are modified
                              by the entries of table
                              IS_SEL_HIDE-T_ENTRIES.
    t_entries:         Table with selection information
    t_entries-mode:   'A' = Display selection information of the current
                             table row on the information dialog box.
                      'D' = Do not display selection information of the
                             the Select option or of parameter SELNAME
                             on the dialog box.
    t_entries-selname: (required only if t_entries-mode = 'D')
                       name of Select option or parameter
    The following table fields are only required if t_entries-mode = 'A'. They contain the selection information to be added.
    t_entries-field:  DDIC field name of the field for which selection
                       information is to be displayed
    t_entries-table:  DDIC table name of t_entries-field.
    t_entries-stext:  Field description on the information dialog box.
                      If t_entries-field and t_entries-table were
                      filled, this text is taken from the DDIC.
    t_entries-valuf:  Selection condition from-value (external format)
    t_entries-valut:  Selection condition to-value (external format)
    t_entries-sign0:  (I)nclusive (E)xclusive
    t_entries-optio:  All values of the option field of the Select
                      option are allowed.
    The remaining fields are used internally and are irrelevant to the caller.
    aRs

  • Displayig ALV GRID, then a screen with write satetment

    Hi,
    I developed a program to post GL accounts. First I am displaying a report through ALV GRID(OOPS). I am providing a button on the same screen. If the user clicks it, it will post the GL documents, then I want to display the results from this GL posting. Please help me to display the results in other screen. I am not able to do this.
    Thanks,
    Ravi

    Hi Ravi,
    Try this way.
    <li>When you click on POST button on ALV, It posts the documents using some BAPI, Here get the all messages into one internal table. I do not know whether you loop and call BAPI or at a time post all GL a/cs. But You need to gather all the messages into one internal table. After postings, Write LEAVE TO LIST PROCESSING AND RETURN TO SCREEN 0. Then loop your message internal table and display using WRITE statement. LEAVE TO LIST PROCESSING will take you to LIST processing displays in classical way.
    CASE sy-ucomm.
      WHEN 'POST'.
        "Post the documents
        "Gather all the msges into one internal table.
        "Finally call the below statement
        LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
        LOOP AT it_msgs INTO wa_msgs.
          WRITE:/ wa_msgs-message.
        ENDLOOP.
    ENDCASE.
    Thanks
    Venkat.O

  • How to display two grids in same screen using SALV Method

    Hi Freinds,
    Please let me know how to display two grids in same screen using SALV Method.
    Thank you
    Regards,
    SDV

    Using the same concept as described in How to dispaly Three Internal Table  Data (One below another) in ALV OOPS .
    All you need to add is passing your new containers as r_container parementer of factory method.
    "1st one
          cl_salv_table=>factory(
             EXPORTING
               R_CONTAINER    = g_top_container
    "2nd one
          cl_salv_table=>factory(
             EXPORTING
               R_CONTAINER    = g_bottom_container
    Regards
    Marcin

Maybe you are looking for