PARAMETERS : <파라메터명> TYPE <참조대상>,
<파라메터명> TYPE <참조대상>,
... ,
<파라메터명> TYPE <참조대상>.
네이밍 룰 : pa
+ 의미있는 이름
파라메터는 스크린에서 선언되는 변수
와 같다.
=
로 할당한다.옵션 설정 가능
DEFAULT
NO-DISPLAY
파라메터에 아무것도 할당하지 않을 시, 공백
이 할당된다.
파라메터 | 셀렉트옵션 | |
---|---|---|
선언문 | PARAMETERS: | SELECT-OPTIONS: |
구조 | 변수 | 인터널테이블 |
타입 | P | S |
WHERE조건 | = | IN |
할당 없음 | 무시 | 공백''할당됨 |
NO-EXTENSION
, NO INTERVAL
을 함께 사용하면 스크린에서 파라메터처럼 보인다.
IS INITIAL
/ IS NOT INITIAL
: 비어있다 / 데이터가 입력되었다
PARAMETERS : <체크박스명> AS CHECKBOX,
<체크박스명> AS CHECKBOX DEFAULT 'X'.
PARAMETERS : <라디오버튼명> RADIOBUTTON GROUP <그룹명>,
<라디오버튼명> RADIOBUTTON GROUP <그룹명>,
...
<라디오버튼명> RADIOBUTTON GROUP <그룹명>.
X
는 체크됨을 표시PARAMETERS : <리스트박스명> TYPE <참조대상> AS LISTBOX VISIBLE LENGTH 20,
<리스트박스명> TYPE <참조대상> AS LISTBOX VISIBLE LENGTH 20 DEFAULT 'FC' OBLIGATORY.
VISIBLE LENGTH <숫자>
필수. 리스트박스의 가로길이를 설정한다.DEFAULT
OBLIGATORY
등 옵션 사용 가능DATA : gv_carrname TYPE scarr-carrname,
gt_data LIKE TABLE OF SFLIGHT.
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE TEXT-t01.
PARAMETERS : pa_carr TYPE sflight-carrid DEFAULT 'LH',
pa_name LIKE gv_carrname NO-DISPLAY,
pa_chec1 AS CHECKBOX DEFAULT 'X',
pa_chec2 AS CHECKBOX,
pa_chec3 AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK bl1.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE gt_data
FROM sflight
WHERE carrid = pa_carr.
DATA : gv_carrname TYPE scarr-carrname,
gt_data LIKE TABLE OF SFLIGHT.
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE TEXT-t01.
PARAMETERS : pa_carr TYPE sflight-carrid DEFAULT 'LH',
pa_name LIKE gv_carrname NO-DISPLAY,
pa_chec1 AS CHECKBOX DEFAULT 'X',
pa_chec2 AS CHECKBOX,
pa_chec3 AS CHECKBOX DEFAULT 'X',
* 라디오버튼 : 같은 그룹 안에서, 단 하나만 체크된다.
* 디폴트 설정하지 않으면 첫번째 라디오버튼이 체크되어 표시된다.
pa_rb1 RADIOBUTTON GROUP rb1,
pa_rb2 RADIOBUTTON GROUP rb1,
pa_rb3 RADIOBUTTON GROUP rb2,
pa_rb4 RADIOBUTTON GROUP rb2,
pa_rb5 RADIOBUTTON GROUP rb2.
SELECTION-SCREEN END OF BLOCK bl1.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE gt_data
FROM sflight
WHERE carrid = pa_carr.
TABLES : sbuspart.
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE TEXT-t01.
PARAMETERS : pa_num TYPE sbuspart-buspartnum OBLIGATORY.
SELECT-OPTIONS : so_cont FOR sbuspart-contact.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME TITLE TEXT-t02.
PARAMETERS : pa_type TYPE sbuspart-buspatyp
AS LISTBOX VISIBLE LENGTH 20 DEFAULT 'FC'.
SELECTION-SCREEN END OF BLOCK bl2.
SELECTION-SCREEN END OF BLOCK bl1.
DATA : gt_part TYPE TABLE OF sbuspart.
CLEAR : gt_part.
IF pa_type IS NOT INITIAL.
SELECT buspartnum contact contphono buspatyp
INTO CORRESPONDING FIELDS OF TABLE gt_part
FROM sbuspart
WHERE buspartnum EQ pa_num
AND contact IN so_cont
AND buspatyp EQ pa_type.
ELSE.
SELECT buspartnum contact contphono buspatyp
INTO CORRESPONDING FIELDS OF TABLE gt_part
FROM sbuspart
WHERE buspartnum EQ pa_num
AND contact IN so_cont.
ENDIF.
cl_demo_output=>display( gt_part ).
TABLES : sflight.
SELECTION-SCREEN BEGIN OF BLOCK bl_fli WITH FRAME TITLE TEXT-t02.
PARAMETERS : pa_carr TYPE sflight-carrid OBLIGATORY,
pa_conn TYPE sflight-connid.
SELECTION-SCREEN END OF BLOCK bl_fli.
**********
DATA : gs_sflight TYPE sflight,
gt_sflight LIKE TABLE OF gs_sflight.
IF pa_conn IS NOT INITIAL.
SELECT carrid connid
INTO CORRESPONDING FIELDS OF TABLE gt_sflight
FROM sflight
WHERE carrid = pa_carr
and connid = pa_conn.
ELSE.
SELECT carrid connid
INTO CORRESPONDING FIELDS OF TABLE gt_sflight
FROM sflight
WHERE carrid = pa_carr.
** 케이스문인 경우 *
*CASE pa_conn.
* WHEN '0000'.
*ENDCASE.
ENDIF.
TABLES : sbuspart.
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE TEXT-t01.
PARAMETERS : pa_bus TYPE sbuspart-buspartnum OBLIGATORY.
SELECT-OPTIONS : so_con FOR sbuspart-contact NO INTERVALS LOWER CASE.
PARAMETERS : pa_rb_ta RADIOBUTTON GROUP ib1 DEFAULT 'X',
pa_rb_fc RADIOBUTTON GROUP ib1.
SELECTION-SCREEN END OF BLOCK bl1.
DATA : gs_sbus TYPE sbuspart,
gt_sbus LIKE TABLE OF gs_sbus,
gv_sbus TYPE sbuspart-buspatyp.
CLEAR : gs_sbus.
REFRESH : gt_sbus.
CASE 'X'.
WHEN pa_rb_ta.
gv_sbus = 'TA'.
WHEN pa_rb_fc.
gv_sbus = 'FC'.
ENDCASE.
SELECT buspartnum contact contphono buspatyp
INTO CORRESPONDING FIELDS OF TABLE gt_sbus
FROM sbuspart
WHERE buspartnum = pa_bus
AND contact IN so_con
AND buspatyp = gv_sbus.
cl_demo_output=>display( gt_sbus ).
TABLES : sbuspart.
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE TEXT-t01.
PARAMETERS : pa_num TYPE sbuspart-buspartnum OBLIGATORY.
SELECT-OPTIONS : so_cont FOR sbuspart-contact NO INTERVALS LOWER CASE.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME TITLE TEXT-t02.
PARAMETERS : pa_ta RADIOBUTTON GROUP ib1 DEFAULT 'X',
pa_fc RADIOBUTTON GROUP ib1.
SELECTION-SCREEN END OF BLOCK bl2.
SELECTION-SCREEN END OF BLOCK bl1.
DATA : gt_part TYPE TABLE OF sbuspart,
* [개념] 반드시 스트럭처를 선언할 필요는 없다.
gv_sbus TYPE sbuspart-buspatyp.
* [개념] 변수는 연관있는 테이블의 필드타입을 참조한다.
* [개념] 유지보수를 위해 직접 고정길이를 선언(빌트인 타입 선언)하지 않는다.
CLEAR : gt_part.
CASE 'X'.
WHEN pa_ta.
gv_sbus = 'TA'.
WHEN pa_fc.
* [개념] WHEN OTHERS pa_rb_fc. 도 사용 가능 *
gv_sbus = 'FC'.
ENDCASE.
SELECT buspartnum contact contphono buspatyp
INTO CORRESPONDING FIELDS OF TABLE gt_part
FROM sbuspart
WHERE buspartnum EQ pa_num
AND contact IN so_cont
* contact NOT IN so_cont ---> [개념] NOT 사용 가능 *
AND buspatyp EQ gv_sbus.
cl_demo_output=>display( gt_part ).
* 0714 실습 - 리스트박스 *
***** 스크린 생성 *****
TABLES : sbook.
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE TEXT-t01.
PARAMETERS : pa_carr TYPE sbook-carrid OBLIGATORY DEFAULT 'AA'.
SELECT-OPTIONS : so_conn FOR sbook-connid OBLIGATORY.
PARAMETERS : pa_cuty TYPE sbook-custtype OBLIGATORY AS LISTBOX VISIBLE LENGTH 30.
SELECT-OPTIONS : so_fldt FOR sbook-fldate DEFAULT sy-datum,
so_bkid FOR sbook-bookid,
so_cuid FOR sbook-customid NO-EXTENSION NO INTERVALS.
SELECTION-SCREEN END OF BLOCK bl1.
***** 인터널테이블 생성 및 데이터 저장 *****
DATA : BEGIN OF gs_sbook,
carrid TYPE sbook-carrid,
connid TYPE sbook-connid,
fldate TYPE sbook-fldate,
bookid TYPE sbook-bookid,
customid TYPE sbook-customid,
custtype TYPE sbook-custtype,
invoice TYPE sbook-invoice,
class TYPE sbook-class,
END OF gs_sbook,
gt_sbook LIKE TABLE OF gs_sbook,
gv_tabix TYPE sy-tabix.
CLEAR : gs_sbook.
REFRESH : gt_sbook.
SELECT carrid connid fldate bookid customid custtype invoice class
INTO CORRESPONDING FIELDS OF TABLE gt_sbook
FROM sbook
WHERE carrid = pa_carr
AND connid IN so_conn
AND custtype = pa_cuty
AND fldate IN so_fldt
AND bookid IN so_bkid
AND customid IN so_cuid.
***** 에러체크 *****
IF sy-subrc <> 0.
WRITE : 'Data not found'.
STOP.
ENDIF.
***** 데이터 변경 *****
LOOP AT gt_sbook INTO gs_sbook.
gv_tabix = sy-tabix.
CASE gs_sbook-invoice.
WHEN 'X'.
gs_sbook-class = 'F'.
MODIFY gt_sbook FROM gs_sbook INDEX gv_tabix
TRANSPORTING class.
ENDCASE.
ENDLOOP.
***** 확인 *****
cl_demo_output=>display( gt_sbook ).
TABLES : sflight, sbook.
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE TEXT-t01.
PARAMETERS : pa_carr TYPE sflight-carrid OBLIGATORY.
SELECT-OPTIONS : so_conn FOR sflight-connid OBLIGATORY.
PARAMETERS : pa_pltp TYPE sflight-planetype AS LISTBOX VISIBLE LENGTH 20.
SELECT-OPTIONS : so_bkid FOR sbook-bookid,
so_csty FOR sbook-custtype NO-EXTENSION NO INTERVALS.
SELECTION-SCREEN END OF BLOCK bl1.
DATA : BEGIN OF gs_fli,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
planetype TYPE sflight-planetype,
paymentsum TYPE sflight-paymentsum,
currency TYPE sflight-currency,
bookid TYPE sbook-bookid,
customid TYPE sbook-customid,
custtype TYPE sbook-custtype,
class TYPE sbook-class,
order_date TYPE sbook-order_date,
agencynum TYPE sbook-agencynum,
END OF gs_fli,
gt_fli LIKE TABLE OF gs_fli,
gv_planetype TYPE sflight-planetype,
gv_tabix TYPE sy-tabix.
CLEAR : gs_fli.
REFRESH : gt_fli.
IF gs_fli-planetype IS NOT INITIAL.
SELECT a~carrid a~connid a~fldate a~planetype a~paymentsum a~currency
b~bookid b~customid b~custtype b~class b~order_date b~agencynum
INTO CORRESPONDING FIELDS OF TABLE gt_fli
FROM sflight AS a
INNER
JOIN sbook AS b
ON a~carrid EQ b~carrid AND a~connid EQ b~connid AND a~fldate EQ b~fldate
WHERE a~carrid = pa_carr
AND a~connid IN so_conn
AND a~planetype = pa_pltp
AND b~bookid IN so_bkid
AND b~custtype IN so_csty.
ELSE.
SELECT a~carrid a~connid a~fldate a~planetype a~paymentsum a~currency
b~bookid b~customid b~custtype b~class b~order_date b~agencynum
INTO CORRESPONDING FIELDS OF TABLE gt_fli
FROM sflight AS a
INNER
JOIN sbook AS b
ON a~carrid EQ b~carrid AND a~connid EQ b~connid AND a~fldate EQ b~fldate
WHERE a~carrid = pa_carr
AND a~connid IN so_conn
AND b~bookid IN so_bkid
AND b~custtype IN so_csty.
ENDIF.
IF sy-subrc <> 0.
WRITE : 'Data not found'.
STOP.
ENDIF.
LOOP AT gt_fli INTO gs_fli.
gv_tabix = sy-tabix.
CASE 'B'.
WHEN gs_fli-custtype.
gs_fli-class = 'C'.
MODIFY gt_fli FROM gs_fli INDEX gv_tabix TRANSPORTING class.
ENDCASE.
ENDLOOP.
cl_demo_output=>display( gt_fli ).