‎2010 May 30 8:38 AM
Dear All,
I am working on table control taking input in my itab, It is working quite fine; except when I press enter on first line input it display the correct data, but when I press enter again It append the line again in my table control, when I presses more enter keys it appends more lines in my table control. I want to restrict my table control not to append extra lines when I press enter. How I can achieve this with the code.
My PAI and PBO code is as follows:
PROCESS BEFORE OUTPUT.
Loop at itab_tc WITH CONTROL tc CURSOR tc-current_line.
ENDLOOP.
* MODULE radio_selection.
* MODULE STATUS_1000.
* MODULE getmax_srno.
PROCESS AFTER INPUT.
* MODULE fill_data.
LOOP AT itab_tc.
Field itab_tc-matnr MODULE matnr.
Field itab_tc-maktx MODULE maktx.
Field itab_tc-meins MODULE meins.
Field itab_tc-menge MODULE menge.
Field itab_tc-kbetr MODULE kbetr.
Field itab_tc-total MODULE total.
ENDLOOP.
* MODULE get_texts.
* MODULE USER_COMMAND_1000.Thanks and Regards,
Sohail
‎2010 May 30 9:44 AM
HI Sohail,
In PAI
loob at itab.
" Declare your Fields here
module modify_tc
endloop.
in program.
module modify_tc.
describe table itab lines tc-lines.
if tc-lines ge tc-current_line.
modify itab index tc-current_line.
else.
append itab. " Append should be here only
endmodule.Cheerz
Ram
‎2010 May 30 10:14 AM
Thanks for your's kind reply,
I have implemented your's code, Now the problem is that when I press ENTER after entering the table control line(s), other lines of table control becomes disabled, I can't enter more lines in table control fields.
Now; My code Looks Like that:
PAI & PBO Code:
PROCESS BEFORE OUTPUT.
Loop at itab_tc WITH CONTROL tc CURSOR tc-current_line.
ENDLOOP.
MODULE radio_selection.
MODULE STATUS_1000.
MODULE getmax_srno.
PROCESS AFTER INPUT.
MODULE fill_data.
LOOP AT itab_tc.
Field itab_tc-matnr MODULE matnr.
Field itab_tc-maktx MODULE maktx.
Field itab_tc-meins MODULE meins.
Field itab_tc-menge MODULE menge.
Field itab_tc-kbetr MODULE kbetr.
Field itab_tc-total MODULE total.
MODULE modify_tc.
ENDLOOP.
MODULE get_texts.
MODULE USER_COMMAND_1000.Code For (Field itab_tc-matnr MODULE matnr.) & (Field itab_tc-maktx MODULE maktx.).... and other(s) looks like same.
module MATNR input.
MODIFY itab_tc INDEX tc-current_line.
endmodule. " MATNR INPUT
*----------------------------------------------------------------------*
module MAKTX input.
Select SINGLE maktx
FROM makt
INTO itab_tc-maktx
WHERE matnr = itab_tc-matnr
AND SPRAS EQ 'E'.
MODIFY itab_tc INDEX tc-current_line.
endmodule. " MAKTX INPUTmodule MODIFY_TC
module MODIFY_TC input.
describe table itab_tc lines tc-lines.
if tc-lines ge tc-current_line.
modify itab_tc index tc-current_line.
else.
append itab_tc.
endif.
endmodule.
Thanks and Regards,
Sohail
‎2010 May 31 2:10 PM
Re: Table control Append Lines Problem after Pressing Enter Key
‎2010 May 31 2:51 PM
‎2010 Jun 01 7:34 AM
Dear thx.
MODULE Fill_data, only takes header data, e.g; kunnar, date, etc. I am filling header data in it.
Regards,
Sohail