技术开发 频道

图解ABAP简单屏幕编程

2. 创建如下的代码:

REPORT  ZSCREEN.
parameters: pa_anum type sbook-agencynum.
data wa_booking type sbc400_booking.
*workarea for single booking to be changed
data:wa_sbook type sbook.
data: w_sbook type sbook.
*workarea for dynpro
tables sdyn_book.
*variable for function code of user action
data: ok_code like sy-ucomm.

start-of-selection.
set pf-status 'LIST'.
set titlebar 'LIST'.

*selecting data using a dictionary view to get the data from sbook
* and the customer name from scustom
select carrid connid fldate bookid customid name
  from sbc400_booking
  into corresponding fields of wa_booking
  where agencynum = pa_anum.

  if sy-subrc = 0.
    write: / wa_booking-carrid color col_key,
             wa_booking-connid color col_key,
             wa_booking-fldate color col_key,
             wa_booking-bookid color col_key,
             wa_booking-name.
    hide:    wa_booking-carrid,
             wa_booking-connid,
             wa_booking-fldate,
             wa_booking-bookid,
             wa_booking-name.
  endif.
endselect.
clear wa_booking.

at line-selection.
select single *
  from sbook
  into wa_sbook
  where carrid = wa_booking-carrid
    and connid = wa_booking-connid
    and fldate = wa_booking-fldate
    and bookid = wa_booking-bookid.

if sy-subrc = 0.
  move-corresponding wa_sbook to w_sbook.
*  move wa_booking-name to sdyn_book-name.
  call screen 100.
else.
message id 'BC400' type 'S' number '047' with wa_booking-carrid.
endif.

3. 如图:

0
相关文章