Skip to Content

Here in this blog , i would like to share my experience with code values check provided by BOPF Framework, as we all know BOPF frame work enables developer to develop application in a unique approach.Of course it also provides with lot of  generic  features which makes developer life easy.similarly it provides generic way to validate BO Node field values against the value range in the data domain.Feeling happy in writing a blog for BOPF.  😘

BOPF provides the generic validation class /BOFU/CL_V_CODE_VALUES ,Which shall be  inherited in order to implement the validation check against the Domain value range for the BO node attribute.

As we can see this generic class implements /BOBF/IF_FRW_VALIDATION, So it is recommended to implement BOPF validation to the respective node by inheriting the class 😉 . and the method GET_VALIDATION_CONFIGURATION which is an abstract method need to be redefined.

Let me quickly take through 3 easy steps on how to implement the validation.

Creating Action validation :


     i have created a action validation for the node ‘PR_ITEM‘ , it is been modeled  to trigger the validation on the instance update of the node PR_ITEM.

Implement GET_VALIDATION_CONFIGURATION :


          Now lets implement the abstract method GET_VALIDATION_CONFIGURATION, this methods keeps track of the information of the node attributes to which the field value are to be validated. i do some dirty coding some times 😉 .Here we bind the node attribute and the data domain object of the node attribute and give it back to the validation. Note: Data Domain is mandatory for the node attribute in order to perform this validation ,also i have tried only with the fixed value range of the domain but not with the domain value table.

     In the above image i have defined the ‘MAT_TYPE‘ and Domain ‘ZMAT_TYPE‘ , so when ever the field MAT_TYPE is provided with the values which is not maintained in the Domain values , BOPF will not allow the instance to update.

Testing:


          So finally we have implemented code values check to a node attribute let test the application on the test ui and we will how BOPF reacts to it.

In the below image ,Attribute MAT_TYPE has 4 possible values in domain fixed values.

and when we try to input some other values rather than the possible 4 entries , validation stops the instance update process with error message as shown in below snip.

Conclusion:

          So  the code values check helps in validation of the node attribute with quick and easy implementation with generic implementation,Thanks for reading and am not so expertise in writing a blog but i think this blog at least  give some overview knowledge in BOPF code values check.Like wise BOPF provides other lot of features which definitely helps in developer.so let me come up with some other new BOPF topic on my next blog,Happy Blogging !!!. 🙂


To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

  1. Oliver Jaegle

    Nice description of a good example for re-use in BOPF. The BOPF re-usables provide some more generic features as library classes which you may want to explore.

    Oliver

    P.s.: If you trigger a validation on update, it should usually also be triggered on create, as also data can be provided with the create-call.

    (0) 
  2. Vivek Kumar Gupta

    Hi vigneswaran,

    Appreciate your blogging, its very helpful for my task. But i am stuck with 2 code value checks simultaneously.

    Could you please help me out on this?

    Thanks,

    Vivek

    (0) 
  3. Roman Becker

    Hello Vigneshwaran,

    nice blog, well done.

    I have a case the validation class is not working (or I just think it is not working). I have domain “CALENDAR_WEEKS” for storing the calendar weeks a year can have. The Domain is a DEC(2). The possible value would be 52 and 53.

    I have implemented the check class but I always get an error that my value is wrong no matter what I input.

    Any idea on this?

    Best regards

    Roman

    (0) 

Leave a Reply