Validation of entry in custom table
I have one requirement where users can maintain value into a custom table. While entering a new value, if the similar primary key entries already exist in the table then there is a requirement of giving a pop-up box to the user informing that a similar kind of entry already exist and if he wants to overwrite. If the user clicks yes, then the new record should be saved and also one of the field in old record should be modified.
I have written an event in the table maintenace by which i am able to get the pop-up and the old entry gets modifed but when the PBO module gets triggered inside a standard include i get the error mssage " Record already exist". The error is obvious as the same primary keys are used in the second entry too but i am just curious to know if there is any way by which this standard error could be overcome so that the user should get only my pop-up box and not the standard error message.
Midhun Abraham replied
You are getting the standard text because you are going to insert into the table.You cannot suppress the standard message but you can do some other thing.You take the values in the table to the internal table and before insertion into the table you should check the value which the user had entered and then check the value and the key.Thus you can catch that before the insertion into the table.
You can use the READ statement with key for reading the database.if the sy-subrc is 0 you can understand a value is there in the table.
Hope this will be helpful.
Edited by: Midhun Abraham on Oct 5, 2008 5:23 AM