Refresh a subscreen

Hello,
how can I refresh / redraw a subscreen after an event on the main screen?
Thanks,
Manuel

Hello,
how can I do that without using the statement CALL SCREEN 100 (same screen that is already being displayed)?
On the subscreen I use textboxes that are linked to a structure of the program.So the first time the screen loads automatically the data that is present in the structure. On the double_click event of the ALV grid I change the content of the structure, but the textboxes on the subscreen do not refresh.
Therefore, even though the contents of the structure has changed, the contents of the textboxes remains the old.
Thanks for your help. Points will obviously be rewarded.
Manuel

Similar Messages

  • ALV tree  not getting refreshed

    Hi
    I have 2 fields A and B in the main screen and a tabstrip with 4 tabs.
    Each tab contains a ALV tree
    Now when I open the main screen for the first time the ALV tree data is coming properly as per the default values of A and B.
    But when I change the values of A or B the ALV tree does not get refreshed. The final table has the changed data but the ALV shows only the old data.
    I am doing the ALV tree for the first time in module pool. Please provide some sample code to refresh the ALV tree.
    Regards,

    Hi
    Alv tree is now getting refreshed.The subscreen refresh problem is solved
    we have to use REFRESH_TABLE_DISPLAY method to do it.
    if tree1 is initial
       create object
       create container
      call method set_table_for_first display
    else.
      call method refresh_table_display.
    endif.
    Regards,
    Mozila

  • Modifying different subscreens

    hi!
    i have 2 subscreens on my screen... subscreen A and subscreen B. user interaction is on subscreen A. I have an ALV on subscreen A with a double click event. what i want is whenever i double click a row on the ALV on subscreen A, the elements of subscreen B will display the additional details of the selected row from subscreen A. in effect, I shall be "calling" or "modifying" subscreen B from subscreen A. any inputs on how this can be done? thanks in advance!

    You might like to try the "ZREFRESH" solution I proposed for:
    Refresh a subscreen
    (scroll down that thread a little to see it)... i.e. you can use the method cl_gui_cfw=>set_new_ok_code when a row is double-clicked to trigger a normal user-command that you can handle in your PAI... you can then set your details subscreen from there.
    Jonathan

  • Tabstrip problems

    Hi ALL,
    I am using tabstrip to do the work.
    the flow of call is like this.
    1,define the tabstrip, and subscreen for the tabstrip. and some other needed. we assume that the screen of tabstrip is 0100.
       any direct click on tabstrip can be performed correctly.
    2,after user click one button on the menu, call something like this: perform run_check.
    3,in run_check, updated the tabstrip-activetab, and update the content of subscreen, and also called the refresh of subscreen.
    4,the update of subscreen content is successful. but the tabstrip didn't. 
    5, only after all the operation finished, back to screen 0100, the tabstrip update can be visible.
    didn't there any operation like the refresh to tabstrip???
    Thank you!
    Best Regards,
    Sean
    Edited by: Sean Zhang on Dec 3, 2009 3:10 AM

    Hi Clemens,
    Thank you!
    I have checked it, the tabstrip-ACTIVETAB do changed.
    but if do the leave to screen 0100, the tabstrip is valid. (I mean the leave to 0100  can make the screen 0100 is visible, but I can not do this, because there are some other code to do after the tabstrip is activated)
    so for this kind of way I do like this:
    call screen 0100. then in the pbo of 0100 leave to screen 0.( this can back to the code and go on the following code)
    but this way doesnot work.
    Thanks,
    Best Regards,
    Sean
    Edited by: Sean Zhang on Dec 3, 2009 3:50 AM

  • Subscreen Refresh

    Hi,
    I am having 1 main screen in which there are 4 buttons on application toolbar.
    On 1st button i have table control and on other 3 there are ALV.
    on execution repoort display table control and  if i click on 4th button alv is displayed
    after  displaying of alv if i click on any other button it is displaying same alv and not refreshing subscreen.
    Please suggest ?
    Ankesh

    you need to destroy the previous ALV instance before displaying other ALV using FREE method of class CL_GUI_ALV_GRID and also free the object reference of ALV using FREE statement.
    let say ALV object reference name is lo_alv
    so on click of each button first check if lo_alv is bound.
    if yes then first call destructor lo_alv->free( ).
    and then free the object reference FREE lo_ALV.
    then go ahead and instantiate another ALV.
    Edited by: Gaurav B. on Jan 18, 2012 4:35 PM

  • Getting error while calling a subscreen in  module pool program

    HI  ALL,
                         ACTUALLY I'M GETTING A SYNTAX ERROR WHILE I'M CALLING A SUBSCREEN
                       IN A MODULE POOL PROGRAM IN PAI MODULE
                       THE ERROR IS AS FOLLOW
                           "." or "ID ... FIELD ..." expected after "SUBSCREEN"
                        CAN ANYBODY PLS HELP ME.
    REGARDS
    ANDREWS

    HI MAX ,
                      THE CODE IS AS FOLLOWS:
    *& Report  ZTABSTRIP_PS
    REPORT  ZTABSTRIP_PS.
    type-pools : vrm.
    DATA:number1 type I,
         number2 type I,
         result  type I,
         ok_code like SY-UCOMM,
         employee1 type c,
         ABAP(19)    type c,
         SALES(19)  type c,
         HR(19)      type c,
         MM(19)     type  c,
    employee type c.
        emp type c.
    CONTROLS  tabstrip TYPE TABSTRIP.
    CALL SCREEN 100.
    call screen 110.
    call screen 130.
    call screen 120.
    call screen  140.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'STATUS'.
      SET TITLEBAR 'TITLE'.
      CASE OK_CODE.
        WHEN 'BACK' or 'EXIT' or 'DELETE'.
         leave program.
         WHEN 'SAVE'.
           MESSAGE 'please choose a valid function' TYPE 'I'.
       WHEN 'BACK'.
        leave PROGRAM.
    when  'EXIT' or 'DELETE'.
        leave to screen 0.
        WHEN 'SAVE'.
          MESSAGE 'please choose a valid function' TYPE 'I'.
    endcase.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
    CASE OK_CODE.
      when 'TAB1'.
    tabstrip-activetab = 'TAB1'.
       when 'TAB2'.
    tabstrip-activetab = 'TAB2'.
    result = number1 + number2.
       when 'TAB3'.
      tabstrip-activetab = 'TAB3'.
    SET TITLEBAR 'TITLE1'.
      when 'TAB4'.
        tabstrip-activetab = 'TAB4'.
       if employee = 'NEERAJ'.
         ABAP = 'NEERAJ'.
       elseif employee = 'UMESH'.
         SALES = 'UMESH'.
       ELSEIF employee = 'RAM'.
         HR = 'RAM'.
       elseif employee = 'ANIL'.
         MM = 'ANIL'.
         endif.
       employee = employee.
    WHEN 'BACK'.
        leave PROGRAM.
    when  'EXIT' or 'DELETE'.
        leave to screen 0.
        WHEN 'SAVE'.
          MESSAGE 'please choose a valid function' TYPE 'I'.
    ENDCASE.
       WHEN 'BACK' or 'EXIT' or 'DELETE'.
         leave program .
         WHEN 'SAVE'.
           MESSAGE 'please choose a valid function' TYPE 'I'.
    endcase.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  STATUS_0110  OUTPUT
          text
    **MODULE STATUS_0110 OUTPUT.
    SET PF-STATUS 'STATUS1'.
    SET TITLEBAR 'xxx'.
    **case ok_code.
    **WHEN 'back' or 'exit' or 'delete'.
        leave PROGRAM.
        WHEN 'save'.
          MESSAGE 'please choose a valid function ' TYPE 'W'.
    ENDCASE.
    **ENDMODULE.                 " STATUS_0110  OUTPUT
    *&      Module  USER_COMMAND_0110  INPUT
          text
    MODULE USER_COMMAND_0110 INPUT.
      number1 = number1.
      number2 = number2.
    CLEAR NUMBER1.
    CLEAR NUMBER2.
    REFRESH NUMBER1.
    REFRESH NUMBER2.
    ENDMODULE.                 " USER_COMMAND_0110  INPUT
    *&      Module  STATUS_0130  OUTPUT
          text
    MODULE STATUS_0130 OUTPUT.
    SET PF-STATUS 'STATUS2'.
    SET TITLEBAR 'xxx'.
    RESULT = number1 + number2.
    *CLEAR RESULT.
    REFRESH RESULT.
    ENDMODULE.                 " STATUS_0130  OUTPUT
    *&      Module  STATUS_0120  OUTPUT
          text
    MODULE STATUS_0120 OUTPUT.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    DATA:  l_name TYPE vrm_id,
            li_list TYPE vrm_values,
            l_value LIKE LINE OF li_list.
      l_value-key = '1'.
      l_value-text = 'ANIL'.
      APPEND l_value TO li_list.
      CLEAR l_value.
    CLEAR li_list.
      l_value-key = '2'.
      l_value-text = 'RAM'.
      APPEND l_value TO li_list.
      CLEAR l_value.
    CLEAR li_list.
      l_value-key = '3'.
      l_value-text = 'NEERAJ'.
      APPEND l_value TO li_list.
      CLEAR l_value.
    CLEAR li_list.
      l_value-key = '4'.
      l_value-text = 'UMESH'.
      APPEND l_value TO li_list.
      CLEAR l_value.
    CLEAR li_list.
    l_name =  'employee'.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          ID                    =  l_name
          VALUES                =  li_list
       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.
    CLEAR li_list.
    ENDMODULE.                 " STATUS_0120  OUTPUT
    *&      Module  USER_COMMAND_0120  INPUT
          text
    MODULE USER_COMMAND_0120 INPUT.
    INCLUDING sy-repid '140'.
    employee1 = employee.
    IF employee1 CS 'NEERAJ'.
      call SUBSCREEN    sub4  .
      ABAP = 'NEERAJ'.
      CLEAR ABAP.
    ELSEIF employee1 CS 'UMESH'.
       call SUBSCREEN  sub4  .
        SALES = 'UMESH'.
        CLEAR SALES.
    elseif employee1 CS 'RAM'.
      call SUBSCREEN sub4 .
       HR = 'RAM'.
       CLEAR  HR.
    ELSEIF employee1 CS 'ANIL'.
       call SUBSCREEN sub4 .
       MM = 'ANIL'.
       CLEAR MM.
       endif.
    ENDMODULE.                 " USER_COMMAND_0120  INPUT
    *&      Module  STATUS_0140  OUTPUT
          text
    MODULE STATUS_0140 OUTPUT.
    *CASE OK_CODE.
       WHEN employee1  'NEERAJ'.
         screen-active = 1.
         ABAP = 'NEERAJ'.
       WHEN employee1 = 'UMESH'.
         screen-active = 1.
         SALES = 'UMESH'.
       WHEN employee1 = 'RAM'.
         screen-active = 1.
         HR = 'RAM'.
       WHEN employee1 = 'ANIL'.
         screen-active = 1.
         MM = 'ANIL'.
         endif.
    *ENDCASE.
    ENDMODULE.                 " STATUS_0140  OUTPUT

  • ALV grid in Subscreen

    Hi all,
    I have a subscreen with ALV grid in module pool program.
    The main screen has two subscreens (one is header and other is items/reports)
    from the main screen, the ALV Grid subscreen can be called in two ways.
    1. from application tool bar (show report button) - ALV grid will be displayed in Items/Reports subscreen.
    2. In Items/Reports subscreen, while displaying items there is a requirement to display same ALV grid subscreen report on hotspot of particular item.
    ALV Grid in subscreen displaying only first come first serve for subscreen, if the subscreen called from application toolbar button then the ALV grid from items hotspot call not displaying and vice versa.
    Not sure where i am doing wrong, but if i free the container, alv and re-generate all the objects its working fine but user doesn't like the flickering display of conatiner when it re-generating.
    Any suggestions would help.
    Regards
    Syed

    Hi Aruna Kumara,
    Thanks for the reply.
    I have only one ALV grid instance.
    Process Flow from Application toolbar
    Main Screen: 100
    PBO:
    CALL SUBSCREEN C_REPORT INCLUDING SY_REPID '0300'.
    SUBSCREEN: 300
    PBO:
    IF CONTAINER IS NOT BOUND.
         CREATE Container.           with container name
         CREATE ALV_Grid.           passing container created
         BUILD FIELDCAT.
         CREATE EVENTS.
         CALL METHOD SET_DISPLAY_TABLE_FIRST.
    ELSE.
         REFRESH_TABLE_DISPLAY.
         FLUSH.     "tried with without flush too.
    ENDIF.
    Process Flow from Items:
    Items table is a subscreen 200 in main screen.
    When the desired item click thru hotspot, a Modal dialog screen 250 open with subscreen element.
    In event hotspot_click.
    CALL SCREEN 250 STARTING AT ...ENDING AT.
    PBO of 250:
    CALL SUBSCREEN C_REPORT INCLUDING SY-REPID '0300'.
    SubScreen 0300:
    PBO as describe above, as the container already bound next time it refreshes the table display. But i see a blank screen in Popup.
    Hope this helps.
    Regards
    Syed

  • Need to function module to clear Subscreen contents

    Hi.
    can anyone say Function module which clears the contents of Subscreen when navigated from subscreen to subscreen.
    MY Problem:
    i have 6 subscreen.(A,B,C,D,E,F) each subscreen has 100 checkboxes.
    i checked some checkboxes of subscreen A. And navigated to subscreen B. And again navigated back to subscreen A.
    I found all the checkboxes what i checked before are checked. I want them to be unchecked(screen not refreshed), when i come back to that subscreen.
    Any Function module avaliable to refresh screen contents.
    Help me.

    Don't think so. I am affraid you will have to clear all checkboxes one by one. Anyhow you can use field symbols to address them dynamically and clear their content.
    "suppose you have checkboxes ch_01, ch_02 ... ch99
    field-symbols <checkbox> type any.
    data: g_checkbox_name type string.
    data: n_index(2) type n.
    do 99 times.
      n_index = sy-index.
      concatenate 'CH_' n_index into  g_checkbox_name.
      assign (g_checkbox_name) to <checkbox>.
      check sy-subrc = 0.
       "cleat the content of subsequent checkboxes
       clear <checkbox>.
    enddo.
    Regards
    Marcin

  • Callin two different subscreens which belong to different function groups

    hi,
    I have a  main screen which contains two subscreens say 'sub1' and 'sub2'. This main screen is part of the function group say 'A'. 'sub1' is also part of this function group 'A' and hence i am able to get the data. But, 'sub2' is part of the function group 'B'. So when i call this subscreen i am unable to fetch the data. So, i wanted to know is there any way to fetch the data from the function group "B" and display it in the subscreen of function group "A".
    i wrote the codes like this:
    PBO:
    CALL SUBSCREEN sub1
            INCLUDING 'SAPLZNEW_ORDER' c_sub1.
      CALL SUBSCREEN sub2
            INCLUDING 'SAPLZ_CONTENT' c_sub2.
    PAI:
    call subscreen sub1.
    call subscreen sub2.
    The above is not working because the internal tables get refreshed when the call to subscreen 'sub2' is done.
    Help will be appreciated with points.
    Thanks.

    Hi
    U have to create 2 fm in function group B:
    - one to transfer the data from main screen (so fg A) to subscreen SUB2 (so fg B)
    - one to return the data from subscreen SUB2 (so fg B) to main screen (so fg A).
    PROCESS PBO.
      CALL SUBSCREEN sub1 INCLUDING 'SAPLZNEW_ORDER' c_sub1.
      MODULE TRANSFER_DATA_TO_SUB2.
      CALL SUBSCREEN sub2 INCLUDING 'SAPLZ_CONTENT' c_sub2.
    PROCESS PAI.
      call subscreen sub1.
      call subscreen sub2.
      MODULE GET_DATA_FROM_SUB2.
    So u need to insert a module before calling subarea SUB2 in order to transfer the data:
    MODULE TRANSFER_DATA_TO_SUB2.
       CALL FUNCTION 'Z_SET_DATA'
           EXPORTING
    ENDMODULE.
    The IMPORTING paramenter of this new fm has to allow to transfer all data u need to manage the subscreen of SAPLZ_CONTENT.
    Here u can insert all code in order to fill the input/output field of subscreen.
    In PAI u can insert another fm in ordert to get the data setted in subscreen of SAPLZ_CONTENT':
    MODULE TRANSFER_DATA_TO_SUB2.
       CALL FUNCTION 'Z_GET_DATA'
           IMPORTING
    ENDMODULE.
    The EXPORTING paramenter of this new fm has to allow to transfer all data u need to manage in main screen.
    It's import both function modules belong to the function group Z_CONTENT.
    Max

  • Subscreen in Screen Painter

    Hi Friends,
    I have created a layout in screen painter using Tabstrip with wizard which is having Tabstrip control with four tabs. 
    Now I want to attach to table to each tab,so that I can input some data and save in the table.
    I request you to kindly guide me as to how to do the same.
    TIA.
    Regards,
    Mark K

    Hi
      Insert subscreens in 4 tabs and give names to those subscreens, and create these 4 screens and change the attributes of these screens to subscreen, and call them in main screen like this.
    process before output.
    MODULE STATUS_1000.
    call subscreen: <subscreen area1> including sy-repid s_no, -> <b>Screen no variable</b>
                             <subscreen area2> including sy-repid s_no,
    process after input.
      module user_command_1000.
    call subscreen : <subscreen area1>,<subscreen area2>.
    In the main screen code the program somewhat like this.
    *& Module pool       ZHTABSTRIP_CONTROL                                *
    program  zhtabstrip_control                      .
    tables : lfa1,kna1,mara,vbak.
    data : begin of itab occurs 0,
             lifnr like lfa1-lifnr,
             name1 like lfa1-name1,
             kunnr like kna1-kunnr,
             land1 like kna1-land1,
             matnr like mara-matnr,
             ersda like mara-ersda,
             ernam like mara-ernam,
             vbeln like vbak-vbeln,
             erdat like vbak-erdat,
             erzet like vbak-erzet,
           end of itab.
    controls : tabstrip type tabstrip.
    data: s_no like sy-dynnr value 100. -> <b>screen no which u r calling for the subscreen.</b>
    *&      Module  USER_COMMAND_1000  INPUT
          text
    module user_command_1000 input.
      case sy-ucomm.
        when 'VEND'.
         s_no = 100.
         tabstrip-activetab = 'VEND'.
        when 'CUST'.
         s_no = 200.
         tabstrip-activetab = 'CUST'.
        when 'MAT'.
         s_no = 300.
         tabstrip-activetab = 'MAT'.
        when 'SD'.
         s_no = 400.
         tabstrip-activetab = 'SD'.
        when 'EXIT'.
         leave program.
      endcase.
    endmodule.                 " USER_COMMAND_1000  INPUT
    *&      Module  STATUS_0100  OUTPUT
          text
    module status_0100 output.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    select * from lfa1 into corresponding fields of table itab.
    read table itab index 3.
      lfa1-lifnr = itab-lifnr.
      lfa1-name1 = itab-name1.
    refresh itab.
    endmodule.                 " STATUS_0100  OUTPUT
    *&      Module  STATUS_0200  OUTPUT
          text
    module status_0200 output.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    refresh itab.
    select * from kna1 into corresponding fields of table itab.
    read table itab index 1.
      kna1-kunnr = itab-kunnr.
      kna1-land1 = itab-land1.
    endmodule.                 " STATUS_0200  OUTPUT
    *&      Module  STATUS_0300  OUTPUT
          text
    module status_0300 output.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    refresh itab.
    select * from mara into corresponding fields of table itab.
    read table itab index 5.
      mara-matnr = itab-matnr.
      mara-ersda = itab-ersda.
      mara-ernam = itab-ernam.
    endmodule.                 " STATUS_0300  OUTPUT
    *&      Module  STATUS_0400  OUTPUT
          text
    module status_0400 output.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    refresh itab.
    select * from vbak into corresponding fields of table itab.
    read table itab index 7.
      vbak-vbeln = itab-vbeln.
      vbak-erdat = itab-erdat.
      vbak-erzet = itab-erzet.
    endmodule.
    Hope this code will give you some idea.
    Regards
    Haritha.

  • Subscreen ALV reload

    Hi,
    I got a dynpro which contains a subscreen. The dynpro is called after a selection screen. In the dynpro, I add a couple of lines to the alv-table and refresh it - works fine.
    Problem is if i leave the dynpro with the back button (leave to screen 0) and enter it again, the old alv-table is displayed, even the internal table in the background is empty?!
    Does anyone know why this happens? Do I have to delete the alv instance in a certain way? A clear doesn't work here.
    Thanks in advance!
    Regards,
    Tobi

    Hi,
    Clearing reference variable is not enough here, as corresponding proxy object still resides in frontend. You need to free that object before clearing alv ref.
    r_alv->free( ).
    clear r_alv.
    Now each time you enter that screen recreate alv. New object will replace old one .
    Regards
    Marcin

  • Graph in a subscreen area

    Hi Experts,
    How do you create a graph in a subscreen?
    I checked out transaction GRAL but all the graph charts popup in a separate screen.
    Moreover I do not want the BOXES internal table attached to the chart.  How do you suppress this functionality? Because in it's place I need an ALV tree instead.
    Thanks!

    Hi Guys,
    Very helpful, but this presents a new problem.
    The chart data is not static, I need to refresh the graph when data is changed.
    The Gantt chart generated by the Chart Designer is an XML file that is very very huge to code into abap using the IF_XML_ELEMENT classes as per sample program GRAPHICS_GUI_CE_DEMO.
    So I would like to use the XML file as a template in my dialog program and change it when the data changes. Any ideas how to do this?
    Thanks!

  • Deactivate buttons in ALV GRID being called in subscreen

    Hi,
    In a screen, when a specific tab is selected (tab strip), the subscreen area is filled with ALV GRID. I need to deactivate few buttons on the ALV GRID. How can that be done??
    Advance Thanks

    Hi Aadarsh,
    Check out the following program.
    Global data definitions for ALV
    To allow the declaration of gr_event_handler before the
    lcl_event_receiver class is defined, decale it as deferred in the
    start of the program
    CLASS lcl_event_handler DEFINITION DEFERRED.
    Object reference
    ALV Grid instance reference
    DATA: gr_alvgrid    TYPE REF TO cl_gui_alv_grid,
    Custom container instance reference
          gr_ccontainer TYPE REF TO cl_gui_custom_container,
    Event class reference
          gr_event_handler TYPE REF TO lcl_event_handler.       "IC210507+
    Internal Table
    Field catalog table
    DATA: gt_fieldcat TYPE lvc_t_fcat,
    Internal table holding list data
          gt_list     TYPE STANDARD TABLE OF sflight,
    Table to be filled up for excluding some of the standard function
    buttons
          gt_exclude  TYPE ui_functions.                        "IC210507+
    Work area
    Layout structure
    DATA: gs_layout   TYPE lvc_s_layo,
    Field catalog structure
          gs_fcat     TYPE lvc_s_fcat,
    Exclude button structure
          gs_exclude  TYPE ui_func,                             "IC210507+
    Structure to add button in the ALV toolbar
          gs_toolbar  TYPE stb_button.                          "IC210507+
    Variables
    DATA: ok_code                TYPE sy-ucomm,
          save_ok                TYPE sy-ucomm,
    Name of the custom control added on the screen
          gv_custom_control_name TYPE scrfname VALUE 'CC_ALV'.
    Begin of IC210507
    Local classes
    CLASS lcl_event_handler DEFINITION .
      PUBLIC SECTION.
        METHODS:
    To add new functional buttons to the ALV toolbar
        handle_toolbar      FOR EVENT toolbar OF cl_gui_alv_grid
                            IMPORTING e_object e_interactive,
    To implement user commands
        handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
                            IMPORTING e_ucomm.
    ENDCLASS.                    "lcl_event_handler DEFINITION
    End of IC210507
    Calling the screen where ALV output is displayed
    CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
          PBO
    MODULE status_0100 OUTPUT.
    ALV display
      PERFORM display_alv.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          PAI
    MODULE user_command_0100 INPUT.
      save_ok = ok_code.
      CLEAR ok_code.
      IF save_ok EQ 'EXIT'.
        LEAVE PROGRAM.
      ENDIF.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  display_alv
          ALV display
    FORM display_alv.
      PERFORM get_data.
      PERFORM create_alv.
    ENDFORM.                    " display_alv
    *&      Form  get_data
          Fetch data to be displayed in the list
    FORM get_data.
      SELECT * FROM sflight
               INTO TABLE gt_list.
    ENDFORM.                    " get_data
    *&      Form  create_alv
          Create and set or Refresh ALV
    FORM create_alv.
    Checking whether an instance of the container (or ALV Grid) exists.
      IF gr_alvgrid IS INITIAL.
    If not, creating and setting ALV for the first display.
    Creating custom container instance
        CREATE OBJECT gr_ccontainer
          EXPORTING
            container_name              = gv_custom_control_name
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6.
    Creating ALV Grid instance
        CREATE OBJECT gr_alvgrid
          EXPORTING
            i_parent          = gr_ccontainer
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            OTHERS            = 5.
    Begin of IC210507
    Creating an instance for the event handler
        CREATE OBJECT gr_event_handler.
    Registering handler methods to handle ALV Grid events
        SET HANDLER gr_event_handler->handle_user_command FOR gr_alvgrid.
        SET HANDLER gr_event_handler->handle_toolbar FOR gr_alvgrid.
    End of IC210507
    Preparing field catalog.
        PERFORM prepare_field_catalog CHANGING gt_fieldcat.
    Preparing layout structure
        PERFORM prepare_layout CHANGING gs_layout.
    Excluding Unwanted Standard Function Buttons
        PERFORM exclude_tb_functions CHANGING gt_exclude.       "IC210507+
    Method to display ALV grid
        CALL METHOD gr_alvgrid->set_table_for_first_display
          EXPORTING
            is_layout                     = gs_layout
    To exclude buttons the exclusion table must be passed to the following
    field
            it_toolbar_excluding          = gt_exclude          "IC210507+
          CHANGING
            it_outtab                     = gt_list
            it_fieldcatalog               = gt_fieldcat
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
    To make ALV show our additional buttons, we must call the method
    “set_toolbar_interactive” for the ALV Grid instance after the instance
    is created.
        CALL METHOD gr_alvgrid->set_toolbar_interactive.       "IC210507+
      ELSE.
    If an instance of the container (or ALV Grid) exists, refreshing it.
        CALL METHOD gr_alvgrid->refresh_table_display
          EXCEPTIONS
            finished = 1
            OTHERS   = 2.
      ENDIF.
    ENDFORM.                    " create_alv
    *&      Form  prepare_field_catalog
          Subroutine to populate field catalog
         <--P_GT_FIELDCAT  Table to describe the field catalog
    FORM prepare_field_catalog  CHANGING p_gt_fieldcat TYPE lvc_t_fcat.
    Generating the field catalog semi automatically
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'SFLIGHT'
        CHANGING
          ct_fieldcat            = p_gt_fieldcat
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      LOOP AT p_gt_fieldcat INTO gs_fcat.
        CASE gs_fcat-fieldname.
          WHEN 'CARRID'.
            gs_fcat-outputlen = '10'.
            gs_fcat-coltext = 'Airline Carrier ID'.
            MODIFY p_gt_fieldcat FROM gs_fcat.
          WHEN 'FLDATE'.
            gs_fcat-just = 'C'.
            gs_fcat-hotspot = 'X'.
            MODIFY p_gt_fieldcat FROM gs_fcat.
        ENDCASE.
      ENDLOOP.
    ENDFORM.                    " prepare_field_catalog
    *&      Form  prepare_layout
          Preparing layout structure
         <--P_GS_LAYOUT  Layout structure
    FORM prepare_layout  CHANGING p_gs_layout TYPE lvc_s_layo.
      p_gs_layout-zebra = 'X' .
      p_gs_layout-grid_title = 'Flight Info System'.
      p_gs_layout-smalltitle = 'X'.
    ENDFORM.                    " prepare_layout
    Begin of IC210507
    *&      Form  exclude_tb_functions
          Excluding Unwanted Standard Function Buttons
         <--P_GT_EXCLUDE  Table to be filled up to exclude buttons
    FORM exclude_tb_functions  CHANGING p_gt_exclude TYPE ui_functions.
    “MC_FC_” are names for functions directly and the names beginning with
    “MC_MB_” are for the function menus including some subfunctions as menu
    entries.
    In this case 'Maximum' and 'Minimum' options under 'Sum' button & 'Print'
    button are excluded
      gs_exclude = cl_gui_alv_grid=>mc_fc_maximum.
      APPEND gs_exclude TO p_gt_exclude.
      gs_exclude = cl_gui_alv_grid=>mc_fc_minimum.
      APPEND gs_exclude TO p_gt_exclude.
      gs_exclude = cl_gui_alv_grid=>mc_fc_print.
      APPEND gs_exclude TO p_gt_exclude.
    ENDFORM.                    " exclude_tb_functions
    *&       Class (Implementation)  lcl_event_handler
           Event handler for the ALV Grid instance.
    CLASS lcl_event_handler IMPLEMENTATION.
    Handle Toolbar
      METHOD handle_toolbar.
        PERFORM handle_toolbar USING e_object e_interactive .
      ENDMETHOD .                    "handle_toolbar
    Handle User Command
      METHOD handle_user_command .
        PERFORM handle_user_command USING e_ucomm .
      ENDMETHOD.                    "handle_user_command
    ENDCLASS.               "lcl_event_handler
    *&      Form  handle_toolbar
          Subroutine called from event handler method for event toolbar.
          This is to add a new button in the ALV application toolbar
         -->P_E_OBJECT
         -->P_E_INTERACTIVE
    FORM handle_toolbar  USING    p_e_object TYPE REF TO cl_alv_event_toolbar_set
                                  p_e_interactive.
    Begin of 'Adding a new Button'
      CLEAR gs_toolbar.
    Function code
      MOVE 'EXIT' TO gs_toolbar-function.
    Button type that will be added to the toolbar
      gs_toolbar-butn_type = 0.
    Icon for the button
    From the type group ICON in SE11, we can get the value to be passed
    for icon
      gs_toolbar-icon = '@2N@'.
    Quick info for the button
      MOVE 'Exit' TO gs_toolbar-quickinfo.
    Text for the button
      MOVE 'Exit' TO gs_toolbar-text.
    Adds the button as disabled if set to X
      MOVE ' ' TO gs_toolbar-disabled.
    Appending the structure to the table attribute “mt_toolbar” of the object
      APPEND gs_toolbar TO p_e_object->mt_toolbar.
    End of 'Adding a new Button'
    Begin of 'Disabling an existing standard Button'
      LOOP AT p_e_object->mt_toolbar
              INTO gs_toolbar
    Identify which button to disable from the function code
    In this case disabling the 'Filter' button
              WHERE function = '&MB_FILTER'.
    Set the 'DISABLED' field to disable a button
        gs_toolbar-disabled = 'X'.
        MODIFY p_e_object->mt_toolbar FROM gs_toolbar.
      ENDLOOP.
    End of 'Disabling an existing standard Button'
    ENDFORM.                    " handle_toolbar
    *&      Form  handle_user_command
          Implement any new function
         -->P_E_UCOMM  text
    FORM handle_user_command  USING    p_e_ucomm TYPE syucomm.
      IF p_e_ucomm EQ 'EXIT'.
        LEAVE PROGRAM.
      ENDIF.
    ENDFORM.                    " handle_user_command
    End of IC210507
    Award points if found useful.
    Regards
    Indrajit.

  • Module pool data buffer refresh

    Hi,
    I am facing a strange issue in my module pool program for a infotype
    I have created module pool with different screens.
    screen  contains 2 tabs and 2 subscreens.
    in one subscreen, if i go into edit mode and change the values in screen, If i save (usnig standard SAVE button) it is not holding the new value.  it is refreshing picking the value from old value only.
    Please help me here

    Hi,
    What you need to do is to modify the contents of the table control back into the internal table whenever any user action is performed.
    So in PAI of the screen on which you have a table control write code to modify the internal table from the table control.
    it_zekpo is my internal table w/o header line,
    wa_zekpo is work area.
    Name of input/output fields on screen are:-
    wa_zekpo-field1,
    wa_zekpo-field2, and so on...
    At Screen Logic:-
    PROCESS BEFORE OUTPUT.
    *  MODULE status_8003.
      LOOP WITH CONTROL po_tab. "po_tab is table control on screen 8003
        MODULE read_data.
      ENDLOOP.
    PROCESS AFTER INPUT.
    *  MODULE user_command_8003.
      LOOP WITH CONTROL po_tab.
        MODULE modify_data.
      ENDLOOP.
    In PBO:-
    *&      Module  READ_DATA  OUTPUT
    MODULE read_data OUTPUT.
      READ TABLE it_zekpo INTO wa_zekpo INDEX po_tab-current_line. "po_tab is table control name
      data : line_count type i.
      describe it_zekpo
      lines line_count.
      po_tab-lines = line_count + 10.
      "to increase the number of lines in table control dynamically
    ENDMODULE.                 " READ_DATA  OUTPUT
    In PAI,
    *&      Module  MODIFY_DATA  INPUT
    MODULE MODIFY_DATA INPUT.
      MODIFY IT_ZEKPO FROM WA_ZEKPO INDEX po_tab-currentline.
      "this will modify the contents of existing line
    ENDMODULE.                 " MODIFY_DATA  INPUT
    Now whenever you change contents in table control and perform any user action, PAI will be triggered and data in internal table will be modified. Now when PBO is executed then it will read the data again from internal table (modified in this case) into table control.
    Hope this helps you.
    Regards,
    Tarun

  • PAI of subscreen

    Hi I am enhancing cat2 transaction using screen exit. Now SAP has provided a subscreen for customer use and I am trying to add a few fields in the subscreen, open to user input, and want to populate value into an output field in the PAI.
    But the problem is that at no point is the PAI module of subscreen executed.Has anyone encountered such a problem? IIf yes please do share

    Hi,
    We generally call a screen in PAI.
    MODULE user_command_9001 INPUT.
    CASE g_ok_code .
        WHEN 'SUBM'.
          PERFORM f0601_save.
        WHEN 'SHOW'.
          CLEAR : g_wa_outtab_1,
                  g_wa_outtab_1.
          REFRESH : g_t_outtab_1,
                    g_t_outtab_1[].
          PERFORM f0600_show_selections.
          CALL SCREEN 9002 STARTING AT 1 1 ENDING AT 130 20.
      ENDCASE.
    ENDMODULE.
    Hope this helps you.
    Thanx,
    dhanashri.

Maybe you are looking for

  • BADI for restrict creation of business transaction independently

    Hello Experts, I have a requirement where I need to check if the Business activity (say any 'Z' transaction) has a opportunity follow-up document then only that business transaction need to be executed else should give the error that "Z transaction n

  • Can you set a single FILEGROUP to READONLY without getting exclusive access to the entire DB?

    I'm in the process of building a partitioned table with a sliding-window partition.  I have several years of historical static image data that will be moved to individual filegroups created to hold year's worth of data each.  The Business requires th

  • Thunderbolt Display and MBA Display options

    if i make any application ( chrome, spotify etc ) full screen either on MBA display or on the Thunderbolt screen, the other screen goes grey. How can make an application like spotify, chrome full screen on Thunderbolt display but still keep using out

  • Connecting to a WPA2 Wifi network

    I am trying to connect to a wifi access point at work. we have WPA2 security enabled. My phone finds the network but when I enter the password it always says that I have entered the incorrect password. We have changed the password and tried multiple

  • Block stock return to vendor.

    Sir i wish to return material back to vendor from block stock .How to do this.I know that by movement type 122 we can return material back to vendore from unrestected stock. I am online.......