2010 Jan 06 9:27 AM
Hi Experts,
How to Add new blank rows or records in the table control in editable mode ( it should be below the current records which are retrived from the database in the same page) after clicking on a "New" push button.
The retrieved data records from database should be in a displayed mode, and after clicking on the
"New" push button, the new blank records or rows should be in editable mode in the same page.
Please help me out.
Thanks in advance.
Ananth.
2010 Jan 07 8:16 AM
if you loop with control in PBO
you can just modify the attribute of table control to make the next row writable
and insert this new line to itab in PAI
if you loop at itab in PBO
just APPEND INITIAL LINE will work
hope this will help
2010 Jan 06 9:35 AM
Hi!
Your TC has an internal table.
You have to APPEND empty rows to this internal table, based on the actual visible rowcount and the maximum displayable rowcount.
Regards
Tamá
2010 Jan 06 9:36 AM
when click on the NEW button
loop ur internal table and later at the required postion append balnk line into your internal table and modify that internal table
to insert a blank line just append blank work area in you internal table..
This will solve your problem..
Let me know if you need further info
Regards
Satish Boguda
2010 Jan 07 5:49 AM
Hi Satish and Tamas,
I am unable to get that logic..... can you help me out more elaborately.
That will be helpful.
Thanks in Advance,
Ananth.
2010 Jan 07 6:09 AM
Hi
[Check this Thread also for more info, Below is Modified Code for your requirement|]
in PBO
module isert_line. " TO insert a new blank Line.
loop at itab with control tc.
module modify_screen. " If you place your loop at screen in this module the row will be editable/changed to disabled mode
endlooop.
in program.
module insert_line.
data : tabix type sy-tabix.
read table itab with key mark = 'X'. " This gives the current Line selected
tabix = sy-tabix + 1. " At next line Initial line is inserted
loop at itab.
insert INITIAL LINE INTO itab index tabix.
clear tabix.
endloop.
endmodule
module modify_screen.
CASE ok.
WHEN 'MOD'. " Your Modify OK code
LOOP AT SCREEN.
IF jtab-mark = 'X'. " You can check here for Initial line
" if itab is initial . " here the work Area
IF screen-group1 = 'GRP'. " You Assign screen group for all fields you want editable
" Assign a GRP1 for all key fields and GRP2 for other fields
" if screen-group2 = 'GRP2'. " All the screens belong to GRP2 will be modified here
screen-input = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
clear jtab-mark.
modify jtab index sy-tabix. " This clears the Table control Row selector
" If you dont want just remove this.
ENDCASE.
endmodule.
in PAI
loop at itab.
module modify_tab.
" In Top include
data : begin of jtab occurs 0,
mark type c,
matnr type matnr,
maktx type maktx,
end of jtab.
" dont forget to enter JTAB-MARK in screenpainter at Table control W/SelColumn
in program
MODULE modify_tab.
DESCRIBE TABLE jtab LINES tc-lines.
MODIFY jtab INDEX tc-current_line. " This will transfer the Selected line back to internal table of program
ENDMODULE.
endloop.
" Happy new year to you ALL
" This is a tested program and working fine in my system
Cheerz
Ram
2010 Jan 07 7:28 AM
Hi
Try this code.It will solve your query.
MODULE CREATE_RECORD INPUT.
DATA: CURR TYPE I, IDX TYPE I.
IF OK_CODE = 'CREATE'.
CLEAR OK_CODE.
CURR = TAB_CTRL-CURRENT_LINE.
IDX = CURR + 1.
Adding blank line to the table control
INSERT INITIAL LINE INTO IT_tab INDEX IDX.
tab_ctrl-current_line = idx.
endif.
ENDMODULE.
Thanks
Khushboo
2010 Jan 07 8:16 AM
if you loop with control in PBO
you can just modify the attribute of table control to make the next row writable
and insert this new line to itab in PAI
if you loop at itab in PBO
just APPEND INITIAL LINE will work
hope this will help