-----------------------------------------------------------------------------------------------------------
지금 M TYPE 프로그램을 공부하고 있습니다.
질문을 말씀 드리겠습니다.
테이블(ZSADBLO) 의 내용들이 테이블 컨트롤(TC_SADBLO)에 뿌려졌습니다.
테이블 컨트롤에는 테이블 내용들이 나타나게 됩니다.
나타난 내용을 변경한 후 실행을 누르게 되면 변경전 값이 다시 나타나게 됩니다.
제가 원하는 것은 테이블 컨트롤상에서 변경된 값이 실행을 누르게 되면 테이블에 저장이 되어
저장된 값이 다시 테이블 컨트롤에 나타나는 것입니다.
많은 분들의 답변 부탁 드립니다.
아래는 소스코드입니다.
-----------------------------------------------------------------------------------------------------------
PAO 부분
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
MODULE SET_TC_LINES.
LOOP AT IT_ZSADBLO INTO WA_ZSADBLO
WITH CONTROL TC_SADBLO.
MODULE MOVE_DATA.
ENDLOOP.
PAI 부분
PROCESS AFTER INPUT.
MODULE EXIT AT EXIT-COMMAND.
LOOP AT IT_ZSADBLO.
FIELD WA_ZSADBLO-MARK MODULE MODIFY_DATA ON REQUEST.
ENDLOOP.
MODULE USER_COMMAND_0100.
INCLUDE 프로그램들
~TOP
PROGRAM SAPMZINFO_1 MESSAGE-ID ZMESSAGE_SADBLO.
CONTROLS TC_SADBLO TYPE TABLEVIEW
USING SCREEN '0200'.
TABLES: ZSADBLO.
DATA: BEGIN OF WA_ZSADBLO,
MARK(1).
INCLUDE STRUCTURE ZSADBLO.
DATA: END OF WA_ZSADBLO.
DATA: IT_ZSADBLO LIKE TABLE OF WA_ZSADBLO.
DATA: OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE OK_CODE.
~O01
*&---------------------------------------------------------------------*
*& Include MZINFO_1O01 *
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'ZSTATUS'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module MOVE_DATA OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE MOVE_DATA OUTPUT.
MOVE-CORRESPONDING WA_ZSADBLO TO ZSADBLO.
ENDMODULE. " MOVE_DATA OUTPUT
*&---------------------------------------------------------------------*
*& Module SET_TC_LINES OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE SET_TC_LINES OUTPUT.
DESCRIBE TABLE IT_ZSADBLO LINES TC_SADBLO-LINES.
ENDMODULE. " SET_TC_LINES OUTPUT
~I01
*&---------------------------------------------------------------------*
*& Include MZINFO_1I01 *
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module EXIT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE EXIT INPUT.
CASE OK_CODE.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " EXIT INPUT
**&---------------------------------------------------------------------
**
**& Module SAVE_OK_CODE INPUT
**&---------------------------------------------------------------------
**
** text
**----------------------------------------------------------------------
**
*MODULE SAVE_OK_CODE INPUT.
*
* SAVE_OK = OK_CODE.
*
* CLEAR OK_CODE.
*
*ENDMODULE. " SAVE_OK_CODE INPUT
**&---------------------------------------------------------------------
**
**& Module FILL_ZSADBLO INPUT
**&---------------------------------------------------------------------
**
** text
**----------------------------------------------------------------------
**
*MODULE FILL_ZSADBLO INPUT.
*
* CASE OK_CODE.
* WHEN 'SEARCH'.
* SELECT SINGLE * FROM ZSADBLO WHERE SANUM = ZSADBLO-SANUM.
* ENDCASE.
*
*ENDMODULE. " FILL_ZSADBLO INPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
CASE OK_CODE.
WHEN 'SEARCH'.
* SELECT SINGLE * FROM ZSADBLO WHERE SANUM = ZSADBLO-SANUM.
CLEAR OK_CODE.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE IT_ZSADBLO
FROM ZSADBLO.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Module CHECK_SANUM INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE CHECK_SANUM INPUT.
SELECT SINGLE * FROM ZSADBLO WHERE SANUM = ZSADBLO-SANUM.
IF SY-SUBRC = 0.
MESSAGE S017.
ELSEIF SY-SUBRC <> 0.
MESSAGE S016.
CLEAR SY-SUBRC.
ENDIF.
ENDMODULE. " CHECK_SANUM INPUT
*&---------------------------------------------------------------------*
*& Module MODIFY_DATA INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE MODIFY_DATA INPUT.
* MARK초기화
* MARK 및 값처리
MOVE-CORRESPONDING ZSADBLO TO WA_ZSADBLO.
MODIFY IT_ZSADBLO FROM WA_ZSADBLO
INDEX TC_SADBLO-CURRENT_LINE.
ENDMODULE. " MODIFY_DATA INPUT
------------------------------------------------------------------------------------------------------------
댓글 4
-
Gerrard
2008.11.22 02:56
-
현준탱
2008.11.22 20:22
PROCESS AFTER INPUT.
MODULE EXIT AT EXIT-COMMAND.
LOOP AT IT_ZSADBLO.
FIELD WA_ZSADBLO-나이.
FIELD WA_ZSADBLO-MARK MODULE MODIFY_DATA ON REQUEST.
ENDLOOP.
MODULE USER_COMMAND_0100.
이렇게 나이를 추가하시고 MODULE 하나 추가하셔서 MODIFY 시켜주시면 될 것 같습니다^^;
-
튀밥
2008.11.25 17:32
Gerrard님과 현준탱님의 친절한 답변 감사드립니다.^^ -
초보자
2010.12.15 06:27
하나 배워갑니다.^^
PAI 부분에 TABLE CONTROL에 넣어주는 itab의 값들을 MODIFY 시켜줘야하지않을까요
스크린 필드에서 변경된값을 itab에 넣어주지않으면 변경되지않았으니 다시 PBO를 타고
기존의 값이 들어오는거 아닐까요???????