Programmausgabe in Spool schreiben für weitere Verarbeitung im anderen Programm

Aus SAP Wiki ツ
  • DATA: print_parameters TYPE pri_params,
  • gt_data TYPE TABLE OF rspo_ds,
  • gt_data_flag TYPE TABLE OF rspo_ds,
  • ls_data_flag TYPE rspo_ds,
  • gt_output TYPE TABLE OF rspo_index,
  • gs_spool TYPE tsp01sys,
  • ls_valid TYPE char01, "#EC NEEDED
  • ls_valid_for_spool_creation TYPE char01. "#EC NEEDED
  • CONSTANTS lc_spool_name TYPE sypri_plist VALUE 'ZMON_222'.
  • " CONSTANTS lc_spool_name TYPE sypri_plist VALUE 'ZMON_ARCHPRU'.
  • "Set Spool para. like spoolname
  • CALL FUNCTION 'GET_PRINT_PARAMETERS'
  • EXPORTING
  • destination = 'LP01'
  • list_name = lc_spool_name
  • no_dialog = 'X'
  • IMPORTING
  • out_parameters = print_parameters
  • valid = ls_valid
  • valid_for_spool_creation = ls_valid_for_spool_creation
  • EXCEPTIONS
  • archive_info_not_found = 1
  • invalid_print_params = 2
  • invalid_archive_params = 3
  • OTHERS = 4.
  • SUBMIT oadestck TO SAP-SPOOL
  • SPOOL PARAMETERS print_parameters
  • WITHOUT SPOOL DYNPRO
  • AND RETURN.
  • SELECT * INTO @DATA(ls_tsp01) FROM tsp01 WHERE rq2name = @lc_spool_name ORDER BY rqcretime DESCENDING.
  • ENDSELECT.
  • "Get spoolnumber
  • CALL FUNCTION 'RSPO_ISELECT_TSP01'
  • EXPORTING
  • rfcsystem = sy-sysid
  • rqident = ls_tsp01-rqident
  • IMPORTING
  • tsp01_elem = gs_spool
  • EXCEPTIONS
  • error = 1
  • OTHERS = 2.
  • "Get Spool Content
  • CALL FUNCTION 'RSPO_IRETURN_RAW_DATA'
  • EXPORTING
  • rq = gs_spool
  • TABLES
  • line_buffer = gt_data
  • page_index = gt_output
  • EXCEPTIONS
  • error = 1
  • OTHERS = 2.
  • "Check spool content for errors
  • IF gt_data IS NOT INITIAL.
  • LOOP AT gt_data INTO DATA(ls_data).
  • IF 'FEHLER' CO ls_data-data_line OR 'ERROR' CO ls_data-data_line.
  • MOVE-CORRESPONDING ls_data TO ls_data_flag.
  • ls_data_flag-data_line = ls_data_flag-data_line+18.
  • APPEND ls_data_flag TO gt_data_flag.
  • ENDIF.
  • ENDLOOP.
  • ENDIF.