Application Development 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: 

SM30 Enhancement

0 Kudos

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.

1 ACCEPTED SOLUTION

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.
5 REPLIES 5

Hello,

Kindly try this.

Please post the code as text instead of image, so that it can be easily copied.

What event did you use?

PS: Please post the code as text instead of image, so that it can be easily copied.

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.

0 Kudos

Thank you Trilok Sahu, this solved my problem.