‎2007 Dec 15 2:01 PM
8.REPORT ZSCREEN_PAINTER.
TABLES ZEMP_TAB.
DATA: ENO(20), NAME(20), AGE TYPE I, SAL TYPE I.
DATA: ITAB LIKE ZEMP_TAB OCCURS 0 WITH HEADER LINE.
CONTROLS TC TYPE TABLEVIEW USING SCREEN '100'.
SELECT * FROM ZEMP_TAB INTO TABLE ITAB.
CALL SCREEN 0100.
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE USER_COMMAND_0100 INPUT.
*AT USER-COMMAND.
*TEST = SY-UCOMM.
CASE SY-UCOMM.
WHEN 'SAVE'.
ITAB-ENO = ENO.
ITAB-NAME = NAME.
ITAB-AGE = AGE.
ITAB-SAL = SAL.
APPEND ITAB.
INSERT ZEMP_TAB FROM ITAB.
REFRESH CONTROL 'TC' FROM SCREEN '100'.
ENO = ''.
NAME = ''.
AGE = ''.
SAL = ''.
WHEN 'CANCEL'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'ZMP'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Module MOVE OUTPUT
&----
text
----
MODULE MOVE OUTPUT.
MOVE ITAB TO ZEMP_TAB.
ENDMODULE. " MOVE OUTPUT
I created a tcode for this screen.But this table control is empty.(no data).What is the error?But when execute this report it works.
‎2007 Dec 17 10:31 AM
Hai,
In the PBO of the screen 0100 you need to give
LOOP AT itab WITH CONTROL TC.
MODULE move.
ENDLOOP.
then only the values will flow from teh internal table itab to the structure in the screen ie . in this case zemp_tab.
and in the save module that you have written it will only save one record , which is in the header line of the itab.
You need to write INSERT zemp_tab FROM TABLE itab.
Thanks
Neeraj
‎2007 Dec 17 10:38 AM
also use in PAI
LOOP AT itab .
ENDLOOP.
If you are not using it in PAI, it will give you an error.