cancel
Showing results for 
Search instead for 
Did you mean: 

Read serial numbers during Insp. Lot creation on goods receipt

Former Member
0 Kudos

Hello everyone,

I'm not sure if this post belongs here or in ABAP development, but here we go:

When an inspection lot is created on goods receipt and certain criteria are met, I need to populate the inspection lot short text with the serial number from the material document.  I'm using enhancement QPL10001 (QM: Inspection lot creation - editing work area on creation) as the user exit, but I can't get the serial number from the database because it hasn't saved there yet.  Here is my nonfunctioning code in include ZXQPLU02.

*"*"Function Interface:
*"       IMPORTING
*"              I_QALS LIKE  QALS STRUCTURE  QALS
*"       EXPORTING
*"              E_QALS LIKE  QALS STRUCTURE  QALS
*"              E_ACTIVE LIKE  QM00-QKZ

DATA l_serial TYPE equi-sernr.

CHECK i_qals-werk = 'ABCD'. "Only for one plant

CHECK i_qals-art = '04' OR i_qals-art = 'Z04'. "Only for GR insp type

* Get the Serial Number into the short text field.

SELECT sernr

  FROM equi UP TO 2 ROWS

  INTO l_serial

  WHERE matnr = i_qals-matnr

    AND charge = i_qals-charg.

ENDSELECT.

* Only update if there is exactly one serial for batch.

CHECK sy-subrc = 0.

CHECK sy-dbcnt = 1.

e_qals = i_qals. "Output inspection lot record same as input.

e_qals-ktextlos = l_serial. "Put serial in short text field.

e_active = 'X'. "Flag to update inspection lot record.

Any help will be greatly appreciated!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Solved it myself.  Instead of reading the serial number from the MIGO screen (impossible afaik), it can be read from the production order, the same place from which MIGO is reading it.  This could be easily modified to take into account a production order with multiple serial numbers.

* Get serial number from production order

SELECT objk~sernr
  FROM ser05
    JOIN objk ON ser05~obknr = objk~obknr
  INTO
e_qals-ktextlos

  WHERE ser05~ppaufnr = i_qals-aufnr "order number
    AND ser05~ppposnr = 1 "first order item
    AND ser05~anzsn   = 1 "one serial number
    AND objk~obzae    = 1. "first object item

Answers (4)

Answers (4)

Former Member
0 Kudos

As it stands, I do not believe the serial numbers are available in any enhancement until after the inspection lot has been created.

The serial numbers are not available in:

MB_MIGO_BADI

MB_MIGO_ITEM_BADI

MB_DOCUMENT_BADI

They are available in these exits, but these are called AFTER the inspection lot is created:

IQSM0007

IQSM0005

I believe my best bet is to create a BAPI to change inspection lot data and call that via a serial exit or batch job.

Thank you all for the responses.

Former Member
0 Kudos

I have a new idea for the route I want to take...the information is not available in the user exit signature, but maybe I can use another user exit called earlier by MIGO to make it available in memory.

Off to look for another user exit...

Former Member
0 Kudos

check EXIT_SAPLQSS1_001. i used it for coa form printing so im expecting that everything is saved at this point.

former_member42743
Active Contributor
0 Kudos

I'm not a serial number expert but I would think there might be some user exits available on the serial number side. 

That is, when the serial number is saved, look for an exit that allows you to go find the related inspection lot and update the inspection lot instead of trying to modify it during creation.

Maybe IQSM0004?  A serial number guru might be able to help you with this.

FF

Former Member
0 Kudos

That's my plan now.  The user exit turned out to be IQSM0005.  However there is no BAPI to update inspection lot details so I'll have to create one.

former_member42743
Active Contributor
0 Kudos

Well I was close! 

You might want to look at QPLEXT_INSPECTION_LOT_CHANGE as a template or model when you write your FM.

FF

Former Member
0 Kudos

can you not use SER04 ??

Former Member
0 Kudos

No, since the users want to see the serial numbers in the list made by QA32.  This is why we want the serial copied to the short text (under these conditions there is one serial per batch).

Former Member
0 Kudos

You have to use development in QA32 screen to bring serial number.

But in case of large number of serial numbers it will create problems.

Former Member
0 Kudos

We are trying to avoid custom development in QA32 since we haven't modified SAP code and don't ever plan on doing so.  That is why we are adding the serial number to the inspection lot short text upon inspection lot creation.  Short text is already visible in QA32.

I agree with your concern about the large number of serial numbers. That is why I have implemented the logic to only work if the serial number and batch are one-to-one.