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

loop with table control

Former Member
0 Likes
1,727

Hi All,

I have a querry regarding table control. In standard sap screen's flow logic there is 'LOOP WITH CONTROL D0127' statement. This statement will loop at that table control only for 8 Records in that table control, for the remaining records this statement will not get executed.

since sy-loopc will be 8(open lines of table control).

If i scroll down that table control that problem is getting solved, but i want it without scrolling down table control.

Help or suggestion regarding this will be greatly appreciated.

Thanks and regards,

Srinivasa.E

5 REPLIES 5
Read only

Former Member
0 Likes
908

Hi Srinivas,

Befor writing 'LOOP WITH CONTROL D0127', you have to find the number of rows in the itab using describe statement. Try do like this in flow logic.


process before output.
  module status_0100.
  loop with control D0127.
    module fill_table_control.
  endloop.
--
se38
module status_0100 output.
  describe table itab lines fill.
  D0127-lines = fill.
endmodule.

For more information please check standard program <b>DEMO_DYNPRO_TABCONT_LOOP</b> and <b>DEMO_DYNPRO_TABCONT_LOOP_AT</b>.

<i>Hope This Info Helps YOU.</i>

Regards,

Raghav

Read only

Former Member
0 Likes
908

Hi Raghav,

Thanks for your sugestion.

That screen is sap Standard screen i am not authorized to change the flow logic of that screen.

Is there any other method to view last record without scroling table control, that is when i fill that table control the last record should be visible to me.

Thanks and regards,

Srinivasa.E

Read only

0 Likes
908

Hi,

Hope it is not possible. Suppose if you have data for some 10K records , it would not possible to display all the records in the screenn with table contol , at the max we can drag the table control for the whole screen and we can display that many number only , for the other records <u>we have to scroll down</u> .

<i>Hope This Info Helps YOU.</i>

Regards,

Raghav

Read only

Former Member
0 Likes
908

Hi,

have a look at the demo -


> <b>RSDEMO02</b>.

This is perfect example for use of table control.

Mark Helpfull answers.

Regards.

Read only

Former Member
0 Likes
908

Hi

You can't do it, because the table control is like an internal table with only N rows where N is number of displayed rows.

So if you have designed only 8 rows in a table control by screen painter, the system variable SY-LOOPC'll be 8 and SY-STEPL'll be able to tha value from 1 to 8.

In this situation the LOOP WITH CONTROL statament can loop only 8 records of the internal table and the field CURRENT_LINE of table control is the number of the record of internal table is beeing read.

The rule to calculate CURRENT_LINE is:

<TC>-CURRENT_LINE = <TC>-TOP_LINE + SY-STEPL - 1.

If you want to read the remaining records you should do a reading out of LOOP of table control.

PROCESS PAI.

LOOP AT

MODULE READ_DISPLAYED_RECORDS.

ENDLOOP.

MODULE READ_OTHER_RECORDS.

MODULE READ_OTHER_RECORDS.

  • Reading records form 1 to TOP_LINE

DO.

IF SY-INDEX = <TC>-TOP_LINE. EXIT. ENDIF.

READ TABLE ITAB INDEX SY-INDEX.

ENDDO.

  • The first records not displayed:

REC = <TC>-TOP_LINE + SY-LOOPC.

DO.

READ TABLE ITAB INDEX REC.

IF SY-SUBRC <> 0. EXIT. ENDIF.

REC = REC + 1.

ENDDO.

ENDMODULE.

Max