10-10-2008 6:40 AM
Hi Gurus,
I am displaying records data in table control, I wanted to insert new record in last row of the table control.
I am using loop at screen with sel 'Mark' but it will open all column i wanted to open single row only to inserting record in table control.
Can any one suggest me properly.How i done this?
Regards,
Pravin
10-10-2008 6:51 AM
Hi,
This code may help u...
MODULE user_command_9001 INPUT.
WHEN 'INSERT'.
insert = 'X'.
ENDMODULE.
MODULE status_9001 OUTPUT.
"First get the no of rows
DESCRIBE TABLE it_rfqi.
"Open the lines
IF insert = 'X'.
sy-tfill = sy-tfill + 1.
APPEND ' ' TO it_rfqi.
insert = ' '.
ENDIF.
IF sy-tfill = 0.
tab1-lines = 1.
ELSE.
tab1-lines = sy-tfill.
ENDIF.
ENDMODULE. " STATUS_9001 OUTPUT
10-10-2008 6:58 AM
Your question is not very clear. If u are displaying data in a table control and u want to display one additional row to insert a new record. You can set the 'LINES' of your table control with no of lines in ur int. table + 1.
Pls do this code in ur PBO.
DESCRIBE TABLE g_tctrl_indir_itab LINES gv_filli.
tctrl_indir-lines = gv_filli + 1.
Regards
Sathar
10-10-2008 7:03 AM
Hi, Do do this you just disable the data in your table control and leave the blank lines as active.
To disable the table content:
IN PBO LOOP with control:
module set_screen_disable
endloop.
Set_screen_disable:
Loop at screen.
if screen-name = 'fld1'. screen-input = 0. modify screen. endif.
endloop.
The above code will disable the screen fields whenever you insert new row and make other fields ready for input.
Try .
Thanks.
Regards,
Jey
10-10-2008 7:09 AM
Hi pravin,
Check out the standard program DEMO_DYNPRO_TABCONT_LOOP_AT. it will be helpful.
For your problem you need to make sure that when user clicks on a button for new records at that event other records in the table control should be set to display.
this can be done by making screen-input = '0'.
loop at <tabctlrname>-cols into cols.
IF cols-screen-input = '0'.
cols-screen-input = '1'.
elseif cols-screen-input = '1'.
cols-screen-input = '0'.
the above is a sample code for display/change toggle button.
implements the same logic for your requirement, it will work.sel 'mark' is used for change or delete, for adding a row u need to append a blank row to the table control which shud be in change mode, rest all can be in display mode.
also try this,
Go to SE38.
Select Environment Menu ->Examples ->Controls Examples
You can find table control examples.
Amit
10-10-2008 7:23 AM
*when insert button is pressed
module user_command.
when 'insert'.
clear: wa.
insert wa into table itab." insert blank record in internal table
describe table itab lines tc-lines.
*to make this only line editable
in PBO
loop at itab into wa with table control tc
module xyz.
endloop.
module xyz.
if wa-<somefield> is initial.
loop at screen.
if screen-name cs 'wa-'
screen-input = 1.
endif.
endloop.
endif.
10-10-2008 8:06 AM
check whether you kept the module for insert in the loop, if it is keep the module outside the loop in PAI.
Thanks,
prakash