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: 

Table Maintenance Generator for event Number 03

pbiswas
Explorer
0 Kudos

select the record with the help of checkbok and delete the record from sm30.

how to write code for tmg event delete

5 REPLIES 5

former_member228514
Participant
0 Kudos

Could you please elaborate your requirement.

0 Kudos

03-Before deleting the data displayed

This event gets triggered whenever user delete a data i.e. select a record and click on ‘delete’.

Let us add first event i.e. before deleting the data displayed. Give the name of the event in ‘FORM routine’ and click on ‘Editor’.

The following screen would appear. We can use an already existing include or a new include also

After selecting the ‘Include’, write the code inside the ‘include’ of function group of the event and

activate the ‘include’. Write the following code in the FORM routine.

Please note that FORM and ENDFORM statements have to be added on our own because

these statements would appear automatically.

If the user clicks on ‘No’ in step 4.3.2, the record would not get deleted

Hope you understand

Regards,

Sandeep

0 Kudos

If user click on "No",  change <XMARK> to skip "*" (Constants: uebergehen)

Regards,

Raymond

0 Kudos

Select the record with the help of checkbox and delete the record

former_member182915
Active Contributor
0 Kudos

Hi,

Sap provide each a unique field(VIM_MARKED) in each SM30 for selecting rows.

i think you use sap provided field for selecting records.If you need your own field as check box then

you have add a field in table control in screen flow logic and drag and drop check box from tool to table control map with newly added field.

then use tmg event 03

and code to identify check is initial or not then delete their only as you dont select sap field so sap may not identify which record will be  delete from Table control.

form delete_before

data lwa_row type <your z table name>.

  loop at total.

    clear lwa_row.

    if <vim_total_struc> is assigned.

      move-corresponding <vim_total_struc> to lwa_row.

    endif.

    if <action> ne 'D' and <action> is not initial and <action> ne 'X'.

      if lwa_row-<chenck box field > ne 'X'.

        *put logic for delete entry from table control*

      endif.

    endif.

endloop.