L_QALS-MATNR = PMATNR.
L_QALS-WERK = PWERK.
L_QALS-HERKUNFT = '02'.
L_QALS-ART = 'Z21'.
L_QALS-LOSMENGE = PMENGE.
L_QALS-KUNNR = PKUNNR.
L_QALS-KTEXTLOS = 'Test Inspection'.
L_RMQED-DBS_STEUER = '01'.
L_RMQED-DBS_FLAG = 'X'.
L_RMQED-DBS_EDUNK = 'X'.
L_RMQED-DBS_FDUNK = 'X'.
L_RMQED-DBS_NOERR = 'X'.
L_RMQED-DBS_NOWRN = 'X'.
L_RMQED-DBS_NOCHG = 'X'.
L_RMQED-DBS_NOAUF = 'X'.
* Create lot in local LUW...
CALL FUNCTION 'QPL1_INSPECTION_LOT_CREATE'
EXPORTING
QALS_IMP = L_QALS
RMQED_IMP = L_RMQED
IMPORTING
E_PRUEFLOS = L_PRUEFLOS
E_QALS = L_QALS
SUBRC = L_SUBRC.
IF SY-SUBRC = 0.
* Update memory stack for actual posting...
CALL FUNCTION 'QPL1_UPDATE_MEMORY'
EXPORTING
I_QALS = L_QALS
I_UPDKZ = 'I'.
* Post lot to DataBase...
CALL FUNCTION 'QPL1_INSPECTION_LOTS_POSTING'.
COMMIT WORK AND WAIT.
CONCATENATE 'Inspection lot' L_PRUEFLOS 'created successfully' INTO INSP_MSG SEPARATED BY ' '.
MESSAGE INSP_MSG TYPE 'S'.
ENDIF.