ITPub博客

首页 > Linux操作系统 > Linux操作系统 > print form (2)

print form (2)

原创 Linux操作系统 作者:ytfsrs2008 时间:2010-04-29 16:11:53 0 删除 编辑
report  zlrm0031  no standard page heading
line-size 100 line-count 38(20).
tables:zmm010,zmt013,makt,mara,lfa1,cskt,t001k,tka02.
selection-screen: begin of block b1 with frame. title text-001.
parameter:sdocyear type zmm010-docyear obligatory
       default sy-datum+0(4).
select-options:  s_docnum for zmm010-docnumber,
                 doctype for zmm010-doctype no intervals obligatory
                         no-extension modif id m26 default 'P' ,
                 matnr for zmt013-matnr,
                 matkl for mara-matkl,
                 employid for zmm010-employid .
select-options:  aufnr for zmm010-aufnr,
                 kostl for zmm010-kostl,
                 comment for zmm010-commenttext.
selection-screen: end of block b1.
data:begin of itab  occurs 10 ,
     docnumber like zmm010-docnumber,
     badat like zmm010-badat,
     kostl like zmm010-kostl,
     commenttext like zmm010-commenttext,
     employid like zmm010-employid,
     end of itab.
data: begin of itab_a occurs 0 .
        include structure itab.
data:   selflag(1),
        docitem like  zmt013-docitem,
        matnr  like zmt013-matnr,
        werks like zmt013-werks,
        lgort like zmt013-lgort,
        charg like zmt013-charg,
        erfme like zmt013-erfme,
        erfmg like zmt013-erfmg,
     end of itab_a.
data:   v_page type i.
data: begin of g_plant occurs 0,
      werks like marc-werks,
      docnumber like zmt013-docnumber,
      end of g_plant.
 
top-of-page.
  select docnumber werks
    into corresponding fields of table g_plant
    from zmt013
    where docnumber in s_docnum.
  perform. list_report_header using sy-title.
start-of-selection.
  perform. process.
form. process.
  select  zmm010~docnumber zmm010~badat zmm010~kostl
  zmm010~commenttext zmm010~employid
  from  zmm010
  into corresponding fields of table itab
  where docnumber in s_docnum
    and employid in employid
    and zmm010~docyear = sdocyear.
  sort itab by docnumber.
  perform. set_print_parameters.
  loop at itab .
    at new docnumber.
      read table itab index 1.
      v_page = 1.
      new-page.
    endat.
    read table g_plant with key docnumber = itab-docnumber.
    select single * from t001k
      where bwkey = g_plant-werks.
    select single * from tka02
      where bukrs = t001k-bukrs.
    select single * from cskt
      where kokrs = tka02-kokrs
        and kostl = itab-kostl
        and spras = 'E'.
    write:/1 itab-docnumber, 15 itab-kostl, 26 cskt-ltext.
    uline.
    skip 1.
    uline.
    select  zmt013~docitem zmt013~matnr
            zmt013~werks zmt013~lgort zmt013~charg zmt013~erfme
            zmt013~erfmg
    from zmt013
    inner join mara   on mara~matnr = zmt013~matnr
    into corresponding fields of table itab_a
    where zmt013~docnumber = itab-docnumber
    and  mara~matnr in  matnr
    and matkl in matkl
    and zmt013~markdeletion <> 'X'.
    loop at itab_a.
      clear makt.
      select single  maktx
        from makt
        into corresponding fields of makt
        where matnr = itab_a-matnr.
      write : /(5) itab_a-docitem ,
              (18) itab_a-matnr ,
               (6) itab_a-charg,
               (16) itab_a-werks,
               (16) itab_a-lgort,
               (16) itab_a-erfme ,
               (16) itab_a-erfmg left-justified .
      write:/7(40) makt-maktx.
    endloop.
    at end of  docnumber.
      if sy-linno < 55 .
        skip 55.
      endif.
    endat.
  endloop.
endform.                 
form. set_print_parameters.
  call function 'SET_PRINT_PARAMETERS'
       exporting
            layout = 'ZX_28_100_L'.
endform.
form. list_report_header using title.
  data: name(45) value '鴻 海 精 密 工 業 ( 深 圳 ) 有 限 公 司',
        reportname(20),
        companyposition type i,
        dateposition type i,
        titleposition type i,
        pageposition type i,
        titleleng type i,
        len type i.
  companyposition = ( sy-linsz - strlen( name ) ) / 2.
  dateposition = sy-linsz - 15.
  pageposition = sy-linsz - 15.
  len = dateposition + 5.
  titleposition = ( sy-linsz - strlen( title ) ) / 2.
  titleleng = strlen( title ).
  write at /companyposition name.
  write at /dateposition 'FROM:'.
  write at len employid.
  write:/1 ''.
  write:/1 ''.
  write:/1 sy-datum, 11 sy-uzeit,
        at titleposition(titleleng) title,
        at pageposition 'PAGE:',sy-pagno left-justified.
  uline.
endform.

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

上一篇: print form (1)
下一篇: BAPI_GOODSMVT_CREATE
请登录后发表评论 登录
全部评论

注册时间:2008-10-31

  • 博文量
    52
  • 访问量
    50912