2015 Sep 04 10:42 AM
Hello Guru,
I have created a badi and function group for XK01 to add a custom screen. I have added 2 date fields and they are mandatory when user chose a radio button. So, I am validating this using PAI. Everything is working fine upto here.
When I try to save XK01/XK02 with out entering the second date then system throwing custom error message, after error message when I enter the date and then save that time also system generating error message, system is not allowing me to save. I have checked in debug mode as field is not populating after entering the date. How to handle this?
Please light me on this.
Thanks and Regards,
Muralikrishna Peravali
2015 Sep 04 10:47 AM
2015 Sep 04 10:51 AM
Hello Tee Gee,
Yes, I have included the fields in chain endchain.
Thanks and Regards,
Muralikrishna Peravali
2015 Sep 04 10:57 AM
2015 Sep 04 11:52 AM
Hello Gee,
below is the code I have written,
PAI,
chain.
field lfa1-zfrom module date_validations.
field lfa1-zto module date_validations.
endchain.
2015 Sep 04 12:33 PM
2015 Sep 04 1:15 PM
Hello Raymond,
I have done what you explained. But still system is not allowing me to save the transaction.
Thanks and Regards,
Muralikrishna Peravali
2015 Sep 08 3:07 PM
2015 Sep 08 5:30 PM
Hello Raymond,
Apologies for the delay response as I was busy with some other issue. I have defined LFA1 with TABLES statement in Top include of FM.
Thanks and Regards,
Muralikrishna Peravali
2015 Sep 04 10:56 AM
Is the screen field name and the respective variable name in program is same ? If field name and you prog variable name is not matching, then the value that you enter in screen might not populate to the variable that you are validating.
2015 Sep 04 11:53 AM
Yes Sathish. Screen field name and in program field are same.
2015 Sep 04 10:56 AM
I hope you have used "FIELD <Your date Field>" statement before calling your Module for validation.
e.g.
CHAIN.
FIELD <Date Variable>.
MODULE <Your Module>
ENDCHAIN.
R
2015 Sep 04 11:49 AM
Hello Roy,
Yes, before calling module I have used FIELD <Date field> statement in chain end chain.
Thanks and Regards,
Muralikrishna Peravali.
2015 Sep 04 11:53 AM
2015 Sep 04 12:02 PM
2015 Sep 04 1:07 PM
What is inside date_validation module. Can you paste the code of that as well?
2015 Sep 04 1:13 PM
Hello Roy,
Please find the code as attached.
Regards,
Muralikrishna Peravali
2015 Sep 04 12:31 PM
Hello All,
Any suggestion on this.
Regards,
Muralikrishna Peravali
2015 Sep 04 1:27 PM
2015 Sep 04 1:37 PM
Date fields are dictionary fields which are in append structure of LFA1
2015 Sep 04 1:42 PM
aah....there you go...just declare them in your program...and use the reference from your program.
2015 Sep 04 1:48 PM
Tee Gee,
I am sorry, I didn't understand. Can you please explain me.
2015 Sep 04 1:56 PM
Declare something like this wa_lfa1 type lfa1.
and then refer the fields on your screen from this program variable wa_lfa1 and not from the dictionary.
2015 Sep 07 11:12 AM
Hello All,
I have resolved by using ok_code value. previously I checked only for SAVE option now I have added ok code for enter also, now it is working fine.
However, before pressing an enter if I didn't give date and save the transaction then system throwing an error which is correct. After entering the date and press enter then it is directly saving the transaction, system is not allowing to enter other inputs (table control).
How to stop the transaction and allow to user to enter the data?
Thanks and Regards,
Muralikrishna Peravali.
2015 Sep 07 2:17 PM
Hello Gurus,
Any help on my requirement.
Thanks and Regards,
Muralikrishna Peravali
2015 Sep 07 2:36 PM
Within your date check module / condition before throwing the error message clear sy-ucomm / ok_code .
2015 Sep 07 2:56 PM
Hello Tee Gee,
I have done as suggested by you. But it is still allowing me to save.
Thanks and Regards,
Muralikrishna Peravali
2015 Sep 07 3:11 PM
can you please show me the code you have written in your date validation module and the code in the SAVE module
2015 Sep 07 6:32 PM
Hello Tee Gee,
Sorry for the delay. Kindly find attached file.
Thanks and Regards,
Muralikrishna Peravali
2015 Sep 07 6:47 PM
2015 Sep 07 6:58 PM
Gee Tee,
Even now also system allowing me to save the transaction. What I did is, with out entering dates I saved the XK02 that time system thrown error message. I have changed the radio button and pressed enter system saved the transaction.
Thanks and Regards,
Muralikrishna Peravali
2015 Sep 07 7:03 PM
when you change the radio button and press enter, please go to debug and check what is the value of sy-ucomm
2015 Sep 07 7:09 PM
2015 Sep 07 7:14 PM
ok, usually standard sap transactions save sy-ucomm in a variable, please dlso debug after you press enter button which variable xk02 is storing the sy-ucomm value..and add leave list processing after your error message
2015 Sep 07 7:19 PM
somewhere in the middle of the XK02 code sy-ucomm is becoming as UPDA.
After changing radio button and if I didn't give the date the system is not allowing to save. if I give the date value and chose another button and then press enter that time system is allowing to save the transaction
2015 Sep 07 7:29 PM
in your date validation module write this code
field-symbols <fs> type any.
assign ('SAPMF02K(SY-UCOMM)') to <fs>.
if <fs> is assigned.
clear <fs>.
endif.
assign ('SAPMF02K(OK-CODE)') to <fs>.
if <fs> is assigned.
clear <fs>.
endif.
assign ('SAPMF02K(ZAV_OK_CODE)') to <fs>.
if <fs> is assigned.
clear <fs>.
endif.
2015 Sep 07 8:06 PM
I think the code will not satisfy. Any way I will try and let you know
2015 Sep 08 8:26 AM
Hello TEE Gee,
Sorry to say that, your logic didn't work. Did I miss anything here?. But, as per my understanding it is a standard behavior why because I have checked for another screen there also after giving required value and press enter then system allowing to save the transaction.
Thanks and Regards,
Muralikrishna Peravali
2015 Sep 08 8:43 AM
You have to assign and clear those variable before throwing the error message.
2015 Sep 08 9:19 AM
Tee Gee,
I have tried using your suggestion, still system is allowing me to save. I have checked in debug mode that fied sysmbol is not assigning the ok_code values