Application Development 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: 

field validation in dialog programing

Former Member
0 Kudos

Hi all,

How can i validate a field in dialog programing

kindly describe it.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi TArun,

In PAI if you want to validate group of fields put in

chain and End chain statement .

You can declare fields in the chain enchain .

CHAIN.
FIELD chk_ABC.
FIELD chk_DEF.
FIELD chk_GHI.
FIELD CHK-JKL.
MODULE CHK_screenfields.
ENDCHAIN.


MODULE CHK_screenfields INPUT.
CLEAR okcode.
okcode = sy-ucomm.
CASE okcode.
WHEN 'ENTER' OR 'EXECUTE'.
 
IF chk_ABC IS INITIAL AND chk_DEF  IS INITIAL AND CHK_GHI 
IS INITIAL .
MESSAGE e000(zo_spa) WITH text-017. " Enter VALUES'
ELSE.
  .....
ENDIF.
ENDIF.
 
ENDMODULE. " modify_screenfields INPUT

[link|http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbaa4735c111d1829f0000e829fbfe/content.htm]

[Link|http://help.sap.com/saphelp_nw04/Helpdata/EN/9f/dbabbd35c111d1829f0000e829fbfe/content.htm]

Regards,

Sandeep Patel

8 REPLIES 8

former_member200872
Active Participant
0 Kudos

Hi,

Go through the documentation for the keywords CHAIN, FIELD, MODULE (F1 Help).

Regards,

Wajid Hussain P.

Former Member
0 Kudos

Hi TArun,

In PAI if you want to validate group of fields put in

chain and End chain statement .

You can declare fields in the chain enchain .

CHAIN.
FIELD chk_ABC.
FIELD chk_DEF.
FIELD chk_GHI.
FIELD CHK-JKL.
MODULE CHK_screenfields.
ENDCHAIN.


MODULE CHK_screenfields INPUT.
CLEAR okcode.
okcode = sy-ucomm.
CASE okcode.
WHEN 'ENTER' OR 'EXECUTE'.
 
IF chk_ABC IS INITIAL AND chk_DEF  IS INITIAL AND CHK_GHI 
IS INITIAL .
MESSAGE e000(zo_spa) WITH text-017. " Enter VALUES'
ELSE.
  .....
ENDIF.
ENDIF.
 
ENDMODULE. " modify_screenfields INPUT

[link|http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbaa4735c111d1829f0000e829fbfe/content.htm]

[Link|http://help.sap.com/saphelp_nw04/Helpdata/EN/9f/dbabbd35c111d1829f0000e829fbfe/content.htm]

Regards,

Sandeep Patel

Former Member
0 Kudos

Check Tcodes.....

TZ60

TZ50

TZ70

Former Member
0 Kudos

HI,

SAMPLE CODE IF U HAVE OF DIALOG PROGRAME THAT'S EASSY TO UNDERSTAND. JUST PROGRAME AND FLOW LOGIC ONLY.

former_member188685
Active Contributor
0 Kudos

Check the Below Demo Programs.

demo_dynpro_automatic_checks 
demo_dynpro_value_select
demo_dynpro_field_chain

They are very simple and small

former_member787646
Contributor
0 Kudos

Hi

Using FIELD Statement in the Flow Logic we can validate a field in the Module Pool Programming.

Eg. FIELD <fieldname> MODULE <module_name>.

Hope this would help you.

Murthy

0 Kudos

Hi.....

If you want to validate a perticuler field and display erroir message if user enters wrong input...

Do like this....

say P_F1 is field attribute name.... in layout...,

Now write this syntax for the next actions in that screen after enters the input into that field...in PAI event

Decalere itab with that field...

> select * from <check table of that field> into correspoding fields of tabel itab where F1 = P_F1.

>

> If sy-subrc <> 0

> message 'P_F1 does not exists' type 'E'.

> Endif.

>

We can do field validation like this also...in module pools..

Thanks,

Naveen.I

Former Member
0 Kudos

thanks