Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Table control Append Lines Problem after Pressing Enter Key

muhammad_sohail
Participant
0 Likes
936

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

5 REPLIES 5
Read only

Former Member
0 Likes
627

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

Read only

0 Likes
627

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  INPUT

module 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

Read only

0 Likes
627

Re: Table control Append Lines Problem after Pressing Enter Key

Read only

0 Likes
627

What have you written inside MODULE fill_data ???

Read only

0 Likes
627

Dear thx.

MODULE Fill_data, only takes header data, e.g; kunnar, date, etc. I am filling header data in it.

Regards,

Sohail