cancel
Showing results for 
Search instead for 
Did you mean: 

Input Field Validation in Webdynpro

Former Member
0 Kudos

HI,

And i got a Doubt i need to Validate the Input and i have to show the Error Message and i know its Simple and i am Just trying in if_wd_message_maanger. but if i Enter Wrong Sale Order Number it should throw the Error.

Regards,

Sadiq.

Accepted Solutions (1)

Accepted Solutions (1)

Lukas_Weigelt
Active Contributor

You should use hook method WDDOBEFOREACTION to validate user inputs. As you stated, you throw error messages with the message manager.

I always get the Message Manager in WDDOINIT of CC and bind it to a global attribute so I don't have to define it ever again:

* WD4A API

  DATA lo_api_componentcontroller TYPE REF TO if_wd_component.

* Globales Interface holen

  lo_api_componentcontroller = wd_this->wd_get_api( ).

* Message Manager in Attribut schreiben für globalen instanziierten Zugriff

  wd_this->z_go_mess_man = lo_api_componentcontroller->get_message_manager( ).

The you can just access it like this from wherever you want. Example:

wd_comp_controller->z_go_mess_man->report_attribute_error_message

But what exactly is your problem? Do you need help with the approach or is your coding not doing what you want it to?

regards, Lukas

Former Member
0 Kudos

Hi Lukas,

Thanks for your Reply , In my Condition is Sale Order Number VBELN ,,,, and i want to throw the message if the sale Order is not there,,,,, and i need a Coding.....

Former Member
0 Kudos

Hi Basha,

You want to raise a message if values is not there in vbeln field??

For example : if lv_vbeln is initial.

* 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_MESSAGE
      EXPORTING
        MESSAGE_TEXT = 'Enter Sales Order'.

ENDIF.

OR if you want to check wheather entered value is there or not in database means..

using select quesry check that.

You need write use some coding to get this..

First get all vbeln values in one internal table.

loop at it_vbeln into wa_vbeln // Your vbeln field.

read table itab into witab with key vbeln = wa_vbeln.

if sy-subrc ne 0.

//raise error message. means the entered vbeln is not in database.

endif.

endloop.

Hope it clear.

Cheers,

Kris.

Former Member
0 Kudos

HI Kissnas,

Thanks a lot for your Reply ,,, It Working Fine,,,, and i have rewarded you a 10 Points. And i will be Back when i got an Issue.

Regards,

Sadiq.

Answers (0)