05-22-2006 6:07 PM
Hello SAPients.
I have a Maintenance Dialog for a ZTable, I have two fields that are updated with code (Changed by and Changed on) in the event "01 Before saving the data in the database". The data is correctly saved in the ZTable, but the records changed are not refreshed in the screen after I clicked the save button. What can I do to get the Table Control refreshed and make it show the new values of those fields immediately after I clicked the Save button?
Thank you in advance for your kind help.
05-22-2006 6:46 PM
Ricardo - I use the following code in event 01 and the screen is refreshed after the data is saved:
*&---------------------------------------------------------------------*
*& Form FILL_SY_FIELDS
*&---------------------------------------------------------------------*
* Add the creation date and userid if the line is being created.
* Add the change date and userid if the line is being changed.
*----------------------------------------------------------------------*
form fill_sy_fields.
data: f_index like sy-tabix. "Index to note the lines found
data begin of total_s.
include structure ZZHB6_GL_ST_CD_V.
data action.
data mark.
data end of total_s.
data extract_s like total_s.
loop at total.
if <action> = 'U'.
move total to total_s.
read table extract with key total.
if sy-subrc eq 0.
f_index = sy-tabix.
extract_s = extract.
else.
clear f_index.
endif.
* (make desired changes to the line TOTAL)
total_s-zzfchdate = sy-datum.
total_s-zzfchusr = sy-uname.
move total_s to total.
modify total.
check f_index gt 0.
extract = total.
modify extract index f_index.
elseif <action> = 'N'.
move total to total_s.
read table extract with key total.
if sy-subrc eq 0.
f_index = sy-tabix.
extract_s = extract.
else.
clear f_index.
endif.
* (make desired changes to the line TOTAL)
total_s-zzfcredate = sy-datum.
total_s-zzfcreusr = sy-uname.
move total_s to total.
modify total.
check f_index gt 0.
extract = total.
modify extract index f_index.
elseif total is initial.
move total to total_s.
read table extract with key total.
if sy-subrc eq 0.
f_index = sy-tabix.
extract_s = extract.
else.
clear f_index.
endif.
* (make desired changes to the line TOTAL)
delete total.
check f_index gt 0.
delete extract index f_index.
endif.
endloop.
sy-subrc = 0.
endform. " FILL_SY_FIELDS
Rob
05-22-2006 6:46 PM
Ricardo - I use the following code in event 01 and the screen is refreshed after the data is saved:
*&---------------------------------------------------------------------*
*& Form FILL_SY_FIELDS
*&---------------------------------------------------------------------*
* Add the creation date and userid if the line is being created.
* Add the change date and userid if the line is being changed.
*----------------------------------------------------------------------*
form fill_sy_fields.
data: f_index like sy-tabix. "Index to note the lines found
data begin of total_s.
include structure ZZHB6_GL_ST_CD_V.
data action.
data mark.
data end of total_s.
data extract_s like total_s.
loop at total.
if <action> = 'U'.
move total to total_s.
read table extract with key total.
if sy-subrc eq 0.
f_index = sy-tabix.
extract_s = extract.
else.
clear f_index.
endif.
* (make desired changes to the line TOTAL)
total_s-zzfchdate = sy-datum.
total_s-zzfchusr = sy-uname.
move total_s to total.
modify total.
check f_index gt 0.
extract = total.
modify extract index f_index.
elseif <action> = 'N'.
move total to total_s.
read table extract with key total.
if sy-subrc eq 0.
f_index = sy-tabix.
extract_s = extract.
else.
clear f_index.
endif.
* (make desired changes to the line TOTAL)
total_s-zzfcredate = sy-datum.
total_s-zzfcreusr = sy-uname.
move total_s to total.
modify total.
check f_index gt 0.
extract = total.
modify extract index f_index.
elseif total is initial.
move total to total_s.
read table extract with key total.
if sy-subrc eq 0.
f_index = sy-tabix.
extract_s = extract.
else.
clear f_index.
endif.
* (make desired changes to the line TOTAL)
delete total.
check f_index gt 0.
delete extract index f_index.
endif.
endloop.
sy-subrc = 0.
endform. " FILL_SY_FIELDS
Rob
05-22-2006 6:49 PM
05-22-2006 8:44 PM