Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7184898
  • 博文数量: 655
  • 博客积分: 10264
  • 博客等级: 上将
  • 技术积分: 8278
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-04 17:47
个人简介

ABAP顾问

文章分类

全部博文(655)

文章存档

2017年(2)

2014年(8)

2013年(3)

2012年(2)

2011年(18)

2010年(102)

2009年(137)

2008年(274)

2007年(134)

分类:

2008-08-25 15:09:39

REPORT  z_barry_test NO STANDARD PAGE HEADING MESSAGE-ID so LINE-SIZE 255  .
 
DATA: objcont TYPE soli OCCURS 0 WITH HEADER LINE.
DATA: owner LIKE soud-usrnam,
      rcode(4) .
 
START-OF-SELECTION.
  owner = sy-uname.
  PERFORM read_spool  TABLES objcont
                      USING  owner
                             rcode.
  LOOP AT objcont.
    WRITE objcont-line.
  ENDLOOP.

*&---------------------------------------------------------------------*
*&      Form  read_spool
*&---------------------------------------------------------------------*
FORM read_spool TABLES objcont STRUCTURE soli
                USING  owner rcode.
  DATA h_objcont     LIKE tline OCCURS 0 WITH HEADER LINE.
  DATA spool_number  LIKE rspotype-rqnumber.
  DATA desired_type  LIKE sood-objtp.
  DATA real_type     LIKE sood-objtp.
  DATA f_stop_loop   LIKE sonv-flag.
  DATA is_otf.
  CLEAR: f_stop_loop.
  WHILE f_stop_loop EQ ' '.
    CALL FUNCTION 'SO_WIND_SPOOL_LIST'
      EXPORTING
        owner        = owner
      IMPORTING
        spool_number = spool_number.
    IF spool_number IS INITIAL.
      MOVE '9000' TO rcode.
      MOVE 'X' TO f_stop_loop.
      EXIT.
    ENDIF.
    CALL FUNCTION 'RSPO_GET_TYPE_SPOOLJOB'
      EXPORTING
        rqident        = spool_number
      IMPORTING
        is_otf         = is_otf
      EXCEPTIONS
        can_not_access = 1.
    IF NOT is_otf IS INITIAL.
      MOVE 'OTF' TO desired_type.
    ELSE.
      MOVE 'RAW' TO desired_type.
    ENDIF.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
      EXPORTING
        rqident              = spool_number
        desired_type         = desired_type
      IMPORTING
        real_type            = real_type
      TABLES
        buffer               = objcont
      EXCEPTIONS
        no_such_job          = 1
        type_no_match        = 2
        job_contains_no_data = 3
        no_permission        = 4
        can_not_access       = 4
        read_error           = 5.
    CASE sy-subrc.
      WHEN '00'.
        MOVE '00' TO rcode.
        MOVE 'X' TO f_stop_loop.
        IF real_type EQ 'OTF'.
          CALL FUNCTION 'CONVERT_OTF'
            TABLES
              otf    = objcont
              lines  = h_objcont
            EXCEPTIONS
              OTHERS = 1.
          IF sy-subrc EQ '00'.
            CLEAR objcont.
            REFRESH objcont.
            LOOP AT h_objcont.
              APPEND h_objcont-tdline TO objcont.
            ENDLOOP.
          ENDIF.
        ENDIF.
      WHEN 1.
        MESSAGE i753 WITH spool_number.
      WHEN 2.
        MESSAGE i100.
      WHEN 4.
        MESSAGE i015.
        MOVE '9000' TO rcode.
        MOVE 'X'  TO f_stop_loop.
      WHEN 5.
        MESSAGE i752 WITH spool_number.
        MOVE '9000' TO rcode.
        MOVE 'X'  TO f_stop_loop.
    ENDCASE.
  ENDWHILE.
ENDFORM.                    "READ_SPOOL
 
更多关于Spool的函数见函数组:SPOX
阅读(4096) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~