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

List display

Former Member
0 Likes
340

Hi all,

In a classical report, after getting the display, i want to enter the value of a particular field. This is done with write statement,write:/ field1 input.

Then, with respect to the given input, the adjacent field has to display by adding the given value with another field value.

How to do the above...

Expecting reply...

2 REPLIES 2
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
313

Hi, take this example program. Enter a value and hit enter, the field next to the input field will change, enter another number into the intput field, the number next to it will change again. You will need to create the PF-status called MAIN. Enter the word "ENTER" in the green check mark, also put BACK, EXIT, and CANCEL for the other top teir buttons.



report zrich_0001 .

data: field1(10) type c.
data: field2(10) type c.

start-of-selection.

  set pf-status 'MAIN'.

  write: ' Input',  field1 input on no-gap, field2 .


at user-command.
  case sy-ucomm.
    when 'ENTER'.
      data: tmp_field1(10) type c.
      data: tmp_field2(10) type c.
      read current line field value field1 into tmp_field1.
      read current line field value field2 into tmp_field2.
      tmp_field2 = tmp_field2 + tmp_field1.
      modify current line field value field2 from tmp_field2.
  endcase.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
313

hi Obuli,

code in the at line-selection event or at user-command event.

you can read the current value from the list using either

GET CURSOR FIELD <FIELD> VLAUE <VARIABLE>

or

using system field SY-LISEL, and then reading the value with offset.

after necessary calculation, modify the line using command

MODIFY CURRENT LINE FIELD VALUE <FILED> FROM <VARIABLE>.

Hope this answers your question.

Sajan.