08-02-2013 3:43 PM
The validation should be like we need an unique cost center in the program.
i have three fieds in the table
company code and cost center are primary fields and user is another field
The validation that we want is if we have an entry
company code cost center user
ww ARZ5511 Nithin
is allowed
it should not allow any more entry for the same cost center
ie ARZ5511
and if we have an entry
company code cost center user
X1 ARZ5511 Nithin
it should not abllow any entry with
1* ARZ5511 ttruax
similarly for X3, X5, X7 and X9, 3*,5*,7*,9*.
Here * means the company code starting with 1.
I'm not knowing how to deal with this case.
Please help me guys.
Thanks in advance.
08-02-2013 5:07 PM
Hi,
You can use the events of the table maintenance generator..go to SE54..and give your table maintenance view/table and choose environment -> events...to write a subroutine...to validate your entries...
OR if it is a custom table..you can write your own validations in PAI..but it might get overwritten if you re-generate your table maintenance..
Thanks
Naren
08-09-2013 3:33 PM
08-09-2013 4:02 PM
Hi Nitin,
if it is a custom table then you can use events in TMG........
to do so go to SE11-> generate TMG -> from environment -> go to modifications->Events.
Create new entries and select the required event number....and create routine.......write the required logic and save it activate it.........
--
Jack
08-12-2013 10:56 AM
Hi,
I think the best way is to make the unique value as a key in your table and generate a new maintenance screen, then edit the flow of fields in your table maintenance screen. This way you don't need to write any other code from the events.
Thanks
08-12-2013 11:11 AM
Hi Nithin,
You can write Events in TMG.
Refer below link for detail.
http://wiki.sdn.sap.com/wiki/display/ABAP/TABLE+MAINTENANCE+GENERATOR+and+ITS+EVENTS
Regards,
Sujeet Mishra
08-12-2013 11:58 AM
Hi Nithin,
Do the following,
Open your table in se11 then go to Utilities-> Table Maintenance Generator do the below screen shots,
From that go to Environment->Modification->Events. Then do the following like the below screen shots,
There are many event select one event which fulfill your requirement, 01 for before save data in database, Zemp is your form name then click on editor then click ok on popup then paste the below code then check active.
then come back while coming back screen before save every thing.
Then go to se38 give the program name SAPL(Your table) activate the program. Here my program name is saplzemp_data3.
After activating go to sm30 my data look like below,
In my table i have already employee number 10 now i am trying to insert that like below,
While saving it will throw the below error which i created in event,
Hope this will solve your problem,
Regards,
John.