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 is not working in module pool programming

0 Kudos

Hi Experts,

Iam facing little trouble in validating field in module pool program,cannot able to find the where the problem is,

The details are some thing like this,

1:i have added a field in screen for of type material number

like mara-matnr,

2:for validaton of that field i have written module validation.

3:module is called in PAI of screen.

PAi of screen.

field field_var module validation------------>written like this.

in module i have validated the fielld again mara table

module validation input.

case sy-ucomm.

case 'DISPLAY'.

select single * from mara where matnr = field_Var.

if sy-subrc <> 0.

'''''''''''erroor message dislaI--------------

endif.

endcase.

endmodule

the problem is its not displaying the error if wrong material number is ebtered and display  push button is pressed.

while debugging also ints not going in PAI module after push button is pressed.

can anybody help.

5 REPLIES 5

former_member196331
Active Contributor
0 Kudos

May i know after pressing the push button, Where it is going, you said not going to pai.

How it is behaving.

0 Kudos

hi ,after entering the material number if click push button it is bot going anywer in debugging...nothing after that.

expectation is it has to show error after push button is  pressed if invalid material

0 Kudos

Can you please enable the break point in  pbo. With  no if condition.

just write break-point.

Now press the push button, and tell me break-point reaching or not.

After pai, pbo has to trigger.

In pai also enable the break-point with no if condition.

after screen came, (after run execute the tcode) just press enter in material number

tell me pai will be triggering or not.

Hope you understood.

Former Member
0 Kudos

Hi,

I dont think you need to put the sy-ucomm check inthe field validation.it will anyway go inside the module.

Even if you check the sy-ucomm whats the value that is comming in the sy-ucomm after you press display button.

Hope this helps.

raymond_giuseppi
Active Contributor
0 Kudos

Don't check the sy-ucomm during field validation (actually never check it, check the ok_code field)

Your PAI logic should look like


process after input.

  module exit_command at exit-command.

  field record-field1 MODULE check_field1.

  MODULE user_command.

In exit_command manage the exit functions (e.g. back, cancel, exit) which don't require data validity in the user_command which is executed if check are passed, manage other functions. in both case use a code like


  lv_code = ok_code.

  clear ok_code.

  case lv_code.

    when 'FUNCSAVE'.

      " some code

      get cursor field l_fieldname line l_line.

    when 'FUNCTCODE'.

      " some other code

  endcase.

Execute the checks in the modules associated to FIELD or CHAIN to raise error messages,.

Regards,

Raymond