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

Looping with control

Former Member
0 Likes
980

Hello,

In va02/01(uses SAPMV45A) I have created a new button which fills up profit center for all inserted rows using the first row. My problem here is that it only fills up the ones actually seen on the screen. So I debugged a little and found out that at screen 4900 it loops with control TCTRL_U_ERF_AUFTRAG. But it only loops as many times as many rows are seen on the screen. So say, I can see 9 items, but there's 30. Then it only fills up that 9 rows, because my module is inside the loop at PAI, after the button is pressed.

Ok, I hacked it a little bit so that the top_line would equal current_line + 1. In that way I put the same module in PBO and fill another 9 rows, which gives me a total of 18 rows (2 times the rows I can see on my screen).

I can fill up the fields in xvbap, which then show me the fields on screen, but they are not actually filled.

Soo.. at screen 4900 my code goes:

LOOP WITH CONTROL TCTRL_U_ERF_AUFTRAG.
MODULE VBAP_UNTERLEGEN.
*{   INSERT
  MODULE ZFCODE_FILL.
*}   INSERT
....
ENDLOOP.

Here is MODULE ZFCODE_FILL.

  if fcode  = 'FILL' and not vbap-posnr is initial.
    data: prctr type prctr.

    read table xvbap index 1.
      prctr = xvbap-prctr.

    if vbap-prctr is initial.
      vbap-prctr = prctr.
    endif.

    LOOP AT SCREEN.
      CASE SCREEN-NAME.
        WHEN 'VBAP-PRCTR'.
          SCREEN-REQUEST = 1.
      ENDCASE.
      MODIFY SCREEN.
    ENDLOOP.
    
TCTRL_U_ERF_AUFTRAG-TOP_LINE = TCTRL_U_ERF_AUFTRAG-CURRENT_LINE + 1. (for PAI module)
endif.

How can I loop TCTRL_U_ERF_AUFTRAG so that all rows are looped not only the ones actually shown on screen?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
832

Hi Märteen,

You shouldn't be able to set values that are not displayed is a table control.

But you should be able to set XVBAP in PAI but only after the loop at tablecontrol.

I have to say that's kind of messy, but you already now that :).

hope it helps,

Edgar

3 REPLIES 3
Read only

Former Member
0 Likes
833

Hi Märteen,

You shouldn't be able to set values that are not displayed is a table control.

But you should be able to set XVBAP in PAI but only after the loop at tablecontrol.

I have to say that's kind of messy, but you already now that :).

hope it helps,

Edgar

Read only

0 Likes
832

Thanks, I will try that.

Read only

Former Member
0 Likes
832

I will close this for now, and if I find a solution, I will post here as well.