2007 Jul 20 6:11 AM
hi experts,
i have an internal table which has some 10 to 20 records.while printing it it will print vertically i need it horizontally .what is the logic for it .
ex)
mat1
mat2
mat3
mat4
but i need like this
mat1,mat2,mat3,mat4
what shll i do .i have to make it in smartforms.
thanks in advance
mani
2007 Jul 20 6:14 AM
Hi
Read the Internal table with index.. and move the each record(field) into different varaibles and print those varaibles at the convenient place in smartform.
<b>Reward points for useful Answers</b>
Regards
Anji
hi experts,
i have an internal table which has some 10 to 20 records.while printing it it will print vertically i need it horizontally .what is the logic for it .
ex)
mat1
mat2
mat3
mat4
but i need like this
mat1,mat2,mat3,mat4
what shll i do .i have to make it in smartforms.
thanks in advance
mani
2007 Jul 20 6:14 AM
Hi
Read the Internal table with index.. and move the each record(field) into different varaibles and print those varaibles at the convenient place in smartform.
<b>Reward points for useful Answers</b>
Regards
Anji
2007 Jul 20 6:16 AM
Refer the following code:
types: begin of t_data,
COLUMN1 type c,
COLUMN2 type c,
COLUMN3 type c,
end of t_data.
data: i_data type table of t_data,
wa_data like line of i_data.
WA_DATA-COLUMN1 = '1'.
WA_DATA-COLUMN2 = 'a'.
WA_DATA-COLUMN3 = 'x'.
APPEND WA_DATA TO i_DATA.
clear: WA_DATA.
WA_DATA-COLUMN1 = '2'.
WA_DATA-COLUMN2 = 'b'.
WA_DATA-COLUMN3 = 'y'.
APPEND WA_DATA TO i_DATA.
clear: WA_DATA.
WA_DATA-COLUMN1 = '3'.
WA_DATA-COLUMN2 = 'c'.
WA_DATA-COLUMN3 = 'z'.
APPEND WA_DATA TO i_DATA.
clear: WA_DATA.
LOOP AT i_DATA INTO WA_DATA.
WRITE :/ WA_DATA-COLUMN1, WA_DATA-COLUMN2, WA_DATA-COLUMN3.
clear: WA_DATA.
ENDLOOP.
NEW-LINE.
FIELD-SYMBOLS : <FS_ANY> TYPE ANY.
DATA : COL_NO TYPE I VALUE 1.
DATA : ROW_NO TYPE I VALUE 1.
DATA : TOTAL_LINES TYPE I.
DATA : TOTAL_ROWS TYPE I.
DESCRIBE TABLE i_DATA LINES TOTAL_ROWS.
WHILE SY-INDEX <= TOTAL_ROWS.
DO.
READ TABLE i_DATA INTO WA_DATA INDEX ROW_NO.
IF SY-SUBRC = 0.
ASSIGN COMPONENT COL_NO OF STRUCTURE WA_DATA TO <FS_ANY>.
WRITE: <FS_ANY>.
ELSE.
EXIT.
ENDIF.
ROW_NO = ROW_NO + 1.
ENDDO.
COL_NO = COL_NO + 1.
ROW_NO = 1.
NEW-LINE.
ENDWHILE.
2007 Jul 20 6:37 AM
hi thanx for ur replies ...the problem is i dont know how many fields will be for each table .i am selecting an production oreder no and i am displaying the work centers in smartforms. the problem is work centers number may differ for each and every production order for one order they may be 10 work centers for another it may be 20 so what to do in this case .is there any possible way to add variabes dynamically ????
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |