When end users
do not have authorization for SP01 to print and/or do print previews from a
spool file, Function Module 'RSPO_RID_SPOOLREQ_DISP' can be used to do it.
Please see the code below for implementation details of the above mentioned Function Module.
************************************************************************
* Printing spool file without SP01 *
************************************************************************
* Data Declarations
************************************************************************
TABLES:
tsp01.
************************************************************************
*Types
************************************************************************
TYPES: BEGIN OF t_sp01r_id,
id TYPE tsp01-rqident. "Spool ID
INCLUDE TYPE alsysid. "Name of the SAP System
TYPES: END OF t_sp01r_id.
************************************************************************
* internal tables
************************************************************************
DATA : i_id_list TYPE STANDARD TABLE OF t_sp01r_id.
************************************************************************
* Constants
************************************************************************
CONSTANTS : c_s TYPE c LENGTH 1 VALUE 'S',
c_e TYPE c LENGTH 1 VALUE 'E',
c_adsp TYPE c LENGTH 4 VALUE 'ADSP'.
* Printing spool file without SP01 *
************************************************************************
* Data Declarations
************************************************************************
TABLES:
tsp01.
************************************************************************
*Types
************************************************************************
TYPES: BEGIN OF t_sp01r_id,
id TYPE tsp01-rqident. "Spool ID
INCLUDE TYPE alsysid. "Name of the SAP System
TYPES: END OF t_sp01r_id.
************************************************************************
* internal tables
************************************************************************
DATA : i_id_list TYPE STANDARD TABLE OF t_sp01r_id.
************************************************************************
* Constants
************************************************************************
CONSTANTS : c_s TYPE c LENGTH 1 VALUE 'S',
c_e TYPE c LENGTH 1 VALUE 'E',
c_adsp TYPE c LENGTH 4 VALUE 'ADSP'.
************************************************************************
* Parameters and Selection Options
************************************************************************
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-b01.
SELECT-OPTIONS:
s_spool FOR tsp01-rqident NO-EXTENSION NO INTERVALS. "Spool Number
SELECTION-SCREEN END OF BLOCK b1.
************************************************************************
* Initialization
************************************************************************
INITIALIZATION.
* Parameters and Selection Options
************************************************************************
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-b01.
SELECT-OPTIONS:
s_spool FOR tsp01-rqident NO-EXTENSION NO INTERVALS. "Spool Number
SELECTION-SCREEN END OF BLOCK b1.
************************************************************************
* Initialization
************************************************************************
INITIALIZATION.
START-OF-SELECTION.
PERFORM fetching_spool_file.
************************************************************************
** forms
***********************************************************************
*&---------------------------------------------------------------------*
*& Form FETCHING_SPOOL_FILE
*&---------------------------------------------------------------------*
* Fetching data from spool and print it
*----------------------------------------------------------------------*
FORM fetching_spool_file .
SELECT rqident
FROM tsp01
INTO TABLE i_id_list
WHERE rqident IN s_spool
AND rqdoctype EQ c_adsp.
CALL FUNCTION 'RSPO_RID_SPOOLREQ_DISP'
EXPORTING
id_list = i_id_list
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE c_s NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 DISPLAY LIKE c_e.
ENDIF.
ENDFORM. " FETCHING_SPOOL_FILE
![]() |
Run the program |
![]() |
Run SP01 |
![]() |
Click the Type column |
![]() |
Output of SP01 |