ITPub博客

首页 > 数据库 > 数据库开发技术 > 在屏幕上多項選擇示例(More on selection screens)

在屏幕上多項選擇示例(More on selection screens)

原创 数据库开发技术 作者:tolyhuang 时间:2007-12-07 11:16:25 0 删除 编辑
程序代碼:[@more@]

*&---------------------------------------------------------------------*
*& Report ZPROG02
*&
*&---------------------------------------------------------------------*
*& Demo 2 - More on selection screens
*&
*&---------------------------------------------------------------------*

REPORT ZPROG02.

**********************************
*Define Tables
**********************************
TABlES: MARA.

**********************************
*Input Screen
**********************************

**** First Block
SELECTION-SCREEN BEGIN OF BLOCK a001 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: s_date FOR SY-DATUM.
SELECTION-SCREEN END OF BLOCK a001.

SELECTION-SCREEN SKIP 1.

**** Second Block
SELECTION-SCREEN BEGIN OF BLOCK b001 WITH FRAME TITLE text-t02.
PARAMETERS: P_WK RADIOBUTTON GROUP OPT DEFAULT 'X'.
PARAMETERS: P_DY RADIOBUTTON GROUP OPT.

SELECTION-SCREEN SKIP 1.

PARAMETERS: P_SERVER AS CHECKBOX DEFAULT ' '.
PARAMETERS: P_DATE1 LIKE SY-DATUM.

SELECTION-SCREEN SKIP 1.

PARAMETERS: P_LOCAL AS CHECKBOX DEFAULT 'X'.
PARAMETERS: P_DATE2 LIKE SY-DATUM.
SELECTION-SCREEN END OF BLOCK b001.


**********************************
*Declare variable
**********************************
DATA: f_sum TYPE i,
f_v1(3) TYPE c,
f_v2(5) TYPE p DECIMALS 2.

**********************************
*At selection Screen
**********************************
AT SELECTION-SCREEN.

** FILL THE DATE WHEN THE DATE FIELD IS INITIAL
if P_SERVER = 'X' and P_DATE1 is INITIAL.
P_DATE1 = '20060101'.
endif.

** WARNING IF DATE FIELD IS INITIAL.
if P_LOCAL = 'X' and P_DATE2 is INITIAL.
MESSAGE ID 'ZZ' TYPE 'W' NUMBER '000'
WITH 'You must enter date range'.
endif.

** BLOCK FOR INPUT IF A OPTION IS NOT SET
AT SELECTION-SCREEN OUTPUT.
IF P_SERVER = ' '.
LOOP AT SCREEN.
CASE SCREEN-NAME.
WHEN 'P_DATE1'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDCASE.
ENDLOOP.
ENDIF.
**********************************
*Start of selection
**********************************
START-OF-SELECTION.
** Calculation

END-OF-SELECTION.


**********************************
*Output result
**********************************
* Print out

if P_WK = 'X'.
WRITE: / 'Weekly report is output..'.
else.
WRITE: / 'Daily report is output..'.
endif.

if P_SERVER = 'X'.
WRITE: / 'Report has been downloaded to server..'.
endif.

if P_LOCAL = 'X'.
WRITE: / 'Report has been downloaded to local file..'.
endif.

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

请登录后发表评论 登录
全部评论

注册时间:2010-07-22

  • 博文量
    268
  • 访问量
    1413877