cancel
Showing results for 
Search instead for 
Did you mean: 

FM to assign inspection plan and calculate sample

Former Member
0 Kudos

Hi gurus,

I am developing a program to create inspection lots using BAPIs QPL1_INSPECTION_LOT_CREATE, QPL1_UPDATE_MEMORY, QPL1_INSPECTION_LOTS_POSTING and BAPI_TRANSACTION_COMMIT.

It is working fine but I need to create inspection lot and automatically assign a inspection plan and calculate sample as I do in QA01 transaction. Do you know what FM I can use or how I can handle this situation?

Hope you are all fine.

Thanks.

Rodrigo

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

Hi Guys,

Anyone solve the issue with multiple Inspection Plans associated from the bapi

QPL1_INSPECTION_LOT_CREATE.

Regards,

Gianmichele

former_member34
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi there,

You have a question and need help by the community? Instead of posting into an old question thread, it is more helpful for you, if you create your own question. Here is how to get started:

  1. Learn about asking and answering questions in SAP Community with this tutorial: https://developers.sap.com/tutorials/community-qa.html
  2. Ask your detailed question here: https://answers.sap.com/questions/ask.html
  3. Wait for a response.

That's it. Thank you!

Best regards

Jennifer

Your SAP Community moderator

former_member664438
Discoverer
0 Kudos

Hi,

rajen.madan thank you for answer. Your solution works fine. When generating Inspection Lot for material which have only one associated Inspection Plan, those functions work fine - Inspection Plan is assigned to Lot and samples are calculated so Inspection Lot have status Released.

Now, I want to achieve same when material have multiple Inspection Plans associated. In this case those functions will create Inspection Lot, but with status Created (not Released) and samples will not be calculated. After few days of trying I didn't achieve this with those functions. Does someone have solution?

Former Member
0 Kudos

Hi all,

Just to register the solution that was implemented: I used all FM/BAPIs informed below:

1) QPL1_INITIALIZE

2) QPL1_INSPECTION_LOT_CREATE

3) QPL1_UPDATE_MEMORY

4 ) QPL1_INSPECTION_LOTS_POSTING

5) BAPI_TRANSACTION_COMMIT

And I set fields 'Inspect by task list' and 'Assign reqmts automatically' on S_ALR_87005369 transaction (IMG > Quality Management > Quality Inspection > Inspection Lot Creation > Define Default Values for Inspection Type).

With this configuration and correct mentions on QPL1_INSPECTION_LOT_CREATE it works fine for me:

Structure RMQED_IMP

DBS_STEUER = 01

DBS_FLAG = X

DBS_NOCHG = X

DBS_SUBRC = X

Structure QALS_IMP

MATNR

WERK

HERKFUNT

ART

KDAUF

ENSTEHDAT

ENTSTEZEIT

ERSTELLER

ERSTELDAT

ERSTELZEIT

PASTRTERM

PAENDTERM

SELMATNR

SELWERK

GUELTIGAB

WERKVORG

LOSMENGE

MENGENEIGH

Thanks a lot for your help.

Have a nice day!

Rodrigo


former_member208398
Active Contributor
0 Kudos

Hi Rodrigo,

Really appreciate your approach of updating and discussing the solutions once you have successfully achieved your requirements. This thread is another example:

http://scn.sap.com/thread/3391828

Kindly keep contributing.

Cheers!

Rajen

former_member208398
Active Contributor
0 Kudos

Hi Rodrigo,

Just a thought, have you tried to mention PLNTY, PLNNR, PPLVERW, PLNAL in the QALS_IMP structure of the QPL1_INSPECTION_LOT_CREATE FM?

Kindly give it a try.

Best Regards,

Rajen

Former Member
0 Kudos

Hi Rajen,

Thanks for your reply.

Yes, I did. I compared with an inpection lot created by QA01 with inspection plan and sample and mentioned all same fieds at QALS_IMP structure.

In that case, no inspection plan was generated (field AUFPL) so I used another FM  CQTA_NUMBER_GET_NEXT that QA01 uses to get AUFPL number and mentioned it on FM QPL1_INSPECTION_LOTS_POSTING but inspection plan still wasn't created. Error message when trying to imput results: No inspection operetions exist for the inspection lot.

I verified that no inspection plan was created on AFVV table.

Regards,

Rodrigo

former_member208398
Active Contributor
0 Kudos

Hi Rodrigo,

Thank you very much for the update.

I hope you can use the FM QPL1_INSPECTION_LOT_PLAN_SAMPL to execute task list assignment and sample determination.

However, you need to check whether you have note 375617 implemented in your system. Please take a look at this OSS note, it specifies the mentioned FM.

Good Luck,

Rajen

Former Member
0 Kudos

HI,

There is no such Fm exist form where u auto create the Inspection plan, and some how if u get success to create it then assignment of Operationand MIC's along with other master data  and parameter u need to assign manually.

Why u want auto creation and auto assignment of quality plan, maintain your master data properly and when u run your developen BAPI of auto lot creation system read the TABLE and pick up the corret plan and assigned it automatically.

Auto creation of Quality plan is not a Best practice. while its assignment with lot is stdn only, if usage and inspection type correctly maintained agaainst  material in master data.

Regards

Former Member
0 Kudos

Hi Shailendra,

Thanks for your reply. Sorry I was not understood. I don't want to create inspection plan as master data. I want to assign the existing inspection plan already created for the material and determine sample automatically when creating inspection lot.

I will try FM suggested by Rajen.

Thanks again.

Have a nice day,

Rodrigo

Former Member
0 Kudos

Hi Rajen,

Unfortunatly I didn't have success using QPL1_INSPECTION_LOT_PLAN_SAMPL to assign inspection plan. Do you know how to fill up this FM?

Thanks a lot.

Regards,

Rodrigo

former_member208398
Active Contributor
0 Kudos

Hi Rodrigo,

I have not used the FM till date, and documentation in EN is not available. I found out the DE documentation changing my Logon language to DE. You can use Google translate or find out a German friend who can translate this for you. The points that I could understand is, you can use this FM to create lots, too. Kindly have a look in the structure RMQED in SE11. You have to mention proper control parameters in order to get the FM work. I am attaching the German documentaation for your reference:

Planzuordnung und Stichprobenberechnung zu Prüflos:

Der Funktionsbaustein ist dazu gedacht, Prüflose automatisch im System anzulegen. Der Aufruf dieses Bausteins wird beispielsweise beim Buchen eines Wareneingangs verwendet.
In der Workarea QALS_IMP müssen Prüflosdaten, welche bekannt sind mitgegeben werden.
Mitgegeben werden muß auf jeden QALS_IMP-MATNR (Materialnummer), QALS_IMP-LOSMENGE (Losmenge), QALS_IMP-HERKUNFT (Prüflosherkunft), QALS_IMP-WERK (Werk), QALS_IMP-MENGENEINH.
Abhängig von der Herkunft sind noch weitere Felder zu füllen. Bei Herkunft '01' muß z.B. auf jeden Fall der Lieferant (QALS_IMP-LIFNR) und die Einkaufsorganisation (QALS_IMP-EKORG) gefüllt werden.
In der Workarea RMQED_IMP für den Baustein steuernde Parameter zu setzen. Als Beispiel kann man sich in diesem Zusammenhang den Baustein QPL1_INIT_QSS ansehen.
Läuft der Baustein ohne Probleme durch (d.h. ist SUBRC entweder 0 oder 4, sind sämtliche Prüflosdaten im lokalen Memory des Bausteins vorhanden. Diese Daten sind in einem nächsten Schritt ins Memory zu schreiben. Dies geschieht mit dem Baustein QPL1_UPDATE_MEMORY. Im Parameter I_QALS kann dabei die Prüflos-Workarea mitgegeben werden. Wird keine Workarea mitgegeben, arbeitet das System mit der zuletzt erzeugten Workarea. Das Kennzeichen I_UPDKZ bestimmt, ob der Prüflossatz neu auf der Datenbank angelegt werden soll (I) oder geändert werden soll.
Soll ein bestimmter Lossatz aus dem Memory geändert werden (z.B. bei Ändern der Menge bei einer WE-Position) empfiehlt es sich, das jetzt im Memory stehende Prüflos aus dem Memory zu entfernen (mit dem Baustein QPL1_LOT_CANCEL) und ein neues Los im Memory abzulegen (mit QPL1_INSPECTION_LOT_CREATE und QPL1_UPDATE_MEMROY). Voraussetzung hierbei ist, daß die Anwendung die vergebenen Prüflosnummern mitführt, da der Zugriff auf das Memory mit der Prüflosnummer erfolgt (Parameter I_PRUEFLOS im Baustein QPL1_LOT_CANCEL).
Zum Löschen eines Lossatzes aus dem Memory verwendet man den Baustein QPL1_LOT_CANCEL).
Die Memorytechnik wird angewandt um innerhalb einer Transaktion mehrere Prüflose gleichzeitig anlegen zu können und diese dann unter einer wohldefinierten Memory-ID im System hinterlegen zu können.
Für die Verbuchung der Lose, welche im Memory stehen, ist es notwendig, sich mittels QPL1_GET_MEMORYTAB die interne Tabelle mit den Prüflosen aus dem Memory zu besorgen und diese dann nach und nach zu verbuchen (Als Vorlage kann dabei der im Wareneingang benutzte Baustein QPBU_GOODSRECEIPT_LOT_POSTING dienen).

Best Regards,

Rajen

former_member208398
Active Contributor

Hi Rodrigo,

In addition to my earlier reply, you can try the following scenario:

instead of using FM QPL1_INSPECTION_LOT_CREATE, use the FM QPL1_INSPECTION_LOT_PLAN_SAMPL, and use other FM's as you are currently using. The control structure RMQED_IMP is very important. I hope you have already used DBS_STEUER = '01' (mode = create), DBS_FLAG = 'X', DBS_NOPLAN  = ' ' etc.

In the QALS_IMP structure mention PLNTY, PLNNR, PPLVERW, PLNAL. The FM QPL1_INSPECTION_LOT_PLAN_SAMPL uses the same structures as in QPL1_INSPECTION_LOT_CREATE. Please try the same.

Best Regards,

Rajen