Hi Debo,
As of Release 7.0, EhP2, the use of data type CURR is no longer recommended. For currencies, use one of the data types fordecimal floating point numbers instead. The correct currency formatting is supported on screens by output styles and in ABAP programs by appropriate formatting for the MONETARYand EXTENDED_MONETARY options. This always records amounts in the main unit of the currency, unlike the data type CURR (or DEC, or the ABAP type p).
So for your currency field you can use attribute of type : decfloat34
PFB the validation example in my test component
My layout design
OnEnter( ) action, I've written following code.
METHOD onactiontet .
DATA lo_el_context TYPE REF TO if_wd_context_element.
DATA ls_context TYPE wd_this->element_context.
DATA lv_curr TYPE wd_this->element_context-curr.
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.
* get element via lead selection
lo_el_context = wd_context->get_element( ).
* get single attribute
lo_el_context->get_attribute( EXPORTING name = `CURR` IMPORTING value = lv_curr ).
IF lv_curr IS INITIAL.
* report message
CALL METHOD lo_message_manager->raise_error_message
EXPORTING
message_text = 'Provide Currecny'.
ENDIF.
ENDMETHOD.
Output:
1)My initial screen is as follows
2)On press of enter on input currecnt field without providing any currecny , following is the error.
Hope this helps you.
Thanks
KH