cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

loop at itab

Former Member
0 Likes
1,424

Hi experts,

Iam trying to display report like this.


fld1                   fld2                     fld3
---------------------------------------------------------
WQIYDGIWEUDOIUWQL      Site Management          shorttext
                       Material Management      shorttext
                       Quality Management       shorttext
---------------------------------------------------------

The above details are in one row.

fld2 details are in one ITAB1(since many rows are there).

fld3 details are in one itab2(since many rows are there).

While iam looping the above tables, iam getting like this.


fld1                   fld2                     fld3
---------------------------------------------------------
WQIYDGIWEUDOIUWQL      Site Management          
                       Material Management      
                       Quality Management       shorttext
                                                shorttext
                                                shorttext
---------------------------------------------------------

Iam getting some space at FLD3.How can i move up that FLD3 values? Here is my code.

itab1(fld2 see above)


LOOP AT T_DET.
    LOOP AT T_LONG WHERE QMNUM = T_DET-QMNUM.
          FCOUNT = FCOUNT + 1.
          IF FCOUNT = 1.           " IF IT IS FIRST ROW
            <b>WRITE: 42(25) T_LONG-LTEXT.</b>
          ELSE.
            <b>WRITE:/42(25) T_LONG-LTEXT.</b>
          ENDIF.        
        ENDLOOP.

itab2(fild 3)


        SCOUNT = 0.
        LOOP AT ITAB WHERE QMNUM = T_DET-QMNUM.
          SCOUNT = SCOUNT + 1.
          IF SCOUNT EQ 1.
            <b>WRITE:110(80) ITAB-DESC.</b>
          ELSE.
           <b> WRITE:/110(80) ITAB-DESC.</b>
          ENDIF.          
        ENDLOOP.
 ENDLOOP.

Can any one tell me where to make changes?

reward guaranteed

kaki

View Entire Topic
Former Member
0 Likes

Hi Kaki,

1. This kind of logic won't give desired output

reason : we cannot GO BACK to Previous Line

after writing some data.

2. hence, we need to use some different

logic

3. The logic would be something like this :

(there are 3 itabs)

(delcare one more itab LINEITAB having

only one field of length say 100 characters,

for printing purpose - first we will

write the data into this intenal table field,

in the loops, AFTER THAT, we will actuallly WRITE

on screen)

Loop at Itab1.

refresh lineitab.

Write field to Lineitab. (at some position)

Loop at itab2.

Write field to lineitab (at desired positoni)

append lineitab.

endloop.

Loop at itab3.

Read Lineitab index 1 (2,3,4,..)

Write field to lineitab (at desired positoni)

modify lineitab.

endloop.

Endloop.

4. My point is that directly on screen we

cannot WRITE.

5. Instead we should use some INTERMEDIATE

INTERNAL TABLE.

We should put values in this first.

then we should write this LINEITAB.

regards,

amit m.