on ‎2006 Jan 20 3:42 AM
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
Request clarification before answering.
Hi Kaki,
When you are looping on ITAB1 ( Fld2), if there are 3 records in ITAB1, then you are already on 3rd row when the loop of ITAB1 ends. After that you are looping on ITAB2 ( Fld3), so obviously when you say here write statement, that would come on the 3rd row or for that matter on the nth row ( where n is the no. of records in ITAB1 ( Fld2 ).
Please try the following code :
LOOP AT T_DET.
LOOP AT T_LONG WHERE QMNUM = T_DET-QMNUM. FCOUNT = FCOUNT + 1.
IF FCOUNT = 1. " IF IT IS FIRST ROW WRITE: 42(25) T_LONG-LTEXT.
ELSE.
WRITE:/42(25) T_LONG-LTEXT. ENDIF.
read table ITAB2 index fcount into wa_tab2 where <condition>.
if sy-subrc eq 0 and fcount = 1.
WRITE: 42(25) T_LONG-LTEXT.
ELSE.
WRITE:/42(25) T_LONG-LTEXT.
endif.
ENDLOOP.
endloop.
Best regards,
Prashant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.