Skip to Content
0
May 20, 2010 at 10:01 AM

Printing directly to spool, how to set deletion date?

406 Views

Hi all,

I am printing data directly to the spool using the code below, and everything works fine, except that I cannot control the deletion date. I want my spool entry to stay in the system for one week and then it should be deleted automatically, using the date in field RQDELDATE ("Deleted on") in the spool entry.

I have tried different values for the parameter LIFETIME, but it makes no difference. My delete date is always set to "2100-01-01"...

Any ideas?

DATA: 
      l_spool_handle TYPE sy-tabix,
      l_name TYPE tsp01-rq0name,
      l_spool_id TYPE rspoid.

l_name = 'Test'.

CALL FUNCTION 'RSPO_SR_OPEN'
  EXPORTING
    dest                   = 'LSW1'
*   LDEST                  =
*   LAYOUT                 =
    NAME                   = l_name
*   SUFFIX1                =
*   SUFFIX2                =
*   COPIES                 =
    PRIO                   = '5'
    immediate_print        = ''
*   AUTO_DELETE            = 
    TITLELINE              = 'Test print'
    RECEIVER               = sy-uname
*   DIVISION               =
*   AUTHORITY              =
*   POSNAME                =
*   ACTTIME                =
    LIFETIME               = '0'
*   APPEND                 =
*   COVERPAGE              =
*   CODEPAGE               =
    doctype                = 'BIN'
*   ARCHMODE               =
*   ARCHPARAMS             =
*   TELELAND               =
*   TELENUM                =
*   TELENUME               =
*   SPONUMIV               = ' '
*   USESPOOLID             =
*   PRINTOPTIONS           =
  IMPORTING
    handle                 = l_spool_handle
    spoolid                = l_spool_id
* TABLES
*   ATTRIBUTES             =
  EXCEPTIONS
    device_missing         = 1
    name_twice             = 2
    no_such_device         = 3
    operation_failed       = 4
    OTHERS                 = 5.

IF sy-subrc <> 0.
  WRITE: 'Error.', sy-subrc.
ENDIF.

CALL FUNCTION 'RSPO_SR_WRITE'
  EXPORTING
    handle = l_spool_handle
    text   = 'ABC123'
    length = 6.

CALL FUNCTION 'RSPO_SR_CLOSE'
  EXPORTING
    handle = l_spool_handle.