‎2010 Oct 28 6:14 PM
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
‎2010 Oct 29 8:32 AM
Hi,
are you sure that you update your internal table with new content after you did VA02 and before you call refresh of report.?
Bye Jan
‎2010 Oct 28 7:13 PM
You may have to pass a value through the I_GRID_SETTINGS parameter of REUSE_ALV_GRID_DISPLAY.
See the bold face here for what you need to add:
DATA: LC_GLAY TYPE LVC_S_GLAY.
LC_GLAY-EDT_CLL_CB = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_GRID_SETTINGS = lc_glay
IT_FIELDCAT = l_fialdcattab
TABLES
T_OUTTAB = t_itab.
This is necessary for sync'ing the iteb with the user's edits, but I'm not sure if it's related to refreshing the itab with your program's edits.
Edited by: ColtsFan on Oct 28, 2010 2:14 PM
Edited by: ColtsFan on Oct 28, 2010 2:16 PM
‎2010 Oct 28 8:40 PM
Hey! Thanks for the advice but it is still not displaying the changes that were made after accessing VA02.
‎2010 Oct 28 9:02 PM
See if setting is_selfield-refresh = 'X' in your USER_COMMAND form will solve it
----
FORM USER_COMMAND *
----
FORM user_command USING i_ucomm TYPE syucomm
is_selfield TYPE slis_selfield.
CASE i_ucomm.
WHEN '&NTE'.
*somewhere before u call the alv, you must set this
is_selfield-refresh = 'X'.
‎2010 Oct 28 8:58 PM
Hi Wendy,
Guess you want to get updated records in alv output, after the user makes changes thru va02. In user exit of sales order if changes is saved, set a flag and export it. In the PAI, Import the flag and check if flag value is checked, If yes call all function modules that populate data on the screen again.
eg:
PAI
perform refresh.
form refresh
perform read data from table
perform refresh alv display
end form
Hope It Helps.!
Regards,
Kalpana
‎2010 Oct 29 8:32 AM
Hi,
are you sure that you update your internal table with new content after you did VA02 and before you call refresh of report.?
Bye Jan
‎2010 Oct 29 9:01 AM
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
‎2010 Oct 29 12:57 PM
I you don't want to check the update, you could set the commit to local
* init data
CLEAR: lv_error,
refresh lt_bdcmsg.
* Call va02
SET PARAMETER ID 'AUN' FIELD old_data-vbeln.
CALL transaction 'VA02' AND SKIP FIRST SCREEN
UPDATE 'L'
MESSAGES INTO lt_bdcmsg.
* 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
‎2010 Dec 03 4:27 AM
Hi Wendy,
I have the exact requirement as yours.
Can you please share how you managed to refresh the data and then the ALV grid? Where did you write the code for it?
Thanks
‎2010 Dec 03 12:10 PM
Hello!
Well, first I called the FM 'REUSE_ALV_GRID_DISPLAY' setting the i_callback_user_command to 'USER_COMMAND'. Here is my code below:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = p_repid
i_callback_top_of_page = 'TOP_OF_PAGE'
i_default = 'X'
is_variant = wa_variant_2
it_fieldcat = p_fieldcat[]
i_callback_user_command = 'USER_COMMAND'
i_save = 'A'
TABLES
t_outtab = p_out.
Then I have the FORM USER_COMMAND. To refresh after the user comes back from going into VA02 I set p_selfield-refresh to 'X' so the FM will know it needs to refresh and then I have to also refresh the output table so the changes the user made will display in the ALV grid. For me, I delete the line the user clicked on out of my output table and then go back and run the processes that previously filled in my output table.
If you need any additional information just let me know!
Thanks,
Wendy