SAP QPL2_GET_LOTS_FOR_BATCH Function Module for NOTRANSL: Nachlesen aller Prüflose, die zu einer Charge existieren
QPL2_GET_LOTS_FOR_BATCH is a standard qpl2 get lots for batch SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for NOTRANSL: Nachlesen aller Prüflose, die zu einer Charge existieren processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for qpl2 get lots for batch FM, simply by entering the name QPL2_GET_LOTS_FOR_BATCH into the relevant SAP transaction such as SE37 or SE38.
Function Group: QPL2
Program Name: SAPLQPL2
Main Program: SAPLQPL2
Appliation area: Q
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function QPL2_GET_LOTS_FOR_BATCH pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'QPL2_GET_LOTS_FOR_BATCH'"NOTRANSL: Nachlesen aller Prüflose, die zu einer Charge existieren.
EXPORTING
I_MATNR = "Material
I_WERK = "Plant
I_CHARG = "Batch
* I_AUFNR = "Order Number
* I_X_LOT_DATA = "X and Blank
TABLES
T_QALS_TAB = "Inspection Lots
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1 INTERNAL_ERROR = 2
IMPORTING Parameters details for QPL2_GET_LOTS_FOR_BATCH
I_MATNR - Material
Data type: QALS-MATNROptional: No
Call by Reference: No ( called with pass by value option)
I_WERK - Plant
Data type: QALS-WERKOptional: No
Call by Reference: No ( called with pass by value option)
I_CHARG - Batch
Data type: QALS-CHARGOptional: No
Call by Reference: No ( called with pass by value option)
I_AUFNR - Order Number
Data type: QALS-AUFNROptional: Yes
Call by Reference: No ( called with pass by value option)
I_X_LOT_DATA - X and Blank
Data type: QM00-QKZOptional: Yes
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for QPL2_GET_LOTS_FOR_BATCH
T_QALS_TAB - Inspection Lots
Data type: QALSOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
INCONSISTENT_PARAMETERS - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INTERNAL_ERROR - Internal program error
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for QPL2_GET_LOTS_FOR_BATCH Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_i_matnr | TYPE QALS-MATNR, " | |||
| lt_t_qals_tab | TYPE STANDARD TABLE OF QALS, " | |||
| lv_inconsistent_parameters | TYPE QALS, " | |||
| lv_i_werk | TYPE QALS-WERK, " | |||
| lv_internal_error | TYPE QALS, " | |||
| lv_i_charg | TYPE QALS-CHARG, " | |||
| lv_i_aufnr | TYPE QALS-AUFNR, " | |||
| lv_i_x_lot_data | TYPE QM00-QKZ. " |
|   CALL FUNCTION 'QPL2_GET_LOTS_FOR_BATCH' "NOTRANSL: Nachlesen aller Prüflose, die zu einer Charge existieren |
| EXPORTING | ||
| I_MATNR | = lv_i_matnr | |
| I_WERK | = lv_i_werk | |
| I_CHARG | = lv_i_charg | |
| I_AUFNR | = lv_i_aufnr | |
| I_X_LOT_DATA | = lv_i_x_lot_data | |
| TABLES | ||
| T_QALS_TAB | = lt_t_qals_tab | |
| EXCEPTIONS | ||
| INCONSISTENT_PARAMETERS = 1 | ||
| INTERNAL_ERROR = 2 | ||
| . " QPL2_GET_LOTS_FOR_BATCH | ||
ABAP code using 7.40 inline data declarations to call FM QPL2_GET_LOTS_FOR_BATCH
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single MATNR FROM QALS INTO @DATA(ld_i_matnr). | ||||
| "SELECT single WERK FROM QALS INTO @DATA(ld_i_werk). | ||||
| "SELECT single CHARG FROM QALS INTO @DATA(ld_i_charg). | ||||
| "SELECT single AUFNR FROM QALS INTO @DATA(ld_i_aufnr). | ||||
| "SELECT single QKZ FROM QM00 INTO @DATA(ld_i_x_lot_data). | ||||
Search for further information about these or an SAP related objects