03-02-2007 1:53 PM
Hi,
I have one table control i am displaying data into table control ,
my problem is : i want to display data into read mode in table control.
but when i click on insert button on the same screen i want one blank line should inserted into table control , then i want to insert some data into table control on that row , when i click the save button . the new data inserted into the table control is insert that data into ztable ,
please give me solution
main problen is how can know inserted line in table control and pass that data into ztable.
03-02-2007 2:01 PM
Check out these Demo Programs
RSDEMO_TABLE_CONTROL
DEMO_DYNPRO_TABLE_CONTROL_1
DEMO_DYNPRO_TABLE_CONTROL_2
RSDEMO_TABLE_CONTROL
RSDEMO02
03-02-2007 2:07 PM
Hi,
Please check this sample code.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK.
WHEN 'INSERT'.
READ TABLE TC-COLS INTO COL WITH KEY SCREEN-INPUT = '1'.
IF SY-SUBRC = 0.
LOOP AT I_BINLOC INTO ZMBINLOC WHERE ZMARK = 'X'.
CLEAR ZMBINLOC.
INSERT ZMBINLOC INTO I_BINLOC INDEX SY-TABIX.
ENDLOOP.
DESCRIBE TABLE I_BINLOC LINES TC-LINES.
ENDIF.
WHEN 'SAVE'.
SORT I_BINLOC ASCENDING BY WERKS LGORT ZBINLOC.
DELETE ADJACENT DUPLICATES FROM I_BINLOC.
IF NOT I_DELETE[] IS INITIAL.
DELETE ZMBINLOC FROM TABLE I_DELETE.
ENDIF.
MODIFY ZMBINLOC FROM TABLE I_BINLOC.
IF SY-SUBRC = 0.
MESSAGE S899(BD) WITH TEXT-002.
ENDIF.
...
ENDCASE.
Regards,
Ferry Lianto
03-02-2007 4:47 PM
Hi,
When you create a table control then loop of that control should be done in the PBO and PAI of flow logic.
**TO update the internal table entered in the table control.
PAI:
loop at itab.
module field_name.
endloop.
Module field_name.
if wa_itab-selec = X.
append itab from wa_itab .
end module.
**To display the appended list on the screen.
PBO:
LOOP AT itab INTO wa_itab
WITH CONTROL tc_itab
CURSOR tc_itab-current_line.
IF you need any validation.
create a module for validation.
ENDLOOP.
Br,
Laxmi
03-02-2007 4:53 PM
Hi,
Follow the below logic,
PROCESS BEFORE OUTPUT.
MODULE STATUS_0001.
MODULE POPULATE_TABLE_CONTROL. --> Get the data from table store in
ITAB
LOOP AT GT_CTRL_LP_D516 INTO GS_WA_CTRL_LP_D516
WITH CONTROL CTRL_LP_D516
CURSOR CTRL_LP_D516-CURRENT_LINE.
The following module moves data to control
MODULE MOVE_TO_CONTROL.--> Move data from ITAB to table control
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT GT_CTRL_LP_D516.
ENDLOOP.
MODULE EXIT AT EXIT-COMMAND.
MODULE USER_COMMAND_0001. --> Here you have to take out the values from table control and update database table
Reward points if helpful.
Thanks and regards,
Mallareddy Rayapureddy,
Munich, Germany.