print form (1)

top-of-page.
  perform. list_column_header(zcbx0001) using 1 2.
  uline.
at user-command.
  perform. user_command.

start-of-selection.
  perform. extract_document_data.
  perform. list_extracted_data.
end-of-selection.
*&---------------------------------------------------------------------*
*&      Form  list_column_header
*&---------------------------------------------------------------------*
form. list_column_header using value(fromline) value(toline).
  data: textpool like textpool occurs 0 with header line,
        textline type i.
  read textpool sy-cprog into textpool language sy-langu.
  format color col_heading intensified on.
  loop at textpool where id eq 'H'.
    add 1 to textline.
    if textline between fromline and toline.
      write: textpool-entry.
    endif.
  endloop.
  format color off.
endform.                    " list_column_header
*&---------------------------------------------------------------------*
*&      Form  extract_document_data
*&---------------------------------------------------------------------*
form. extract_document_data.
  select * into table zmm010tab from zmm010
   where  zmm010~docnumber   in s_docnum
     and  zmm010~doctype     in s_dtype
     and  zmm010~badat       in s_badat
     and  zmm010~employid    in s_empid
     and  zmm010~aufnr       in s_aufnr
     and  zmm010~kostl       in s_kostl
     and  zmm010~commenttext in s_commt
     and  zmm010~docyear = sdocyear  .
  sort zmm010tab by docnumber .
endform.                    " extract_document_data
*&---------------------------------------------------------------------*
*&      Form  list_extracted_data
*&---------------------------------------------------------------------*
form. list_extracted_data.
  data: l_docnum like zmt013-docnumber,
        doctypetext like dd07t-ddtext,
        remainder type i,
        color type i.
  loop at zmm010tab.
    at first.
      set pf-status '1000'.
    endat.
    listindex = sy-tabix.
    remainder = sy-tabix mod 2.
    if remainder eq 1.
      format color col_normal intensified off.
    endif.
    select zmt013~docnumber into l_docnum from zmt013
     where zmt013~docnumber = zmm010tab-docnumber
       and zmt013~markdeletion <> 'X'.
      exit.
    endselect.
    check sy-subrc eq 0.
    perform. get_dommain_value_text(zcbx0001) using 'ZDOCTYPE'
                                                   zmm010tab-doctype
                                                   doctypetext.
    select adrnr into lfa1-adrnr from lfa1
                                 where lifnr eq zmm010tab-employid.
      exit.
    endselect.
    select name1 into adrc-name1 from adrc
                                 where addrnumber eq lfa1-adrnr.
      exit.
    endselect.
    if sy-subrc ne 0.
      clear adrc-name1.
    endif.
    write:/ zmm010tab-selid as checkbox,
            (12) zmm010tab-docnumber,
            (12) doctypetext,
            (12) zmm010tab-badat,
                 zmm010tab-employid,
            (08) adrc-name1,
                 zmm010tab-aufnr,
            (11) zmm010tab-kostl,
                 zmm010tab-commenttext.
    format color off.
    hide listindex.
    uline.
    listline = sy-linno.   "List screen, current line
  endloop.
endform.                  
*&---------------------------------------------------------------------*
*&      Form  user_command
*&---------------------------------------------------------------------*
form. user_command.
  case sy-ucomm.
    when 'OUTPUT' .
      perform. list_document .
  endcase.
endform.                  
*&---------------------------------------------------------------------*
*&      Form  list_document
*&---------------------------------------------------------------------*
form. list_document .
  do listline times.
    zmm010tab-selid = space.
    listindex = 0.
    read line sy-index field value zmm010tab-selid.
    check sy-subrc eq 0 and listindex gt 0.
    modify zmm010tab index listindex transporting selid.
  enddo.
  read table zmm010tab with key selid  = 'X'.
  if sy-subrc ne 0.
    message i000 with 'Please first choose collective no'.
    exit.
  endif.
  perform. write_document .
endform.                    " list_purchase_order
 
*&---------------------------------------------------------------------*
*&      Form  write_document
*&---------------------------------------------------------------------*
form. write_document .
  data:l_program like rs38m-programm,
         abaplist like abaplist occurs 0,
         ascilist(120) occurs 0 with header line,
         linesize type i,
         linecount type i,
         layout like pri_params-paart,
         dest like pri_params-pdest.
  loop at zmm010tab where selid eq 'X'.
    case zmm010tab-doctype .
      when '1'.
        if p_a4 = 'X' .
          l_program = 'ZLRM0021A'.
          linesize = 132.
          linecount = 51.
          layout = 'ZX_51_132_L'.
        endif.
    endcase.
      submit (l_program)
         with s_docnum eq zmm010tab-docnumber
         with sdocyear eq zmm010tab-docyear
         exporting list to memory
         and return.
    call function 'LIST_FROM_MEMORY'    "Prepared list import from m
         tables
              listobject = abaplist
         exceptions
              not_found  = 1
              others     = 2.
    call function 'LIST_TO_ASCI'
         exporting
              list_index         = -1
              with_line_break    = ' '
         tables
              listasci           = ascilist
              listobject         = abaplist
         exceptions
              empty_list         = 1
              list_index_invalid = 2
              others             = 3.
    new-page line-count linecount line-size linesize.
    dest = 'LOCL'.
    call function 'SET_PRINT_PARAMETERS'
         exporting
              layout      = layout
              destination = dest.
    call function 'WRITE_LIST'
         exporting
              write_only = 'X'
         tables
              listobject = abaplist
         exceptions
              empty_list = 1
              others     = 2.
  endloop.
  zmm010tab-selid = space.
  modify zmm010tab transporting selid where selid eq 'X'.
endform.                  

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15117617/viewspace-661617/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/15117617/viewspace-661617/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值