Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

FM RSPO_RETURN_SPOOLJOB_DAT no access error

siongchao_ng
Contributor
0 Kudos

I am having FM RSPO_RETURN_SPOOLJOB_DAT no access error.

This is my abap list spool

I enter the 24517 spool number and path but the FM RSPO_RETURN_SPOOLJOB_DAT keep return no access error.

Anyone have any idea?

FUNCTION znsc_spool_to_excel.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(SPOOL_NUMBER) TYPE  RSPOID
*"     REFERENCE(APP_SERV_PATH) TYPE  TEXT1024 OPTIONAL
*"     REFERENCE(LOCAL_SERV_PATH) TYPE  STRING OPTIONAL
*"----------------------------------------------------------------------
  TYPES : tt_bapixmspop TYPE STANDARD TABLE OF bapixmspop.
  DATA : lt_spool_attr_line  TYPE bapixmspoolid,
         lt_spool_list_plain TYPE tt_bapixmspop,
         lv_spool_list       TYPE  list_string_table,
         lv_first_page       TYPE i,
         lv_last_page        TYPE i.

  CALL FUNCTION 'RSPO_GET_INFORMATION_SPOOLJOB'
    EXPORTING
      rqident          = spool_number
    IMPORTING
      spool_attributes = lt_spool_attr_line
    EXCEPTIONS
      no_such_job      = 1
      read_error       = 2
      no_permission    = 3
      OTHERS           = 4.
  IF sy-subrc <> 0.                 ##FM_SUBRC_OK
  ENDIF.

  CALL FUNCTION 'RSPO_RETURN_SPOOLJOB_DAT'
    EXPORTING
      rqident              = spool_number
      first_line           = lv_first_page
      last_line            = lv_last_page
      pages                = 'X'
    IMPORTING
      buffer_dat           = lv_spool_list
    EXCEPTIONS
      no_such_job          = 1
      not_abap_list        = 2
      job_contains_no_data = 3
      selection_empty      = 4
      no_permission        = 5
      can_not_access       = 6
      read_error           = 6
      OTHERS               = 7.
  IF sy-subrc <> 0.                 ##FM_SUBRC_OK
  ENDIF.

  IF NOT lv_spool_list IS INITIAL.
    IF app_serv_path IS NOT INITIAL.
      FIELD-SYMBOLS <hex_container> TYPE any.
      OPEN DATASET app_serv_path FOR OUTPUT IN TEXT MODE ENCODING DEFAULT WITH SMART LINEFEED.
      IF sy-subrc = 0.
        LOOP AT lv_spool_list ASSIGNING <hex_container> .
          TRANSFER <hex_container> TO app_serv_path.
          CLEAR <hex_container>.
        ENDLOOP.
        CLOSE DATASET app_serv_path.
        MESSAGE 'File succesfully transferred' TYPE 'S' .
      ELSE.
        MESSAGE 'File cannot be opened' TYPE 'E' .
      ENDIF.
    ELSEIF local_serv_path IS NOT INITIAL.
* *      Download in presentation server
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = local_serv_path
          append                  = 'X'
        TABLES
          data_tab                = lv_spool_list
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          OTHERS                  = 22.
      IF sy-subrc = 0.
        MESSAGE 'File succesfully transferred' TYPE 'S' .
      ENDIF.
    ELSE.
      MESSAGE 'Please specify either Application/presentation server path' TYPE 'E' .
    ENDIF.
  ENDIF.
3 REPLIES 3

Sandra_Rossi
Active Contributor
0 Kudos

This function module is only referenced by this blog post Download Spool to Application and Presentation server in Text, HTML and Excel formats | SAP Blogs, so I recommend to contact the author.

siongchao_ng
Contributor
0 Kudos

satyajit.das4

Hi there. Are you the owner of the blog post Download Spool to Application and Presentation server in Text, HTML and Excel formats | SAP Blogs,?

How come your fm spool to excel not working?

Sandra_Rossi
Active Contributor
0 Kudos

siongchao.ng He's not the author of the function module, he's just the only other one who used this FM in the Web, so maybe he knows how it works.