2010 Nov 10 4:22 AM
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
2010 Nov 10 5:41 AM
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
2010 Nov 10 5:41 AM
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
2010 Nov 10 8:38 AM
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!
2010 Nov 10 10:14 AM
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
2010 Nov 10 10:17 AM
sorry replace that db_tab in the append statement with it_tab.
2010 Nov 10 5:52 AM
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.
2010 Nov 10 8:36 AM
Hi jayanti,
Thanks for the reply ! But i didn;t actually get your point......Whet doyou mean by sepate program...........
Thanks
2010 Nov 10 8:40 AM
Hi,
For the existing entries, write a program in SE38 to do changes.