아래내용 만든후 수정하니 질문내용처럼 문제가 생겨 조언을 구하고자 질문을 올립니다.
1. 디버깅을 걸어보니
SELECT scarr~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.
이 내용에 데이터 들어가지 않네요.
그러다보니 출력내용이 아무것도 나오지 않습니다.
뭔가 문제인지 알려주세요.
2. call screen 100내용과 데이터 출력화면이 분리되어 나옵니다.
같이 합쳐서 나오게 할려면 어떻게 해야 하나요?
3.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-group1 = 'G1'.
IF s_carrid EQ 'X'.
screen-active = 0.
ELSE.
screen-active = 1.
ENDIF.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'G2'.
IF s_carrna EQ 'X'.
screen-active = 0.
ELSE.
screen-active = 1.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
위 내용이 전혀 작동이 않됩니다. 작동됐던 소스인데 다시 처음부터 하니 이상하게 작동이
안됩니다. 뭐가 문제인지 알려주세요.
*&---------------------------------------------------------------------*
*& Report ZTEST0004
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ztest0004.
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.
*----------------------------------------------------------------------*
* 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 MODIF ID g1.
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 MODIF ID g2.
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.
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.
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 s_carrid EQ 'X'.
screen-active = 0.
ELSE.
screen-active = 1.
ENDIF.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'G2'.
IF s_carrna EQ 'X'.
screen-active = 0.
ELSE.
screen-active = 1.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
*----------------------------------------------------------------------*
* Start of Selection *
*----------------------------------------------------------------------*
START-OF-SELECTION.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE itab_spfli
FROM spfli
WHERE carrid IN s_carrid.
SELECT scarr~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.
END-OF-SELECTION.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& TOP-OF-PAGE
*&---------------------------------------------------------------------*
TOP-OF-PAGE.
WRITE:/ sy-vline,
(10) 'CARRI-ID',
sy-vline.
SET LEFT SCROLL-BOUNDARY.
WRITE:(08) 'CARRI-NAME',
sy-vline,
(20) 'CONN-ID',
sy-vline,
(08) 'CITY-TO',
sy-vline,
(20) 'CITY-FROM',
sy-vline.
*END-OF-PAGE.
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.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MENUBAR'.
* SET TITLEBAR 'xxx'.
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
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.
==> CARRNAME 만 가져오면 안되겠죠
CARRID 도 같이 가져와야 itab_scarr에서
CARRID 로 CARRNAME 를 조회할 수 있겠죠
END-OF-SELECTION.
CALL SCREEN 100.
==> 조회된 결과를 WRITE 하면 되는데 100번 화면을 왜 CALL 했는지 모르겠네요.
TOP-OF-PAGE 이벤트의 LOOP 부분을 END-OF-SELECTION 이벤트에 적용하면 되겠죠
END-OF-SELECTION.
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.
==> 그리고 itab_scarr 를 LOOP 하는데..
실제 WRITE 는 itab 을 하는군요.
itab_scarr 과 itab_spfli 두 인터널테이블을 합쳐서
itab 에 결과를 다시 만들든지 아니면...
itab_scarr 을 loop 하든 itab_spfli 를 loop 하든
나머지 한쪽 인터널테이블에서 read table 문을 이용해서
현재 loop 적용중인 인터널테이블에 없는 필드를 가져와야 겠죠.
loop at screen 도 그렇고... parameters 부분의 modif id 부분도 그렇고
반대로 하셨군요. 이름 확인을...
IF screen-group1 = 'G1'.
IF s_carrid EQ 'X'
==> s_carrid -> p_carrid
IF screen-group1 = 'G2'.
IF s_carrna EQ 'X'.
==> s_carrna -> p_carna