on 08-12-2009 7:55 PM
I have to print a ordinary classical report in this format.
I need print a report that material wise material text needs to be printed in tabular format.
Scenarios:
1. Material 12345 have 85 lines ,then first 60 lines to printed in left and balance 20 lines to be printed in the right,
2. Material 12345 have 140 lines then first 60 lines to be printed in left and next 60 lines to be printed in the right and
balance 20 lines printed in next page left.
Material Number : 12345
XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
" --> Page Break Here
Material Number : 12346
XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
PS please donot suggest to print using sapscript or smartform
a®
Hi,
You can try like below:
I suppose you would have all the lines in an internal table with text like below:
Now you can loop on this table and create two internal tables based on the number of lines you need to print on the right handside in the above example in loop after first six loop assign to the second internal table with index field like below:
oop on it_mat.
at new materail.
lv-cnt = 70.
endat.
if sy-tabix > 6.
move-corresponding it_mat to it_tab2.
it_tab2-sr = lv_cnt.
append it_tab2.
lv_cnt = lv_cnt + 10.
else.
move-corresponding it_mat to it_tab1.
append it_tab1.
endloop.
and then you can do like below to write on the screen:
loop on it_tab1.
at new material number.
lv_cnt = 70.
if lv_first is initial
lv-first = 'X'.
else.
new-page.
endif.
write:/1 Material Number.
endat.
write:/1 Material Text.
read table it-tab2 with key material = it-tab1-materail
sr = lv_cnt.
if sy-subrc = 0.
write:30 it_tab2-text.
lv_cnt = lv_cnt + 1.
endif.
endloop.
{code]
Regards,
Himanshu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thankyou All,
Problem solved by creating a output internal table with columns
data : begin of i_output_1 occurs 0.
data : matnr like mara-matnr.
data : mtext_1(40) type c,
data : mtext_2(40) type c,
data : end of i_output_1.
...
loop at i_output.
CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING
textline = i_output-mtext
DELIMITER = ' '
OUTPUTLEN = 40
TABLES
OUT_LINES = text_table
...
Fill the I_OUTPUT_1 table and Print with control statement AT END OF
Thanks
a®
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ARS,
I developed a scenario as your and figured out a solution .
I create a internal table with two fields.
text1 and text.
data of internal table t_test is as follows---->>>
text1 text
1 1
1 2
1 3
1 4
1 5
1 6
....
.....
....
....
1 80
2 1
2 2
2 3
2 4
2 5
2 6
......
......
......
......
2 140
lets assume t_test- text1 entries as ur material '1' and '2'.
and t_test-text entries as ur material text description lines, for material 1 there are 80 lines and for material 2 there are 140 lines.
I wrote following code to get the output as u desired.....i create and tested at our IDES, and gives output exactly the same as u wanted.
REPORT ZTEST_MYTEST1.
data: begin of t_test occurs 0,
text1 type i,
text type i,
end of t_test.
data: wa_test like t_test.
DATA: L_TABIX TYPE SY-TABIX.
DATA: CNT TYPE I.
do 2 times.
wa_test-text1 = wa_test-text1 + 1.
CLEAR wa_test-text.
IF wa_test-text1 = 1.
do 80 TIMES.
wa_test-text = wa_test-text + 1.
APPEND wa_test to t_test.
enddo.
ELSE.
do 140 TIMES.
wa_test-text = wa_test-text + 1.
APPEND wa_test to t_test.
enddo.
ENDIF.
ENDDO.
*****Till Now i just created a internal table as ur format and filled it with similar kind of data, now lets see the code to output*******
clear wa_test.
loop at t_test into wa_test.
CNT = CNT + 1.
at new text1.
CLEAR CNT.
CNT = CNT + 1.
NEW-PAGE.
BACK.
write : wa_test-text1.
ULINE.
ENDAT.
* RESERVE 60 LINES.
IF CNT <= 60.
WRITE /1(10) wa_test-text.
IF CNT = 60.
BACK.
WRITE /.
WRITE /.
ENDIF.
ELSEIF CNT >= 61 AND CNT <= 120.
WRITE /13(10) wa_test-text.
IF CNT = 120.
NEW-PAGE.
BACK.
* WRITE /.
* WRITE /.
ENDIF.
ELSEIF CNT > 120.
WRITE /1(10) wa_test-text.
ENDIF.
endloop.
Copy the above program and run to see the output.
This will definitely resolve your issue.
Regards,
Akash Rana
Edited by: AKASH RANA on Aug 12, 2009 11:51 PM
Edited by: AKASH RANA on Aug 12, 2009 11:53 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
try something like this:
assuming you have a table for material texts IT_TEXT.
DATA: l_lines_p_page TYPE i value 60,
ll_right_line TYPE i.
DO.
"Loop reading left column
LOOP AT it_text into ls_text_left FROM 1 TO l_lines_p_page.
l_right_line = sy-tabix + l_lines_p_page.
"Read corresponding right column
CLEAR ls_text_right.
READ TABLE it_text into ls_text_right index l_right_line.
WRITE: ls_text_left,
space,
ls_text_right.
WRITE /.
ENDLOOP.
"Delete first N lines
DO l_lines_p_page TIMES.
DELETE it_text INDEX 1.
ENDDO.
IF it_text IS INITIAL.
CONTINUE. "Exit DO.
ENDIF.
ENDDO.
Hope can help you,
Frisoni
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
put two columns in your internal table.
while passing values (looping in the table) check the tabix or inserting number. if thats less than equal to 60 pass it in the first field and keep appending, if greater than 60 then keep updating that (rownumber- 60)th row passing the field into the 2nd field of the table.
reset the count when its 120( or even multiple of 60). again follow the same process.
hope this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I assume the lines are of fixed length or already correctly formatted in an internal table?
Rob
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Rob,
Lines are fixed length left = 40 right = 40
But internal table have length of 80 (Output table )
1234567890XXXXXXXXXX1234567890XXXXXXXXXX1234567890XXXXXXXXXX1234567890XXXXXXXXXX
needs to be
1234567890XXXXXXXXXX1234567890XXXXXXXXXX 1234567890XXXXXXXXXX1234567890XXXXXXXXXX
1234567890XXXXXXXXXX1234567890XXXXXXXXXX
1234567890XXXXXXXXXX1234567890XXXXXXXXXX
1234567890XXXXXXXXXX1234567890XXXXXXXXXX
a®s
Edited by: a®s on Aug 12, 2009 3:14 PM
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.