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

Module Pool

Former Member
0 Likes
817

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
790

<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.

7 REPLIES 7
Read only

Former Member
0 Likes
791

<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.

Read only

Former Member
0 Likes
790

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

Read only

Former Member
0 Likes
790

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.

Read only

0 Likes
790

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

Read only

0 Likes
790

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.

Read only

Former Member
0 Likes
790

the text box must be incremented v_lines number of times.

V_lines + v_text.

Read only

0 Likes
790

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