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!