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

dialog programming field validation problem.

Former Member
0 Likes
3,263

just did field validation for name field of char data type in the PAI event. its doing field validation properly but not starting next process just strucked there. if i enter correct value after validation itz again showing that error message that please enter correct value.... please someone help me out.

my validation module

module validation input.

if zstudent-name co sy-abcde.

else

message 'enter the correct value' type ' e'.

endif.

end module.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,221

Venkatesh, 

If the field which is causing the error is a screen field, try this.

PROCESS AFTER INPUT.

CHAIN.

FIELD: scree-field module error_check.

ENDCHAIN.

26 REPLIES 26
Read only

former_member225688
Participant
0 Likes
3,221

I believe error message are not allowed could you please try changing message type. and let me know if problem persists.

if zstudent-name co sy-abcde.

else

message 'enter the correct value' type ' i'.

endif.

Read only

0 Likes
3,221

hi ,

thanks for ur response sir.

i changed the message type i,but it just showing the message and doesnt make the field for  input again and continuing the next process

Read only

Former Member
0 Likes
3,221

Hello.

Put a break point on the if zstudent-name co sy-abcde. statement, check the value of the fields, doing that you will get an idea of why if showing the error.

Regards

Read only

0 Likes
3,221

hi miguel,

just did with break points i  found the mistake in validation module it just transferring the control again and again to the field statement and validation module associated with it, not processing further modules.how to correct it help me please. 

Read only

gurunathkumar_dadamu
Active Contributor
0 Likes
3,221

Hi,

to continue with error messages write the code under MODULE EXIT AT EXIT-COMMAND.

in this module

case sy-ucom or ok_code.

when 'BACK'.

leave program.

when'EXIT'.

leave program.

endcase.

Regards,

Gurunath Kumar D

Read only

Former Member
0 Likes
3,221

can you post your code?

Read only

0 Likes
3,221

Hi,

it is not possible to post my code.it is our client requirement and also it is confidential. but i already posted the sample code.here write sample code.here double click on this exit. in your GUI status where your having the BACK,EXIT...buttons there double click on the buttons and check with all are type 'E'.

still any issues let me know.

Regards,

Gurunath Kumar D

Read only

Former Member
0 Likes
3,222

Venkatesh, 

If the field which is causing the error is a screen field, try this.

PROCESS AFTER INPUT.

CHAIN.

FIELD: scree-field module error_check.

ENDCHAIN.

Read only

0 Likes
3,221

hi kishore,

i tried with chain...endchain too but the same result after executing validation module its not transfering control to the further modules.

regards.

Read only

0 Likes
3,221

Once again try placing other scree-fields in the chain which you want to navigate after getting error on one screen-field.

Read only

0 Likes
3,221

hi kishore,

cant get u iam new to abap could just post some examples please.

Read only

0 Likes
3,221

Hi Venkatesh

Please find below code for your reference

LOOP AT v_t056p.
*   MODULE STATUS_9010.
*   CHAIN.
**   FIELD V_T056P-ZILABEZ .
**   FIELD V_T056P-ZIKUBEZ .
*    FIELD V_T056P-ZSOLL .
*    FIELD V_T056P-DATAB .
*    FIELD V_T056P-REFERENZ .
*    MODULE SET_UPDATE_FLAG ON CHAIN-REQUEST.
*    MODULE COMPLETE_V_T056P ON CHAIN-REQUEST.
*   ENDCHAIN.

Regards

dnyan

Read only

0 Likes
3,221

   CHAIN.

     FIELD: scrflds-filename,

            scrflds-fspath,

            scrflds-filepath,

            scrflds-filetype,

            scrflds-jname,

            scrflds-dnlty,

            scrflds-dnlin,

            scrflds-dnlas,

            scrflds-dctmpl,

            scrflds-flocn.

     MODULE file_details_check.

   ENDCHAIN.

Read only

0 Likes
3,221

hi kishore,

        i just tried with it but after validating itz not proceeding further.

Read only

0 Likes
3,221

Can you please post your code here . So that i will check and let you know where exactly the error is .

At least sceen logic and the module which is not proceeding further.

Or just debug and check why its is not proceeding further. Was it looping at the same time. I mean in a infinite loop or there is some other problem.

Read only

0 Likes
3,221

hi dnyan,

     i had attached the codes below please check with it. I had did validation module in screen 1000...

Read only

0 Likes
3,221

Hi Venkatesh,

I have checked the code .

And found that every time the

IF  zstudet-NAME  co SY-ABCDE.

  IF ZSTUDET-ADDRESS CO SY-ABCDE.

    ELSE.

      message e000  with text-001.

      ENDIF.

  else.

    message e000  with text-001.

     ENDIF.

it gets failed.

As if you put a beakpoint there and check you could understand that. If this condition satisfies correctly then the control moves to next module and program will be executed successfully.

For example below code. Where in Name1 and Name2 contains '1234' and condition satisfies successfully.

IF  lfa1-name1 EQ '1234'.
   IF lfa1-name2 EQ '1234'.
     ELSE.
       message e000  with 'error'.
       ENDIF.
   else.
     message e000  with 'error'.
      ENDIF.

Please try changing the condition as this means address should contains only A-Z and that will not be a case. please press F1 on the 'CO' you will get all the details of command and you can check why it is getting failed.

Hope this will help you and will resolve your issue .

Regards

Dnyan

Read only

0 Likes
3,221

hi dnyan,

            i set break point and chekd also changed co but if i remove co itz not working properly if i put co itz showing error... but the values are changing i put a watch point over the screen field and checkd but itz not proceeding further with co. if i add cs instead of co itz not properly validating... so can u tell me any other way to validate char data types.

Read only

0 Likes
3,221

what is the requirement. Address and name should only contain letters or what. So that i can provide the alternative for you .

Read only

0 Likes
3,221

hi dnyan,

ya name and address can contain only alphabets no other special characters or numbers.

Read only

0 Likes
3,221

Use below logic it will solve the problem.

IF address CA '123456789!@#$%^&*()'.
write 'wrong'.
ELSE.
write 'correct'.
ENDIF.

Regards

Dnyan

Read only

0 Likes
3,221

hi dnyan,

       thanks very much got the perfect output.....

regards,

Read only

Former Member
0 Likes
3,221

Hi Venkatesh,

Try out the code given below,

Use the ON INPUT addition with your module

PROCESS AFTER INPUT

CHAIN.

FIELD: ZSTUDET-NAME,

             ZSTUDET-ADDRESS    MODULE CHECK_IN ON INPUT.

ENDCHAIN.

-------Code for the module

Module CHECK_IN INPUT.

IF  zstudet-NAME  co SY-ABCDE.

  IF ZSTUDET-ADDRESS CO SY-ABCDE.

    ELSE.

      message e000  with text-001.

      EXIT.

      ENDIF.

  else.

    message e000  with text-001.

     EXIT.

     ENDIF.

ENDMODULE.                 " CHECK_IN  INPUT

Thanks & Regards,

Tushar

Read only

0 Likes
3,221

hi tushar,

     ya i did wat u told but the same problem... the problem is with that relational operator co..need an alternative for that.

Read only

0 Likes
3,221

Hello Venkatesh,

Change the data type of name and address fields to STRING from CHAR.

Hope this changes will solve your problem.

Thanks & Regards,

Tushar

Read only

0 Likes
3,221

hi tushar,

if i change from char type to string itz showing an error that table should not have string as components

regards,

venkatesh.