# Calculation of 'Units to be inspected' and sample size of inspection lot

Hi folks,

Im stuck with a scenario and not finding a way to map this. I hope I get an advice here. This scenario is related to inspection of incoming goods (Type 01).

My client follows AQL to carry out sampling and inspection of raw materials. They have different inspection parameters and refer their own set of test methods to complete the inspection and approve the material. It goes like,

1. A material subjected to AQL inspection is sampled and visually inspected.

2. In terms of SAP, inspection task list has one operation and Five MICs are assigned to it. Each MIC, or more have different sampling procedure (no of units to be inspected).

3. MIC 3 and MIC4 follows fixed sample size and MIC 5 follows sampling scheme. Therefore I'm able to calculate the required units to be inspected for each of three MICs. All sampling procedures are defined and assigned to relevant MIC in operation of the task list. No issue until here. It returns with correct value of 'Units to be inspected' in result recording screen.

4. MIC 1 and MIC 2, adopts a different practice. To record the results of these MICs, sample units equaling "(Sq Root of N) +1" are to inspected where N is the lot size or GR quantity. If Inspection lot quantity is 100 units, then 11 units must be inspected for each of MIC 1 and MIC 2. Here lies the problem.

Im not sure what settings do I need to maintain in the system to make system calculate "units to be inspected" which equals "(Sq Root of N) +1" of the lot size i.e 11 in this example.

In addition, Sample size calculated for MIC 1 and MIC 2 will always be equal and also bigger number than rest of the sample size, so "(Sq Root of N) +1" should be reflected as sample size of inspection lot when seen in QA32 layout and inspection stock posting screen.

Please suggest best ways to map this scenario and get the appropriate samples size. Im not sure how complex or easy is this process, but Im finding it really hard to map :(

Thanks,

Nitin

10|10000 characters needed characters exceeded
• Reopening this query because of change in requirement.

Jul 26, 2017 at 04:46 PM

To take into account number of containers you can do it a couple of ways.

1) utilize a sample-drawing procedure. In the sample drawing procedure you can specify that samples are based on containers.

2) the other way is a bit more complicated. I have not done this but I believe this is how you want to do it. In configuration you'll create a new "rule for sample determination". The rule will be a copy of one of the existing ones, probably in your case a copy of 30 - Use sampling scheme. Copy this to 31 for instance. There is a FM associated with this, QDRS_SAMPLING_PLAN_SAMPLE with 30. You'll need to copy the FM and create your own Z FM. In the FM it imports and uses QALS-LOSMENGE (lot qty). Change this to use QALS-ANZGEB (# of containers). Then in the FM make the updates to use ANZGEB where ever LOSMENGE is used. Configure 31 to use the new Z FM.

Now when you create a new sample procedure, the system will see more than one sample determination rule for 300 (using sample scheme). It will ask you to pick either 30 or 31. 30 should do the calculation based in QALS-LOSMENGE while 31 will do it based on QALS-ANZGEB.

A third hybrid option is to change the FM for the sample determination rule 30. Copy it to a Z FM and put in a IF-then statement. Import both LOSMENGE and ANZGEB. Then if ANZGEB is not initial then use it, else use LOSMENGE.

Depending on your business needs, you might also want to put a check into the GR MIGO user exit at the time of saving to make sure the number of containers has been filled in. You'll need to maybe base this on the particular inspection type. i.e. 01 it's not req. but if 01_CONT inspection type is set up as preferred, then number of containers has to be recorded in the GR.

This should work and should be relatively straight forward.

Craig

10|10000 characters needed characters exceeded
• Jun 13, 2017 at 04:37 PM

I've found the best way to handle SQRT of N + 1 is to simply set this up as a sample procedure that uses a sampling scheme.

I used Excel with the "fill down" functionality to create a table of sampling quantities and then I used this table as a reference to create the sampling scheme table. It's a bit time-consuming to set up the sampling scheme table but it shouldn't take more than an hour to set it up.

You can also use the partial lots funcitonality. But defining MIC 1 and MIC 2 using the same paritial lot number (001). This tells the system they will use the same sample qty's for boths tests. I.e. overall same size for 100 units should be 11, not 22. Without defining this, you would get 22 for your overall sample requirement.

You can do the same for Mic's 3-5. I.e. assign them to 001 or give them their own parital lot number which would increase the overall sample qty.

Also, make sure you look at the requirement of "no. of containers" Many things are ordered and receieved in by BUOM but are actually inspectied by the number of containers. Espeically liquids. I.e. 5000 Kgs might be 10 drums of material and sample calculation is based on 10 drums, not 5000 kgs.

Hope this helps.

Craig