ALV Grid Refresh prpblem

Hi all,
  In custom infotype we had a requirement to have a alv. So we created a container and we are displaying alv.
The alv is working fine. But, when we go in display mode, it shows the same alv for all the records, say if there are 3 records in infotype and if we select 'Next' button, the alv is not refreshing the contents.
We tried all the possiblities like refresh_table_display, free the container, clearing the table, freeing the grid etc. But nothing is working.
Please let us know.
Thanks,

Thanks for the reply. So it means that the below coding should be executed only once.
So, it should be somewhere in the declaration or something?
Now this is in PBO and whenever the user clicks the Next button this will get executed. But at the end of PBO this container and ref_grid has been freed.   
CREATE OBJECT container
      EXPORTING
        container_name = 'CONTAINER'.               "name of container in module pool
    CREATE OBJECT ref_grid
      EXPORTING
        i_parent = container.

Similar Messages

  • Reg : ALV Grid Refresh - Output not appearing

    Hi All ,
    Am calling a screen 100 at 3 different places.
    Though i use refresh_table_display , The value in the output table, say i_final changes, but while displaying the output , the whole screen is blank , even the container is not appearing in the output .
    Can you please help me with your inputs .
    Regards,
    Chitra

    yes it is good ...see the example...for your requirement..
    REPORT yztest .
    TYPE-POOLS: slis.
    Tables
    TABLES: mara.
    TYPES: BEGIN OF ty_name,
           name  TYPE char10,
           age   TYPE i,
           END OF ty_name.
    TYPES: BEGIN OF ty_marks,
           sub1   TYPE i,
           sub2   TYPE i,
           total  TYPE  i,
           END OF ty_marks.
    TYPES: BEGIN OF ty_phone,
           phnum TYPE char10,
           END  OF ty_phone.
    TYPES: BEGIN OF ty_addr,
           address TYPE char20,
           END  OF ty_addr .
    Output internal table
    DATA: itab TYPE TABLE OF ty_name,
          wa   TYPE ty_name,
          itab1 TYPE TABLE OF ty_marks,
          wa1  TYPE ty_marks,
          itab2 TYPE TABLE OF ty_phone,
          wa2  TYPE ty_phone,
          itab3 TYPE TABLE OF ty_addr,
          wa3  TYPE ty_addr.
    ALV Grid
    DATA: r_grid  TYPE REF TO cl_gui_alv_grid,
          r_grid1 TYPE REF TO cl_gui_alv_grid,
          r_grid2  TYPE REF TO cl_gui_alv_grid,
          r_grid3  TYPE REF TO cl_gui_alv_grid,
          g_dock TYPE REF TO cl_gui_docking_container,
          g_dock1 TYPE REF TO cl_gui_docking_container,
          g_dock2 TYPE REF TO cl_gui_docking_container,
          g_dock3 TYPE REF TO cl_gui_docking_container,
          g_dock4 TYPE REF TO cl_gui_docking_container,
          it_fieldcat  TYPE lvc_t_fcat,
          it_fieldcat1 TYPE lvc_t_fcat,
          it_fieldcat2 TYPE lvc_t_fcat,
          it_fieldcat3 TYPE lvc_t_fcat,
          wa_fieldcat TYPE lvc_s_fcat.
    DATA picture TYPE REF TO cl_gui_picture.
    DATA url(255).
    CLEAR url.
    DATA  init.
    START-OF-SELECTION.
      wa-name = 'test01'.
      wa-age = '1'.
      APPEND wa TO itab.
      wa-name = 'test02'.
      wa-age = '2'.
      APPEND wa TO itab.
      wa-name = 'test03'.
      wa-age = '3'.
      APPEND wa TO itab.
      wa1-sub1 = '11'.
      wa1-sub2 = '22'.
      wa1-total = wa1-sub1 + wa1-sub2.
      APPEND wa1 TO itab1.
      wa1-sub1 = '22'.
      wa1-sub2 = '33'.
      wa1-total = wa1-sub1 + wa1-sub2.
      APPEND wa1 TO itab1.
      wa2-phnum = '99999999999'.
      APPEND wa2 TO itab2.
      wa2-phnum = '888888888888'.
      APPEND wa2 TO itab2.
      wa2-phnum = '777777777777'.
      APPEND wa2 TO itab2.
      wa3-address = 'HItech City'.
      APPEND wa3 TO itab3.
      wa3-address = 'Secunderabad'.
      APPEND wa3 TO itab3.
      wa3-address = 'Hyderabad'.
      APPEND wa3 TO itab3.
      PERFORM display_image.
      CALL SCREEN 100.
    *& Module STATUS_0100 OUTPUT
    text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'LISTOUT1'.
      SET TITLEBAR 'LIST1'.
      wa_fieldcat-fieldname = 'NAME'.
      wa_fieldcat-seltext   = 'NAME OF THE STUDENT'.
      wa_fieldcat-coltext =   'NAME OF THE STUDENT'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname = 'AGE'.
      wa_fieldcat-seltext   = 'AGE OF THE STUDENT'.
      wa_fieldcat-coltext =    'AGE OF THE STUDENT'.
      APPEND wa_fieldcat TO it_fieldcat.
      wa_fieldcat-fieldname = 'SUB1'.
      wa_fieldcat-seltext   = 'SUBJECT1'.
      wa_fieldcat-coltext =    'SUBJECT1'.
      APPEND wa_fieldcat TO it_fieldcat1.
      wa_fieldcat-fieldname = 'SUB2'.
      wa_fieldcat-seltext   = 'SUBJECT2'.
      wa_fieldcat-coltext =    'SUBJECT2'.
      APPEND wa_fieldcat TO it_fieldcat1.
      wa_fieldcat-fieldname = 'TOTAL'.
      wa_fieldcat-seltext   = 'TOTAL'.
      wa_fieldcat-coltext =    'TOTAL'.
      APPEND wa_fieldcat TO it_fieldcat1.
      wa_fieldcat-fieldname = 'PHNUM'.
      wa_fieldcat-seltext   = 'PHONE NO'.
      wa_fieldcat-coltext =    'PHONE NO'.
      APPEND wa_fieldcat TO it_fieldcat2.
      wa_fieldcat-fieldname = 'ADDRESS'.
      wa_fieldcat-seltext   = 'ADDRESS'.
      wa_fieldcat-coltext =    'ADDRESS'.
      APPEND wa_fieldcat TO it_fieldcat3.
      IF g_dock IS INITIAL.
        CREATE OBJECT g_dock
                      EXPORTING
                      repid     = sy-repid
                      dynnr     = sy-dynnr
                      side      = g_dock->dock_at_left
                      extension = 300.
        CREATE OBJECT r_grid
                  EXPORTING
                  i_parent = g_dock.
      ENDIF.
      IF g_dock1 IS INITIAL.
        CREATE OBJECT g_dock1
                      EXPORTING
                      repid     = sy-repid
                      dynnr     = sy-dynnr
                      side      = g_dock1->dock_at_right
                      extension = 300.
        CREATE OBJECT r_grid1
                  EXPORTING
                  i_parent = g_dock1.
      ENDIF.
      IF g_dock2 IS INITIAL.
        CREATE OBJECT g_dock2
                      EXPORTING
                      repid     = sy-repid
                      dynnr     = sy-dynnr
                      side      = g_dock2->dock_at_top
                      extension = 100.
        CREATE OBJECT r_grid2
                  EXPORTING
                  i_parent = g_dock2.
        IF g_dock3 IS INITIAL.
          CREATE OBJECT g_dock3
                        EXPORTING
                        repid     = sy-repid
                        dynnr     = sy-dynnr
                        side      = g_dock3->dock_at_top
                        extension = 100.
          CREATE OBJECT r_grid3
                    EXPORTING
                    i_parent = g_dock3.
        ENDIF.
        IF NOT itab[] IS INITIAL.
          CALL METHOD r_grid->set_table_for_first_display
            CHANGING
              it_outtab       = itab
              it_fieldcatalog = it_fieldcat.
        ENDIF.
        IF NOT itab1[] IS INITIAL.
          CALL METHOD r_grid1->set_table_for_first_display
            CHANGING
              it_outtab       = itab1
              it_fieldcatalog = it_fieldcat1.
        ENDIF.
        IF NOT itab2[] IS INITIAL.
          CALL METHOD r_grid2->set_table_for_first_display
            CHANGING
              it_outtab       = itab2
              it_fieldcatalog = it_fieldcat2.
        ENDIF.
        IF NOT itab3[] IS INITIAL.
          CALL METHOD r_grid3->set_table_for_first_display
            CHANGING
              it_outtab       = itab3
              it_fieldcatalog = it_fieldcat3.
        ENDIF.
    if   g_dock4 is initial.
        CREATE OBJECT g_dock4
                      EXPORTING
                      repid     = sy-repid
                      dynnr     = sy-dynnr
                      side      = g_dock4->dock_at_bottom
                      extension = 100.
        CREATE OBJECT picture
                          EXPORTING parent = g_dock4.
        CALL METHOD picture->load_picture_from_url
          EXPORTING
            url = url.
        init = 'X'.
    endif.
      ENDIF.
    ENDMODULE. " STATUS_0100 OUTPUT
    *& Module USER_COMMAND_0100 INPUT
    text
    MODULE user_command_0100 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    *&      Form  display_image
    FORM display_image .
      DATA query_table LIKE w3query OCCURS 1 WITH HEADER LINE.
      DATA html_table LIKE w3html OCCURS 1.
      DATA return_code LIKE  w3param-ret_code.
      DATA content_type LIKE  w3param-cont_type.
      DATA content_length LIKE  w3param-cont_len.
      DATA pic_data LIKE w3mime OCCURS 0.
      DATA pic_size TYPE i.
      REFRESH query_table.
      query_table-name = '_OBJECT_ID'.
      query_table-value = 'ENJOYSAP_LOGO'.
      APPEND query_table.
      CALL FUNCTION 'WWW_GET_MIME_OBJECT'
        TABLES
          query_string        = query_table
          html                = html_table
          mime                = pic_data
        CHANGING
          return_code         = return_code
          content_type        = content_type
          content_length      = content_length
        EXCEPTIONS
          object_not_found    = 1
          parameter_not_found = 2
          OTHERS              = 3.
      IF sy-subrc = 0.
        pic_size = content_length.
      ENDIF.
      CALL FUNCTION 'DP_CREATE_URL'
        EXPORTING
          type     = 'image'
          subtype  = cndp_sap_tab_unknown
          size     = pic_size
          lifetime = cndp_lifetime_transaction
        TABLES
          data     = pic_data
        CHANGING
          url      = url
        EXCEPTIONS
          OTHERS   = 1.
    ENDFORM.                    " display_image
    *&      Module  EXIT  INPUT
          text
    MODULE exit INPUT.
      CALL METHOD g_dock->free.
      CALL METHOD g_dock1->free.
      CALL METHOD g_dock2->free.
      CALL METHOD g_dock3->free.
    ENDMODULE.                 " EXIT  INPUT

  • Problems with ALV grid refresh

    Hello,
    I am writing a relatively simple wd application, I enter a few values in the select-options and display the data in an ALV grid. My problem seems to be that the grid values do not refresh if I change the selection conditions.
    On going through the forum I saw a few posts which ask me to call the Node->Invalidate( ) method, but on using that my grid refreshes completely and data does not appear again, even on changing the input values.
    I have pasted the ALV portion of the code from my onAction method - could you suggest what I could do to correct this? I realise this is a relatively stupid question, but I am very new to this technology and am trying to learn. Thanks in advance.
    ***Database selection (this works fine, tested in debug)
    Bind the data to the context
        dyn_node = wd_context->get_child_node( name = 'TIME_ENTRY' ).
        dyn_node->bind_table( icatsdb ).
    Connect to the component Usage of the ALV
        l_ref_cmp_usage = wd_this->wd_cpuse_display_alv( ).
        IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
          l_ref_cmp_usage->create_component( ).
        ENDIF.
    Through the interface controller of the ALV Component set the DATA node dynamically
        l_ref_interfacecontroller = wd_this->wd_cpifc_display_alv( ).
        l_ref_interfacecontroller->set_data( r_node_data = dyn_node ).
    Sudha

    Hi,
    Did you change the statement <b>SET PF-STATUS 'ZIMP'</b> to <b>SET PF-STATUS 'ZLIQ'</b> ? If not, please do that, and run the program after activation.
    Reward points if the asnwer is helpful.
    Regards,
    Mukul

  • 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 Refresh problem

    hi,
    I have 2 views, input and output these two included in a MAIN views.
    when user key in their input values in INPUT view and the search results will be displayed in OUTPUT view using ALV grid.
    the problem i'm facing here is, when user changes search criteria once after search results displayed.. it is not displaying with new search results. every time i have to give F5(Refresh) it is certainly not comfortable to deliver it as it is.
    i have tried same scenario with simple query in our local server.. where it is working very well.
    i really clueless what would be the cause.. is there any with SAP patch issues.
    i have tried with refresh method of ALV component.
    please help me out of this, i cannot use TABLE control every time to avoid this.
    thanks,
    gupta.

    Hi Gupta,
    Could you please let us know how you are filling the context node which is mapped to ALV table?
    After the search criteria is changed, if you are doing it inside handler of the button or something like that, it should work.
    Refer to the tutorial in the following link which shows an example similar to your scenario:
    SAP List Viewer in Web Dynpro - Simple Example for Using ALV
    please post the code also which you are using to fill the node in case if you still face the issue after referring to the above tutorial.
    Hope this helps!
    Regards.
    Srilatha
    Edited by: Srilatha M on Jul 19, 2010 7:57 AM

  • ALV grid refresh while fcat and internal table change

    Hi,
       I am displaying an ALV output using OOPS ALV grid. It is displaying data from internal table t1.
    Later I am changing fieldcat table content and I want to display with internal table t2. how can I do this.
    It is not refreshing the fieldcat values in the ALV.
    Which method I should call to refresh the ALV.
    Thanks and regards,
    Venkat.

    hi,
    to refresh the alv display.
    you can use the method refresh_table_display
    of the class cl_gui_alv_grid.
    regards.

  • ALV Grid: refresh in sub screens

    Hello All,
    I have some issues with internal table display in ALV grid.
    The following is the scenario.
    I am in a wizard which has 2 sub screens (SScreen 1 and sscreen 2).
    1)On sscreen 1, i have a input field,where i provide a value and on clicking the next button i get a list of values which i display on sub screen 2 using ALV grid.
    2)Now i go back to sscreen1 and change the value in the input field,since i use on-request module, i know the value in the field has changed and now i need to display new set of values on sscreen 2.
    In this case i clear the internal table, get new values for internal table and then call set_values_for_first_display().However i still get the old values displayed on SScreen 2!!!!.
    Any suggestions on what i might be doing wrong?
    Cheers
    Dev

    Hi Vijay,
    Thanks for the info.
    I will try refresh_table_display option after getting to work in a couple of hours.
    I am initializing the grid and control everytime i change a value on Subscreen 1 in the PBO of Subscreen 2(the screen where the ALV list is displayed).
    That is the reason why i call set_table_first_display, whenever there are new values in the internal table and avoid refresh_table_display.
    Cheers
    Dev

  • ALV grid refresh problem - Icons briefly flashed on screen

    Hi ,
    I have an editable OO ALV grid which has a "New Entries" option. When the user clicks on that button a new blank row is appended at the bottom. The problem is on some monitors /screens when the user clicks on the button the ALV grid flashes for a brief moment and every cell has an image icon.
    You can see this problem  by going to Tcode SE16N choose a large table like VBAP and display 500 records or more. On the next screen press the page down button, you would see those icons.(the problem is as described above, except that the se16n ALV is not editable ).
    Is this a buffering problem of ALV ? Or is there a way to avoid / fix this ?
    Thanks

    you will find a beginning of explanation here in [sap library - Using the ALV Grid Control in WANs|http://help.sap.com/saphelp_nw2004s/helpdata/en/32/d3e962f7fb11d2b48c006094192fe3/frameset.htm]

  • ALV grid Refresh problem  for one user

    Have an ALV with editable columns. Validation and save works for all columns for one user but not for the other. The user with the issue is able to modify the values and save to the database fine.The problem is it doesn't display in the ALV once refreshed. Please suggest any ideas of how to look into this issue as it works for one and not other user.

    Strange work for one user not for other.
    Once you save the data, rebind the data to table. so that new data will display. ( that use set_initial_elements as true, so that old values not display ).
    Regards
    Srinivas

  • ALV Grid refresh to exact row position

    Hi All
    After implementing DATA_CHANGED CL_GUI_ALV_GRID event
    1. As I enter the event, I set CALL METHOD GRID->GET_CURRENT_CELL
    2. validate and apply changes to grid
    3. CALL METHOD GRID->REFRESH_TABLE_DISPLAY
    4. CALL METHOD CL_GUI_CONTROL=>SET_FOCUS " to custom control
    5. CALL METHOD CL_GUI_CFW=>FLUSH
    6. CALL METHOD GRID->SET_CURRENT_CELL_VIA_ID
    However, the grid refreshes by putting my current row right at the bottom.
    I'd like the top row to remain the top row, but the methods that look usable are 'protected'
    If you know how to avoid this repositioning of the grid, please assist.
    Thank you and best regards,
    Adrian

    *&      Form  FM_REFRESH_TABLE_DISPLAY
    FORM FM_REFRESH_TABLE_DISPLAY USING GRID TYPE REF TO CL_GUI_ALV_GRID.
      DATA LS_STABLE TYPE LVC_S_STBL.
      LS_STABLE-COL = 'X'.
      LS_STABLE-ROW = 'X'.
      CALL METHOD GRID->REFRESH_TABLE_DISPLAY
        EXPORTING
          IS_STABLE = LS_STABLE
        EXCEPTIONS
          FINISHED  = 1
          OTHERS    = 2.
    ENDFORM.                    " FM_REFRESH_TABLE_DISPLAY
    Edited by: Adrian Bruwer on Apr 14, 2011 9:07 AM

  • OO ALV grid refresh problem on sort

    I have an editable OO ALV where I over ride the standard functionality for append, insert, Delete etc to handle condition that when a new row is inserted/appended its status which is in a non-editable cell  is defaulted to some value. Now the logic is as follows
    1.User clicks on append button(which we have overridden)  I capture it in user command and append a blank row at end with default status in itab and do a grid->refresh_table_display()
    2.User enters values in all cells and presses ENTER , control goes to handle_data_changed method I validate and check the modified rows from ER_DATA_CHANGED->MOD_ROWS or ER_DATA_CHANGED->MOD_CELLS and update my itab with the values entered on screen and again do a grid->refresh_table_display() so the values are displayed again on the screen.
    Problem is when I give a SORT criteria or press sort say according to Year (descending) if grid already contains 2 rows and we add 3rd row with year 2009 at bottom
    Amount Year Status
    100        2007  Old
    200        2006  Old
    300        2009 New
    Then on ENTER the 3rd row goes to 1st place as it should  but the values on the 3rd row do not change!!! eg see below
    Amount Year Status
    300        2009 New
    100        2007  Old
    300        2009 New
    The problem is only when the ALV is sorted & I have a unique row index in my itab to keep track of records. I feel this is a mismatch in the frontend and backend update. Any body else have a clue why is this happening only on sort ?

    Don't do your refresh_table_display( ) until the data_changed_finished event.
    Cheers,
    Phil

  • ALV GRID REFRESH

    Haii All..
    i have created a list with the fn. module <b>'reuse_alv_grid_display'</b>, and when i click on a field (say material number matnr) it would go to <b>MM02</b> and i would change the storage location for that material and after the changes were made..the control comes back to the grid..now i want the grid to be refreshed automatically..i should not create any <b>REFRESH</b> button in this case..
    is it possible..??
    Best Regards,
    rama

    yaa..i understood that logic..but it works only when i click on the refresh button..but i shouldnt click any button in the list..and it should be refreshed automatically..
    i think you can get some idea seeing this code:
        WHEN '&IC1'.                                     " Auswählen
          CASE rs_selfield-fieldname.
    Lagerplatzzuordnung ändern----
            WHEN 'LGPLA'.
              CHECK aendern = 'X'.
              READ TABLE daten
                 INTO  h_wa_it_result
                 INDEX rs_selfield-tabindex.
              PERFORM lagerplatz.
    and the code for lagerplatz is:
    FORM lagerplatz.
      DATA: BEGIN OF felder OCCURS 1.
              INCLUDE STRUCTURE sval.
      DATA: END OF felder.
      DATA: textline(50),
            matnr2 LIKE mara-matnr,
            code(1),
            meins(3).
    Abfrage-Popup: Felder definieren----
      felder-tabname   = 'MARA'.
      felder-fieldname = 'MATNR'.
      APPEND felder.
      felder-tabname   = 'MARA'.
      felder-fieldname = 'BISMT'.
      felder-fieldtext = 'Lagerplatzmenge'.
      APPEND felder.
      felder-tabname   = 'MARA'.
      felder-fieldname = 'FERTH'.
      felder-fieldtext = 'Behältermenge'.
      APPEND felder.
      felder-tabname   = 'MLGN'.
      felder-fieldname = 'LETY3'.
      felder-fieldtext = 'Lagereinheitentyp'.
      APPEND felder.
      CLEAR: textline.
      textline    = 'Bitte Werte für Lagerplatz'.
      textline+27 = h_wa_it_result-lgpla.
      textline+38 = 'eingeben:'.
      CALL FUNCTION 'POPUP_GET_VALUES'
        EXPORTING
          popup_title = textline
        IMPORTING
          returncode  = code
        TABLES
          fields      = felder.
    Abbruch der Funktion----
      IF code NE ' '.
        EXIT.
      ENDIF.
    Eingabe verarbeiten----
      LOOP AT felder.
        CASE felder-fieldname.
          WHEN 'MATNR'.
            matnr2 = felder-value.
          WHEN 'BISMT'.
            h_wa_it_result-lpmax = felder-value.
          WHEN 'FERTH'.
            h_wa_it_result-lpmin = felder-value.
          WHEN 'LETY3'.
            h_wa_it_result-lety3 = felder-value.
        ENDCASE.
      ENDLOOP.
    Materialnummer prüfen----
      IF matnr2 NE ' '.
        SELECT SINGLE meins FROM  mara INTO meins
               WHERE  matnr  = matnr2.
        IF sy-subrc NE 0.
          CLEAR: textline.
          textline    = 'Material'.
          textline9  = matnr210(8).
          textline+18 = 'nicht vorhanden.'.
          CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
            EXPORTING
              titel     = 'Fehler'
              textline1 = textline.
          EXIT.
        ENDIF.
      ENDIF.
    Lagerplatz im Lagertyp vorhanden?----
      SELECT SINGLE lgpla FROM  lagp INTO lgpla
             WHERE  lgnum  = lgnum
             AND    lgtyp  = h_wa_it_result-lgtyp
             AND    lgpla  = h_wa_it_result-lgpla.
      IF sy-subrc = 4.
        REFRESH bdc_tab.
        CLEAR   bdc_tab.
        PERFORM dynpro USING:
           'X' 'SAPML01S'   '0400',
           ' ' 'BDC_OKCODE' '/00',
           ' ' 'LAGP-LGNUM' lgnum,
           ' ' 'LAGP-LGTYP' h_wa_it_result-lgtyp,
           ' ' 'LAGP-LGPLA' h_wa_it_result-lgpla,
           'X' 'SAPML01S'   '0400',
           ' ' 'BDC_OKCODE' '=BU',
           ' ' 'LAGP-LGBER' '001'.
        CALL TRANSACTION 'LS01N' USING bdc_tab
                                 MODE mode
                                 UPDATE 'S'.
      ENDIF.
    Bestehende Lagerplatzdaten im Materialstamm löschen----
      IF h_wa_it_result-matnr NE ' ' AND h_wa_it_result-matnr NE matnr2.
        REFRESH bdc_tab.
        CLEAR:  bdc_tab.
        PERFORM dynpro USING:
          'X' 'SAPLMGMM'              '0060',
          ' ' 'BDC_OKCODE'            '=ENTR',
          ' ' 'RMMG1-MATNR'           h_wa_it_result-matnr+10(8),
          'X' 'SAPLMGMM'              '0070',
          ' ' 'BDC_OKCODE'            '=ENTR',
          ' ' 'MSICHTAUSW-KZSEL(01)'  'X',
          'X' 'SAPLMGMM'              '4004',
          ' ' 'BDC_OKCODE'            '=SP22',
          'X' 'SAPLMGMM'              '0081',
          ' ' 'BDC_OKCODE'            '=ENTR',
          ' ' 'RMMG1-LGNUM'           lgnum,
          ' ' 'RMMG1-LGTYP'           h_wa_it_result-lgtyp,
          ' ' 'RMMG1-WERKS'           werks,
          'X' 'SAPLMGMM'              '4000',
          ' ' 'BDC_OKCODE'            '=BU',
          ' ' 'MLGT-LGPLA'            ' ',
          ' ' 'MLGN-LHMG3'            ' ',
          ' ' 'MLGN-LHME3'            ' ',
          ' ' 'MLGN-LETY3'            ' ',
          ' ' 'MLGT-LPMAX'            ' ',
          ' ' 'MLGT-LPMIN'            ' '.
        CALL TRANSACTION 'MM02'
                     USING bdc_tab
                     MODE mode.
      ENDIF.

  • ALV Grid Refresh Issue

    Hello!
        I am using the FM 'REUSE_ALV_GRID_DISPLAY' to display a report we have written. The report displays sales orders and when the user double-clicks on a line they are taken in VA02. I put in a change to have the report refresh after the user came back from VA02. I put in the code p_selfield-refresh = 'X' in the user_command section. This was working before and now it is not refreshing. I'm wondering if this has to do with a default layout we added after these changes were put in. I've done some google searches and I can find object-oriented code but my report is not setup that way so hopefully there is a solution for me!
    Thanks,
    Wendy

    If you set refresh subfield (and row/col_stable subfields if sort fields are not changed), then you should update the internal table record in your user_command form. You need to reload the data from database, but there may be a delay between leaving VA02 and actual update of database, you may try to lock the sales order to insure update task release the lock. (DO/ENQUEUE_EVVBAKE with WAIT/ENDDO and when/if successful DEQUEUE_EVVBAKE, if not successful after some tries, put a warning/status message)
    * init data
    CLEAR: lv_error,
    refresh lt_bdcmsg.
    * Read record
    READ TABLE gt_data INTO old_data
      INDEX rs_selfield-tabindex.
    CHECK sy-subrc EQ 0.
    * Call VA02
    SET PARAMETER ID 'AUN' FIELD old_data-vbeln.
    CALL transaction 'VA02' AND SKIP FIRST SCREEN
      MESSAGES into lt_bdcmsg.
    * Call successful ?
    LOOP AT lt_bdcmsgcoll INTO ls_bdcmsg WHERE msgtyp = 'E' OR msgtyp = 'S'.
      MESSAGE message ID ls_bdcmsg-msgid TYPE ls_bdcmsg-msgtyp
        NUMBER ls_bdcmsg-msgnr WITH ls_bdcmsg-msgv1. " 2 3 4
      IF ls_bdcmsg-msgtyp EQ 'E'.
        lv_error = 'X'.
        EXIT.
      ENDIF.
    ENDLOOP.
    CHECK lv_error IS INITIAL.
    * Is update ended
    DO 10 TIMES.
      CALL FUNCTION 'ENQUEUE_EVVBAKE'
           EXPORTING
                vbeln          = old_data-vbeln
                _wait          = 'X'
           EXCEPTIONS
                foreign_lock   = 1
                system_failure = 1
                OTHERS         = 1.
      IF sy-subrc EQ 0.
        CALL FUNCTION 'DEQUEUE_EVVBAKE'
             EXPORTING
                  vbeln  = old_data-vbeln
             EXCEPTIONS
                  OTHERS = 0.
        EXIT.
      ENDIF.
    ENDDO.
    * Reload
    new_data = old_data.
    SELECT SINGLE * FROM vbak INTO CORRESPONDING FIELDS OF new_data
      WHERE vbeln = l_sdata-vbeln. " more coding for other fields
    * Update internal table
    IF new_data NE old_data.
      MODIFY gt_data FROM new_data.
      rs_selfield-refresh = 'X'.
    ENDIF.
    Regards,
    Raymond

  • Two ALV Grid in the same screeen

    Hi,
      I have created a module pool with a screen.
    In this screen I have defined two customer objects and I dipslay two different ALV grid.
    DATA: grid_1         TYPE REF TO cl_gui_alv_grid,
              grid_2         TYPE REF TO cl_gui_alv_grid.
    When the user puts the values into the field in both lists and pushes "enter", the program gets the input value by method
    "get_selected_rows". It works only for the list where there is the cursor.
    I need to read the value of each list at the same moment.
    Thanks in advance
    Marco

    *& Report  Z7CC_ALV_OOPS_TWO_ALV_SCREENS                               *
    report  z7cc_alv_oops_two_alv_screens           .
    * TEMP DECLARATION TYPE DECLARATIONS
    * Structure for Sales Order
    types: begin of y_vbak      ,
    vbeln type vbeln_va ,
    end of y_vbak        ,
    * Structure for Sales Order Details.
    begin of y_vbap           ,
    vbeln type vbeln_va    ,
    posnr type posnr_va    ,
    matnr type matnr       ,
    charg type charg_d     ,
    arktx type arktx       ,
    end of y_vbap             ,
    *& Structure of line item ----------
    begin of  y_po_item,
    ebeln type ekko-ebeln, " PO NUMBER
    ebelp type ekpo-ebelp,  "LINE ITEM
    matnr like ekpo-matnr,  " Material Number
    netpr like ekpo-netpr,  " Price per unit.
    menge like ekpo-menge,  " Purchase order quantity.
    netwr like ekpo-netwr,  " Net order in Purchase order currency
    meins like ekpo-meins,  " UOM
    end of y_po_item.
    data: t_y_po_item type standard table of y_po_item.
    data:  w_container_1        type ref to cl_gui_container        .
    data: t_vbap      type standard table of y_vbap.
    *--------- END OF TEMP DECLARATION ------------
    data: ok_code like sy-ucomm.
    *-- Global data definitions for ALV
    *--- ALV Grid instance reference
    data gr_alvgrid type ref to cl_gui_alv_grid .
    *--- Name of the custom control added on the screen
    data gc_custom_control_name type scrfname value 'Z7CC_ALV2' .
    *--- Custom container instance reference
    data gr_ccontainer type ref to cl_gui_custom_container .
    *--- Field catalog table
    data gt_fieldcat type lvc_t_fcat .
    data gt_fieldcat_2 type lvc_t_fcat .
    *--- Layout structure
    data gs_layout type lvc_s_layo .
    *&------- DECLARATION FOR THE NEXT SCREEN ------------------
    *--- ALV Grid instance reference
    data gr_alvgrid_2 type ref to cl_gui_alv_grid .
    *--- Name of the custom control added on the screen-----------
    data gc_custom_control_name_2 type scrfname value 'Z7CC_ALV' .
    *--- Custom container instance reference
    data gr_ccontainer_2 type ref to cl_gui_custom_container .
    *Declare your internal table which is supposed to hold the list data.
    *&Let’s name it “gt_list”.
    *Here is an example declaration.
    *--- Internal table holding list data
    data begin of gt_list occurs 0.
    data   matnr like mara-matnr.
    data   maktx like makt-maktx.
    data end of gt_list .
    data: begin of gt_list_2 occurs 0.
    include structure  z7cc_po_header.
    data: linecolor(4) type c, "Color for corresponding line
    end of gt_list_2.
    data: t_gt_list_2   type standard table of z7cc_po_header.
    *----- CLASS DECLARATION ------
    * FIELD-SYMBOLS
    field-symbols <fs_vbap> type y_vbap.
    field-symbols <fs_gt_list_2> type z7cc_po_header.
    class lcl_event_receiver definition deferred.
    data w_event_receiver type ref to lcl_event_receiver.
    * Creating a class definition for handling events on the ALV Grid.
    class lcl_event_receiver definition.
    public section.
    methods: handle_top_of_page for event top_of_page
    of cl_gui_alv_grid
    importing e_dyndoc_id,
    handle_hotspot_click for event hotspot_click
    of cl_gui_alv_grid
    importing e_row_id,
    handle_toolbar_event for event toolbar
    of cl_gui_alv_grid
    importing e_object,
    handle_user_command  for event user_command
    of cl_gui_alv_grid
    importing e_ucomm.
    endclass.                    "lcl_event_receiver  DEFINATION
    * Implementing the Class for handling events on the ALV Grid.
    class lcl_event_receiver implementation.
    method handle_top_of_page.
    perform show_top_of_page using e_dyndoc_id   w_container_1.
    endmethod.                    "handle_top_of_page
    method handle_hotspot_click.
    perform show_hotspot_click_details using e_row_id.
    endmethod.                    "lcl_event_receiver
    method handle_toolbar_event.
    perform create_alv_toolbar using e_object.
    endmethod.                    "handle_toolbar_event
    method handle_user_command.
    perform handle_user_command using e_ucomm.
    endmethod.                    "handle_user_command
    endclass.                    "lcl_event_receiver IMPLEMENTATION
    data:   w_grid               type ref to cl_gui_alv_grid         .
    *-------- END OF CLASS DECLARATION -------------
    start-of-selection.
    perform populate_table.
    call screen 100.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    module status_0100 output.
    set pf-status 'Z7CC_ALV1'.
    *  SET TITLEBAR 'xxx'.
    endmodule.                 " STATUS_0100  OUTPUT
    *&      Module  DISPLAY_ALV  OUTPUT
    *       text
    module display_alv output.
    perform display_alv.
    endmodule.                 " DISPLAY_ALV  OUTPUT
    *&      Form  POPULATE_TABLE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form populate_table .
    select ebeln ebelp matnr  netpr menge netwr meins into corresponding fields of table t_y_po_item
    from ekpo.
    select ekko~ebeln ekko~bukrs ekko~aedat ekko~ernam
    ekko~lifnr ekko~zterm ekko~angnr  into corresponding fields of
    table t_gt_list_2    from ekko .
    endform.                    " POPULATE_TABLE
    *&      Form  DISPLAY_ALV
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form display_alv .
    if gr_alvgrid is initial .
    perform create_first_obj_container.
    *&----------- ONE MORE CONTROL ON THE SCREEN-------------------
    perform create_second_obj_container.
    " DISPLAY_ALV
    *   Creating ALV Grid instance
    perform create_first_alvgrid.
    perform create_second_alvgrid.
    *  PERFORM FIELD_CATALOG.  " CREATE A FIELD CATALOG.
    perform field_cat changing gt_fieldcat.
    perform field_cat_1 changing gt_fieldcat_2.
    *----Here will be additional preparations
    *--e.g. initial sorting criteria, initial filtering criteria, excluding
    *--functions
    perform call_mthd_display_both_grid.
    *&---------  create a field catalog.------------
    perform event_handling.
    else.
    *&-----------CALL ALV GRID REFRESH  TABLE DISPLAY
    perform call_mthd_alv_refresh.
    endif.
    endform.                    "DISPLAY_ALV
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    module user_command_0100 input.
    endmodule.                 " USER_COMMAND_0100  INPUT
    *&      Form  EXIT_PROGRAM
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form exit_program .
    leave program.
    endform.                    " EXIT_PROGRAM
    *&      Module  PAI  INPUT
    *       text
    module pai input.
    case ok_code.
    when '&EXT'.
    perform exit_program.
    when others.
    *     do nothing
    endcase.
    clear ok_code.
    endmodule.                 " PAI  INPUT
    *&      Form  CREATE_FIRST_OBJ_CONTAINER
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form create_first_obj_container .
    create object gr_ccontainer
    exporting
    container_name              = gc_custom_control_name
    if sy-subrc <> 0.
    *          MESSAGE ID SY-MSGID TYPE  SY-MSGTY NUMBER SY-MSGNO
    *                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    endform.                    " CREATE_FIRST_OBJ_CONTAINER
    *&----------------------------------------

  • Back from ALV Grid with multiple refresh

    I have a report that from a selection screen shows an editable ALV Grid, and after I save it, it will refresh the grid.
    My problem is when I hit the BACK button it returns to the "previous grid" instead of the selection screen
    I am using the following:
    WHEN 'BACK_C'.
      LEAVE to SCREEN '0'.
    How can I force it to go back to the selection screen?
    sidenote: I have tried using call
    selection-screen '1000'
    but it adds a new problem as in the selection screen hitting back will return to the grid and I can never exit the report.

    Neither solution works.
    If it helps, I'm refreshing the grid with:
    DATA : ref_grid TYPE REF TO cl_gui_alv_grid.
      IF ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = ref_grid.
      ENDIF.
    CALL METHOD ref_grid->refresh_table_display( ).
    It seems when I refresh the grid it generates a completely independent grid screen and there's no way to skip them all and return to the selection screen.

Maybe you are looking for