今天心情还是很坏,改了一个程序,就实在没有心思再去处理别的事情了,还有好多报表没有处理,FI和CO现在也要接手开始写了。下午无聊的时候,写了一个简单的互动报表。
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