程序代码
*&---------------------------------------------------------------------*
*& Report Z3TEST004
*&---------------------------------------------------------------------*
*& 打印 采购发票 查询
*&---------------------------------------------------------------------*
REPORT zprint001.TABLES:EKET,MAKT,MKPF,EKKO,EKPO,RBKP,RSEG,EKBE." 数据类型1
*
*TYPES: BEGIN OF TY_EKKPO,
* LIFNR TYPE EKKO-LIFNR,
* EKORG TYPE EKKO-EKORG,
* WERKS TYPE EKPO-WERKS,
* EBELN TYPE EKKO-EBELN,
* AEDAT TYPE EKKO-AEDAT,
* END OF TY_EKKPO.DATA: GSD_EKKPO TYPE ZMMPRINT01 ,GTD_EKKPO TYPE STANDARD TABLE OF ZMMPRINT01."数据类型2*TYPES: BEGIN OF TY_ITEM,
* EBELN TYPE EKKO-EBELN,
* EBELP TYPE EKPO-EBELP,
* MATNR TYPE MAKT-MATNR,
* MAKTX TYPE MAKT-MAKTX,
* MENGE TYPE EKPO-MENGE,
* MEINS TYPE EKPO-MEINS,
* NETPR TYPE EKPO-NETPR,
* WAERS TYPE EKKO-WAERS,
* EINDT TYPE EKET-EINDT,
* END OF TY_ITEM.DATA: GSD_ITEM TYPE ZMMPRINT02,GTD_ITEM TYPE STANDARD TABLE OF ZMMPRINT02.*--------------------------------------------------------------------------** 选择屏幕*--------------------------------------------------------------------------*SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.SELECT-OPTIONS:S_EKGRP FOR EKKO-EKORG ,S_EKDAT FOR EKKO-BEDAT .SELECTION-SCREEN END OF BLOCK B1.*----------------------------------------------------------------------** START-OF-SELECTION*----------------------------------------------------------------------*START-OF-SELECTION.SELECTEKKO~EKORG "财务组织RBKP~BLDAT"发票日期RBKP~BELNR "发票号EKKO~LIFNR "供应商编号"供方名称EKKO~EKGRP "采购部门"扣款小计(计算)RBKP~WMWST1 "税额"应付金额RBKP~BVTYP "开户行RBKP~HBKID "账户名称RBKP~BANKN "银行帐户号码"MEPOITEM_PROP~AFNAM "制单人INTO CORRESPONDING FIELDS OF TABLE GTD_EKKPOFROM EKKO
INNER JOIN EKPO ON EKKO~EBELN = EKPO~EBELN
INNER JOIN RSEG ON EKKO~EBELN = RSEG~EBELN
INNER JOIN RBKP ON RSEG~BELNR = RBKP~BELNR
"INNER JOIN MEPOITEM_PROP ONWHERE EKKO~EKGRP IN S_EKGRPAND EKKO~BEDAT IN S_EKDAT.BREAK-POINT."断点READ TABLE GTD_EKKPO INTO GSD_EKKPO INDEX 1.SELECTEKKO~EBELN "MAKT~MATNR "物料号MAKT~MAKTX "物料描述EKPO~MENGE "数量EKPO~MEINS "单位EKPO~NETPR "价格INTO CORRESPONDING FIELDS OF TABLE GTD_ITEMFROM EKKOINNER JOIN EKPO ON EKKO~EBELN = EKPO~EBELNLEFT JOIN EKET ON EKPO~EBELN = EKET~EBELN AND EKPO~EBELP = EKET~EBELPLEFT JOIN MAKT ON EKPO~MATNR = MAKT~MATNR
WHERE EKKO~AEDAT IN S_EKDATAND EKKO~EKGRP IN S_EKGRP.READ TABLE GTD_ITEM INTO GSD_ITEM INDEX 1.** 设置调用表单 **DATA:FM_NAME TYPE RS38L_FNAM.CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'EXPORTINGFORMNAME = 'ZPRINT001' " 调用 表单程序IMPORTINGFM_NAME = FM_NAME.CALL FUNCTION FM_NAMEEXPORTING
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
* CONTROL_PARAMETERS =
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
* OUTPUT_OPTIONS =
* USER_SETTINGS = 'X'GSD_EKKPO = GSD_EKKPOGSD_ITEM = GSD_ITEMTABLESGTD_ITEM = GTD_ITEM
* IMPORTING
* DOCUMENT_OUTPUT_INFO =
* JOB_OUTPUT_INFO =
* JOB_OUTPUT_OPTIONS =* EXCEPTIONS
* FORMATTING_ERROR = 1
* INTERNAL_ERROR = 2
* SEND_ERROR = 3
* USER_CANCELED = 4
* OTHERS = 5.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.** 设置调用表单 **
定义表单模板
事务代码 smartforms