‎2006 Nov 22 7:32 AM
Hi friends,
I am trying to learn module pool programming, where in i got stuck up in a situation that, i want to delete, update, modify/insert the database table.
I have used a table control for that. i have inserted 4 buttons (exit E, updateU,deleteD,getdataG). Getdata and exit are working fine but how to make use of these update and delete. Please help me in this regard.....
Here is the code.......please make the neccesary changes
********This is the flow logic**********************
PROCESS BEFORE OUTPUT.
MODULE STATUS_1000.
*
LOOP AT IT_ITAB WITH CONTROL TCL.
MODULE COPY_DATA.
ENDLOOP.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1000.
MODULE EXIT.
LOOP AT IT_ITAB.
*MODULE READ_DATA.
ENDLOOP.
*********This is the code of my program***************
PROGRAM ZBADRI_SCREEN_PROG_EXMP10.
*CALL SCREEN 1000.
TABLES : ZOMEGA_EMP_DET.
CONTROLS : TCL TYPE TABLEVIEW USING SCREEN 1000.
DATA : BEGIN OF IT_ITAB OCCURS 0,
EMPNO TYPE ZEMPNO,
EMPNAME TYPE ZEMPNAME,
MOBNUM TYPE ZMOBNUM,
END OF IT_ITAB.
&----
*& Module EXIT INPUT
&----
text
----
module EXIT input.
CASE SY-UCOMM.
WHEN 'E'.
LEAVE PROGRAM.
WHEN 'G'.
SELECT EMPNO
EMPNAME
MOBNUM
FROM
ZOMEGA_EMP_DET INTO CORRESPONDING FIELDS OF TABLE IT_ITAB.
WHEN 'U'.
READ TABLE IT_ITAB WITH KEY IT_ITAB-EMPNO.
MOVE-CORRESPONDING IT_ITAB TO ZOMEGA_EMP_DET.
UPDATE ZOMEGA_EMP_DET FROM TABLE IT_ITAB.
ENDCASE.
endmodule. " EXIT INPUT
&----
*& Module COPY_DATA OUTPUT
&----
text
----
module COPY_DATA output.
MOVE-CORRESPONDING IT_ITAB TO ZOMEGA_EMP_DET.
endmodule. " COPY_DATA OUTPUT
&----
*& Module READ_DATA INPUT
&----
text
----
module READ_DATA input.
READ TABLE IT_ITAB.
MOVE-CORRESPONDING IT_ITAB TO ZOMEGA_EMP_DET.
CASE SY-UCOMM.
WHEN 'U'.
UPDATE ZOMEGA_EMP_DET FROM TABLE IT_ITAB.
ENDCASE.
endmodule. " READ_DATA INPUT
Points will be rewarded.
Regards
Badri
Message was edited by:
Badrinath Thiriveedhi
‎2006 Nov 22 7:36 AM
Check the answer in ur other thread and plz close this thread to avoid confusion.
Regards
- Gopi
‎2006 Nov 22 10:11 AM
in PAI do the foll thing .
loop with control tc_abc .
chain .
field : a ,
b,
c .
module update on chain-request .
endchain .
endloop .
whenever fields of ur table displayed in table control changes module update will be called .
do all ur processing here .