(1권 p.253)
write : /15 text-001, "제일 왼쪽에서 15칸을 띄우고
/35 sy-datum,
/15 'manager'(002), 35 sy-uname.
단어 더블클릭 하면 창이 뜨는데 word라고 입력하고 저장 후 active - 저장
단어 더블클릭 창에서 go-to translation - en 에서 ko로 들어가서
단어 아래쪽에 한글로 입력하면 로그인 ko로 했을 때 한글버전으로 나오게 됨
active 후 저장
입력이 안되어있으면 빨간색, 입력 후 엔터를 누르면 노란색으로 변함
다시 ko버전으로 로그인하면
추가 ) 이벤트 넣고 루프넣고 메세지로 처리해보기
REPORT zbc400_01_e17.
TYPES : BEGIN OF gty_s_flihtocc,
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
seatsocc TYPE sflight-seatsocc,
END OF gty_s_flihtocc.
DATA : gt_flightocc TYPE TABLE OF gty_s_flihtocc ,
gs_flightocc like line of gt_flightocc.
*START-OF-SELECTION. "버퍼에 쌓인 데이터를 출력하는 것
*이벤트가 세개 있는데 세개중에 이니셜라이제이션 셀렉션 스크린오브 사용자의 출력을 체크하는 것
*레포ㅡ 프로그램에서 ㄴ 쓰지않아도 되지만 .. 프로그램에 자동으로 스타트오브 셀렉션으로 생각하는것
SELECT connid fldate seatsocc
FROM sflight " sflight 는 Transparent 라고 해서 기존에 있는 것을 가지고 오는 것
INTO TABLE gt_flightocc
WHERE seatsocc > 200
ORDER BY connid DESCENDING seatsocc ASCENDING.
if sy-subrc = 0.
loop at gt_flightocc into gs_flightocc.
write : gs_flightocc-connid,
gs_flightocc-fldate,
gs_flightocc-seatsocc.
endloop.
endif.
출력 값
cl_demo_output=>display_data(gt_flightocc)
p.410 참고
types gt_flightocc
type STANDARD TABLE OF gty_s_flightocc
with NON-UNIQUE key connid .
data : gt_flightocc type gty_s_flight,
gs_fligihtocc like line of gt_flightocc.
PARAMETERS : pa_order type c DEFAULT 'X'.
case 'x'.
when pa_order.
PERFORM order_by changing gt_flightocc.
endcase.
pattern - abap object click - cl_demo_output / display_data
p.642~
REPORT ZBC400_01_E24.
types : begin of gty_s_spfli,
carrid type spfli-carrid,
connid type spfli-connid,
countryfr type spfli-countryfr,
cityfrom type spfli-cityfrom,
countryto type spfli-countryto,
cityto type spfli-cityto,
end of gty_s_spfli.
data : gt_spfli type table of gty_s_spfli ,
gs_spfli like line of gt_spfli .
START-OF-SELECTION.
select carrid connid countryfr cityfrom countryto cityto
from spfli
"from spfli as a 로도 사용 가능
into table gt_spfli
where countryfr = spfli~countryto.
"where countryfr = a~countryto.
IF sy-subrc = 0.
cl_demo_output=>display_data( gt_spfli ).
else.
message i100(zbc400_01).
ENDIF.
REPORT zbc400_01_multi.
TYPES : BEGIN OF gty_s_flight,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
seatsmax TYPE sflight-seatsmax,
seatsocc TYPE sflight-seatsocc,
END OF gty_s_flight.
* data : gt_sflight type table of gty_s_flight,
* gs_sflight like line of gt_sflight.
DATA : gt_flight TYPE SORTED TABLE OF gty_s_flight
WITH NON-UNIQUE DEFAULT KEY. "index처리가 안된다는 단점이 있음.
*&---------------------------------------------------------------------*
*& Report ZBC400_01_PKGSIZE
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zbc400_01_pkgsize.
TYPES : BEGIN OF gty_s_flight,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
seatsmax TYPE sflight-seatsmax,
seatsocc TYPE sflight-seatsocc,
END OF gty_s_flight.
TYPES : gty_t_flight TYPE STANDARD TABLE OF gty_s_flight
WITH NON-UNIQUE DEFAULT KEY.
DATA : gt_flight TYPE gty_t_flight,
gs_flight LIKE LINE OF gt_flight.
PARAMETERS : pa_fetch TYPE xfeld RADIOBUTTON GROUP grp DEFAULT 'X',
pa_loop TYPE xfeld RADIOBUTTON GROUP grp,
pa_size TYPE xfeld RADIOBUTTON GROUP grp,
pa_all TYPE xfeld RADIOBUTTON GROUP grp.
START-OF-SELECTION.
CASE 'X'.
WHEN pa_fetch.
PERFORM array_fetch CHANGING gt_flight.
WHEN pa_loop.
PERFORM select_loop CHANGING gt_flight.
WHEN pa_size.
PERFORM package_size CHANGING gt_flight.
WHEN pa_all.
PERFORM package_size CHANGING gt_flight.
cl_demo_output=>display( gt_flight ).
PERFORM select_loop CHANGING gt_flight.
cl_demo_output=>display( gt_flight ).
PERFORM array_fetch CHANGING gt_flight.
ENDCASE.
cl_demo_output=>display( gt_flight ).
*&---------------------------------------------------------------------*
*& Form ARRAY_FETCH
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
* <--P_GT_FLIGHT text
*&---------------------------------------------------------------------*
FORM array_fetch CHANGING ct_flight TYPE gty_t_flight.
DATA : lt_flight TYPE gty_t_flight,
ls_flight LIKE LINE OF lt_flight.
DATA : lv_percentage TYPE p LENGTH 3 DECIMALS 2.
CLEAR ct_flight. " changing을 쓸 때 클리어를 쓰는게 좋다
SELECT carrid connid fldate seatsmax seatsocc
FROM sflight
INTO TABLE lt_flight.
LOOP AT lt_flight INTO ls_flight.
lv_percentage = ls_flight-seatsocc / ls_flight-seatsmax * 100.
IF lv_percentage < 5.
APPEND ls_flight TO ct_flight.
ENDIF.
ENDLOOP.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form SELECT_LOOP
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
* <--P_GT_FLIGHT text
*&---------------------------------------------------------------------*
FORM select_loop CHANGING ct_flight TYPE gty_t_flight.
DATA : ls_flight TYPE gty_s_flight.
DATA : lv_percentage TYPE p LENGTH 3 DECIMALS 2.
CLEAR ct_flight.
SELECT carrid connid fldate seatsmax seatsocc
FROM sflight INTO ls_flight.
lv_percentage = ls_flight-seatsocc / ls_flight-seatsmax * 100.
IF lv_percentage < 5.
APPEND ls_flight TO ct_flight.
ENDIF.
ENDSELECT.
ENDFORM.
FORM package_size CHANGING ct_flight TYPE gty_t_flight.
DATA: lt_flight TYPE gty_t_flight,
ls_flight TYPE gty_s_flight,
lv_percentage TYPE p LENGTH 3 DECIMALS 2.
CLEAR ct_flight.
SELECT carrid connid fldate seatsmax seatsocc
FROM sflight INTO TABLE lt_flight
PACKAGE SIZE 100.
LOOP AT lt_flight INTO ls_flight.
lv_percentage = ls_flight-seatsocc / ls_flight-seatsmax * 100.
IF lv_percentage < 5.
APPEND ls_flight TO ct_flight.
ENDIF.
ENDLOOP.
ENDSELECT.
ENDFORM.
스탠다드 테이블을 ---로 복붙하는데 중복값을 허용하겠다는 의미
LIKE : 단일 형태
LIKE LINE OF : 테이블 형태
TYPE을 체크박스로
같은 목록안에 들어가는 경우의 이름은 AAA로 통일 시켜줘야 한다.
SELECT구문을 통해 필드를 가지고 왔을 때 필드 중에 몇 퍼센트를 사용하는지 분석