04-13-2019 1:38 AM
Hello all,
I have a requeriment wich I need to get update a field table at SM30 when press a button.
I tried to update the internal tables "total" and "extract", but the changes does not apply to the display table.
04-13-2019 8:25 AM
Use Event 1 - before Save or Event 5 Create new entry as per your requirement.
LOOP AT total.
l_tabix = sy-tabix.
* Assign the table header line to the work area
ASSIGN total TO <record>.
IF sy-subrc = 0. " If assigning is successful.
* Check if data was changed and get the corresponding line index
IF <action> = 'N'. " New entry
READ TABLE extract WITH KEY <vim_xtotal_key>.
IF sy-subrc = 0 .
l_index = sy-tabix.
ELSE.
CLEAR l_index.
ENDIF.
gs_zfi_bg-create_name = sy-uname.
gs_zfi_bg-create_date = sy-datum.
gs_zfi_bg-created_at = sy-uzeit.
IF <action> = 'U'.
gs_zfi_bg-change_name = sy-uname.
ENDIF.
<vim_total_struc> = gs_zfi_bg.
MODIFY total.
CHECK l_index > 0.
extract = <record>.
* Modify extract table
MODIFY extract INDEX l_index.
endif.
endif.
ENDLOOP.
04-13-2019 6:55 AM
04-13-2019 8:14 AM
Please post the code as text instead of image, so that it can be easily copied.
04-13-2019 8:14 AM
What event did you use?
PS: Please post the code as text instead of image, so that it can be easily copied.
04-13-2019 8:25 AM
Use Event 1 - before Save or Event 5 Create new entry as per your requirement.
LOOP AT total.
l_tabix = sy-tabix.
* Assign the table header line to the work area
ASSIGN total TO <record>.
IF sy-subrc = 0. " If assigning is successful.
* Check if data was changed and get the corresponding line index
IF <action> = 'N'. " New entry
READ TABLE extract WITH KEY <vim_xtotal_key>.
IF sy-subrc = 0 .
l_index = sy-tabix.
ELSE.
CLEAR l_index.
ENDIF.
gs_zfi_bg-create_name = sy-uname.
gs_zfi_bg-create_date = sy-datum.
gs_zfi_bg-created_at = sy-uzeit.
IF <action> = 'U'.
gs_zfi_bg-change_name = sy-uname.
ENDIF.
<vim_total_struc> = gs_zfi_bg.
MODIFY total.
CHECK l_index > 0.
extract = <record>.
* Modify extract table
MODIFY extract INDEX l_index.
endif.
endif.
ENDLOOP.
04-14-2019 6:15 PM