Académique Documents
Professionnel Documents
Culture Documents
While maintaining entries in custom table through SM30, I want to check if couple fields(they are not part of
primary keys) has any value. If user has not entered any value in them then I have to show them a message
and doesn't allow to save. I tried below methods to achieve it.
1. I used Event 05 and gave an error message if the field values are empty. The problem is that the fields
got greyed out and doesn't allow to input any value.
2. I used combination of events 21 and 01 (with the same code in both of them). In both the events I am
checking if field values are initial, then I am giving information message and before the information message
I am setting VIM_ABORT_SAVING = 'X'. The problem is that the entry is getting saved though the the fields I
am checking for are empty.
I want to show the user an E or I or S message (which ever is suitable in this scenario) if couple of fields are
empty and not allow them to save and also allow them to enter some value in those fields with out getting them
greyed out.
Is there any better way to achieve it other than the ones I tried above?
Thanks.
Tags: abap
Regards,
Raghu.
I tried following code in EVENT01 but the fields with empty data is getting is saved.
form field_validation.
if ztest-saknr is initial.
vim_abort_saving = 'X'.
message i003(zmessage).
endform.
Thanks.
If you set vim_abort_saving = 'X' then the record wont save in the table.
Regards
Praveen
Unfortunatley the entry is getting saved. Am I missing anything here. Am I using the wrong event?
Thanks,
Shiva
I am giving the error message in EVENT05 if the field value is empty and once the error message is triggered
the field is getting greyed out (since it is not a primary key) and is not allowing to enter any value. I want to give
the user the flexibility to enter the value after the message on the same screen.
Thanks.
Regards,
Vijeta
form field_validation.
if ztest-saknr is initial.
message e003(zmessage).
LEAVE TO CURRENT TRANSACTION.
endif.
endform.
FIELD zco_objif-zgjahr .
FIELD zco_objif-zperio .
FIELD zco_objif-zwerks .
FIELD zco_objif-zflg_vaprod .
FIELD zco_objif-zflg_vaent .
FIELD zco_objif-zflg_vavente .
FIELD zco_objif-zkostl .
FIELD zco_objif-zvalue .
FIELD zco_objif-zpvstd .
FIELD zco_objif-zpvreel .
FIELD zco_objif-zdivers .
FIELD zco_objif-zaffair .
MODULE change_field ON CHAIN-REQUEST. "Here you can make the fields as editable
Check fields corresponding to check box
Regards,
Darshana
FIELD ZTABLENAME-ERDAT .
FIELD ZTABLENAME-ERZET .
FIELD ZTABLENAME-ERNAM .
FIELD ZTABLENAME-AEDAT .
FIELD ZTABLENAME-AEZET .
FIELD ZTABLENAME-AENAM .
MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.
MODULE UPDATE_TIMESTAMP. " This is my custom Module . write your validation logic with in this
module.
ENDCHAIN.
FIELD VIM_MARKED MODULE LISTE_MARK_CHECKBOX.
CHAIN.
MODULE LISTE_UPDATE_LISTE.
ENDCHAIN.
ENDLOOP.
MODULE LISTE_AFTER_LOOP.
Best regards,
Prabhuranjan
Kindly let me know how to validate the fields in the table control which I created by using table maintenance
generator.
For Example I have 2 fields one is deptno and deptname. I want to validate the Deptname which should not be
blank.The above screens I created via Table Maintenance generator.
Thanks
Prasad
In order to make the input Ready, the thumb rule in ABAP screen programming is writing the code in Chain and
Endchain.
so in the Function Group in the table maintenance generator screen, write the logic of your validation by
creating modules for the corresponding fields.
Thanks,
Vinayaka SJ
Regards,
Deepthi
Regards,