09-29-2008 1:49 PM
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.
09-29-2008 2:38 PM
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
09-29-2008 2:02 PM
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
09-29-2008 2:15 PM
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.
09-29-2008 2:38 PM
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
09-30-2008 10:13 AM
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.
10-01-2008 6:46 AM
04-06-2009 8:07 AM