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: 

Validation at table level in table maintenance generator

0 Kudos

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.

6 REPLIES 6

Former Member
0 Kudos

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

0 Kudos

thanks narendran

Former Member
0 Kudos

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

0 Kudos

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

sujeet2918
Active Contributor

former_member184958
Active Participant
0 Kudos

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.