马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
【DETAIL LIST 子报表】
BC400 USER Dialog : LISTS 涉及内容: 概念:base lists text symbols detail list 事件:INITIALIZATION STAR-SELECT-SCREEN AUTHORITY-CHECK OBJECT **? 系统参数:SY-LSIND 格式命令:FORMAT COLOR COL_KEY 申明工作区或内表的方式
DATA: wa_spfli TYPE spfli,
SAMPLE 1 :ZBC400_##_DETAIL_LIST *&---------------------------------------------------------------------* *& Report
SAPBC400UDD_DETAIL_LIST
* *&---------------------------------------------------------------------* *&
Interactive Reporting, line-selection
* *&---------------------------------------------------------------------* REPORT
sapbc400udd_detail_list
. DATA: wa_spfli TYPE spfli,
wa_sflight TYPE sflight.
START-OF-SELECTION. * Read data and display
SELECT carrid connid airpfrom cityfrom airpto cityto deptime arrtime
FROM spfli
INTO CORRESPONDING FIELDS OF wa_spfli.
FORMAT COLOR COL_KEY.
WRITE: / wa_spfli-carrid ,
wa_spfli-connid .
FORMAT COLOR COL_NORMAL.
WRITE:
wa_spfli-airpfrom ,
wa_spfli-cityfrom ,
wa_spfli-airpto ,
wa_spfli-cityto ,
wa_spfli-deptime ,
wa_spfli-arrtime .
*hide information
HIDE: wa_spfli-carrid, wa_spfli-connid.
ENDSELECT.
*initialization
CLEAR wa_spfli.
* ---
end of event start-of-selection * ------------ Interactive event, secondary list ----------------------- AT LINE-SELECTION.
IF sy-lsind = 1.
* page header for secondary list.
WRITE: text-001 COLOR COL_NORMAL,
wa_spfli-carrid COLOR COL_TOTAL,
wa_spfli-connid COLOR COL_TOTAL.
SKIP.
FORMAT COLOR COL_HEADING.
WRITE: text-003, text-004, text-005.
SKIP.
FORMAT COLOR COL_NORMAL.
* selecting data for secondary list
SELECT fldate seatsmax seatsocc
FROM sflight
INTO CORRESPONDING FIELDS OF wa_sflight
WHERE carrid = wa_spfli-carrid
AND
connid = wa_spfli-connid.
* output detail list
WRITE: / wa_sflight-fldate COLOR COL_KEY UNDER text-003,
wa_sflight-seatsmax COLOR COL_NORMAL UNDER text-004,
wa_sflight-seatsocc COLOR COL_NORMAL UNDER text-005.
ENDSELECT.
ENDIF.
CLEAR wa_spfli.
SAMPLE 2 :SAPBC400UDS_DETAIL_LIST *&---------------------------------------------------------------------* *& Report
SAPBC400UDS_DETAIL_LIST
* *&---------------------------------------------------------------------* *&---------------------------------------------------------------------* REPORT
sapbc400uds_detail_list. CONSTANTS actvt_display TYPE activ_auth VALUE '03'. DATA: wa_flight TYPE sbc400focc,
wa_sbook
TYPE sbook.
PARAMETERS: pa_car TYPE s_carr_id. START-OF-SELECTION.
AUTHORITY-CHECK OBJECT 'S_CARRID'
ID 'CARRID' FIELD pa_car
ID 'ACTVT'
FIELD actvt_display.
CASE sy-subrc.
WHEN 0.
SELECT carrid connid fldate seatsmax seatsocc FROM sflight
INTO CORRESPONDING FIELDS OF wa_flight
WHERE carrid = pa_car.
wa_flight-percentage =
100 * wa_flight-seatsocc / wa_flight-seatsmax.
WRITE: / wa_flight-carrid,
wa_flight-connid,
wa_flight-fldate,
wa_flight-seatsocc,
wa_flight-seatsmax,
wa_flight-percentage,'%'.
* Hide key field values corresponding to the actual line
HIDE: wa_flight-carrid, wa_flight-connid, wa_flight-fldate.
ENDSELECT.
WHEN OTHERS.
WRITE: / 'Authority-Check Error'(001).
ENDCASE.
CLEAR wa_flight.
* Program continues here, if a line is selected on basic list AT LINE-SELECTION.
IF sy-lsind = 1.
* Key fields transported back from hide area to ABAP dataobjects
WRITE: / wa_flight-carrid, wa_flight-connid, wa_flight-fldate.
ULINE.
SKIP.
* Selection of bookings, which depend on selected flight
SELECT bookid customid custtype class order_date
smoker cancelled loccuram loccurkey
FROM sbook INTO CORRESPONDING FIELDS OF wa_sbook
WHERE carrid = wa_flight-carrid
AND
connid = wa_flight-connid
AND
fldate = wa_flight-fldate.
* Creation of detail list
WRITE: / wa_sbook-bookid,
wa_sbook-customid,
wa_sbook-custtype,
wa_sbook-class,
wa_sbook-order_date,
wa_sbook-smoker,
wa_sbook-cancelled.
ENDSELECT.
ENDIF.
CLEAR wa_flight.
要点: 1.
Hide : wa_flight-carris,wa_flight-connid …….. 作用与原理 2.
AUTHORITY-CHECK 3.
Text- 注意中间不空格 4.Write 的格式: DATA: WA_FLIGHT TYPE SFLIGHT. (tables sflight 可参照一张数据库表定义一个同名的工作区???) CONSTANTS: C_ID TYPE S_CARR_ID VALUE 'SQ'. *参照一个element 定义一个常数 START-OF-SELECTION. write: sy-uline(100).
*ULINE长度 WRITE: /TEXT-001. write:
sy-uline.
SELECT * FROM SFLIGHT
INTO CORRESPONDING FIELDS OF WA_FLIGHT Where carrid = c_id .
WRITE : / WA_FLIGHT-CARRID ,
(9)
WA_FLIGHT-CONNID,
*间隔数(9)
WA_FLIGHT-FLDATE,
WA_FLIGHT-PLANETYPE.
CLEAR WA_FLIGHT.
ENDSELECT. |