今天无聊的时候写了个这个程序,嘿嘿!这两天都忙疯了,一个报表接一个报表的!弄死了,更郁闷的事,准备五一参加的MM培训,现在地点却在北京了!只能参加上海的fi培训了,不喜欢fi的培训,不晓得那个几天能学到什么东西!
REPORT ZRL003.
TABLES: EKKO.
**---Initial table ekko
TYPES: BEGIN OF STR_EKKO,
EBELN LIKE EKKO-EBELN,
BUKRS LIKE EKKO-BUKRS,
EKGRP LIKE EKKO-EKGRP,
END OF STR_EKKO.
DATA: WA_EKKO TYPE STR_EKKO,
IT_EKKO TYPE TABLE OF STR_EKKO.
**---Initial table ekpo
TYPES: BEGIN OF STR_EKPO,
EBELN LIKE EKPO-EBELN,
NETPR LIKE EKPO-NETPR,
END OF STR_EKPO.
DATA: WA_EKPO TYPE STR_EKPO,
IT_EKPO TYPE TABLE OF STR_EKPO.
**---selection screen
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS:P_BUKRS LIKE EKKO-BUKRS OBLIGATORY DEFAULT '1000'.
SELECT-OPTIONS: S_EKGRP FOR EKKO-EKGRP.
SELECTION-SCREEN END OF BLOCK B1.
**---Start-of-selection
PERFORM GET_DATA.
**---End-of-selection
PERFORM DISPLAY_HEADER.
PERFORM DISPLAY_DATA.
**---at line-selection
AT LINE-SELECTION.
CHECK NOT WA_EKKO-EBELN IS INITIAL.
PERFORM SELECT_DATA.
PERFORM GET_MYDATA.
*&---------------------------------------------------------------------*
*& Form get_data
*&---------------------------------------------------------------------*
* Get data from database
*----------------------------------------------------------------------*
FORM GET_DATA .
SELECT EBELN BUKRS EKGRP
INTO CORRESPONDING FIELDS OF TABLE IT_EKKO
FROM EKKO
WHERE BUKRS = P_BUKRS
AND EKGRP IN S_EKGRP.
ENDFORM. " get_data
*&---------------------------------------------------------------------*
*& Form display_data
*&---------------------------------------------------------------------*
* Display data
*----------------------------------------------------------------------*
FORM DISPLAY_DATA .
LOOP AT IT_EKKO INTO WA_EKKO.
**鼠标变成手型
FORMAT HOTSPOT ON.
**格式化字体
FORMAT COLOR COL_KEY INTENSIFIED ON.
WRITE: AT /5 WA_EKKO-EBELN.
FORMAT RESET.
WRITE: AT 16 WA_EKKO-BUKRS,
21 WA_EKKO-EKGRP.
**Hide数据
HIDE: WA_EKKO-EBELN.
ENDLOOP.
ENDFORM. " display_data
*&---------------------------------------------------------------------*
*& Form display_header
*&---------------------------------------------------------------------*
* Display header
*----------------------------------------------------------------------*
FORM DISPLAY_HEADER .
WRITE: AT /5 '采购凭证号',
16 '工厂',
21 '采购组'.
ENDFORM. " display_header
*&---------------------------------------------------------------------*
*& Form select_data
*&---------------------------------------------------------------------*
* Select Data from database
*----------------------------------------------------------------------*
FORM SELECT_DATA .
SELECT EBELN NETPR
INTO CORRESPONDING FIELDS OF TABLE IT_EKPO
FROM EKPO
WHERE EBELN = WA_EKKO-EBELN.
ENDFORM. " select_data
*&---------------------------------------------------------------------*
*& Form get_mydata
*&---------------------------------------------------------------------*
* Display ekpo data
*----------------------------------------------------------------------*
FORM GET_MYDATA .
***---Write header
WRITE: AT /5 '采购凭证号',
AT 16 '采购凭证中的净价格'.
LOOP AT IT_EKPO INTO WA_EKPO.
WRITE: AT /5 WA_EKPO-EBELN.
WRITE: AT 16 WA_EKPO-NETPR.
ENDLOOP.
ENDFORM. " get_mydata