Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 10473

Re: Validation for WBS field Length

$
0
0

Hi Vishal,

        Why don't you try out ABAP regular expression to validate a string conforming to a particular code mask?

 

Syntax for creating the regular expressions can be found in the following link:

http://help.sap.com/abapdocu_70/en/ABENREGEX_SYNTAX.htm

 

Once you create the regular expression for your WBS element, you can make use of the methods in the ABAP class cl_abap_matcher to verify the entered string against your regular expression.

 

Sample code is as given below:

 

DATA: matcher         TYPE REF TO cl_abap_matcher,

          lv_match        TYPE c,

          lv_regex        TYPE text255, "regular expression

          lv_str            TYPE text255.   "string to be validated

 


* Verify match for the string
   matcher cl_abap_matcher=>create( pattern       = lv_regex
                                                            ignore_case   = abap_true
                                                            text          = lv_str ).

 

   lv_match = matcher->match( ).

 

   IF lv_match EQ 'X'.

     Message 'Success'.

    Else.

      Message 'Fail'.

   Endif.

 

 

Hope this is helpful for you in resolving your issue.

 

Thanks & Regards,

Sarath.


Viewing all articles
Browse latest Browse all 10473

Trending Articles