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 ALV doesnt work

Former Member
0 Likes
1,260

Hello guys.

After a couple of days trying to solve this problem I ask for help

My report shows a list, an item on the list goes to a tcode IW32 to update a field and then come back to the report. The report contains the fields that was updated it, but it doest show the new value. The only way that showed me the new value was doing a debug to the program without do nothing else...rare. In addition, the table contains the fields update it, but the ALV doesnt show the new values...The refresh doesnt work also.

This is my code.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

      i_callback_program       = repid

      i_callback_user_command  = g_user_command

      i_callback_pf_status_set = 'SET_STATUS'

      is_layout                = layout

      it_fieldcat              = fieldcat[]

      is_print                 = gs_print

      i_save                   = 'X'

    TABLES

      t_outtab                 = ti_salida

    EXCEPTIONS

      program_error            = 1

      OTHERS                   = 2.

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

*       FORM USER_COMMAND                                             *

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

*Rutina de

FORM user_command USING r_ucomm LIKE sy-ucomm

                        rs_selfield TYPE slis_selfield.

* Nos aseguramos que no haya pinchado sobre una linea sin nada

  CHECK NOT rs_selfield-tabname IS INITIAL.

  CASE r_ucomm.

  * Si se hizo doble clic sobre un pedido

    WHEN '2click_code'.

  *     Leemos de la tabla de salida, el registro que se seleccionó.

      IF rs_selfield-fieldname = 'AUFNR'.

        READ TABLE ti_salida INDEX rs_selfield-tabindex.

        SET PARAMETER ID 'ANR' FIELD ti_salida-aufnr.

        CALL TRANSACTION 'IW32' AND SKIP FIRST SCREEN.

      ELSEIF rs_selfield-fieldname = 'QMNUM'.

          READ TABLE ti_salida INDEX rs_selfield-tabindex.

          IF ti_salida-qmnum <> ''.

          SET PARAMETER ID 'IQM' FIELD ti_salida-qmnum.

          CALL TRANSACTION 'IW23' AND SKIP FIRST SCREEN.

        ENDIF.

      ENDIF.

*     Update ti_mate

      PERFORM update_stat USING ti_salida-aufnr.

      rs_selfield-refresh = 'X'.

  ENDCASE.

ENDFORM.                    "user_command

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

*&      Form  UPDATE_STAT

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

FORM update_stat  USING    p_ti_salida_aufnr LIKE aufk-aufnr.

  DATA: l_objnr LIKE aufk-objnr,

        w_stat LIKE jest-stat,

        w_stma LIKE jsto-stsma,

        w_txt4 LIKE tj30t-txt04,

        w_txt40 LIKE tj30t-txt30.

  SELECT SINGLE stat INTO w_stat

  FROM jest

  WHERE objnr = ti_mate-objnr

  AND   stat LIKE 'E%'

  AND   inact <> 'X'.

  SELECT SINGLE stsma INTO w_stma

  FROM jsto

  WHERE objnr = ti_mate-objnr.

  SELECT SINGLE txt04 txt30 INTO (w_txt4 , w_txt30)

  FROM tj30t

  WHERE stsma = w_stma AND estat = w_stat

  AND spras = 'S'.

  LOOP AT ti_salida WHERE aufnr = p_ti_salida_aufnr.

    ti_salida-txt04  = w_txt4.

    ti_salida-txt30 = w_txt30.

    MODIFY ti_salida.

  ENDLOOP.

ENDFORM.                    " UPDATE_STAT

My problem is the same as this post

http://scn.sap.com/message/13720259

https://scn.sap.com/thread/1597612

mmmm...it seems to be a problem with SAP???..Any ideas how to solve this problem???

Message was edited by: Miguel Alvear

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,082

Hello to all.

I checked it, everything is ok on the code. Also, i did what Miroslav Oprsteny says, but it didnt work as well.

When i update a notification and then come back to the report it is not showing the update fields, but then i go again inside the IW32 and come back (without modify anything) the fields gets updated it.

Very rare

Anyway, after a couple of hours dealing with this issue I was able to solve the problem. It was a delay problem with SAP, sometimes PM module and MM have those kinds of issues.

So, what I did to solve it was to do a do enddo, and......it works. look the solution...this way works for me, i checked several times and get the fields update correctly...i didnt find other way

{code}

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

*       FORM USER_COMMAND                                             *

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

*Rutina de

FORM user_command USING r_ucomm LIKE sy-ucomm

                        rs_selfield TYPE slis_selfield.

* Nos aseguramos que no haya pinchado sobre una linea sin nada

  CHECK NOT rs_selfield-tabname IS INITIAL.

  CASE r_ucomm.

* Si se hizo doble clic sobre un pedido

    WHEN '2click_code'.

*     Leemos de la tabla de salida, el registro que se seleccionó.

        IF rs_selfield-fieldname = 'AUFNR'.

        READ TABLE ti_salida INDEX rs_selfield-tabindex.

        SET PARAMETER ID 'ANR' FIELD ti_salida-aufnr.

        CALL TRANSACTION 'IW32' AND SKIP FIRST SCREEN.

        COMMIT WORK AND WAIT.

*       Update ti_mate with new values of AUFNR

        DO 5 TIMES.  " To be sure that it gets update

          PERFORM update_stat USING ti_salida-aufnr ti_salida-objnr.

          rs_selfield-refresh = 'X'.

            COMMIT WORK AND WAIT.

        ENDDO.

        ELSEIF rs_selfield-fieldname = 'QMNUM'.

          READ TABLE ti_salida INDEX rs_selfield-tabindex.

          IF ti_salida-qmnum <> ''.

          SET PARAMETER ID 'IQM' FIELD ti_salida-qmnum.

          CALL TRANSACTION 'IW23' AND SKIP FIRST SCREEN.

        ENDIF.

      ENDIF.

  ENDCASE.

ENDFORM.                    "user_command

{code}

Thanks to all ..

Miguel

5 REPLIES 5
Read only

Former Member
0 Likes
1,082

any ideas??? Thanks

Read only

0 Likes
1,082

Hi Miguel,

most probably you need to explicitly call method REFRESH_TABLE_DISPLAY

You use this method to refresh the output table in the grid control.

This is necessary if you change the display of the data by means of methods (for example, using set_frontend_layout), or if you want to display new data selected in the same ALV Grid Control.

CALL METHOD ->refresh_table_display
  EXPORTING IS_STABLE =  <structure of type LVC_S_STBL>
  I_SOFT_REFRESH = <variable of type CHAR01>. .
Read only

0 Likes
1,082

Are you sure the data is yet updated in database and that you read up-to-date data ?

- Wait for end of update task (try to lock the order, will be released at end of V1 update tasks)

- Select data BYPASSING BUFFER

Regards,

Raymond

Read only

0 Likes
1,082

Hi Miguel,

did you check in debugger then WHEN '2click_code' matches the r_ucomm parameter? As to my knowledge, only upper case codes are possible. So '2click_code' is never equal r_ucomm and all the statements are never executed.

Otherwise, rs_selfield-refresh = 'X' will definitely cause a refresh of the display of the table.

Regards,

Clemens

Read only

Former Member
0 Likes
1,083

Hello to all.

I checked it, everything is ok on the code. Also, i did what Miroslav Oprsteny says, but it didnt work as well.

When i update a notification and then come back to the report it is not showing the update fields, but then i go again inside the IW32 and come back (without modify anything) the fields gets updated it.

Very rare

Anyway, after a couple of hours dealing with this issue I was able to solve the problem. It was a delay problem with SAP, sometimes PM module and MM have those kinds of issues.

So, what I did to solve it was to do a do enddo, and......it works. look the solution...this way works for me, i checked several times and get the fields update correctly...i didnt find other way

{code}

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

*       FORM USER_COMMAND                                             *

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

*Rutina de

FORM user_command USING r_ucomm LIKE sy-ucomm

                        rs_selfield TYPE slis_selfield.

* Nos aseguramos que no haya pinchado sobre una linea sin nada

  CHECK NOT rs_selfield-tabname IS INITIAL.

  CASE r_ucomm.

* Si se hizo doble clic sobre un pedido

    WHEN '2click_code'.

*     Leemos de la tabla de salida, el registro que se seleccionó.

        IF rs_selfield-fieldname = 'AUFNR'.

        READ TABLE ti_salida INDEX rs_selfield-tabindex.

        SET PARAMETER ID 'ANR' FIELD ti_salida-aufnr.

        CALL TRANSACTION 'IW32' AND SKIP FIRST SCREEN.

        COMMIT WORK AND WAIT.

*       Update ti_mate with new values of AUFNR

        DO 5 TIMES.  " To be sure that it gets update

          PERFORM update_stat USING ti_salida-aufnr ti_salida-objnr.

          rs_selfield-refresh = 'X'.

            COMMIT WORK AND WAIT.

        ENDDO.

        ELSEIF rs_selfield-fieldname = 'QMNUM'.

          READ TABLE ti_salida INDEX rs_selfield-tabindex.

          IF ti_salida-qmnum <> ''.

          SET PARAMETER ID 'IQM' FIELD ti_salida-qmnum.

          CALL TRANSACTION 'IW23' AND SKIP FIRST SCREEN.

        ENDIF.

      ENDIF.

  ENDCASE.

ENDFORM.                    "user_command

{code}

Thanks to all ..

Miguel