Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problems in ALV Refresh after data changes

Former Member
0 Kudos

Hi,

I have a editable ALV grid which is displayed using 'REUSE_ALV_GRID_DISPLAY'. The user updates the editable fields and press 'SAVE' . At SAVE we carry out some operation. These changes are captured by using

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = ref_grid. "Get reference of ALV grid

CALL METHOD ref_grid->check_changed_data

IMPORTING

e_valid = lv_valid. "Update internal table with values from ALV Grid

Now after 'SAVE' , i would like to refresh the grid such that the updated data from database is displayed. It is possible that some row operations failed ,thus we need to re-query the database for data and display the refreshed data in the grid.

I tried this as follows :

Select updated records from database.

rs_selfield-refresh = 'X'. "Display ALV List

or

CALL METHOD ref_grid->refresh_table_display

Both the above refresh methods failed.... Any ideas why so ?? The internal table is updated , but the ALV grid is not refreshed.

Please let me know a possible solution.

Regards,

Tushar

10 REPLIES 10

former_member188685
Active Contributor
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.

  DATA: gd_repid LIKE sy-repid, "Exists
  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.
  IF NOT ref_grid IS INITIAL.
    CALL METHOD ref_grid->check_changed_data .
  ENDIF.

"here you refresh the data from internal table then 
"Reselect the data from DB 
"Select * etcccc 
" then  use refresh = 'X' check it once.
"show me your steps..
  rs_selfield-refresh = 'X'.
  BREAK-POINT.

ENDFORM. "USER_COMMAND

0 Kudos

I tried the changes, the problem still exists.

The issue only comes when we execute method 'CHECK_CHANGED_DATA' before refresh. Otherwise refresh button is working perfectly if i don't call the method. But call to this method is required to capture the changes of grid into the internal table.

(I debugged the flow and could see that a table mt_outtab->* inside method 'CHECK_CHANGED_DATA' which gets updated , and this is the same table which gets assigned to output table after refresh)

former_member188685
Active Contributor
0 Kudos

I worked on that and resolved your issues using the selfield-exit = 'X'. can you check this and let me know...

REPORT ztest_alv_check MESSAGE-ID zz .

TYPE-POOLS: slis.
DATA: x_fieldcat TYPE slis_fieldcat_alv,
it_fieldcat TYPE slis_t_fieldcat_alv,
l_layout TYPE slis_layout_alv,
x_events TYPE slis_alv_event,
it_events TYPE slis_t_event.

DATA: BEGIN OF itab OCCURS 0,
vbeln LIKE vbak-vbeln,
posnr LIKE vbap-posnr,
chk(1),
color(4),
END OF itab.

x_fieldcat-fieldname = 'CHK'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 1.
x_fieldcat-input = 'X'.
x_fieldcat-edit = 'X'.
x_fieldcat-checkbox = 'X'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.

x_fieldcat-fieldname = 'VBELN'.
x_fieldcat-seltext_l = 'VBELN'.
x_fieldcat-hotspot = 'X'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 2.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.

x_fieldcat-fieldname = 'POSNR'.
x_fieldcat-seltext_l = 'POSNR'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 3.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.


perform get_data_anddisp.

form get_data_anddisp.

SELECT vbeln
posnr
FROM vbap
UP TO 20 ROWS
INTO TABLE itab.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    i_callback_program       = sy-repid
    is_layout                = l_layout
    i_callback_user_command  = 'USER_COMMAND'
    it_fieldcat              = it_fieldcat
  TABLES
    t_outtab                 = itab
  EXCEPTIONS
    program_error            = 1
    OTHERS                   = 2.
IF sy-subrc NE 0.

  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

endform.
*&---------------------------------------------------------------------*
*&      Form  USER_COMMAND
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->R_UCOMM      text
*      -->RS_SELFIELD  text
*----------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.

  DATA: gd_repid LIKE sy-repid, "Exists
  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.
  IF NOT ref_grid IS INITIAL.
    CALL METHOD ref_grid->check_changed_data .
  ENDIF.

  LOOP AT itab WHERE chk = 'X'.
    itab-color = 'C300'.
    MODIFY itab INDEX sy-tabix TRANSPORTING color.
  ENDLOOP.

  rs_selfield-refresh = 'X'.
  rs_selfield-exit = 'X'.
 perform get_data_anddisp.

  BREAK-POINT.

ENDFORM. "USER_COMMAND

0 Kudos

Hello again,

Sorry to say , but the problem still persists.....

Let me clarify some more ..

The output is an editable ALV Grid with standard SAVE button and additional button for 'REFRESH' in PF-status. The two actions viz. Change/Save and Refresh are handled differently via two sy-ucomm codes . Thus the user will either 'change and save' or does a 'Refresh'. On save , the changes in grid are updated to database. These changes will be changes in the editable fields + some default values in other fields . And then i press Refresh to retrive the updated values from database.

In change/save we call method 'CHECK_CHANGED_DATA' and update database. In refresh we query the table and call 'REFRESH_TABLE_DISPLAY' or rs_selfield-refresh = 'X'.

This refresh is not working. I changed the data in grid from AB to 90 , pressed SAVE . The database update failed. I query the database .I press Refresh. Ideally the grid should again have AB. But it still shows 90, although the internal table contains AB.

0 Kudos

You need to write the code into parts

According to the user commands

IF UCOMM = 'REFRESH' then you have to reslect the data, for that you have to use the exit = 'X' .

if possible show the complete coding once.

i will tell you.

0 Kudos

Here's the code :

WHEN 'SAVE'.

CLEAR : ref_grid , lv_valid.

  • Get refrence for the ALV Grid on screen

IF ref_grid IS INITIAL.

CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

IMPORTING

e_grid = ref_grid.

ENDIF.

  • Method to update internal table with changed values

IF NOT ref_grid IS INITIAL.

CALL METHOD ref_grid->check_changed_data

IMPORTING

e_valid = lv_valid.

loop at gt_output into wa_output.

Update MARC

set rfpnt = wa_output-rfpnt

spproctype = 'AB'

where matnr = wa_output-matnr

and werks = wa_output-werks.

endloop.

When 'REFRESH'.

perform select_data. "Reselect data from database

rs_selfield-refresh = 'X'.

  • CALL METHOD ref_grid->refresh_table_display.

Edited by: Tushar Kirilkar on Jul 8, 2008 7:28 PM

0 Kudos

The problem is solved.

I was passing dynamic internal table <dyn_table> with data to FM reuse_alv_grid_display.

At refresh , we re-query the database and re-create the dynamic table. The recreation of dynamic table was the problem.

So the solution is to refresh the dynamic table and populate this table again without recreating.

Former Member
0 Kudos

Please check last comments.

Former Member
0 Kudos

Hello Experts...

I am trying to edit the ALV and save the data into database.

I have used two push buttons in SAP Screen Called as Check All(FCT CHCK) and Uncheck All(FCT UNCK). And have used methods set_table_for_first_display to display ALV grid and  refresh_table_display to redisplay the changed data in ALV grid.

1. First time when the report is executed all the records are Unchecked and if I click on "Check All" Push button all the check boxes are selected as expected.

My Problem is :

2. After step 1, if i Click on push button "Uncheck All" data is being changed in the internal table but appropriate changes are not being reflected in ALV grid output.

3. After step 1, if I Uncheck few out of all records and again click on "Check All" data is being changed in internal table but not reflected in Grid output.

4. After step 1, if i click on "Uncheck All" data is being changed in internal table but not reflected in Grid output.

Below is the complete active code:

REPORT  zmm_edit_material_desc.

TABLES : mara, mard.

TYPES : BEGIN OF ty_final,

           matnr TYPE matnr, "Material Number

           matkl TYPE matkl, "Material Group

           mtart TYPE mtart, " Material type

           mbrsh TYPE mbrsh, " Industry Sector

           werks TYPE werks_d, "Plant

           lgort TYPE lgort_d, " Storage Location

           maktx TYPE maktx, "Material Description

           flag(1),           " for selection of records

         END OF ty_final.

TYPES : BEGIN OF ty_summary,

           material LIKE mara-matnr.

         INCLUDE STRUCTURE bapiret2.

TYPES : END OF ty_summary.

CONSTANTS : c_check(1) VALUE 'X'.    " value used to set X for a field

DATA : wa_bapimathead TYPE bapimathead ,

        it_desc TYPE TABLE OF bapi_makt ,

        wa_desc TYPE bapi_makt ,

        wa_return TYPE bapiret2 .

DATA : it_final  TYPE STANDARD TABLE OF ty_final,

        it_final2 TYPE STANDARD TABLE OF ty_final,

        wa_final TYPE ty_final,

        it_summary TYPE TABLE OF ty_summary,

        wa_summary TYPE ty_summary.

DATA container  TYPE REF TO cl_gui_custom_container,

         grid1      TYPE REF TO cl_gui_alv_grid,

         it_fielcatalogue  TYPE lvc_t_fcat,

         ls_fcat           TYPE lvc_s_fcat,

         it_sort           TYPE lvc_t_sort,

*        ls_sort           TYPE lvc_s_sort ##NEEDED,

         it_layout         TYPE lvc_s_layo.

DATA: i_selected_rows TYPE lvc_t_row,                "Selected Rows

       w_selected_rows TYPE lvc_s_row.

DATA:   lt_exclude TYPE ui_functions.

DATA gs_variant TYPE disvariant.    " sy-repid

*Global variable declaration

DATA: gstring TYPE c,

       lv_material_prev TYPE mara-matnr,

       lv_maktx_prev TYPE makt-maktx,

        ok_code       TYPE ui_func,

*data declaration for refreshing of alv

       stable TYPE lvc_s_stbl.

SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text-001.

SELECT-OPTIONS : s_matnr  FOR mara-matnr , "Material Number

                  s_matkl  FOR mara-matkl"Material Group

                  s_mtart  FOR mara-mtart"Material Type

                  s_mbrsh  FOR mara-mbrsh"Industry Sector

                  s_werks  FOR mard-werks"Plant

                  s_lgort  FOR mard-lgort"Storage Location

SELECTION-SCREEN END OF BLOCK blk .

***start of hotspot logic

*----------------------------------------------------------------------*

*       CLASS lcl_event_receiver DEFINITION

*----------------------------------------------------------------------*

*

*----------------------------------------------------------------------*

CLASS lcl_event_receiver DEFINITION.

   PUBLIC SECTION.

     METHODS on_hotspot_click

        FOR EVENT hotspot_click OF cl_gui_alv_grid

        IMPORTING

*        e_row_id ##NEEDED

         e_column_id

         es_row_no .

ENDCLASS.                    "lcl_event_receiver DEFINITION

*----------------------------------------------------------------------*

*       CLASS lcl_event_receiver IMPLEMENTATION

*----------------------------------------------------------------------*

*

*----------------------------------------------------------------------*

CLASS lcl_event_receiver IMPLEMENTATION.

   METHOD  on_hotspot_click.

     CLEAR wa_final .

     READ TABLE it_final INTO wa_final INDEX es_row_no-row_id.

     IF sy-subrc = 0 .

       CASE e_column_id .

         WHEN 'MATNR'.

           SET PARAMETER ID 'MAT' FIELD wa_final-matnr.

           CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.

         WHEN OTHERS.

       ENDCASE.

     ENDIF.

   ENDMETHOD.                    "handle_double_click

ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION

***End of hotspot logic

INITIALIZATION.

   gs_variant-report = sy-repid.

AT SELECTION-SCREEN .

   IF s_matnr  IS INITIAL AND

      s_matkl  IS INITIAL AND

      s_mtart  IS INITIAL AND

      s_mbrsh  IS INITIAL AND

      s_werks  IS INITIAL AND

      s_lgort  IS INITIAL.

     MESSAGE 'Please select any one option in selection screen'(003) TYPE 'E' .

   ENDIF.

START-OF-SELECTION.

   SELECT  a~matnr a~matkl a~mtart a~mbrsh

           b~werks b~lgort

           c~maktx

           FROM mara AS a

                INNER JOIN mard AS b ON a~matnr EQ b~matnr

                INNER JOIN makt AS c ON a~matnr EQ c~matnr

           INTO TABLE it_final

           WHERE a~matnr IN s_matnr

           AND   a~matkl IN s_matkl

           AND   a~mtart IN s_mtart

           AND   a~mbrsh IN s_mbrsh

           AND   b~werks IN s_werks

           AND   b~lgort IN s_lgort.

   IF it_final[] IS INITIAL.

     MESSAGE 'No records found'(004) TYPE 'E' .

   ENDIF.

END-OF-SELECTION.

   LOOP AT it_final INTO wa_final.

     CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

       EXPORTING

         input  = wa_final-matnr

       IMPORTING

         output = wa_final-matnr.

*APPEND wa_final TO it_final .

*    CLEAR wa_final .

   ENDLOOP.

   CALL SCREEN '9000'.

*&---------------------------------------------------------------------*

*&      Module  STATUS_9000  OUTPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE status_9000 OUTPUT.

   SET PF-STATUS 'ZMM_MATDESC'.

   SET TITLEBAR 'ZMM_MATDESC_TITLE'.

   DATA  : gv_event TYPE REF TO lcl_event_receiver .

   PERFORM alv_display .

   IF gv_event IS INITIAL.

     CREATE OBJECT gv_event .

     SET HANDLER gv_event->on_hotspot_click FOR grid1.

   ENDIF.

ENDMODULE.                 " STATUS_9000  OUTPUT

*&---------------------------------------------------------------------*

*&      Form  ALV_DISPLAY

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM alv_display .

* Build feild catalogue

   ls_fcat-fieldname  = 'MATNR' .

   ls_fcat-scrtext_l  = 'Material Number' .

   ls_fcat-outputlen  25.

   ls_fcat-no_merging = ' ' .

   ls_fcat-hotspot    = 'X'.

   ls_fcat-col_pos    = 1 .

   APPEND ls_fcat TO it_fielcatalogue .

   CLEAR  ls_fcat .

   ls_fcat-fieldname  = 'MATKL' .

   ls_fcat-scrtext_l  = 'Material Group' .

   ls_fcat-outputlen  12.

   ls_fcat-no_merging = ' ' .

   ls_fcat-col_pos    = 2 .

   APPEND ls_fcat TO it_fielcatalogue .

   CLEAR  ls_fcat .

   ls_fcat-fieldname  = 'MTART' .

   ls_fcat-scrtext_l  = 'Material Type' .

   ls_fcat-outputlen  10.

   ls_fcat-no_merging = ' ' .

   ls_fcat-col_pos    = 3 .

   APPEND ls_fcat TO it_fielcatalogue .

   CLEAR  ls_fcat .

   ls_fcat-fieldname  = 'MBRSH' .

   ls_fcat-scrtext_l  = 'Industry Sector' .

   ls_fcat-outputlen  15.

   ls_fcat-no_merging = ' ' .

   ls_fcat-col_pos    = 4 .

   APPEND ls_fcat TO it_fielcatalogue .

   CLEAR  ls_fcat .

   ls_fcat-fieldname  = 'WERKS' .

   ls_fcat-scrtext_l  = 'Plant' .

   ls_fcat-outputlen  4.

   ls_fcat-no_merging = ' ' .

   ls_fcat-col_pos    = 5 .

   APPEND ls_fcat TO it_fielcatalogue .

   CLEAR  ls_fcat .

   ls_fcat-fieldname  = 'LGORT' .

   ls_fcat-scrtext_l  = 'S. Loc' .

   ls_fcat-outputlen  6.

   ls_fcat-no_merging = ' ' .

   ls_fcat-col_pos    = 6 .

   APPEND ls_fcat TO it_fielcatalogue .

   CLEAR  ls_fcat .

   ls_fcat-fieldname  = 'MAKTX' .

   ls_fcat-scrtext_l  = 'Material Description' .

   ls_fcat-outputlen  50.

   ls_fcat-no_merging = ' ' .

   ls_fcat-edit = 'X'.

   ls_fcat-col_pos    = 7 .

   APPEND ls_fcat TO it_fielcatalogue .

   CLEAR  ls_fcat .

   ls_fcat-fieldname = 'FLAG'.   " name of field from internal table

   ls_fcat-tabname = 'IT_FINAL'. " internal table name

   ls_fcat-outputlen = 5.        " output length on screen

   ls_fcat-checkbox = c_check.   " print as checkbox

   ls_fcat-edit = c_check.       " make field open for input

   ls_fcat-scrtext_l = 'Save'.      " header information

   ls_fcat-col_pos    = 8 .

   APPEND ls_fcat TO it_fielcatalogue .   " append field catalog internal table

   CLEAR ls_fcat .                " clear field catalog work area

   PERFORM grid_display .

ENDFORM.                    " ALV_DISPLAY

*&---------------------------------------------------------------------*

*&      Module  change  INPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE pai INPUT.

   grid1->check_changed_data( ).

*Based on the user input

*When user clicks 'SAVE;

   CASE ok_code.

     WHEN 'CHCK' .

       CALL METHOD cl_gui_cfw=>flush .

*      grid1->check_changed_data( ).

*      CALL METHOD grid1->free.

       CLEAR : it_final2[] .

       it_final2[] = it_final[] .

       CLEAR it_final[], wa_final .

       LOOP AT it_final2 INTO wa_final.

         wa_final-flag = 'X' .

         APPEND wa_final TO it_final .

         CLEAR wa_final .

       ENDLOOP.

*      PERFORM alv_display .

       PERFORM redisplay.

*      CALL METHOD cl_gui_cfw=>flush.

     WHEN 'UNCK'.

       CALL METHOD cl_gui_cfw=>flush .

*PERFORM alv_display .

*      CALL METHOD grid1->free.

*      CALL METHOD cl_gui_cfw=>flush.

*      grid1->check_changed_data( ).

       CLEAR : it_final2[] .

       it_final2[] = it_final[] .

       CLEAR it_final[], wa_final .

       LOOP AT it_final2 INTO wa_final.

         wa_final-flag = ' ' .

         APPEND wa_final TO it_final .

         CLEAR wa_final .

       ENDLOOP.

**PERFORM alv_display .

       PERFORM redisplay.

     WHEN 'BACK'.

       LEAVE TO SCREEN 0 .

     WHEN 'CANCEL'.

       LEAVE TO SCREEN 0 .

     WHEN 'SAVE'.

*A pop up is called to confirm the saving of changed data

       CALL FUNCTION 'POPUP_TO_CONFIRM'

         EXPORTING

           titlebar       = 'SAVING DATA'

           text_question  = 'Continue?'

*         icon_button_1  = 'icon_booking_ok'

         IMPORTING

           answer         = gstring

         EXCEPTIONS

           text_not_found = 1

           OTHERS         = 2.

       IF sy-subrc NE 0.

         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

       ENDIF.

       IF gstring = '1'.

         LOOP AT it_final INTO  wa_final WHERE flag = 'X'.

           wa_bapimathead-material wa_final-matnr .

           wa_bapimathead-basic_view 'X'.

           wa_desc-langu = 'EN' .

           wa_desc-matl_desc = wa_final-maktx .

           APPEND wa_desc TO it_desc .

           CLEAR wa_desc.

           CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

             EXPORTING

               headdata            = wa_bapimathead

             IMPORTING

               return              = wa_return

             TABLES

               materialdescription = it_desc.

           PERFORM result USING wa_bapimathead wa_return.

           CLEAR wa_bapimathead, wa_return, it_desc[].

         ENDLOOP.

       ENDIF.

*When the User clicks 'YES'

       IF gstring = '1' .

*        MESSAGE 'Saved' TYPE 'S'.

*Now the changed data is stored in the it_pbo internal table

*        it_pbo = it_final.

*Subroutine to display the ALV with changed data.

         PERFORM redisplay.

         PERFORM display_summary.

       ELSE.

*When user clicks NO or Cancel

*A pop to display Summary text

         CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'

           EXPORTING

             titel        = 'Summary of Changes'

             textline1    = 'Data Not Changed'

*           TEXTLINE2    = ' '

*           START_COLUMN = 25

*           START_ROW    =                 6

           .

         LEAVE TO SCREEN 0.

       ENDIF.

*****add logic to display summary of saved and unsaved items

* call FM to display it_summary as popup

*      PERFORM display_summary.

*****

**When the user clicks the 'EXIT; he is out

     WHEN 'EXIT'.

       LEAVE PROGRAM.

   ENDCASE.

   CLEAR: ok_code.

ENDMODULE.                 " change  INPUT

*&---------------------------------------------------------------------*

*&      Form  REDISPLAY

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM redisplay .

   IF ok_code EQ 'CHCK' OR ok_code EQ 'UNCK'.

     CALL METHOD grid1->set_ready_for_input

       EXPORTING

         i_ready_for_input = 1.

   ELSE.

*Cells of the alv are made non editable after entering OK to save

     CALL METHOD grid1->set_ready_for_input

       EXPORTING

         i_ready_for_input = 0.

   ENDIF.

*Row and column of the alv are refreshed after changing values

   stable-row = 'X'.

   stable-col = 'X'.

*REfreshed ALV display with the changed values

*This ALV is non editable and contains new values

   CALL METHOD grid1->refresh_table_display

     EXPORTING

       is_stable = stable

     EXCEPTIONS

       finished  = 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.

ENDFORM.                    " REDISPLAY

*&---------------------------------------------------------------------*

*&      Form  RESULT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->P_WA_BAPIMATHEAD  text

*      -->P_WA_RETURN  text

*----------------------------------------------------------------------*

FORM result  USING    p_wa_bapimathead LIKE wa_bapimathead

                       p_wa_return LIKE wa_return.

   wa_summary-material = p_wa_bapimathead-material.

   wa_summary-type     = p_wa_return-type.

   wa_summary-message     = p_wa_return-message.

   APPEND wa_summary TO it_summary.

ENDFORM.                    " RESULT

*&---------------------------------------------------------------------*

*&      Form  DISPLAY_SUMMARY

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM display_summary .

   TYPE-POOLS: slis.

   DATA: fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.

   fieldcat-tabname   = 'IT_SUMMARY'.

   fieldcat-fieldname = 'MATERIAL'.

   fieldcat-seltext_m = 'MATERIAL'.

   fieldcat-ddictxt   = 'M'.

   fieldcat-outputlen = 10.

   APPEND fieldcat.

   CLEAR fieldcat.

   fieldcat-tabname   = 'IT_SUMMARY'.

   fieldcat-fieldname = 'TYPE'.

   fieldcat-seltext_m = 'Status'.

   fieldcat-ddictxt   = 'M'.

   fieldcat-outputlen = 5.

   APPEND fieldcat.

   CLEAR fieldcat.

   fieldcat-tabname   = 'IT_SUMMARY'.

   fieldcat-fieldname = 'MESSAGE'.

   fieldcat-seltext_m = 'Message'.

   fieldcat-ddictxt   = 'M'.

   fieldcat-outputlen = 60.

   APPEND fieldcat.

   CLEAR fieldcat.

   CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'

     EXPORTING

       i_title       = 'Summary of Changes'

       i_tabname     = 'IT_SUMMARY'

       it_fieldcat   = fieldcat[]

     TABLES

       t_outtab      = it_summary

     EXCEPTIONS

       program_error = 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.

ENDFORM.                    " DISPLAY_SUMMARY

*&---------------------------------------------------------------------*

*&      Form  GRID_DISPLAY

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*  -->  p1        text

*  <--  p2        text

*----------------------------------------------------------------------*

FORM grid_display .

   CLEAR : container .

   IF container IS INITIAL.

     CREATE OBJECT container

       EXPORTING

         container_name = 'CONTAINER'.

     IF sy-subrc EQ 0.

       CREATE OBJECT grid1

         EXPORTING

           i_parent = container.

     ENDIF.

     CALL METHOD grid1->set_table_for_first_display

       EXPORTING

         is_layout                     = it_layout

         i_save                        = 'A'

         is_variant                    = gs_variant

         it_toolbar_excluding          = lt_exclude[]

         i_structure_name              = 'WA_FINAL'

       CHANGING

         it_outtab                     = it_final[]

         it_fieldcatalog               = it_fielcatalogue[]

         it_sort                       = it_sort[]

       EXCEPTIONS

         invalid_parameter_combination = 1

         program_error                 = 2

         too_many_lines                = 3

         OTHERS                        = 4.

     IF sy-subrc <> 0.

       MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

     ENDIF.

     CALL METHOD cl_gui_cfw=>flush .

   ENDIF.

ENDFORM.                    " GRID_DISPLAY






Thanks to experts in advance.

Please help!!!