Skip to Content

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).

ik01.JPG


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 > ,

spro.JPG

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:

systmsg.JPG

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:

/wp-content/uploads/2015/12/b_842809.jpg

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).

a.JPG



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.

Author’s other posts

Thank you !

Regards

KJogeswaraRao

To report this post you need to login first.

1 Comment

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

  1. Amol Khairnar

    Thank you very much sir..as usual..hats off to quality of content & quality of presenting document…we can learn the difference of conventional user manuals in regular SAP implementations & SCN blogs/document writing skills. Thanks for being an inspiration always.

    (0) 

Leave a Reply