on 08-21-2013 10:19 PM
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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can you not use SER04 ??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
User | Count |
---|---|
91 | |
7 | |
7 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.