如何在SAP的Screen中编写List报表

1、相关命令
LEAVE TO LIST-PROCESSING [AND RETURN TO SCREEN <nnnn>].

LEAVE LIST-PROCESSING.

2、使用说明

3、推荐设计思路
设计一个空屏幕,在需要调用list的屏幕的逻辑流中使用CALL SCREEN调用空屏幕。空屏幕的next  screen设置为0,不需要PAI,只需要在PBO中设计一个Module,这个module的具体步骤如下:

  1. 首先调用LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
  2. 为list设置GUI status ;如:设置SPACE 或者为自己定义的.
  3. 使用下列语句使空屏幕不输出:

    SUPPRESS DIALOG.

    or

    LEAVE SCREEN. 
  4. 进行List输出和处理.

4、示例
REPORT demo_leave_to_list_processing .
TABLES sdyn_conn.
DATA: wa_spfli TYPE spfli,
      flightdate TYPE sflight-fldate.

CALL SCREEN 100.

MODULE status_0100 OUTPUT.
  SET PF-STATUS 'SCREEN_100'.
ENDMODULE.

MODULE cancel INPUT.
  LEAVE PROGRAM.
ENDMODULE.

MODULE user_command_0100.
  CALL SCREEN 500.
  SET SCREEN 100.
ENDMODULE.

MODULE call_list_500 OUTPUT.
  LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
  SET PF-STATUS space.
  SUPPRESS DIALOG.
  SELECT  carrid connid cityfrom cityto
    FROM  spfli
    INTO  CORRESPONDING FIELDS OF wa_spfli
    WHERE carrid = sdyn_conn-carrid.
    WRITE: / wa_spfli-carrid, wa_spfli-connid,
             wa_spfli-cityfrom, wa_spfli-cityto.
    HIDE: wa_spfli-carrid, wa_spfli-connid.
  ENDSELECT.
  CLEAR: wa_spfli-carrid.
ENDMODULE.

TOP-OF-PAGE.
  WRITE text-001 COLOR COL_HEADING.
  ULINE.

TOP-OF-PAGE DURING LINE-SELECTION.
  WRITE sy-lisel COLOR COL_HEADING.
  ULINE.

AT LINE-SELECTION.
  CHECK not wa_spfli-carrid is initial.
  SELECT  fldate
    FROM  sflight
    INTO  flightdate
    WHERE carrid = wa_spfli-carrid AND
          connid = wa_spfli-connid.
     WRITE / flightdate.
  ENDSELECT.
  CLEAR: wa_spfli-carrid.

该示例屏幕100只包含一个输入字段(SDYN_CONN-CARRID ),在屏幕100的逻辑流中会调用list处理.屏幕100的逻辑流如下:

PROCESS BEFORE OUTPUT.
  MODULE STATUS_0100.

PROCESS AFTER INPUT.
  MODULE CANCEL AT EXIT-COMMAND.
  MODULE USER_COMMAND_0100.

在屏幕100的PAI的module USER_COMMAND_100 将使用CALL SCREEN调用屏幕500。屏幕500的逻辑流中封装了所有List处理,屏幕500的逻辑流如下:

PROCESS BEFORE OUTPUT.
  MODULE CALL_LIST_500.

PROCESS AFTER INPUT.

屏幕500的PBO的module CALL_LIST_500定义了list处理代码。另外由于屏幕500的屏幕流设置为0,该程序从List处理返回时到屏幕100的USER_COMMAND_100的调用CALL SCREEN 500的语句之后.

该程序会在list处理时显示一个明细List,具体代码参见AT LINE-SELECTION、TOP-OF-PAGE 和 TOP-OF-PAGE DURING LINE-SELECTION事件代码.



你可能感兴趣的:(screen)