TABLE CONTROL 에서 어떻게 SE16N 처럼 행추가 ,행삭제를 실현할수 있나요?
참고 소스 부탁드립니다~~~~~~~
* e-abap님에 의해서 게시물 복사되었습니다 (2010-01-09 13:44)
* e-abap님에 의해서 게시물 이동되었습니다 (2010-01-09 13:55)
댓글 4
-
요요
2009.12.30 19:36
-
처음처럼
2009.12.30 19:43
감사합니다 ^^ -
whdrms11
2009.12.31 02:39
음,. 위에 방법으로 하시면 아마 맨밑 Line 으로만 추가가 될꺼 라고 보는데요..
현재 커서의 위치에 라인을 추가 해주시고 싶으시면.
DATA : GV_CURSOR TYPE I,
GV_FIELD(20).
선언해 주시고,
*&---------------------------------------------------------------------*
*& Module GET_CURSOR_TABLE_CTRL INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE GET_CURSOR_TABLE_CTRL INPUT.
DATA : LV_STEPL LIKE SY-STEPL.
GET CURSOR FIELD GV_FIELD.
GET CURSOR LINE LV_STEPL.
IF LV_STEPL = '0'.
LV_STEPL = '1'.
ENDIF.
LV_STEPL = LV_STEPL + TC_0100-TOP_LINE - 1.
GV_CURSOR = LV_STEPL.
ENDMODULE. " GET_CURSOR_TABLE_CTRL INPUT
*&---------------------------------------------------------------------*
*& Module SET_CURSOR_TABLE_CTRL OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE SET_CURSOR_TABLE_CTRL OUTPUT.
READ TABLE ITAB INDEX GV_CURSOR.
IF SY-SUBRC = 0.
SET CURSOR FIELD GV_FIELD LINE GV_CURSOR.
ENDIF.
ENDMODULE. " SET_CURSOR_TABLE_CTRL OUTPUT
SCREEN.
PROCESS BEFORE OUTPUT.
MODULE status_0100.
MODULE tc_change_tc_attr.
LOOP AT itab
INTO st
WITH CONTROL tc
CURSOR tc-current_line.
ENDLOOP.
* CURSOR
MODULE SET_CURSOR_TABLE_CTRL. <-----요거 추가 해주시구~
PROCESS AFTER INPUT.
MODULE exit AT EXIT-COMMAND.
LOOP AT itab.
CHAIN.
FIELD st-field1.
FIELD st-field2.
FIELD st-field3.
FIELD st-field4.
MODULE tc_modify ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
* CURSOR
MODULE GET_CURSOR_TABLE_CTRL. <------요거 추가해주시구요~
MODULE user_command.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND INPUT
*&---------------------------------------------------------------------*
MODULE user_command INPUT.
DATA : LS_ITAB LIKE ITAB. <---요거 선언하시구~
CASE g_okcode.
WHEN 'CREATE'. " New Line insert
INSERT LS_ITAB <-- 요렇게 바꿔주시면 원하는 라인에 라인추가 가능합니다.
INTO ITAB LS_ITAB 에 값을 넣어서 추가 하실수도 있구요.
INDEX GV_CURSOR.
WHEN 'DELETE'.
DELETE itab INDEX tc-current_line.
ENDCASE.
CLEAR g_okcode.
ENDMODULE. " USER_COMMAND INPUT
-
요요
2009.12.31 02:52
se16n 에서 위에 표시된 아이콘은 추가 아이콘 입니다.
그 옆에 있는 '+' 있는 것이 삽입이구요.
inserr line 기능에는 whdrms11님 말씀처럼 하시면 될 거예요.
[Source code]
DATA : g_okcode TYPE syucomm.
DATA : BEGIN OF st,
field1 TYPE c LENGTH 3,
field2 TYPE c LENGTH 4,
field3 TYPE c LENGTH 5,
field4 TYPE c LENGTH 6,
END OF st,
itab LIKE TABLE OF st.
CONTROLS tc TYPE TABLEVIEW USING SCREEN 100.
START-OF-SELECTION.
APPEND 'ABCDEFGHIJKLMN' TO itab.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAIN0100'.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module EXIT INPUT
*&---------------------------------------------------------------------*
MODULE exit INPUT.
LEAVE TO SCREEN 0.
ENDMODULE. " EXIT INPUT
*----------------------------------------------------------------------*
* MODULE TC_1_CHANGE_TC_ATTR OUTPUT
*----------------------------------------------------------------------*
MODULE tc_change_tc_attr OUTPUT.
DESCRIBE TABLE itab LINES tc-lines.
ENDMODULE. "TC_1_CHANGE_TC_ATTR OUTPUT
*----------------------------------------------------------------------*
* MODULE TC_1_MODIFY INPUT
*----------------------------------------------------------------------*
MODULE tc_modify INPUT.
MODIFY itab
FROM st
INDEX tc-current_line.
ENDMODULE. "TC_1_MODIFY INPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND INPUT
*&---------------------------------------------------------------------*
MODULE user_command INPUT.
CASE g_okcode.
WHEN 'CREATE'. " New Line insert
CLEAR st.
APPEND st TO itab.
WHEN 'DELETE'.
DELETE itab INDEX tc-current_line.
ENDCASE.
CLEAR g_okcode.
ENDMODULE. " USER_COMMAND INPUT
[Process flow]
PROCESS BEFORE OUTPUT.
MODULE status_0100.
MODULE tc_change_tc_attr.
LOOP AT itab
INTO st
WITH CONTROL tc
CURSOR tc-current_line.
ENDLOOP.
PROCESS AFTER INPUT.
MODULE exit AT EXIT-COMMAND.
LOOP AT itab.
CHAIN.
FIELD st-field1.
FIELD st-field2.
FIELD st-field3.
FIELD st-field4.
MODULE tc_modify ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE user_command.
위 itab 으로 테이블 컨트롤 그리구요.
생성, 삭제 버튼 만드시구요.
대략적으로 위처럼 하시면 될 거예요.