cancel
Showing results for 
Search instead for 
Did you mean: 

DDIC domain level interval validation

Former Member
0 Kudos

Hi guys

playing around with DDIC and validation I have a few questions:

on domain level it is possible to define an interval: lower limit and upper limit, but in my test application it is not being validated wether an entered value is inside the range.

when using single values it is being validated.

1) is it possible to define ranges at all and get that validated automatically by framework

2) is it possible to change error message

for example: "The Entered Value Can Only Contain Numerical Characters" when entering characeters instead of numbers...

regards

stefan

Accepted Solutions (1)

Accepted Solutions (1)

alejandro_bindi
Active Contributor
0 Kudos

For the ranges validation, you could use function module DD_DOMVALUES_GET, which returns internal table DD07V_TAB.

In that table, you have fields DOMVALUE_L and DOMVALUE_H for the ranges limits (if DOMVALUE_H is initial, it is a fixed value, not a range).

Using that info, in case they are numeric ranges (most probably), you could use DO cycles for each range to generate a single value set and finally bind it to the corresponding attribute (i.e. using if_wd_context_node_info~set_attribute_value_set)

Hope it helps.

Edited by: Alejandro Bindi on Oct 22, 2008 10:31 AM

Answers (2)

Answers (2)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

> 1) is it possible to define ranges at all and get that validated automatically by framework

>

Unfortunetely the framework does not yet validate the domain ranges. It is something being discussed for the future. The application would be responsible for such validations today.

> 2) is it possible to change error message

> for example: "The Entered Value Can Only Contain Numerical Characters" when entering characeters instead of numbers...

The message is not configurable. You could find the message and alter it, but that would be considered a system modification.

Former Member
0 Kudos

Hi,

For the lower and higher limits we can go for the Select-Options component.

We can use the standard component WDR_SELECT_OPTIONS for this.

And if you are not using the select options and if you are trying to have two different input fields one for lower and opther for higher limit then we need to handle the validations by ourself.

You can have you own messages also. The message you are getting is from the standard table T100. try to use the other methods of the Message component in order to throw your own message.

Try to have the sample code -

Here I have considered the message container.

Here I have created an input field for 'CONNID' and I'm checking wether it is intitial or not. I have taken antoher context attribute 'TEXT' for haveing the own message and to the Textview UI element I have bound this TEXT to have my own message.

method wddomodifyview .

if wd_this->text = 'YES'.
  data:
   lr_text type ref to cl_wd_text_view,
   v_connid type s_conn_id.

  data:
    elem_context        type ref to if_wd_context_element,
    stru_context        type if_mesg=>element_context ,
    item_connid         like stru_context-connid.
* get element via lead selection
  elem_context = wd_context->get_element(  ).

* get single attribute
  elem_context->get_attribute(
    exporting
      name =  `CONNID`
    importing
      value = item_connid ).

        data:
          elem_context1   type ref to if_wd_context_element,
          stru_context1  type if_mesg=>element_context ,
          item_text      like stru_context-text.
*       get element via lead selection
        elem_context1 = wd_context->get_element(  ).


lr_text ?= view->get_element( 'TV1' ).
  if item_connid is initial.
       item_text = 'Please enter value'.
      lr_text->bind_text( path = 'TEXT'   ).

  elseif not item_connid is initial.

   select connid
   up to 1 rows
   from sflight
   into v_connid
   where connid = item_connid .
   endselect.
   if sy-subrc ne 0.
      item_text = 'Please enter correct value'.
      lr_text->bind_text( path = 'TEXT'   ).

   else.
      item_text = ' '.

      lr_text->bind_text( path = 'TEXT'   ).

   endif.
  endif.
  wd_this->text = ' '.
  elem_context1->set_attribute(
      value  =  item_text
      name   = 'TEXT'
         ).


endif

.

If you want to validate the lower and higher limits-

if item_connid-low GE <<number>> and item_connid-high LE <<number>> .

Use the message container compoenent and throw the message.

Else.

Proceed further.

endif.

Using the message container methods- Here I'm validating the Airline Id (CARRID) for the valid values -

method onactionclick ( or your event handler).

  data:
    elem_context    type ref to if_wd_context_element,
    stru_context    type if_mesg=>element_context ,
    item_carrid     like stru_context-carrid,
    l_current_controller type ref to if_wd_controller,
    l_message_manager    type ref to if_wd_message_manager,
    l_str type string,
    l_carrid type s_carr_id,
    l_msg type symsg,
    l_parm type syst-msgv1.


* get element via lead selection
  elem_context = wd_context->get_element(  ).

* get single attribute
  elem_context->get_attribute(
    exporting
      name =  `CARRID`
    importing
      value = item_carrid ).


  l_current_controller ?= wd_this->wd_get_api( ).
  l_message_manager = l_current_controller->get_message_manager( ).

  if item_carrid is initial.

    l_str = 'Please Enter the Carrier Id'.
* report message
    l_message_manager->report_error_message(
        message_text             = l_str

           ).

  else.

    select single carrid                        " Airline Carrier Id
        from scarr
        into l_carrid
        where carrid eq item_carrid.

    if l_carrid is initial.
      concatenate l_parm item_carrid into l_parm.

      l_message_manager->report_t100_message(
          msgid                    = 'BC_BOR'
          msgno                    = '159'
          msgty                    = 'E'
          p1                       = l_parm   ).

    endif.
  endif.

endmethod.

Here I'm validating only the lower values this not using the select options. here i have taken an input field and validated it.

If you use the select-options then after we populate the ranges table in that then we need to the validations as specified above.

Regards

Lekha