REPORT ztest0004_1 MESSAGE-ID zfi.
TABLES: spfli, scarr.
DATA: BEGIN OF itab_spfli OCCURS 0.
INCLUDE STRUCTURE spfli.
DATA: END OF itab_spfli.
DATA: BEGIN OF itab_scarr OCCURS 0.
INCLUDE STRUCTURE scarr.
DATA: END OF itab_scarr.
DATA : BEGIN OF itab OCCURS 0,
carrid LIKE spfli-carrid,
carrname LIKE scarr-carrname,
connid LIKE spfli-connid,
cityto LIKE spfli-cityto,
cityfrom LIKE spfli-cityfrom,
END OF itab.
DATA: ok_code LIKE sy-ucomm.
DATA : l_cnt TYPE i.
*----------------------------------------------------------------------*
* Selection Screen
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(12) text-002 FOR FIELD p_carrid.
SELECTION-SCREEN POSITION 32.
PARAMETERS : p_carrid AS CHECKBOX USER-COMMAND pcarrid.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 20(12) text-003 FOR FIELD p_carna.
SELECTION-SCREEN POSITION 40.
PARAMETERS : p_carna AS CHECKBOX USER-COMMAND pcarrname.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK bl1.
SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK bl2 WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_carrid FOR spfli-carrid MODIF ID g1.
SELECTION-SCREEN END OF BLOCK bl2.
SKIP 1.
SELECTION-SCREEN BEGIN OF BLOCK bl3 WITH FRAME TITLE text-003.
SELECT-OPTIONS: s_carrna FOR scarr-carrname NO INTERVALS NO-EXTENSION MODIF ID g2.
SELECTION-SCREEN END OF BLOCK bl3.
*----------------------------------------------------------------------*
* INITIALIZATION.
*----------------------------------------------------------------------*
INITIALIZATION.
s_carrid-sign = 'I'.
s_carrid-option = 'BT'.
s_carrid-low = 'AA'.
s_carrid-high = 'AB'.
APPEND s_carrid.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-group1 = 'G1'.
IF p_carrid EQ 'X'.
screen-active = 1.
ELSE.
screen-active = 0.
ENDIF.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'G2'.
IF p_carna EQ 'X'.
screen-active = 1.
ELSE.
screen-active = 0.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'SELECT'.
MESSAGE i001 WITH text-m01.
WHEN 'SELECTALL'.
MESSAGE i001 WITH text-m02.
ENDCASE.
*----------------------------------------------------------------------*
* Start of Selection *
*----------------------------------------------------------------------*
START-OF-SELECTION.
IF p_carrid EQ space.
p_carrid = '%'.
ENDIF.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE itab_spfli
FROM spfli
WHERE carrid IN s_carrid.
SELECT carrid carrname
INTO CORRESPONDING FIELDS OF TABLE itab_scarr
FROM scarr
FOR ALL ENTRIES IN itab_spfli
WHERE carrid = itab_spfli-carrid AND
carrname IN s_carrna.
LOOP AT itab_spfli.
* 1)
* MOVE-CORRESPONDING itab_spfli TO itab.
* CLEAR itab_scarr.
* READ TABLE itab_scarr WITH KEY carrid = itab_spfli-carrid.
* itab-carrname = itab_scarr-carrname.
*
* APPEND itab.
* CLEAR itab.
* 2)
CLEAR itab_scarr.
READ TABLE itab_scarr WITH KEY carrid = itab_spfli-carrid.
IF SY-SUBRC = 0.
itab-carrname = itab_scarr-carrname .
APPEND itab.
ENDIF.
CLEAR itab.
IF NOT itab_spfli[] IS INITIAL.
l_cnt = LINES( itab_spfli ).
ENDIF.
ENDLOOP.
END-OF-SELECTION.
* IF NOT itab[] IS INITIAL.
* SET PF-STATUS 'MENUBAR'.
* LOOP AT itab.
* WRITE:/ itab-carrid,
* itab-carrname,
* itab-connid,
* itab-cityfrom,
* itab-cityto.
*
* ENDLOOP.
* ENDIF.
IF NOT itab[] IS INITIAL.
SET PF-STATUS 'MENUBAR'.
LOOP AT itab.
WRITE:/ sy-vline,
(10) itab-carrid COLOR 5,
sy-vline,
(25) itab-carrname,
sy-vline,
(10) itab-connid,
sy-vline,
(20) itab-cityto,
sy-vline,
(20) itab-cityfrom,
sy-vline.
HIDE: itab-carrid,
itab-carrname,
itab-connid,
itab-cityto,
itab-cityfrom.
ENDLOOP.
ENDIF.
*&---------------------------------------------------------------------*
*& TOP-OF-PAGE
*&---------------------------------------------------------------------*
TOP-OF-PAGE.
WRITE: 45(29) sy-uline.
WRITE: /45 sy-vline.
WRITE: 'Selection Screen' COLOR 7.
WRITE: sy-vline.
WRITE: /45(29) sy-uline.
WRITE: /'COUNT : ' COLOR 4, l_cnt.
WRITE: / 'page_number : ' COLOR 5, sy-pagno.
WRITE: /.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
ULINE.
WRITE:/ sy-vline,
(10) 'CARRI-ID',
sy-vline.
SET LEFT SCROLL-BOUNDARY.
WRITE:(25) 'CARRI-NAME' CENTERED,
sy-vline,
(10) 'CONN-ID' CENTERED,
sy-vline,
(20) 'CITY-TO' CENTERED,
sy-vline,
(20) 'CITY-FROM' CENTERED,
sy-vline.
ULINE.
END-OF-PAGE.
* IF NOT itab[] IS INITIAL.
* SET PF-STATUS 'MENUBAR'.
*
* LOOP AT itab_scarr.
*
* WRITE:/ sy-vline,
* (10) itab-carrid,
* sy-vline,
* (08) itab-carrname,
* sy-vline,
* (20) itab-connid,
* sy-vline,
* (08) itab-cityto,
* sy-vline,
* (20) itab-cityfrom,
* sy-vline.
*
* ENDLOOP.
*
* ENDIF.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MENUBAR'.
SET TITLEBAR 'TITLE'.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'BACK' OR 'CANC' OR 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*******************************************************************
AT LINE-SELECTION.
*******************************************************************
AT LINE-SELECTION.
LOOP AT itab.
WRITE:/ sy-vline,
itab-carrid COLOR 5,
sy-vline,
itab-carrname,
sy-vline,
itab-connid,
sy-vline,
itab-cityto,
sy-vline,
itab-cityfrom,
sy-vline.
ENDLOOP.
1. 위 소스 중에
l_cnt = LINES( itab_spfli ).
디버깅을 걸어보니 값은 정확하게 들어가는데
결과출력하니 l_cnt(count)값이 0으로 출력되네요.
데이터출력건수(조회건수)를 넣을려고 하는데
뭐가 문제인지 알 수가 없네요,
보시고 답변부탁합니다.
2. 제공한 그림처럼 어떤 셀에 더블클릭하면 메시지창이 나오면 그에 대한 정보나오겠끔하고
싶은데 어떻게 해야 하는지 도저히 알 수가 없어서 질문을 드립니다.
제가 생각에는 at line selection, hide. message로 사용하면 될것같은데
감이 전혀 잡히지 않아서요..
자세한 설명부탁합니다.
댓글 2
-
도도마녀
2009.02.26 06:29
-
SAYA
2009.02.26 17:10
1.
LOOP AT itab_spfli.
.....
IF NOT itab_spfli[] IS INITIAL.
l_cnt = LINES( itab_spfli ).
ENDIF.
ENDLOOP
==> 이 구문은 아래처럼 하는게 좋을 것 같네요.
IF NOT itab_spfli[] IS INITIAL.
l_cnt = LINES( itab_spfli ).
LOOP AT ITAB_SPFLI
...
ENDLOOP.
ENDIF.
2. AT LINE-SELECTION 이벤트를 사용해야 합니다.
그리고 해당 라인을 더블클릭했을때 해당 라인 전체 데이터를 보여주는게 아니고
더블클릭한 부분의 값만 팝업으로 보여주는 것이라면
GET CURSOR ~ 구문으로 하는 것이 좋을 것 같네요.
1. 일단 위에 소스에서 왜 값이 출력이 안되는지는 돌려봐야 정확히 알듯하고요..(집이라소 -0-)
LOOP AT itab_spfli.
.....
IF NOT itab_spfli[] IS INITIAL.
l_cnt = LINES( itab_spfli ).
ENDIF.
ENDLOOP.
이렇게 조회건수를 loop문 안에서 반복적으로 구할 필요가 있나요?
루프문 밖에서
==> describe table itab_spfli lines l_cnt 이 한줄로 될것 같은데요
2. PICK 를 사용하시면 될 듯 한데요
pf-status에서 pick이 정의되어 있는지 확인하시고 없으시면 f2에 pick을 정의해 주시면 됩니다
그럼 해당 라인을 더블클릭하면 user-command에 pick이 들어올꺼고요 그때 팝업창 만들어서 띄워주시면 될 듯 합니다