SAP COPF_DETERMINE_BATCH Function Module for NOTRANSL: Durchführung einer Chargenfindung oder Chargenprüfung
COPF_DETERMINE_BATCH is a standard copf determine 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: Durchführung einer Chargenfindung oder Chargenprüfung 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 copf determine batch FM, simply by entering the name COPF_DETERMINE_BATCH into the relevant SAP transaction such as SE37 or SE38.
Function Group: COPF
Program Name: SAPLCOPF
Main Program:
Appliation area: C
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function COPF_DETERMINE_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 'COPF_DETERMINE_BATCH'"NOTRANSL: Durchführung einer Chargenfindung oder Chargenprüfung.
EXPORTING
IM_PLANT = "Plant of the material
IM_RESERVATION_ITEM = "Reservation item
* IM_NUMBER_OF_SPLITS = '1' "Predefined Type
IM_PHASE = "Operation/Phase
IM_PROCESS_INSTRUCTION = "Process Instruction
IM_MATERIAL = "Material
* IM_BATCH = "Batch
IM_MATERIAL_QUANTITY = "Quantity
IM_UNIT_OF_MEASURE = "Unit of Measure
IM_STORAGE_LOCATION = "Warehouse
IM_RESERVATION = "Reservation
IMPORTING
EX_BATCH = "Batch Number
EX_MATERIAL_QUANTITY = "Quantity in Unit of Entry
EX_UNIT_OF_MEASURE = "Unit of Entry
EX_STORAGE_LOCATION = "Storage Location
TABLES
* TAB_BATCH = "Batches
* TAB_MATERIAL_QUANTITY = "Quantities
* TAB_UNIT_OF_MEASURE = "Units of Measure
* TAB_STORAGE_LOCATION = "Storage Locations
EXCEPTIONS
DATA_INCOMPLETE = 1 DETERMINATION_ERROR = 2 BATCH_OK = 3
IMPORTING Parameters details for COPF_DETERMINE_BATCH
IM_PLANT - Plant of the material
Data type: BDPIS-WERKSOptional: No
Call by Reference: No ( called with pass by value option)
IM_RESERVATION_ITEM - Reservation item
Data type: BDPIS-RSPOSOptional: No
Call by Reference: No ( called with pass by value option)
IM_NUMBER_OF_SPLITS - Predefined Type
Data type: IDefault: '1'
Optional: Yes
Call by Reference: No ( called with pass by value option)
IM_PHASE - Operation/Phase
Data type: CLIKEOptional: No
Call by Reference: No ( called with pass by value option)
IM_PROCESS_INSTRUCTION - Process Instruction
Data type: CLIKEOptional: No
Call by Reference: No ( called with pass by value option)
IM_MATERIAL - Material
Data type: BDPIS-MATNROptional: No
Call by Reference: No ( called with pass by value option)
IM_BATCH - Batch
Data type: BDPIS-CHARGOptional: Yes
Call by Reference: No ( called with pass by value option)
IM_MATERIAL_QUANTITY - Quantity
Data type: BDPIS-ERFMGOptional: No
Call by Reference: No ( called with pass by value option)
IM_UNIT_OF_MEASURE - Unit of Measure
Data type: BDPIS-ERFMEOptional: No
Call by Reference: No ( called with pass by value option)
IM_STORAGE_LOCATION - Warehouse
Data type: BDPIS-LGORTOptional: No
Call by Reference: No ( called with pass by value option)
IM_RESERVATION - Reservation
Data type: BDPIS-RSNUMOptional: No
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for COPF_DETERMINE_BATCH
EX_BATCH - Batch Number
Data type: BDBATCH-CHARGOptional: No
Call by Reference: Yes
EX_MATERIAL_QUANTITY - Quantity in Unit of Entry
Data type: BDBATCH-ERFMGOptional: No
Call by Reference: Yes
EX_UNIT_OF_MEASURE - Unit of Entry
Data type: BDBATCH-ERFMEOptional: No
Call by Reference: Yes
EX_STORAGE_LOCATION - Storage Location
Data type: BDBATCH-LGORTOptional: No
Call by Reference: Yes
TABLES Parameters details for COPF_DETERMINE_BATCH
TAB_BATCH - Batches
Data type: BDPIS_CHARG_TABOptional: Yes
Call by Reference: Yes
TAB_MATERIAL_QUANTITY - Quantities
Data type: BDPIS_ERFMG_TABOptional: Yes
Call by Reference: Yes
TAB_UNIT_OF_MEASURE - Units of Measure
Data type: BDPIS_ERFME_TABOptional: Yes
Call by Reference: Yes
TAB_STORAGE_LOCATION - Storage Locations
Data type: BDPIS_LGORT_TABOptional: Yes
Call by Reference: Yes
EXCEPTIONS details
DATA_INCOMPLETE - Data is incomplete
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
DETERMINATION_ERROR - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
BATCH_OK - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for COPF_DETERMINE_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_ex_batch | TYPE BDBATCH-CHARG, " | |||
| lv_im_plant | TYPE BDPIS-WERKS, " | |||
| lt_tab_batch | TYPE STANDARD TABLE OF BDPIS_CHARG_TAB, " | |||
| lv_data_incomplete | TYPE BDPIS_CHARG_TAB, " | |||
| lv_im_reservation_item | TYPE BDPIS-RSPOS, " | |||
| lv_im_number_of_splits | TYPE I, " '1' | |||
| lv_im_phase | TYPE CLIKE, " | |||
| lv_determination_error | TYPE CLIKE, " | |||
| lv_ex_material_quantity | TYPE BDBATCH-ERFMG, " | |||
| lt_tab_material_quantity | TYPE STANDARD TABLE OF BDPIS_ERFMG_TAB, " | |||
| lv_batch_ok | TYPE BDPIS_ERFMG_TAB, " | |||
| lv_ex_unit_of_measure | TYPE BDBATCH-ERFME, " | |||
| lt_tab_unit_of_measure | TYPE STANDARD TABLE OF BDPIS_ERFME_TAB, " | |||
| lv_im_process_instruction | TYPE CLIKE, " | |||
| lv_im_material | TYPE BDPIS-MATNR, " | |||
| lv_ex_storage_location | TYPE BDBATCH-LGORT, " | |||
| lt_tab_storage_location | TYPE STANDARD TABLE OF BDPIS_LGORT_TAB, " | |||
| lv_im_batch | TYPE BDPIS-CHARG, " | |||
| lv_im_material_quantity | TYPE BDPIS-ERFMG, " | |||
| lv_im_unit_of_measure | TYPE BDPIS-ERFME, " | |||
| lv_im_storage_location | TYPE BDPIS-LGORT, " | |||
| lv_im_reservation | TYPE BDPIS-RSNUM. " |
|   CALL FUNCTION 'COPF_DETERMINE_BATCH' "NOTRANSL: Durchführung einer Chargenfindung oder Chargenprüfung |
| EXPORTING | ||
| IM_PLANT | = lv_im_plant | |
| IM_RESERVATION_ITEM | = lv_im_reservation_item | |
| IM_NUMBER_OF_SPLITS | = lv_im_number_of_splits | |
| IM_PHASE | = lv_im_phase | |
| IM_PROCESS_INSTRUCTION | = lv_im_process_instruction | |
| IM_MATERIAL | = lv_im_material | |
| IM_BATCH | = lv_im_batch | |
| IM_MATERIAL_QUANTITY | = lv_im_material_quantity | |
| IM_UNIT_OF_MEASURE | = lv_im_unit_of_measure | |
| IM_STORAGE_LOCATION | = lv_im_storage_location | |
| IM_RESERVATION | = lv_im_reservation | |
| IMPORTING | ||
| EX_BATCH | = lv_ex_batch | |
| EX_MATERIAL_QUANTITY | = lv_ex_material_quantity | |
| EX_UNIT_OF_MEASURE | = lv_ex_unit_of_measure | |
| EX_STORAGE_LOCATION | = lv_ex_storage_location | |
| TABLES | ||
| TAB_BATCH | = lt_tab_batch | |
| TAB_MATERIAL_QUANTITY | = lt_tab_material_quantity | |
| TAB_UNIT_OF_MEASURE | = lt_tab_unit_of_measure | |
| TAB_STORAGE_LOCATION | = lt_tab_storage_location | |
| EXCEPTIONS | ||
| DATA_INCOMPLETE = 1 | ||
| DETERMINATION_ERROR = 2 | ||
| BATCH_OK = 3 | ||
| . " COPF_DETERMINE_BATCH | ||
ABAP code using 7.40 inline data declarations to call FM COPF_DETERMINE_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 CHARG FROM BDBATCH INTO @DATA(ld_ex_batch). | ||||
| "SELECT single WERKS FROM BDPIS INTO @DATA(ld_im_plant). | ||||
| "SELECT single RSPOS FROM BDPIS INTO @DATA(ld_im_reservation_item). | ||||
| DATA(ld_im_number_of_splits) | = '1'. | |||
| "SELECT single ERFMG FROM BDBATCH INTO @DATA(ld_ex_material_quantity). | ||||
| "SELECT single ERFME FROM BDBATCH INTO @DATA(ld_ex_unit_of_measure). | ||||
| "SELECT single MATNR FROM BDPIS INTO @DATA(ld_im_material). | ||||
| "SELECT single LGORT FROM BDBATCH INTO @DATA(ld_ex_storage_location). | ||||
| "SELECT single CHARG FROM BDPIS INTO @DATA(ld_im_batch). | ||||
| "SELECT single ERFMG FROM BDPIS INTO @DATA(ld_im_material_quantity). | ||||
| "SELECT single ERFME FROM BDPIS INTO @DATA(ld_im_unit_of_measure). | ||||
| "SELECT single LGORT FROM BDPIS INTO @DATA(ld_im_storage_location). | ||||
| "SELECT single RSNUM FROM BDPIS INTO @DATA(ld_im_reservation). | ||||
Search for further information about these or an SAP related objects