‎2009 May 14 7:00 AM
Dear All,
I am facing a very weired problem.I have a module pool program where there is one input field with input help(F4).This field is mandatory field in certain scenarios.If this field is empty then the system should displya an error saying "Reject Reason is required field".
Case 1 -
If the field is empty ---the system display error message - This is correct
Case 2 -If this field is not empty - The system still displays an error message saying it is a required field - This is wrong.
In the code there is the following If condition
-
CHECK error_flag EQ space.
IF zpc0-responsibil EQ '95' OR
zpc0-responsibil EQ '98'.
IF zpc0-rjc_rea EQ space OR
zpc0-rej_remarks EQ space.
MESSAGE i653 WITH 'Reject Reason'.
error_flag = 'Y'.
position_flag = 'RJC_REA'.
ENDIF.
ELSE.
IF zpc0-rjc_rea NE space OR
zpc0-rej_remarks NE space.
MESSAGE i416 WITH
'Must be empty reject reason & remark for rejection'.
error_flag = 'Y'.
position_flag = 'RJC_REA'.
ENDIF.
ENDIF.
-
I am sending zpc0-responsibil = 95 and zpc0-rjc_rea = 99..Still the IF condition is satisfied and i system executes the stmt MESSAGE i653 WITH 'Reject Reason'.
Can any one please suggest what could be the problem .
NOTE- In debugging mode i see the values for zpc0-responsibil as 95 and zpc0-rjc_rea as 99.
Thanks in advance,
Swati
‎2009 May 14 7:05 AM
HI,
Check this code
IF zpc0-responsibil EQ '95' OR
zpc0-responsibil EQ '98'.
" If You use OR and pass 99 to zpc0-rjc_rea and space in zpc0-rej_remarks
" then if any one is satisfied the error message is displayed
IF zpc0-rjc_rea EQ space AND " -->NOT OR
zpc0-rej_remarks EQ space.
MESSAGE i653 WITH 'Reject Reason'.
error_flag = 'Y'.
position_flag = 'RJC_REA'.
ENDIF.
ELSE.
IF zpc0-rjc_rea NE space OR
zpc0-rej_remarks NE space.
MESSAGE i416 WITH
'Must be empty reject reason & remark for rejection'.
error_flag = 'Y'.
position_flag = 'RJC_REA'.
ENDIF.
ENDIF.
‎2009 May 14 7:05 AM
SO what about this field
zpc0-rej_remarks
is that equal to space at that time in that case that will be the prob
‎2009 May 14 7:07 AM
Hi,
You said you are passing the following values:-
""zpc0-responsibil = 95 and zpc0-rjc_rea = 99.
Still the IF condition is satisfied and i system executes the stmt MESSAGE i653 WITH 'Reject Reason'.""
But you have not specified what you are passing in zpc0-rej_remarks .
If zpc0-rej_remarks contains space then you will definitely get your error message because you are using 'OR' condition.
Regards,
Ankur Parab
‎2009 May 14 7:11 AM
Hi,
u have put OR condition in IF,
IF zpc0-rjc_rea EQ space OR
zpc0-rej_remarks EQ space..
therefore even u are passing zpc0-rjc_rea = 99 , but zpc0-rej_remarks is taking space hense if condition is true and giving u that message.
Use AND in above IF condition.
Regards
Vishal
‎2009 May 14 7:16 AM
I cant believe this ..this simple thing didnt strike me ....Guys you all are correct .The zpc0-rej_remarks is passed as space hence the errror.
Thanks a lot for this help.
Problem Solved.
‎2009 May 14 7:14 AM
Hi,
IF zpc0-rjc_rea EQ space OR
zpc0-rej_remarks EQ space.
MESSAGE i653 WITH 'Reject Reason'.
if any of the above condition is true the 'if' condition gets satisfied..
if the zpc0-rej_remarks field is empty then it would giv u the error msg.
pass the value in zpc0-rej_remarks field
Regards,
‎2009 May 14 7:16 AM
‎2009 May 14 7:22 AM
do like this
IF zpc0-responsibil EQ '95' and
zpc0-responsibil EQ '98'.
IF zpc0-rjc_rea EQ space OR
zpc0-rej_remarks EQ space.
MESSAGE i653 WITH 'Reject Reason'.
error_flag = 'Y'.
position_flag = 'RJC_REA'.
ENDIF.
ELSE.
IF zpc0-rjc_rea NE space OR
zpc0-rej_remarks NE space.
MESSAGE i416 WITH
'Must be empty reject reason & remark for rejection'.
error_flag = 'Y'.
position_flag = 'RJC_REA'.
ENDIF.
ENDIF.
Regards
Shashi