Application Development and Automation 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: 
Read only

Refresh is not working using cl_salv_table

0 Likes
6,634

Hi Team,

I am using cl_salv_table class to display the ALV output. In the output there are records displayed and the user can select one or multiple records and then custom button is clicked.

Once it is clicked it will process the selected records and then messages will be updated to the table. After processing I am using the gr_table->refresh( ). But it is not getting refreshed the entire screen.

The record status is not getting displayed.

Please advise.

Regards,

Sunil Kumar.

1 ACCEPTED SOLUTION
Read only

gouravkumar64
Active Contributor
0 Likes
2,728

Hi,

Can u paste your code?

Gourav.

7 REPLIES 7
Read only

gouravkumar64
Active Contributor
0 Likes
2,729

Hi,

Can u paste your code?

Gourav.

Read only

0 Likes
2,728

Hi,

Please find the below code.

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

*& Report  ZAUTOPAY

*&

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

*To post the incoming invoices and clear the same in F-28 transaction.

*Program reads the file contents like customer number, invoice number and amount and

*process the same to post the invoices using BDC Technique of F-28 transaction.

REPORT zautopay.

DATA: p_file TYPE string.

PARAMETER: p_bukrs TYPE bukrs OBLIGATORY DEFAULT 'SWHL',

            d_fname TYPE rlgrap-filename OBLIGATORY,

            p_bldat TYPE bldat OBLIGATORY DEFAULT sy-datum,

            p_budat TYPE budat OBLIGATORY DEFAULT sy-datum,

            p_waers TYPE waers OBLIGATORY DEFAULT 'CAD',

            p_xblnr TYPE xblnr OBLIGATORY,

            p_bktxt TYPE bktxt OBLIGATORY,

            p_konto TYPE konto OBLIGATORY DEFAULT '0001001050',

            p_valut TYPE valut OBLIGATORY DEFAULT sy-datum.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR d_fname.

   CALL FUNCTION 'F4_FILENAME'

     EXPORTING

       field_name = 'D_FNAME'

     IMPORTING

       file_name  = d_fname.

   p_file = d_fname.

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

*       CLASS lcl_report DEFINITION

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

CLASS lcl_report DEFINITION.

   PUBLIC SECTION.

     TYPES:BEGIN OF ty_file,

            kunnr  TYPE kunnr,

            xref1  TYPE xref1,

            wrbtr  TYPE wrbtr,

           END OF ty_file.

     DATA: gt_f28  TYPE zauto_t_f28,

           gtm_f28 TYPE zauto_t_f28,

           ws_f28  TYPE zauto_s_f28.

     DATA: zautopay TYPE zautopay.

     DATA: trx_mode(1VALUE 'N',

           trx_updt(1VALUE 'S'.

     DATA: bdcdata TYPE STANDARD TABLE OF bdcdata,

           messtab TYPE STANDARD TABLE OF bdcmsgcoll .

     DATA: gr_table      TYPE REF TO cl_salv_table.

     DATA: gr_functions  TYPE REF TO cl_salv_functions.

     DATA: gr_display    TYPE REF TO cl_salv_display_settings.

     DATA: gr_layout     TYPE REF TO cl_salv_layout.

     DATA: key           TYPE salv_s_layout_key.

     DATA: gr_columns    TYPE REF TO cl_salv_columns_table.

     DATA: gr_column     TYPE REF TO cl_salv_column_table.

     DATA: gl_events     TYPE REF TO cl_salv_events_table.

     DATA: gr_selections TYPE REF TO cl_salv_selections.

     METHODS:

             read_file,

             bdc_recording IMPORTING

                   lt_f28 TYPE zauto_t_f28,

             write_message,

             display_output IMPORTING

                    lt_output TYPE zauto_t_f28,

             set_column_names,

             bdc_screen IMPORTING

                 program TYPE sy-repid

                 dynpro TYPE sy-dynnr,

             bdc_field IMPORTING

                 fnam TYPE fnam_____4

                 fval TYPE any,

             on_user_command FOR EVENT

                 added_function OF cl_salv_events

                 IMPORTING e_salv_function,

*Displaying the records only pertaining to selected accounts.

             on_double_click

                 FOR EVENT double_click OF cl_salv_events_table

                 IMPORTING row column.

ENDCLASS.                    "lcl_report DEFINITION

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

*       CLASS lcl_report IMPLEMENTATION

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

*

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

CLASS lcl_report IMPLEMENTATION.

   METHOD:read_file.

*global internal table for reading csv file

     DATA: itab TYPE TABLE OF ty_file.

     DATA: ltab TYPE ty_file.

     CALL FUNCTION 'GUI_UPLOAD'

       EXPORTING

         filename                = p_file

         filetype                = 'DAT'

         has_field_separator     = 'X'

       TABLES

         data_tab                = itab

       EXCEPTIONS

         file_open_error         = 1

         file_read_error         = 2

         no_batch                = 3

         gui_refuse_filetransfer = 4

         invalid_type            = 5

         no_authority            = 6

         unknown_error           = 7

         bad_data_format         = 8

         header_not_allowed      = 9

         separator_not_allowed   = 10

         header_too_long         = 11

         unknown_dp_error        = 12

         access_denied           = 13

         dp_out_of_memory        = 14

         disk_full               = 15

         dp_timeout              = 16

         OTHERS                  = 17.

     IF sy-subrc <> 0.

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

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

     ELSE.

       LOOP AT itab INTO ltab.

         CLEAR ws_f28.

         MOVE-CORRESPONDING ltab TO ws_f28.

         UNPACK ws_f28-kunnr TO ws_f28-kunnr.

         SELECT SINGLE name1

           INTO ws_f28-name1

           FROM kna1

          WHERE kunnr = ws_f28-kunnr.

         IF sy-subrc NE 0.

           ws_f28-action = 'Customer is missing.'.

         ELSE.

           SELECT SINGLE *

             INTO zautopay

             FROM zautopay

            WHERE customer = ws_f28-kunnr.

           IF sy-subrc EQ 0.

             CASE zautopay-reference_type.

*** Logic to search invoice by Assignment Number (PO) ***

               WHEN 'P' OR 'W'.

                 SELECT SINGLE belnr

                   INTO ws_f28-belnr

                   FROM bsid

                  WHERE bukrs = p_bukrs

                    AND kunnr = zautopay-customer

                    AND xblnr = ws_f28-xref1+0(8).

                 IF sy-subrc NE 0.

                   SELECT SINGLE belnr

                     INTO ws_f28-belnr

                     FROM bsad

                    WHERE bukrs = p_bukrs

                      AND kunnr = zautopay-customer

                      AND xblnr = ws_f28-xref1+0(8).

                   IF sy-subrc NE 0.

                     ws_f28-belnr = ws_f28-xref1.

                   ENDIF.

                 ENDIF.

*** Logic to use extra search invoice by Item Text ***

               WHEN 'T' OR 'D'.

                 SELECT SINGLE belnr

                   INTO ws_f28-belnr

                   FROM bsid

                  WHERE bukrs = p_bukrs

                    AND kunnr = zautopay-customer

                    AND belnr = ws_f28-xref1+0(10).

                 IF sy-subrc NE 0.

                   SELECT SINGLE belnr

                     INTO ws_f28-belnr

                     FROM bsad

                    WHERE bukrs = p_bukrs

                      AND kunnr = zautopay-customer

                      AND belnr = ws_f28-xref1+0(10).

                   IF sy-subrc NE 0.

                     CONCATENATE ws_f28-xref1+0(10) '%'

                     INTO ws_f28-xref1.

                     SELECT SINGLE belnr

                       INTO ws_f28-belnr

                       FROM bsid

                      WHERE bukrs = p_bukrs

                        AND kunnr = zautopay-customer

                        AND blart = 'RV'

                        AND sgtxt LIKE ws_f28-xref1.

                     IF sy-subrc NE 0.

                       SELECT SINGLE belnr

                         INTO ws_f28-belnr

                         FROM bsad

                        WHERE bukrs = p_bukrs

                          AND kunnr = zautopay-customer

                          AND blart = 'RV'

                          AND sgtxt LIKE ws_f28-xref1.

                       IF sy-subrc NE 0.

                         ws_f28-belnr = ws_f28-xref1.

                       ENDIF.

                     ENDIF.

                   ENDIF.

                 ENDIF.

               WHEN OTHERS.

                 ws_f28-belnr = ws_f28-xref1.

             ENDCASE.

           ELSE.

             ws_f28-belnr = ws_f28-xref1.

           ENDIF.

*** Check invoice data ***

           SELECT SINGLE pswbt zfbdt zterm zbd1t skfbt

             INTO CORRESPONDING FIELDS OF ws_f28

             FROM bsid

            WHERE bukrs = p_bukrs

              AND kunnr = ws_f28-kunnr

              AND belnr = ws_f28-belnr

              AND buzei = '001'.

           IF sy-subrc NE 0.

             SELECT SINGLE pswbt zfbdt zterm zbd1t skfbt augbl

               INTO CORRESPONDING FIELDS OF ws_f28

               FROM bsad

              WHERE bukrs = p_bukrs

                AND kunnr = ws_f28-kunnr

                AND belnr = ws_f28-belnr.

             IF sy-subrc EQ 0.

               ws_f28-action = 'Invoice is already cleared!'(006).

               ws_f28-flag = 'S'.

             ELSE.

               ws_f28-action = 'Invoice is missing.'(007).

             ENDIF.

           ELSE.

             CLEAR ws_f28-action.

           ENDIF.

         ENDIF.

         APPEND ws_f28 TO gt_f28.

       ENDLOOP.

     ENDIF.

   ENDMETHOD.                    "read_file

   METHOD:bdc_recording.

     DATA: ls_messtab LIKE LINE OF messtab.

     DATA: process_diff.

     DATA: lv_kunnr TYPE kunnr.

     DATA: lv_wrbtr TYPE wrbtr.

     DATA: l_amount(16).

     DATA: l_date(10).

     IF NOT lt_f28[] IS INITIAL.

       gtm_f28[] = lt_f28[].

       LOOP AT gtm_f28 INTO ws_f28. "WHERE action IS INITIAL.

         CLEAR process_diff.

         IF ws_f28-wrbtr > ws_f28-pswbt.

           process_diff = 'O'.

         ELSEIF ws_f28-wrbtr < ws_f28-pswbt.

           process_diff = 'S'.

         ENDIF.

         REFRESH bdcdata.

         REFRESH messtab.

         CLEAR messtab.

         CLEAR bdcdata.

         CALL METHOD bdc_screen

           EXPORTING

             program = 'SAPMF05A'

             dynpro  = '0103'.

         CALL METHOD bdc_field

           EXPORTING

             fnam = 'BDC_OKCODE'

             fval = '=PA'.

         WRITE p_bldat TO l_date.

         CALL METHOD bdc_field

           EXPORTING

             fnam = 'BKPF-BLDAT'

             fval = l_date.

         CALL METHOD bdc_field

           EXPORTING

             fnam = 'BKPF-BLART'

             fval = 'DZ'.

         CALL METHOD bdc_field

           EXPORTING

             fnam = 'BKPF-BUKRS'

             fval = p_bukrs.

         WRITE p_budat TO l_date.

         CALL METHOD bdc_field

           EXPORTING

             fnam = 'BKPF-BUDAT'

             fval = l_date.

         CALL METHOD bdc_field

           EXPORTING

             fnam = 'BKPF-WAERS'

             fval = p_waers.

         CALL METHOD bdc_field

           EXPORTING

             fnam = 'BKPF-XBLNR'

             fval = p_xblnr.

         CALL METHOD bdc_field

           EXPORTING

             fnam = 'BKPF-BKTXT'

             fval = p_bktxt.

         CALL METHOD bdc_field

           EXPORTING

             fnam = 'RF05A-KONTO'

             fval = p_konto.

         WRITE ws_f28-wrbtr TO l_amount.

         CALL METHOD bdc_field

           EXPORTING

             fnam = 'BSEG-WRBTR'

             fval = l_amount.

         WRITE p_valut TO l_date.

         CALL METHOD bdc_field

           EXPORTING

             fnam = 'BSEG-VALUT'

             fval = l_date.

         CALL METHOD bdc_field

           EXPORTING

             fnam = 'RF05A-AGKON'

             fval = ws_f28-kunnr.

         CALL METHOD bdc_field

           EXPORTING

             fnam = 'RF05A-AGKOA'

             fval = 'D'.

         CALL METHOD bdc_field

           EXPORTING

             fnam = 'RF05A-XNOPS'

             fval = 'X'.

         CALL METHOD bdc_field

           EXPORTING

             fnam = 'RF05A-XPOS1(01)'

             fval = ' '.

         CALL METHOD bdc_field

           EXPORTING

             fnam = 'RF05A-XPOS1(03)'

             fval = 'X'.

         CALL METHOD bdc_screen

           EXPORTING

             program = 'SAPMF05A'

             dynpro  = '0731'.

         CALL METHOD bdc_field

           EXPORTING

             fnam = 'BDC_OKCODE'

             fval = '=PA'.

         CALL METHOD bdc_field

           EXPORTING

             fnam = 'RF05A-SEL01(01)'

             fval = ws_f28-belnr.

         CALL METHOD bdc_screen

           EXPORTING

             program = 'SAPDF05X'

             dynpro  = '3100'.

         IF process_diff = 'O'. "over payment

           CALL METHOD bdc_field

             EXPORTING

               fnam = 'BDC_OKCODE'

               fval = '=KMD'.

           CALL METHOD bdc_field

             EXPORTING

               fnam = 'RF05A-ABPOS'

               fval = '1'.

           CALL METHOD bdc_screen

             EXPORTING

               program = 'SAPMF05A'

               dynpro  = '0700'.

           CALL METHOD bdc_field

             EXPORTING

               fnam = 'BDC_OKCODE'

               fval = '/00'.

           CALL METHOD bdc_field

             EXPORTING

               fnam = 'RF05A-NEWBS'

               fval = '11'.

           CALL METHOD bdc_field

             EXPORTING

               fnam = 'RF05A-NEWKO'

               fval = ws_f28-kunnr.

           CALL METHOD bdc_screen

             EXPORTING

               program = 'SAPMF05A'

               dynpro  = '0301'.

           CALL METHOD bdc_field

             EXPORTING

               fnam = 'BDC_OKCODE'

               fval = '=BU'.

           lv_wrbtr = ws_f28-wrbtr - ws_f28-pswbt.

           WRITE lv_wrbtr TO l_amount.

           CALL METHOD bdc_field

             EXPORTING

               fnam = 'BSEG-WRBTR'

               fval = l_amount.

         ELSEIF process_diff = 'S'. "short payment

           CALL METHOD bdc_field

             EXPORTING

               fnam = 'BDC_OKCODE'

               fval = '=KMD'.

           CALL METHOD bdc_field

             EXPORTING

               fnam = 'RF05A-ABPOS'

               fval = '1'.

           CALL METHOD bdc_screen

             EXPORTING

               program = 'SAPMF05A'

               dynpro  = '0700'.

           CALL METHOD bdc_field

             EXPORTING

               fnam = 'BDC_OKCODE'

               fval = '/00'.

           CALL METHOD bdc_field

             EXPORTING

               fnam = 'RF05A-NEWBS'

               fval = '01'.

           CONCATENATE 'C' ws_f28-kunnr+4(6)

           INTO lv_kunnr.

           CALL METHOD bdc_field

             EXPORTING

               fnam = 'RF05A-NEWKO'

               fval = lv_kunnr.

           CALL METHOD bdc_screen

             EXPORTING

               program = 'SAPMF05A'

               dynpro  = '0301'.

           CALL METHOD bdc_field

             EXPORTING

               fnam = 'BDC_OKCODE'

               fval = '=BU'.

           lv_wrbtr = ws_f28-pswbt - ws_f28-wrbtr.

           WRITE lv_wrbtr TO l_amount.

           CALL METHOD bdc_field

             EXPORTING

               fnam = 'BSEG-WRBTR'

               fval = l_amount.

         ELSE.

           CALL METHOD bdc_field

             EXPORTING

               fnam = 'BDC_OKCODE'

               fval = '=BU'.

           CALL METHOD bdc_field

             EXPORTING

               fnam = 'RF05A-ABPOS'

               fval = '1'.

         ENDIF.

         CALL TRANSACTION 'F-28' USING         bdcdata

                                 MODE          trx_mode

                                 UPDATE        trx_updt

                                 MESSAGES INTO messtab.

         IF sy-subrc NE 0.

           CALL METHOD write_message.

           REFRESH messtab.

           CLEAR messtab.

         ELSE.

           COMMIT WORK.

           READ TABLE messtab INTO ls_messtab WITH KEY msgtyp = 'S'

                                                       msgid  = 'F5'

                                                       msgnr  = '312'.

           IF sy-subrc EQ 0.

             CONCATENATE ls_messtab-msgv2 ls_messtab-msgv1 text-001

             INTO ws_f28-action SEPARATED BY space.

             ws_f28-augbl = ls_messtab-msgv1.

             ws_f28-flag  = ls_messtab-msgtyp.

             MODIFY gtm_f28 FROM ws_f28.

           ENDIF.

         ENDIF.

         CLEAR: ws_f28.

       ENDLOOP.

     ENDIF.

   ENDMETHOD.                "bdc_recording

   METHOD:display_output.

     DATA: lr_functions TYPE REF TO cl_salv_functions_list,

           lt_dispouput TYPE zauto_t_f28.

     lt_dispouput[] = lt_output[].

     TRY.

         cl_salv_table=>factory( IMPORTING r_salv_table = gr_table

                                     CHANGING t_table = lt_dispouput ). "gt_f28 ).

         gr_functions = gr_table->get_functions( ).

         gr_functions->set_all( abap_true ).

         gr_display = gr_table->get_display_settings( ).

         gr_display->set_striped_pattern( cl_salv_display_settings=>true ).

         gr_display->set_list_header( 'Automatically Post Incoming Payments'(008) ).

       CATCH cx_salv_msg.

     ENDTRY.

     TRY.

         gr_columns = gr_table->get_columns( ).

       CATCH cx_salv_not_found.

     ENDTRY.

     lr_functions = gr_table->get_functions( ).

     lr_functions->set_all( ).

     gr_table->set_screen_status( pfstatus = 'SALV_TABLE_STANDARD'

                           report = sy-repid

                           set_functions = gr_table->c_functions_all ).

     CALL METHOD set_column_names.

     gr_layout = gr_table->get_layout( ).

     key-report = sy-repid.

     gr_layout->set_key( key ).

     gr_layout->set_save_restriction( cl_salv_layout=>restrict_none ).

     gl_events = gr_table->get_event( ).

*... §6.1 register to the event USER_COMMAND

     SET HANDLER me->on_user_command FOR gl_events.

*   event handler

     SET HANDLER  me->on_double_click FOR gl_events.

*Set up selections.

     gr_selections = gr_table->get_selections( ).

     gr_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ). "Single

     gr_table->display( ).

   ENDMETHOD.                    "display_output

   METHOD:set_column_names.

     TRY.

         gr_column ?= gr_columns->get_column('NAME1').

         gr_column->set_long_text( 'Customer Name'(009) ).

         gr_column->set_medium_text( 'Customer Name'(009) ).

         gr_column->set_short_text( 'Name'(010) ).

         gr_column->set_output_length( 12 ).

         gr_column ?= gr_columns->get_column('KUNNR').

         gr_column->set_output_length( 8 ).

         gr_column ?= gr_columns->get_column('BELNR').

         gr_column->set_long_text( 'Invoice Number'(011) ).

         gr_column->set_medium_text( 'Invoice Number'(011) ).

         gr_column->set_short_text( 'Invoice'(012) ).

         gr_column->set_output_length( 8 ).

         gr_column ?= gr_columns->get_column('XREF1').

         gr_column->set_long_text( 'Reference' ).

         gr_column->set_medium_text( 'Reference' ).

         gr_column->set_short_text( 'Reference' ).

         gr_column->set_output_length( 8 ).

         gr_column ?= gr_columns->get_column('WRBTR').

         gr_column->set_long_text( 'Incoming Payment'(013) ).

         gr_column->set_medium_text( 'Incoming Payment'(013) ).

         gr_column->set_short_text( 'Payment'(014) ).

         gr_column->set_output_length( 8 ).

         gr_column ?= gr_columns->get_column('PSWBT').

         gr_column->set_long_text( 'Receivable Amount'(015) ).

         gr_column->set_medium_text( 'Receivable Amount'(015) ).

         gr_column->set_short_text( 'Receivable'(016) ).

         gr_column->set_output_length( 8 ).

         gr_column ?= gr_columns->get_column('ZFBDT').

         gr_column->set_output_length( 8 ).

         gr_column ?= gr_columns->get_column('SKFBT').

         gr_column->set_output_length( 8 ).

         gr_column ?= gr_columns->get_column('ACTION').

         gr_column->set_long_text( 'Record Status'(017) ).

         gr_column->set_medium_text( 'Record Status'(017) ).

         gr_column->set_short_text( 'Recd Stat'(018) ).

       CATCH cx_salv_not_found.

     ENDTRY.

   ENDMETHOD.                    "set_column_names

   METHOD:write_message.

     DATA: lv_errtext(250).

     DATA:ls_messtab LIKE LINE OF messtab,

          lv_text TYPE natxt.

     CLEAR lv_errtext.

     LOOP AT messtab INTO ls_messtab.

       IF ls_messtab-msgid = 'F5' AND ls_messtab-msgnr = '074'.

         CONTINUE.

       ENDIF.

       CLEAR lv_text.

       SELECT SINGLE text

         FROM t100

         INTO lv_text

        WHERE sprsl EQ ls_messtab-msgspra

          AND arbgb EQ ls_messtab-msgid

          AND msgnr EQ ls_messtab-msgnr.

       CONCATENATE ls_messtab-msgv1

                   ls_messtab-msgv2

                   ls_messtab-msgv3

                   ls_messtab-msgv4

                   lv_errtext

                   lv_text

              INTO lv_errtext SEPARATED BY space.

     ENDLOOP.

     ws_f28-action = lv_errtext.

     MODIFY gtm_f28 FROM ws_f28.

   ENDMETHOD.                    " WRITE_MESSAGE

   METHOD: bdc_screen.

     DATA:ls_bdcdata TYPE bdcdata.

     CLEAR ls_bdcdata.

     ls_bdcdata-program  = program.

     ls_bdcdata-dynpro   = dynpro.

     ls_bdcdata-dynbegin = 'X'.

     APPEND ls_bdcdata TO bdcdata.

   ENDMETHOD.                    " BDC_SCREEN

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

*&      Form  BDC_FIELD

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

   METHOD bdc_field.

     DATA:ls_bdcdata TYPE bdcdata.

     CLEAR ls_bdcdata.

     ls_bdcdata-fnam = fnam.

     ls_bdcdata-fval = fval.

     APPEND ls_bdcdata TO bdcdata.

   ENDMETHOD.                    " BDC_FIELD

* Handles the UI on the HKONT (HotSpot)

   METHOD on_double_click.

     DATA:ls_f28 TYPE zauto_s_f28,

          lv_gjahr TYPE gjahr.

*   Get the customer number from the table

     READ TABLE me->gt_f28 INTO ls_f28 INDEX row.

     IF sy-subrc EQ 0 AND ls_f28-flag = 'S'.

       CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'

         EXPORTING

           companycodeid = p_bukrs

           posting_date  = p_budat

         IMPORTING

           fiscal_year   = lv_gjahr.

       SET PARAMETER ID 'BLN'  FIELD ls_f28-augbl.

       SET PARAMETER ID 'BUK'  FIELD p_bukrs.

       SET PARAMETER ID 'GJR'  FIELD lv_gjahr.

       CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.

       CLEAR:ls_f28.

     ENDIF.

   ENDMETHOD.                    "on_double_click

   METHOD on_user_command.

* Get the selection rows data:

     DATA: lt_select_rows TYPE salv_t_row.

     DATA: ls_select_rows TYPE LINE OF salv_t_row.

     DATA: lt_f28 TYPE zauto_t_f28.

     DATA: ls_f28 TYPE zauto_s_f28.

     CASE e_salv_function.

       WHEN '&F03'.

         LEAVE TO SCREEN 1000.

       WHEN 'AUTOPAY'.

         lt_select_rows = gr_selections->get_selected_rows( ).

         IF lt_select_rows[] IS NOT INITIAL.

           LOOP AT lt_select_rows INTO ls_select_rows.

             READ TABLE gt_f28 INTO ls_f28 INDEX ls_select_rows.

             IF sy-subrc EQ 0 AND ls_f28-augbl IS INITIAL.

               APPEND ls_f28 TO lt_f28.

             ELSE.

               MESSAGE: 'Document is already cleared'(003) TYPE 'E'.

             ENDIF.

             CLEAR: ls_f28, ls_select_rows.

           ENDLOOP.

           IF NOT lt_f28[] IS INITIAL.

             CALL METHOD bdc_recording

               EXPORTING

                 lt_f28 = lt_f28.

           ENDIF.

           IF NOT gtm_f28[] IS INITIAL.

             LOOP AT gt_f28 INTO ws_f28.

               READ TABLE gtm_f28 INTO ls_f28

                    WITH KEY kunnr = ws_f28-kunnr

                             belnr = ws_f28-belnr.

               IF sy-subrc EQ 0.

                 ws_f28-augbl  = ls_f28-augbl.

                 ws_f28-action = ls_f28-action.

                 ws_f28-flag   = 'S'.

                 MODIFY gt_f28 FROM ws_f28.

               ENDIF.

             ENDLOOP.

           ENDIF.

*... refresh the ALV in order to see the new data but don't generate a new display

*... update the existing display only

*... refresh the table in order to see the new data

           gr_table->refresh( ).

*          TRY.

*              CALL METHOD gr_table->set_data

*                CHANGING

*                  t_table = gt_f28.

*            CATCH cx_salv_no_new_data_allowed.

*          ENDTRY.

         ELSE.

           MESSAGE: 'No records were selected to process the Auto Payments'(004) TYPE 'E'.

         ENDIF.

     ENDCASE.

   ENDMETHOD.                    "on_user_command

ENDCLASS.                    "lcl_report IMPLEMENTATION

START-OF-SELECTION.

   DATA: lo_report TYPE REF TO lcl_report.

   p_file = d_fname.

   CREATE OBJECT lo_report.

   lo_report->read_file( ).

   IF lo_report->gt_f28[] IS NOT INITIAL.

     lo_report->display_output( EXPORTING lt_output = lo_report->gt_f28 ).

   ELSE.

     MESSAGE: 'No Records in the file'(005) TYPE 'E'.

   ENDIF.

END-OF-SELECTION.

Read only

0 Likes
2,728

Hi,

You have to update your internal table which is passed to ALV .

Try to clear and refill <it_table> before calling   gr_table->refresh( ).

then  you call method refresh.

Gourav.

Read only

0 Likes
2,728

Gourav,

Even then it is not working, by clearing and updating the table.

Regards,

Sunil Kumar.

Read only

0 Likes
2,728

Hi,

In this case follow these thread

It will solve your problem

http://scn.sap.com/thread/1455402

http://scn.sap.com/thread/1282445

http://scn.sap.com/thread/1216805

Gourav.

Read only

Former Member
0 Likes
2,728

Hi Sunil,

I didnt understand your question correctly.

But i faced a similar situation before.

Please make sure that the internal table that your are displaying through the alv grid is getting updated during the customization.

Then only go for the refresh.

I kept a button and gave the code to select again and it worked

CASE e_ucomm.

        WHEN 'REFRESH'.

          REFRESH gt_output.

          PERFORM proc_selection( selected data to the internal table again).

          CALL METHOD a_alvgd->refresh_table_display.

Regards,

Akhil

Read only

0 Likes
2,728

Hi,

Even though the internal table is getting updated but it is not refresh my ALV display.

But I am using cl_salv_table class to generate the ALV output.

Regards,

Sunil Kumar.