first report

原创 2004年09月29日 17:14:00

*&---------------------------------------------------------------------*
*& Report  ZSDRP_ORD_LIST_PF1
*
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  ZSDRP_ORD_LIST_PF1
        no standard page heading
        line-size 255 line-count 65(2).

***********************************************************************
* Title           : ZSDRP_ORD_LIST_PF                                 *
* Application     : SD                                                *
* Subject         : PR Report                                         *
* Author          : PF 2004/09/29                                     *
***********************************************************************
* 为了销售订单管理的目的,需要跟踪销售订单的净单价,同时也需  *
* 要跟踪销售订单的毛单价。                                            *
*
***********************************************************************
* MODIFICATIONS (latest entry at the top)                             *
* -------------                                                       *
* REL  DATE    NAME (COMPANY)     DESCRIPTION               TASK-NO   *
* ---  ----    ---- ---------     -----------               -------   *
***********************************************************************


tables: VBAK,    "销售凭证 : 抬头数据
        KNA1,    "客户主文件的一般数据
        VBAP.    "销售凭证:项目数据

*内部表定义
data: begin of it_vbak occurs 0,
        VBELN    like VBAK-VBELN,  "销售凭证号
        KUNNR    like VBAK-KUNNR,  "售达方(客户代码)
        AUDAT    like VBAK-AUDAT,  "定单日期
      end of it_vbak.

data: begin of it_kna1 occurs 0,
        KUNNR    like KNA1-KUNNR,  "客户编号
        NAME1    like KNA1-NAME1,  "名称
      end of it_kna1.

data: begin of it_vbap occurs 0,
        VBELN    like  VBAP-VBELN,   "销售凭证号
        POSNR    like  VBAP-POSNR,   "销售凭证项目
        MATNR    like  VBAP-MATNR,   "物料号
        KWMENG   like  VBAP-KWMENG,  "以销售单位表示的累计订购数量
        VRKME    like  VBAP-VRKME,   "销售单位
        MEINS    like  VBAP-MEINS,   "基本计量单位
        CMPRE    like  VBAP-CMPRE,   "毛单价
        NETPR    like  VBAP-NETPR,   "净单价
        WAERK    like  VBAP-WAERK,   "SD 凭证货币
      end of it_vbap.

* for final output
data: begin of it_output occurs 0,
         KUNNR   like  VBAK-KUNNR,   "客户编号
         NAME1   like  KNA1-NAME1,   "名称
         VBELN   like  VBAK-VBELN,   "销售凭证号
         AUDAT   like  VBAK-AUDAT,   "定单日期
         POSNR   like  VBAP-POSNR,   "销售凭证项目
         MATNR   like  VBAP-MATNR,   "物料号
         KWMENG  like  VBAP-KWMENG,  "以销售单位表示的累计订购数量
         VRKME   like  VBAP-VRKME,   "销售单位
         MEINS   like  VBAP-MEINS,   "基本计量单位
         CMPRE   like  VBAP-CMPRE,   "毛单价
         NETPR   like  VBAP-NETPR,   "净单价
         WAERK   like  VBAP-WAERK,   "SD 凭证货币
      end of it_output.


*---------------------------------------------------------------------*
* INITIALIZATION
*---------------------------------------------------------------------*
initialization.

*---------------------------------------------------------------------*
* AT SELECTION-SCREEN
*---------------------------------------------------------------------*


select-options:
  S_AUDAT for VBAK-AUDAT,               "订单日期
  S_KUNNR for vbak-KUNNR.               "客户代码


*---------------------------------------------------------------------*
* start-of-selection
*---------------------------------------------------------------------*
start-of-selection.

  select vbeln
         kunnr
         audat
    from vbak
    into table it_vbak
   where audat in s_audat and  kunnr in  s_kunnr.

  if sy-subrc <> 0.
    write: '没有记录显示'.
  endif.

  select kunnr
         name1
    from kna1
    into table it_kna1
    for all entries in it_vbak
    where kunnr = it_vbak-kunnr.

  if sy-subrc <> 0.
    write: / '没有相应的记录在客户主数据中'.
  endif.

  select vbeln
         posnr
         matnr
         kwmeng
         vrkme
         meins
         cmpre
         netpr
         waerk
    from vbap
    into table it_vbap
    for all entries in it_vbak
    where vbeln = it_vbak-vbeln.

  if sy-subrc <> 0.
    write: / '没有相应的记录在销售凭证的项目数据中'.
  endif.

loop at it_vbak.
    clear it_output.
    it_output-vbeln = it_vbak-vbeln.
    it_output-kunnr = it_vbak-kunnr.
    it_output-audat = it_vbak-audat.

    read table it_kna1
    with key kunnr = it_vbak-kunnr.
    if sy-subrc = 0.
       it_output-name1 = it_kna1-name1.
    endif.

    read table it_vbap
    with key vbeln = it_vbak-vbeln.
    if sy-subrc = 0.
       it_output-posnr = it_vbap-posnr.
       it_output-matnr = it_vbap-matnr.
      it_output-kwmeng = it_vbap-kwmeng.
       it_output-vrkme = it_vbap-vrkme.
       it_output-meins = it_vbap-meins.
       it_output-cmpre = it_vbap-cmpre.
       it_output-netpr = it_vbap-netpr.
       it_output-waerk = it_vbap-waerk.
     endif.
  append it_output.
endloop.

sort it_output by kunnr.

 

*---------------------------------------------------------------------*
* end-of-selection
*---------------------------------------------------------------------*

end-of-selection.

* Output report
  perform pf_list_in_alv tables it_output.  "Write to screen


*&--------------------------------------------------------------------*
*&      Form  pf_list_in_alv
*&--------------------------------------------------------------------*
*       Output report form
*---------------------------------------------------------------------*
form pf_list_in_alv tables i_table.
  type-pools: slis.
  data: gt_fieldcat type slis_t_fieldcat_alv,
        gs_layout type slis_layout_alv,
        it_sort type slis_sortinfo_alv occurs 0.
  data: g_repid like sy-repid,
        wstr_event type slis_alv_event,
        wtbl_event type slis_t_event.
  data: begin of it_sort_row occurs 0,
           spos like alvdynp-sortpos,
           fieldname type slis_fieldname,
           tabname type slis_fieldname,
           up like alvdynp-sortup,
           down like alvdynp-sortdown,
           group like alvdynp-grouplevel,
           subtot like alvdynp-subtotals,
           comp(1) type c,
           expa(1) type c,
           obligatory(1) type c,
        end of it_sort_row.
  g_repid = sy-repid.
  gs_layout-zebra = 'X'.
  gs_layout-f2code = '&amp;ETA'.
  gs_layout-detail_popup = 'X'.
  gs_layout-colwidth_optimize = 'X'.


  perform fieldcat_init using gt_fieldcat[].

   it_sort_row-fieldname = 'KUNNR'.
  it_sort_row-spos = 2.
  it_sort_row-up = 'X'.
  it_sort_row-subtot = 'X'.
  append it_sort_row to it_sort.

  wstr_event-name = 'TOP_OF_PAGE'.
  wstr_event-form = 'TOP_OF_PAGE_CALLBACK'.
  append wstr_event to wtbl_event.

  call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
      i_callback_program = g_repid
      it_fieldcat        = gt_fieldcat[]
      is_layout          = gs_layout
      it_events          = wtbl_event
      it_sort            = it_sort
    tables
      t_outtab           = i_table.

endform.

*&--------------------------------------------------------------------*
*&      Form  fieldcat_init
*&--------------------------------------------------------------------*
* Initialization fieldcatalog   DEFINITION OF HEADING.
*      Fieldnames and ref_fieldnames MUST be UPPER CASE !!
*---------------------------------------------------------------------*
form fieldcat_init
            using rt_fieldcat type slis_t_fieldcat_alv.
  data: ls_fieldcat type slis_fieldcat_alv.
  data: pos type i value 1.
  clear ls_fieldcat.

  ls_fieldcat-col_pos   =  pos.
  ls_fieldcat-fieldname = 'KUNNR'.
  ls_fieldcat-key       = 'X'.
  ls_fieldcat-seltext_l = '客户编号'.
  ls_fieldcat-seltext_m = '客户编号'.
  ls_fieldcat-seltext_s = '客户编号'.
  ls_fieldcat-outputlen = 10.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.

  ls_fieldcat-col_pos   =  pos.
  ls_fieldcat-fieldname = 'NAME1'.
  ls_fieldcat-seltext_l = '客户名称'.
  ls_fieldcat-seltext_m = '客户名称'.
  ls_fieldcat-seltext_s = '客户名称'.
  ls_fieldcat-outputlen = 12.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.

  ls_fieldcat-col_pos   =  pos.
  ls_fieldcat-fieldname = 'VBELN'.
  ls_fieldcat-seltext_l = '销售订单编号'.
  ls_fieldcat-seltext_m = '销售订单编号'.
  ls_fieldcat-seltext_s = '销售订单编号'.
  ls_fieldcat-outputlen = 10.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.

  ls_fieldcat-col_pos   =  pos.
  ls_fieldcat-fieldname = 'AUDAT'.
  ls_fieldcat-seltext_l = '订单日期'.
  ls_fieldcat-seltext_m = '订单日期'.
  ls_fieldcat-seltext_s = '订单日期'.
  ls_fieldcat-outputlen = 10.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.

  ls_fieldcat-col_pos   =  pos.
  ls_fieldcat-fieldname = 'POSNR'.
  ls_fieldcat-seltext_l = '销售订单明细项目编号'.
  ls_fieldcat-seltext_m = '销售订单明细项目编号'.
  ls_fieldcat-seltext_s = '销售订单明细项目编号'.
  ls_fieldcat-outputlen = 30.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.

  ls_fieldcat-col_pos   =  pos.
  ls_fieldcat-fieldname = 'MATNR'.
  ls_fieldcat-seltext_l = '物料编号'.
  ls_fieldcat-seltext_m = '物料编号'.
  ls_fieldcat-seltext_s = '物料编号'.
  ls_fieldcat-outputlen = 10.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.

  ls_fieldcat-col_pos   =  pos.
  ls_fieldcat-fieldname = 'KWMENG'.
  ls_fieldcat-seltext_l = '订购数量'.
  ls_fieldcat-seltext_m = '订购数量'.
  ls_fieldcat-seltext_s = '订购数量'.
  ls_fieldcat-outputlen = 20.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.

    ls_fieldcat-col_pos   =  pos.
  ls_fieldcat-fieldname = 'VRKME'.
  ls_fieldcat-seltext_l = '销售单位'.
  ls_fieldcat-seltext_m = '销售单位'.
  ls_fieldcat-seltext_s = '销售单位'.
  ls_fieldcat-outputlen = 20.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.

  ls_fieldcat-col_pos   =  pos.
  ls_fieldcat-fieldname = 'MEINS'.
  ls_fieldcat-seltext_l = '基本单位'.
  ls_fieldcat-seltext_m = '基本单位'.
  ls_fieldcat-seltext_s = '基本单位'.
  ls_fieldcat-outputlen = 20.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.

  ls_fieldcat-col_pos   =  pos.
  ls_fieldcat-fieldname = 'CMPRE'.
  ls_fieldcat-seltext_l = '毛单价'.
  ls_fieldcat-seltext_m = '毛单价'.
  ls_fieldcat-seltext_s = '毛单价'.
  ls_fieldcat-outputlen = 20.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.

  ls_fieldcat-col_pos   =  pos.
  ls_fieldcat-fieldname = 'NETPR'.
  ls_fieldcat-seltext_l = '净单价'.
  ls_fieldcat-seltext_m = '净单价'.
  ls_fieldcat-seltext_s = '净单价'.
  ls_fieldcat-outputlen = 20.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.

  ls_fieldcat-col_pos   =  pos.
  ls_fieldcat-fieldname = 'WEARK'.
  ls_fieldcat-seltext_l = '凭证货币'.
  ls_fieldcat-seltext_m = '凭证货币'.
  ls_fieldcat-seltext_s = '凭证货币'.
  ls_fieldcat-outputlen = 20.
  append ls_fieldcat to rt_fieldcat.
  clear ls_fieldcat.
  pos = pos + 1.

endform.

*---------------------------------------------------------------------*
*       FORM top_of_page_callback                                     *
*---------------------------------------------------------------------*
form top_of_page_callback.

  WRITE: / '销售订单列表'.
  WRITE: / 'Date', sy-datum.

endform.

SSRS No Delay for First Report of the Day

What? This article describes a solution our reporting server administrators found to cut the loading...
  • wozengcong
  • wozengcong
  • 2015年12月01日 09:32
  • 244

First Delphi Report Builder Program

TADOQuery1->TDataSource->TppDBPipeLine->TppReportdouble-click TppReport will open a report designer,...
  • EricYeung
  • EricYeung
  • 2007年05月06日 12:23
  • 878

Daily Report 到底该写点什么?

         作为一个tester,每天下班前最后做的一件事情或许就是将自己这一天的工作内容发送给自己的老板,以让老板清楚的看到这一天你到底做了些什么内容的工作。转入软件测试行业快一年了,一直觉得...
  • roger_ge
  • roger_ge
  • 2010年05月20日 00:03
  • 17248

hadoop dfsadmin -report 命令详解

 hadoop dfsadmin -report    用这个命令可以快速定位出哪些节点down掉了,HDFS的容量以及使用了多少,以及每个节点的硬盘使用情况。 当然NameNode有个http页面也...
  • fiberlijun
  • fiberlijun
  • 2009年11月18日 10:16
  • 15744

如何写论文的report(一)

主要参考链接: http://www.assignmentmasters.com/news.php?id=9 https://okayedu.com/assignment-services/r...
  • mdjxy63
  • mdjxy63
  • 2017年09月23日 10:31
  • 1210

Jmeter Aggregate Report 与 Summary Report 分析

关于Aggregate Report和 Summary Report里面每个字段的说明,在网上有很多资料,在此不做说明。 本文主要讲Aggregate Report与Summary Report对比...
  • liuyu5210
  • liuyu5210
  • 2017年08月07日 09:53
  • 479

fast report for delphi

 1)fast report的简单的主从表使用(subreport)fast report报表打印可分两种:一种为动态打印,也就是我们一般的打印预缆(rptMain.ShowReport()),另外一...
  • sheshou2
  • sheshou2
  • 2007年08月14日 11:16
  • 1759

jmeter summary report 字段意思和设置集合点解释

1.需要在添加一个名为summary report的监听器,跑完之后查看 Label:取样器/监听器名称 Samples :事务数量 Average:平均一个完成一个事务消耗的时间(平均响应时间) M...
  • j379832526
  • j379832526
  • 2017年06月23日 16:57
  • 1635

SAP学习7--ABAP Report程序

1.我们先 /nse38 进入来
  • yuxiao198808
  • yuxiao198808
  • 2014年09月16日 13:54
  • 770

Report design not valid 解决

net.sf.jasperreports.engine.design.JRValidationException: Report design not valid :   1. Field no...
  • sartner
  • sartner
  • 2011年09月16日 09:11
  • 5011
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:first report
举报原因:
原因补充:

(最多只允许输入30个字)