‎2007 Mar 01 8:51 AM
Hi,
I have a text field and a button in the screen.
the value in the text field in 1 initially.
my requirement is that when i press that button the value in the text field must be incremented by 1 each time.
can someone help me out with this please.
Thanks,
Supriya Manik.
‎2007 Mar 01 8:58 AM
<b>MODULE PBO.</b>
data : v_ince type i value '1'..
v_text = v_inc
<b>MODULE PAI.</b>
MODULE INCREMENT.
MODULE INCREMENT.
case sy-ucomm.
when 'PUSH1'.
v_inc = v_inc + 1.
v_field = v_inc.
endcase.
ENDMODULE.
‎2007 Mar 01 8:58 AM
<b>MODULE PBO.</b>
data : v_ince type i value '1'..
v_text = v_inc
<b>MODULE PAI.</b>
MODULE INCREMENT.
MODULE INCREMENT.
case sy-ucomm.
when 'PUSH1'.
v_inc = v_inc + 1.
v_field = v_inc.
endcase.
ENDMODULE.
‎2007 Mar 01 9:01 AM
Hi
I hope text field doesn't mean label, becuase you can change it.
U should replace the text field with a char variable and insert it in the screen setting the attribute ONLY OUTPUT, in this way the variable will be shown as a text field.
So in the user command you have to increment it:
MODULE USER_COMMAND.
CASE OK_CODE.
WHEN <BUTTON>. TEXT = TEXT + 1.
...........................................................
ENDMODULE.Max
‎2007 Mar 01 9:18 AM
i am having a condition like i have to increment it for 5 times
i have a internal table where i have some data.
according to the no. of records in the table i am incrementing it.
how can i do that.
‎2007 Mar 01 9:24 AM
hi,
if it depends on the no of records in your internal table.
then find out number of records in table using describe table statement to get no of records in the table and then increment the counter accordingly.
describe table itab line v_lines.
v_text = v_text + v_lines.
Hope this helps.
Regards,
Richa
‎2007 Mar 01 9:28 AM
MODULE PBO.
<b>describe table itab lines v_lines.</b>
data : v_ince type i value '1'..
v_text = v_inc
MODULE PAI.
MODULE INCREMENT.
MODULE INCREMENT.
case sy-ucomm.
when 'PUSH1'.
<b>if v_inc LE v_lines.</b>
v_inc = v_inc + 1.
v_field = v_inc.
<b>endif.</b>
endcase.
ENDMODULE.
‎2007 Mar 01 9:28 AM
the text box must be incremented v_lines number of times.
V_lines + v_text.
‎2007 Mar 01 9:44 AM
Hi,
you need to use Do..endo loop for the v_lines number of times and increment within the loop.
case sy-ucomm.
when 'PUSH1'.
<b>do v_lines times.</b>
v_inc = v_inc + 1.
<b>enddo.</b>
endcase.
Regards,
Saumya