SAP /AIN/TMPL_GET_NRRANGE Function Module for Get Next GTIN Serial Number
/AIN/TMPL_GET_NRRANGE is a standard /ain/tmpl get nrrange SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Get Next GTIN Serial Number 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 /ain/tmpl get nrrange FM, simply by entering the name /AIN/TMPL_GET_NRRANGE into the relevant SAP transaction such as SE37 or SE38.
Function Group: /AIN/NRRANGE_GEN
Program Name: /AIN/SAPLNRRANGE_GEN
Main Program: /AIN/SAPLNRRANGE_GEN
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function /AIN/TMPL_GET_NRRANGE 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 '/AIN/TMPL_GET_NRRANGE'"Get Next GTIN Serial Number.
EXPORTING
IV_EPC_TYPE = "EPC Type
* IV_SIZE = 1 "Size of number range requested
IT_COMP = "Compornent of Elements
* IV_DEVGRP_GUID = "Device Group GUID
* IV_DOC_GUID = "Document GUID
IMPORTING
EV_NUMBER_FROM = "Current Number
EV_NUMBER_TO = "Current Number
EV_SIZE = "Size of number range requested
ET_RET_MSG = "Table with BAPI Return Information
EXCEPTIONS
NO_NUMBER_RANGE_AVAILABLE = 1 NUMBER_RANGE_LOCKED = 2
IMPORTING Parameters details for /AIN/TMPL_GET_NRRANGE
IV_EPC_TYPE - EPC Type
Data type: /AIN/EPC_TYPEOptional: No
Call by Reference: Yes
IV_SIZE - Size of number range requested
Data type: /AIN/EPC_NR_SIZEDefault: 1
Optional: No
Call by Reference: Yes
IT_COMP - Compornent of Elements
Data type: /AIN/ID_COMP_TABOptional: No
Call by Reference: Yes
IV_DEVGRP_GUID - Device Group GUID
Data type: /AIN/DM_DEVGRP_GUIDOptional: Yes
Call by Reference: Yes
IV_DOC_GUID - Document GUID
Data type: /AIN/DM_DOC_GUIDOptional: Yes
Call by Reference: Yes
EXPORTING Parameters details for /AIN/TMPL_GET_NRRANGE
EV_NUMBER_FROM - Current Number
Data type: /AIN/ID_AN_SERIAL_NOOptional: No
Call by Reference: Yes
EV_NUMBER_TO - Current Number
Data type: /AIN/ID_AN_SERIAL_NOOptional: No
Call by Reference: Yes
EV_SIZE - Size of number range requested
Data type: /AIN/EPC_NR_SIZEOptional: No
Call by Reference: Yes
ET_RET_MSG - Table with BAPI Return Information
Data type: BAPIRETTABOptional: No
Call by Reference: Yes
EXCEPTIONS details
NO_NUMBER_RANGE_AVAILABLE - No Number Range Available
Data type:Optional: No
Call by Reference: Yes
NUMBER_RANGE_LOCKED - Number Range Table is locked
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for /AIN/TMPL_GET_NRRANGE 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_iv_epc_type | TYPE /AIN/EPC_TYPE, " | |||
| lv_ev_number_from | TYPE /AIN/ID_AN_SERIAL_NO, " | |||
| lv_no_number_range_available | TYPE /AIN/ID_AN_SERIAL_NO, " | |||
| lv_iv_size | TYPE /AIN/EPC_NR_SIZE, " 1 | |||
| lv_ev_number_to | TYPE /AIN/ID_AN_SERIAL_NO, " | |||
| lv_number_range_locked | TYPE /AIN/ID_AN_SERIAL_NO, " | |||
| lv_ev_size | TYPE /AIN/EPC_NR_SIZE, " | |||
| lv_it_comp | TYPE /AIN/ID_COMP_TAB, " | |||
| lv_et_ret_msg | TYPE BAPIRETTAB, " | |||
| lv_iv_devgrp_guid | TYPE /AIN/DM_DEVGRP_GUID, " | |||
| lv_iv_doc_guid | TYPE /AIN/DM_DOC_GUID. " |
|   CALL FUNCTION '/AIN/TMPL_GET_NRRANGE' "Get Next GTIN Serial Number |
| EXPORTING | ||
| IV_EPC_TYPE | = lv_iv_epc_type | |
| IV_SIZE | = lv_iv_size | |
| IT_COMP | = lv_it_comp | |
| IV_DEVGRP_GUID | = lv_iv_devgrp_guid | |
| IV_DOC_GUID | = lv_iv_doc_guid | |
| IMPORTING | ||
| EV_NUMBER_FROM | = lv_ev_number_from | |
| EV_NUMBER_TO | = lv_ev_number_to | |
| EV_SIZE | = lv_ev_size | |
| ET_RET_MSG | = lv_et_ret_msg | |
| EXCEPTIONS | ||
| NO_NUMBER_RANGE_AVAILABLE = 1 | ||
| NUMBER_RANGE_LOCKED = 2 | ||
| . " /AIN/TMPL_GET_NRRANGE | ||
ABAP code using 7.40 inline data declarations to call FM /AIN/TMPL_GET_NRRANGE
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.| DATA(ld_iv_size) | = 1. | |||
Search for further information about these or an SAP related objects