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: 

events in table maintenace generator

Former Member
0 Kudos
169

Hi All,

I have a TMG with a 1st field as key field .I wrote a routine in event 05 so as to make my second field as treated as primary fied.that is no duplicates,

But the problem i am facing now,once i click new entries and add the data in TMG , it checks the duplicay for the seconf feild with thr rwos on same screen.But not considered the entries previously done.

More over it also do not consider while making modification in existing entries the duplicacy in second field....

Snippets of coding done is as follows:

FORM VALIDATION_ON_FIELD.

DATA: LS_WA TYPE YTEST.

LOOP AT TOTAL.

CHECK <action> EQ 'N' OR <action> EQ 'M'.

ls_wa = <vim_total_struc>.

*ls_wa = <vim_EXTRACT_struc>.

IF LS_WA-ERNAM = YTEST-ERNAM.

MESSAGE 'User Already Exist' TYPE 'E'.

ELSE.

MODIFY TOTAL.

ENDIF.

ENDLOOP.

ENDFORM .

Please do suggest , i got stuck on a object....

Thnaks in advance!!!!!!

Pankaj

1 ACCEPTED SOLUTION

Former Member
0 Kudos
132

Hi Pankaj,

In TMG whatever code we do perform is always done at the new entry level. So for the validations to be done on the previous records you have to fetch the record from the data base table using the Select Query put in an inetrnal table and then write the code.

Let me know if you you understood or need some more help.

Regards

Mona

7 REPLIES 7

Former Member
0 Kudos
133

Hi Pankaj,

In TMG whatever code we do perform is always done at the new entry level. So for the validations to be done on the previous records you have to fetch the record from the data base table using the Select Query put in an inetrnal table and then write the code.

Let me know if you you understood or need some more help.

Regards

Mona

0 Kudos
132

Thanks Mona,

Will you plesae suggest me where should i write this select statement ...Do i need to write in same Routineunder Event 05 or somewhere else!

0 Kudos
132

Hi ,

Yes you have to right it under the same routine Event 05.

SELECT * FROM zXXXX f INTO TABLE it_tab.

*append the new entry into the same table as below

ls_data-field1 = zXXX-field1

ls_data-field1 = zXXX-field2.

ls_data-field1 = zXXX-field3

ls_data-field1 statcng = zXXX-field4.

APPEND ls_data TO db_tab.

loop at it_tab into ls_chck.

  • Perform your check

Endloop.

Hope you got the logic.

Regards

Mona

0 Kudos
132

sorry replace that db_tab in the append statement with it_tab.

jayanthi_jayaraman
Active Contributor
0 Kudos
132

Hi,

As suggeste,d only new entries will be taken care by the event. For existing entries, write a separete program in which do the changes as required.

0 Kudos
132

Hi jayanti,

Thanks for the reply ! But i didn;t actually get your point......Whet doyou mean by sepate program...........

Thanks

0 Kudos
132

Hi,

For the existing entries, write a program in SE38 to do changes.