Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
jogeswararao_kavala
Active Contributor

Hello friends,

Few years ago I had posted a query in scn on the subject matter, which had to be closed without solution. Same query was posted recently by one of the members, reminding me that old post of mine. Situation changed in these years. Now I am able to try and find out solutions technically wherever feasible, if they aren't possible functionally.  Present blog is about that worked-out solution for the above mentioned query and the subject line of the blog.

The Requirement

While creating Measuring Points (IK01) customer wants to have uniqueness of the field 'MeasPosition' (field name PSORT, also known as Sort field).



The Issue

The spro settings in the path: Plant Maintenance and Customer Service > Master Data in Plant Maintenance and Customer Service > Basic Settings > Measuring Points, Counters and Measurement Documents > Define Measuring Point Categories > ,

look like achieving this requirement, but it does not. In-spite of this setting we get warning message only(shown below), when the uniqueness of this field values is violated :

and as a result, the creation of Measuring point is not prevented.


The Solution:

First I tried the answer to this issue using the user-exit IMRC0001. This worked good, but has an issue, because this exit triggers After Commit work. The error message we arrange in the exit code (when the uniqueness of the MeasPosition value is violated) , interrupts the Commit work of the exit, leading to a short dump under some conditions.

The effort continued for a better solution and arrived at a right implicit enhancement point in the MPt create program (IK01) namely SAPLIMR0 in the include LIMR0F1H at the beginning of the form PSORT_UNIQUE at Line 3.  The tested solution codes are given below for different situations.


Case1

If you want the standard Warning message we are getting to be converted to Error message without changing the message text, then the code:


The error message we get in the status bar in this case is:



Case2

If you want a Custom Error message text, then the code is as under:

The error message we get in the status bar in this case is:


Case3

Another case, where you want to have Uniqueness check within the Measuring Point Category, say 'M' . (Error message same as Case2).



Now for the convenience of copying, above three codes are given below:


Case1

DATA v_psort TYPE char20.
     CLEAR v_psort.
     SELECT SINGLE psort FROM imptt INTO v_psort WHERE psort = impt-psort .
     IF v_psort IS NOT INITIAL.
       MESSAGE E140.
     ENDIF.

Case2

DATA v_psort TYPE char20.
     CLEAR v_psort.
     SELECT SINGLE psort FROM imptt INTO v_psort WHERE psort = impt-psort.
     IF v_psort IS NOT INITIAL.
       MESSAGE 'MeasPosition is not unique. This MeasPosition already exists.' type 'E'.
     ENDIF.

Case3


DATA v_psort TYPE char20.
     CLEAR v_psort.
     SELECT SINGLE psort FROM imptt INTO v_psort WHERE psort = impt-psort and mptyp = impt-mptyp.
     IF v_psort IS NOT INITIAL.
       MESSAGE 'MeasPosition is not unique. This MeasPosition already exists.' type 'E'.
     ENDIF.







Conclusion

As members are aware, the author believes in documenting all useful solutions worked out during replying to members queries, which builds a knowledge repository at the same time helps for quick reference in case of need. Also this way the solutions are not lost/misplaced.

jogeswararao.kavala/content

Thank you !

Regards

KJogeswaraRao

1 Comment
Labels in this area