‎2008 Nov 14 1:15 PM
Hi Experts,
When i create an entry for an infotype via Pa30, The data i givein for a particular field if invalid should immediately prompt me for an error message when i start moving to the next field. I dont want my error message to come when i give "SAVE" rather i want it instantly when i move on to the nest field. How can i go about this i.e. where should i place my validation code?
TIA
‎2008 Nov 15 3:49 AM
Hi ,
Thier must be some exit for this under which you can write your code for validation checking.
You can try this exit PBAS0001 in SMOD.Under it you will get 2 component write the code under 2nd component.
I am sample code for error message display for an infotype
DATA:
i0000 LIKE p0000,
w_persk4(25) TYPE c VALUE '(SAPFP50M)PSPAR-plans'.
ASSIGN (w_persk4) TO <fs>.
CASE:innnn-infty.
WHEN:'0000'.
CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
EXPORTING
prelp = innnn
IMPORTING
pnnnn = i0000.
IF i0000-massn = '01' OR i0000-massn = '12'.
IF <fs> = '99999999'.
MESSAGE text-000 TYPE 'E'.
CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp
EXPORTING
pnnnn = i0000
IMPORTING
prelp = innnn.
ENDIF.
ENDIF.
ENDCASE.With Regards,
Anomitro Guha
‎2008 Nov 15 3:15 AM
Hi,
There is no such event like lost focus or something.
You can do one thing, place your validation in 'WHEN OTHERS' condition of case endcase along with 'WHEN SAVE' inside PAI module.
This called when u press enter or any event is occured.
‎2008 Nov 15 3:49 AM
Hi ,
Thier must be some exit for this under which you can write your code for validation checking.
You can try this exit PBAS0001 in SMOD.Under it you will get 2 component write the code under 2nd component.
I am sample code for error message display for an infotype
DATA:
i0000 LIKE p0000,
w_persk4(25) TYPE c VALUE '(SAPFP50M)PSPAR-plans'.
ASSIGN (w_persk4) TO <fs>.
CASE:innnn-infty.
WHEN:'0000'.
CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
EXPORTING
prelp = innnn
IMPORTING
pnnnn = i0000.
IF i0000-massn = '01' OR i0000-massn = '12'.
IF <fs> = '99999999'.
MESSAGE text-000 TYPE 'E'.
CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp
EXPORTING
pnnnn = i0000
IMPORTING
prelp = innnn.
ENDIF.
ENDIF.
ENDCASE.With Regards,
Anomitro Guha