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

Field validation in Module Pool

Former Member
0 Likes
554

Hi,

In my module pool, on main screen there are various fields, now out of these i've to give validation for 4 fields through a drop down field such that:

There are 2 items in my drop down, when 1st item of drop down is clicked then out of 4 fields for which i've to give validation, 2 should be Active (should take input) and other 2s should be inactive.

And if I click the 2nd item of dropdown then there shoud be vice versa(inactive ones should b active now and active ones should be inactive now).

Also got the function module VRM_SET_VALUES & a program DEMO_DYNPRO_DROPDOWN_LISTBOX for dropdown but don't know how can I use. If anybody can tell for either of or for both probs then will be a great help.

1 REPLY 1
Read only

MarcinPciak
Active Contributor
0 Likes
388

Hi,

As for the question regarding (de)activating fields:


parameters: pa_list ... "your listbox

data: st_first_two type i value 1,   "status of first two fields,
        st_last_two type i value 0.   "status of last two fields


at selection-screen.   "in PAI
  "determine status of fields depending of what was choosen
  if pa_list = '1st_item'.   "if first item picked
     st_first_two = 1.
     st_last_two = 0.
  else.                           "2nd picked
     st_first_two = 0.
     st_last_two = 1.
  endif.

  "now change them
  Loop at screen.
     if screen-name CS 'First_field' or 
        screen-name CS 'Secodn_field'.
        screen-input = st_first_two.                  "(de)activate first two fields
    elseif screen-name CS 'Third_field' or
             screen-name CS 'Fourth field'.
         screen-input = st_last_two.                 "(de)activate last two fields
     endif.
    modify screen.
  endloop.

This way you can in turn activate/deactivate your fields depending of the item picked in the listbox.

As for the question, this fm (VRM_SET_VALUES) is used to populate possible entires in the listbox in PBO (AT SELECTION-SCREEN OUTPUT) which user can later pick. It is usually used to fill data with your custom structure, not the DDIC one. Go through this demo and see step by step how data are populated to listobox (just before screen is displayed).

Also refer [this link|http://sap.niraj.tripod.com/id38.html]. It gives quite good explanation how it should be used.

Regards

Marcin