SAP QUEUE_GET Function Module for Read data element from queue
QUEUE_GET is a standard queue get SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Read data element from queue 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 queue get FM, simply by entering the name QUEUE_GET into the relevant SAP transaction such as SE37 or SE38.
Function Group: SQUE
Program Name: SAPLSQUE
Main Program: SAPLSQUE
Appliation area: S
Release date: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function QUEUE_GET 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 'QUEUE_GET'"Read data element from queue.
EXPORTING
NAME = "Queue Identifier
* OPENMODE = ' ' "
* POS = 0 "Item in the Unit
* UNIT = 0 "Number of Unit
IMPORTING
BUFFER = "Buffer for data element
LENGTH = "Length of data element
POS = "Item in the Unit
SQLRC = "SQL Error Code
STATE = "Indicator for start/end of unit
UNIT = "Number of Unit
EXCEPTIONS
BUFFER_ERROR = 1 EOQ = 2 INVALID_PARAMETER = 3 MEMORY_ERROR = 4 Q_ERROR = 5 SQL_ERROR = 6
IMPORTING Parameters details for QUEUE_GET
NAME - Queue Identifier
Data type: APQD-QIDOptional: No
Call by Reference: No ( called with pass by value option)
OPENMODE -
Data type: APQI-QSTATEDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
POS - Item in the Unit
Data type: APQD-BLOCKOptional: Yes
Call by Reference: No ( called with pass by value option)
UNIT - Number of Unit
Data type: APQD-TRANSOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for QUEUE_GET
BUFFER - Buffer for data element
Data type: APQD-VARDATAOptional: No
Call by Reference: No ( called with pass by value option)
LENGTH - Length of data element
Data type: APQD-TRANSOptional: No
Call by Reference: No ( called with pass by value option)
POS - Item in the Unit
Data type: APQD-BLOCKOptional: No
Call by Reference: No ( called with pass by value option)
SQLRC - SQL Error Code
Data type: SY-SUBRCOptional: No
Call by Reference: No ( called with pass by value option)
STATE - Indicator for start/end of unit
Data type: APQI-QSTATEOptional: No
Call by Reference: No ( called with pass by value option)
UNIT - Number of Unit
Data type: APQD-TRANSOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
BUFFER_ERROR - Buffer is not defined or too small
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
EOQ - End of queue reached
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INVALID_PARAMETER - missing or invalid parameter
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
MEMORY_ERROR - internal error
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Q_ERROR - internal error
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
SQL_ERROR - internal error
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for QUEUE_GET 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_name | TYPE APQD-QID, " | |||
| lv_buffer | TYPE APQD-VARDATA, " | |||
| lv_buffer_error | TYPE APQD, " | |||
| lv_eoq | TYPE APQD, " | |||
| lv_length | TYPE APQD-TRANS, " | |||
| lv_openmode | TYPE APQI-QSTATE, " SPACE | |||
| lv_pos | TYPE APQD-BLOCK, " | |||
| lv_pos | TYPE APQD-BLOCK, " 0 | |||
| lv_invalid_parameter | TYPE APQD, " | |||
| lv_unit | TYPE APQD-TRANS, " 0 | |||
| lv_sqlrc | TYPE SY-SUBRC, " | |||
| lv_memory_error | TYPE SY, " | |||
| lv_state | TYPE APQI-QSTATE, " | |||
| lv_q_error | TYPE APQI, " | |||
| lv_unit | TYPE APQD-TRANS, " | |||
| lv_sql_error | TYPE APQD. " |
|   CALL FUNCTION 'QUEUE_GET' "Read data element from queue |
| EXPORTING | ||
| NAME | = lv_name | |
| OPENMODE | = lv_openmode | |
| POS | = lv_pos | |
| UNIT | = lv_unit | |
| IMPORTING | ||
| BUFFER | = lv_buffer | |
| LENGTH | = lv_length | |
| POS | = lv_pos | |
| SQLRC | = lv_sqlrc | |
| STATE | = lv_state | |
| UNIT | = lv_unit | |
| EXCEPTIONS | ||
| BUFFER_ERROR = 1 | ||
| EOQ = 2 | ||
| INVALID_PARAMETER = 3 | ||
| MEMORY_ERROR = 4 | ||
| Q_ERROR = 5 | ||
| SQL_ERROR = 6 | ||
| . " QUEUE_GET | ||
ABAP code using 7.40 inline data declarations to call FM QUEUE_GET
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 QID FROM APQD INTO @DATA(ld_name). | ||||
| "SELECT single VARDATA FROM APQD INTO @DATA(ld_buffer). | ||||
| "SELECT single TRANS FROM APQD INTO @DATA(ld_length). | ||||
| "SELECT single QSTATE FROM APQI INTO @DATA(ld_openmode). | ||||
| DATA(ld_openmode) | = ' '. | |||
| "SELECT single BLOCK FROM APQD INTO @DATA(ld_pos). | ||||
| "SELECT single BLOCK FROM APQD INTO @DATA(ld_pos). | ||||
| "SELECT single TRANS FROM APQD INTO @DATA(ld_unit). | ||||
| "SELECT single SUBRC FROM SY INTO @DATA(ld_sqlrc). | ||||
| "SELECT single QSTATE FROM APQI INTO @DATA(ld_state). | ||||
| "SELECT single TRANS FROM APQD INTO @DATA(ld_unit). | ||||
Search for further information about these or an SAP related objects