2016 Sep 02 8:38 AM
Dear Experts,
I need to do field validation so that user can re-enter values if wrong values are passed in zfield let say zdate.
Issue is when using chain endchain statement for validation, ZDATE field contains no data in debugger and it shows 00000000 in the field.
Attached are the screen shots of code containing PAI Code, the MODULE FIELD and MODULE USER_COMI01.
Please suggest.
Thanks
AN
2016 Sep 02 11:19 AM
hi,
since your using only one field in between chain and endchain
in your MODULE_FIELD INPUT
write clear :itab-badli_date above Message 'NO BADLI can be done ' type 'E'.
this will clears the date field and it will not be set to zeros as you said.
this will solve your problem...
i have checked it,
any problem get back to me,
regards,
vinay..
2016 Sep 02 9:11 AM
IMHO CHAIN/ENDCHAIN with a single FIELD has no interest?
Use CHAIN/ENDCHAIN with at least two fielss, so a MODULE statement, and not the MODULE option of a single FIELD statement, can be executed with values of all the mentionned fields available.
chain.
field field1 module check_field1 on request. " with field1 available
field field2.
field field3.
module check_chain on chain-request. " with field1, 2, 3 available
endchain.
Hint: Also put a MODELE AT EXIT-COMMAND before the CHAIN and FIELD statements, so to be able to leave screen before some check raise an error, and the MODULE for user command after those, to not allow work with wrong data.
Regards,
Raymond
2016 Sep 02 9:17 AM
Hi
Raymond is right
and also you need to consider the values from screen to variable will be transfered after command FIELD, that means you should use FIELD option for all i/o fields managed in your module FIELD
Max
2016 Sep 02 9:48 AM
is there any particular reason why you have to execute the logic in MODULE USER_COMMAND_9010 1st in your current flow?
(during PAI) only fields NOT inside FIELD statement(s) will be transferred 1st to the program. that's why it is empty when you are just at the first module.
P/S: there is an exception to this transfer sequence for table control
2016 Sep 02 11:19 AM
hi,
since your using only one field in between chain and endchain
in your MODULE_FIELD INPUT
write clear :itab-badli_date above Message 'NO BADLI can be done ' type 'E'.
this will clears the date field and it will not be set to zeros as you said.
this will solve your problem...
i have checked it,
any problem get back to me,
regards,
vinay..
2016 Sep 02 11:52 AM
Dear Vinay,
I need to use another fields ITAB-FOR_EMPLOYEE and ITAB-TO_EMPLOYEE as well in the CHAIN ENDCHAIN statement.
Please suggest.
2016 Sep 02 12:09 PM
Hi
As it was suggested before you need to manage both fields in CHAIN/ENDCHAIN:
CHAIN.
FIELD ITAB-FOR_EMPLOYEE.
FIELD ITAB-BADLI_DATE.
MODULE FIELD.
ENDCHAIN.
Max
2016 Sep 02 12:12 PM
yes you can use other field also,
see my sample code,
now let us test the code,
i have shown the error if created date is greater than todays date
now see the result
2016 Sep 02 12:45 PM
Dear Experts,
Thank you for your replies. Issue resolved.
Regards,
AN