‎2011 Oct 11 7:57 AM
HI ,
I have a requirement to validate the input in a non key field for existing records in table maintenance . I have writeen a module pool where in table maintenance i check the value and throw error message .However when the End button is pressed and it gives a standard POP up where the screen says do you want the save the data /no/cancel this is exit maintenence pop up if we say Yes it saves the data whetver is there in the field whether valid / invalid . It should not retain the new value when when i click another standard pop up where it says do you want the save the data if yes it should throw an error as it is invalid value and if No it should get the old value which was there before .
If you have no suggestion for module pool can you help me identify the right event for change data validation .The field is plant and the standard check table is not applicabe as there are few other values expect the T001W which are valid for this field .
Thanks,
Anjaneya .
‎2011 Oct 11 8:11 AM
Hi Anjaneya,
In your module pool, if you get that entry entred is invalid delete that entry in the Table control internal table . Thus this will not bee shown in Table maintance. Now even if you say Save to pop up message. the invalid entry will not be saved as it is deleted previously.
Regards,
Ganesh.
‎2011 Oct 11 8:54 AM
HI ,
The question is not about just deleting the erntry it has to restore to the previous value as well , like 1000 is the existing valid entry i change it to ABCD , since this is an invalid value user will get an error message now when he presses cancl button he gets exit meintanece if says yes the original value should get restored is'nt it ? Moreover what i am doing is reading the internal table for validation in my module program should i be overwrirting it as well , whenener the standard pop up is coming it is not behaving the way it should behave ..is it because i have my validation inside module pool that standard exit commands are behaving differently .
Thanks,
Anjaneya .
‎2011 Oct 11 9:48 AM
Hello Anjaneya,
Are you using the standard TMG module pool or have you created a custom table maintenance screen?
If the former you can make use of the [Event 01: Before Saving the Data in the Database |http://help.sap.com/saphelp_nw04s/helpdata/en/91/ca9f0ba9d111d1a5690000e82deaaa/content.htm].
If the validation fails, you have to set SY-SUBRC to a non-zero value & VIM_ABORT_SAVING flag to 'X'.
BR,
Suhas
PS: You can search the SDN forums on further details regarding implementation of the event 01
‎2011 Oct 11 11:31 AM
I am using the module pool of the generated screen ...I have just on screen .
I have PAI module which checks the entry and throws up the error ...the problem comes when he tries to exit the screenn pressing the cancel button as he does not know the correct /valid values ....Liste_exit_command give him a pop up saying exit maintenace when he presses yes the value gets saved which is wrong if says no the valu does not get saved and when you reopen the transaction the correct value stays but if he says yes the wrong valu gets saved in database .....
MODULE liste_exit_command AT EXIT-COMMAND.
MODULE liste_before_loop.
LOOP AT extract.
MODULE liste_init_workarea.
CHAIN.
FIELD Zaft_mpl_auth-ZZplnt .
MODULE validate_existing_entry_update.
ENDCHAIN .
inside this i am issue my error messages .....
Thanks,
Anjaneya .
Edited by: Anjaneya Bhardwaj on Oct 11, 2011 12:31 PM
‎2011 Oct 11 11:56 AM
Hello,
Do not change the flow logic of the generated screen in a TMG. If someone re-generates the TMG your changes will be lost for good.
As i've mentioned try to implement the Event 01. You can check the extra validations inside this event(which is triggered before the data is saved to the DB).
BR,
Suhas
‎2011 Oct 12 1:22 PM
I have the logic of validation written in the event01 .Now i am facing two problems which were not with the original one .
The error message comes on other screen this can be resolved by having the type S diaplay like E ...But that will not be the ideal case for me as i want error message of type E as i have four validations for plant fields based on different criterions and if i use Type S the last message gets diaplayed which is kinda of wrong . SO how can we place error message on same screen.
The cursor position after error message which gets displayed on the next screen comes to first entry , here user has no idea what went wrong as the the all non keys are in uneditable mode ..
Can we set the cursor to the row which generated error ...
Thanks,
Anjaneya .