cancel
Showing results for 
Search instead for 
Did you mean: 

DATE FIELD ENTRY PROBLEM

Former Member
0 Kudos

Hi,

I am using an input field to enter date which is bound to element of datatype date. Even though when the field is blank it is by default taking the system date as input.

The problem is when it is blank , i need the values to be null or blank.

How do I achieve this?

Help is sincerely appreciated.

Thanks and regards.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Thanks everybody for your time and help.

Former Member
0 Kudos

Hi,

Use the data type 'D' for tha attribute which you bound to input field.

If this does not solve, then

can you tell what exactly you are trying to do?are you giving the value in input field during any action?

Can you explain your scenario?

Former Member
0 Kudos

Hi,

My scenario is i have two date input fields , and i have to print a message if the input date is empty to enter the fields.

But the problem is the input help that comes along with for selecting dates already has a selected value of the system date although it is not seen in the input field.

Thank you.

ajoy_chakraborty
Participant
0 Kudos

Hi,

I have replicated the scenario. Please find the steps:

1) Create webdynpro component - WINDOW1, VIEW1

2) Go to CONTEXT tab of COMPONENT CONTROLLER -> Create node (ITAB) -> Cardinality 1..1, Selection 0..1

3) Under ITAB, create ATTRIBUTE -> DATE type D

4) Go to VIEW1 -> CONTEXT tab -> Maintain context mapping

5) Go to VIEW1 -> Layout tab -> use code wizard to create FORM -> bind it with ITAB (you will get DATE in screen)

6) Create VALIDATE button in VIEW1

7) Create Action for button

Please find the validation code written in implementation:



METHOD onactionvalidate.

***-Use code wizard -> READ statement -> Bind with ITAB
  DATA lo_nd_itab TYPE REF TO if_wd_context_node.
  DATA lo_el_itab TYPE REF TO if_wd_context_element.
  DATA ls_itab TYPE wd_this->element_itab.
  DATA lv_date TYPE wd_this->element_itab-date.

* navigate from <CONTEXT> to <ITAB> via lead selection
  lo_nd_itab = wd_context->get_child_node( name = wd_this->wdctx_itab ).

* get element via lead selection
  lo_el_itab = lo_nd_itab->get_element( ).

* get single attribute
  lo_el_itab->get_attribute(
    EXPORTING
      name =  `DATE`
    IMPORTING
      value = lv_date ).

**-Required validation
  IF lv_date IS INITIAL.

**-Use code wizard -> General tab -> GENERATE MESSAGE option
*     get message manager
    DATA lo_api_controller     TYPE REF TO if_wd_controller.
    DATA lo_message_manager    TYPE REF TO if_wd_message_manager.

    lo_api_controller ?= wd_this->wd_get_api( ).

    CALL METHOD lo_api_controller->get_message_manager
      RECEIVING
        message_manager = lo_message_manager.

*     report message
    CALL METHOD lo_message_manager->report_warning
      EXPORTING
        message_text = 'Enter Date'.
  ENDIF.

ENDMETHOD.

former_member199125
Active Contributor
0 Kudos

No, it wont take default system date, i think some where you have assigned system date to input field attribute . Please check your code.

I checked myself.

Regards

Srinivas