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 event handling

mahesh_jagnani
Participant
0 Kudos

i have created a table having three field and generated table maintanance generator for this .

the fields are mandt,account1 and account2 .But i want that when the user want to update the table through SM30 The account 2 must be >= account1. other wise an error message should display and when user enter correct value the table should be updated.

how i can do it.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

You can copy the include under

  • general include-files (never change, please) *

i.e. INCLUDE xyzIXX . " PAI modules

and search for "SAVE" in this include and paste your code here

the table that holds the value here is EXTRACT

loop at extract and check ur condition & display error message

Siddharth

6 REPLIES 6

Former Member
0 Kudos

Hi,

You have to create events for handling validations through SM30. For creating the events, do the below steps:

1) Go to SE11 enter the table needed and then from menu select table maintenance generator

2) On the next screen, Menu- Environment-Modification-Events

3) Now select the event for before save : Event "01", Enter some subroutine name..(Inside this subroutine, write the ccode to validate)

Note that the subrotuine which is created above needs to be in the same func grp of the table mainteannce generator to access the fields and values

Regards

Shiva

mahesh_jagnani
Participant
0 Kudos

Yaa that will be done by event.but when i put error message inside the code and when error encounterd in SM30 then the control goes to begining of the screen,

can you please give code.

Former Member
0 Kudos

Hi,

You can copy the include under

  • general include-files (never change, please) *

i.e. INCLUDE xyzIXX . " PAI modules

and search for "SAVE" in this include and paste your code here

the table that holds the value here is EXTRACT

loop at extract and check ur condition & display error message

Siddharth

Former Member
0 Kudos

Hello Mahesh,

You can try the code in this way :

Account1

Validation for Account 1

select accoun1 from DBTab

into it_acc1

where account1 = DBTab-account1.

if sy-subrc <> 0.

Message e000 with 'the account number is invalid'(010)

endif.

Validation for Account 2

if account1 is initail.

message i000 with 'please enter valid account no'(020).

else.

select accoun2 from Dbtab

into it_acc2

where accoun2 = dbtab-account2 and

account2>=dbtab-account1.

endif.

You can try the code in this way.

Former Member
0 Kudos

hi

check this link

mahesh_jagnani
Participant
0 Kudos

solved thks