cancel
Showing results for 
Search instead for 
Did you mean: 

Validation for WBS field Length

Former Member
0 Kudos

Dear All,

I am using following Project coding mask  T.00.XXX.000.000.00.00.0

Where

Project code- T.00.XXX.000

Level 1 WBS -T.00.XXX.000.000

Level 2 WBS-T.00.XXX.000.000.00

Level 3WBS- T.00.XXX.000.000.00.00

Level 4 WBS-T.00.XXX.000.000.00.00.0

I want to restrict Field legth of Identification of WBS at each level.

For instance the level 1 WBS should be of 12 characters only.

I have used following logic in validation , but it is not working

Prequeste

PRPS-STUFE = '1'

Check

PRPS POSID :13 -: = ' '

Message

Error message.

This logic is  not working . Even i used check condition as PRPS POSID :13 -13= ' '. It is also not working.

Please help , where i am getting wrong.

Regards,

Vishal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Vishal,

Follow these steps ... This will surely help you.

Pre-requisite

PRPS-STUFE='1'

Check

( PRPS-POSID :1-12: = PROJ-PSPID :1-12: ) AND

PRPS-POSID :13-: = ''

followed by the desired error..

Let us know if it worked for you.

Former Member
0 Kudos

Dear All,

The following logic has worked in my case for level 1 WBS.

Pre-requisite

PRPS-STUFE='1'

Check

PRPS-POSID :13-14: = '00'

Message

Error message

Similar logic is working  for other levels also.

I thank everyone for their support in helping me resort this issue.

I would like to appreciate Sarath for bringing out ABAP solution for this issue  which i suppose would  work in this case , but I would like to go ahead with standard configuration available for validation in PS module.

Closing this thread.

Thanks again .

Regards,

Vishal

Answers (2)

Answers (2)

former_member184672
Participant
0 Kudos

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.

former_member209919
Active Contributor
0 Kudos

Hello Vishal,

If you have configured the character " . " as a special character and then use in the mask even if you enter the code :

T.00.XXX.000 the system stores T00XXX000 ( special characters are not stored, only displayed) then you have to validate the position 10 instead of 13.

Check it!!

Former Member
0 Kudos

Hi ,

Thanks for the reply.

In my case the 1st level wbs is T00XXX000000 , which is of 12 characters excluding special characters.

I think there could be some other reason for validation not working.

Regards,

Vishal

former_member209919
Active Contributor
0 Kudos

hello,

Why the validation is not working? the error message doesn't appear? or the error message always appear?

If it is the first case check the validation is correct assigned to your project profile and it is activated and generates correctly. ( you can check validate something like prerequisite : STUFE = 1 Check STUFE = 2) If the error message appears is it is correct configured.

If you think that the problem is with the code entered in the check, you can try :

prps-posid :1-12:

Not sure if this help you..

Former Member
0 Kudos

Hi ,

After putting validation for a particular WBS level ,  I am getting error message always even for correct WBS code at that WBS level

Dont know what could be the error.

I am exploring further on this issue.

Regards,

Vishal

former_member209919
Active Contributor
0 Kudos

Hello Vishal,

Could you try:

1 )  prps-posid :1-12:

or

2) Are you sure that your project is using the mask? Try to use

PRPS POSID :20-: = ' '

to check if continues happening

Regards

Former Member
0 Kudos

Hi Clara,

Thanks for reply.

I am not able to understand how to use logic PRPS- POSID :1-12:

Regarding your second suggestion , I have checked in the system & found that I am not getting error.

One thing I found that we are using multiple project coding mask for different kind of projects.

I have  taken care of the same during validation by using project profile/project type in the prequeste.

Regards,

Vishal

former_member209919
Active Contributor
0 Kudos

Hello Vishal,

You say :

Regarding your second suggestion , I have checked in the system & found that I am not getting error.

If the system validates position "20" and position "13" and you don't have the same result in the validation.. it is due to your project internally is not : T00XXX000000

You can check how the project is intenally in PRPS table field POSID how internally the number has been generated ( you have to go PRPS excute it for your WBS and deactivate in the header : Settings --> user paramentes --> Format ( un flag check conversion exists)

Regards