Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error message in Module pool.

former_member267445
Participant
0 Likes
6,187

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

44 REPLIES 44
Read only

former_member210541
Active Participant
0 Likes
3,220

are the fields included in chain endchain?

Read only

0 Likes
3,220

Hello Tee Gee,

Yes, I have included the fields in chain endchain.

Thanks and Regards,

Muralikrishna Peravali

Read only

0 Likes
3,220

can you paste your code snippet here

Read only

0 Likes
3,220

Hello Gee,

below is the code I have written,

PAI,

chain.

field lfa1-zfrom module date_validations.

field lfa1-zto module date_validations.

endchain.

Read only

0 Likes
3,220

If your module date_validations require values of the two fields, rewrite as:


PROCESS AFTER INPUT.

  CHAIN.

    FIELD lfa1-zfrom.

    FIELD lfa1-zto.

    MODULE date_validations.

  ENDCHAIN.

Regards,

Raymond

Read only

0 Likes
3,220

Hello Raymond,

I have done what you explained. But still system is not allowing me to save the transaction.

Thanks and Regards,

Muralikrishna Peravali

Read only

0 Likes
3,220

I have checked in debug mode as field is not populating after entering the date.

Did you define table LFA1 or your append structure as data in top include of your FM, with or without a TABLES statement?

Regards,

Raymond

Read only

0 Likes
3,220

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

Read only

Former Member
0 Likes
3,220

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.

Read only

0 Likes
3,220

Yes Sathish. Screen field name and in program field are same.

Read only

Former Member
0 Likes
3,220

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

Read only

0 Likes
3,220

Hello Roy,

Yes, before calling module I have used FIELD <Date field> statement in chain end chain.

Thanks and Regards,

Muralikrishna Peravali.

Read only

0 Likes
3,220

Ok then post the code if possible to have a look.

Read only

0 Likes
3,220

Hello Roy,

Please find the attachment.

Regards,

Muralikrishna

Read only

0 Likes
3,220

What is inside date_validation module. Can you paste the code of that as well?

Read only

0 Likes
3,220

Hello Roy,

Please find the code as attached.

Regards,

Muralikrishna Peravali

Read only

former_member267445
Participant
0 Likes
3,220

Hello All,

Any suggestion on this.

Regards,

Muralikrishna Peravali

Read only

0 Likes
3,220

are these program fields or dictionary fileds?

Read only

0 Likes
3,220

Date fields are dictionary fields which are in append structure of LFA1

Read only

0 Likes
3,220

aah....there you go...just declare them in your program...and use the reference from your program.

Read only

0 Likes
3,220

Tee Gee,

I am sorry, I didn't understand. Can you please explain me.

Read only

0 Likes
3,220

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.

Read only

former_member267445
Participant
0 Likes
3,220

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.

Read only

0 Likes
3,220

Hello Gurus,

Any help on my requirement.

Thanks and Regards,

Muralikrishna Peravali

Read only

0 Likes
3,220

Within your date check module / condition before throwing the error message clear sy-ucomm / ok_code .

Read only

0 Likes
3,220

Hello Tee Gee,

I have done as suggested by you. But it is still allowing me to save.

Thanks and Regards,

Muralikrishna Peravali

Read only

0 Likes
3,220

can you please show me the code you have written in your date validation module and the code in the SAVE module

Read only

0 Likes
3,220

Hello Tee Gee,

Sorry for the delay. Kindly find attached file.

Thanks and Regards,

Muralikrishna Peravali

Read only

0 Likes
3,220

Please clear sy-ucomm also with gv_code

Read only

0 Likes
3,220

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

Read only

0 Likes
3,220

when you change the radio button and press enter, please go to debug and check what is the value of sy-ucomm

Read only

0 Likes
3,220

sy-ucomm is space

Read only

0 Likes
3,220

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

Read only

0 Likes
3,220

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

Read only

0 Likes
3,220

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.

Read only

0 Likes
3,220

I think the code will not satisfy. Any way I will try and let you know

Read only

0 Likes
3,220

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

Read only

0 Likes
3,220

You have to assign and clear those variable before throwing the error message.

Read only

0 Likes
3,220

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