on 08-20-2008 4:10 AM
Hi All,
i would like to creat table in sap scripts. but my requirement
is that, tha table should be drawn dynamically based on the no of line items in the internal table.
for example if my internal table has 2 entries it should dynamically draw 2 lines in the table.
it should like below,
NO BANKNAME CHECK NO AMOUNT --> HEADER
1
2
3
Total
in this case it should draw only three lines and stop.
i have tried with Box commands but it was not working....
please let me know on this..
thanks in advavce...................
It is little tough drawing table lines dynamically,mostly it will create a problem when you are drawing horizontal line. Make sure you increment correctly basing on line spacing otherwise horizontal line will print on the text.
Test this example before applying on your script
Example:
1) create SAPscript with main window.
2) in text editor of main window place the following code(main window)
/: BOX XPOS '2.00'CM YPOS &Y_POS&CM WIDTH 0 TW HEIGHT '0.30'CM FRAME 10 TW
/: BOX XPOS '0.00'CM YPOS &Y_POS&CM WIDTH 0 TW HEIGHT '0.30'CM FRAME 10 TW
/: BOX XPOS '5.00'CM YPOS &Y_POS&CM WIDTH 0 TW HEIGHT '0.30'CM FRAME 10 TW
/: BOX YPOS &Y_POS&CM WIDTH 5 CM HEIGHT 0 CM FRAME 10 TW
/E HEAD
/: BOX YPOS &Y_POS&CM WIDTH 5 CM HEIGHT 0 CM FRAME 10 TW
3) create a print program to call your SAPscript
REPORT ztest_007 .
DATA: y_pos(3) TYPE c.
y_pos = '0'.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = 'Z_TEST07'
language = sy-langu.
DO 15 times.
Y_POS = Y_POS + '0.3'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
window = 'MAIN'.
ENDDO.
Y_POS = Y_POS + '0.3'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HEAD '
WINDOW = 'MAIN'.
CALL FUNCTION 'CLOSE_FORM'.
Note: Make sure to re-set Y_POS when data is overflowing to next page.
Close the thread once your question is answered.
Regards,
SaiRam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All
Thank you for the information
Will check and revert back to you..
Regards
Chaitanya.A
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
I did this thing recently ,,,,,,,,write this code in ur text element which is used to print heading
,,TEST,,,,,,,,,,,,UOM,,,,,,,,,,Results
POSITION XORIGIN '-5.8'CM YORIGIN '+2' CM
BOX WIDTH '15' CM HEIGHT '8' MM FRAME 10 TW INTENSITY 15
BOX XPOS '5' CM WIDTH 1 TW HEIGHT '8' MM FRAME 15 TW
BOX XPOS '10' CM WIDTH 1 TW HEIGHT '8' MM FRAME 15 TW
And write this code in the text element which is used for printing data...
POSITION YORIGIN '+8' MM
BOX WIDTH '15' CM HEIGHT '8' MM FRAME 10 TW
BOX XPOS '5' CM WIDTH 1 TW HEIGHT '8' MM FRAME 15 TW
BOX XPOS '10' CM WIDTH 1 TW HEIGHT '8' MM FRAME 15 TW
With Regards..
Always Learner
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you try this below code, here H is paragraph node
/E:MAIN_DATA
/:POSITION WINDOW
/:BOX XPOS '0' MM YPOS '0' MM WIDTH '200' MM HEIGHT '170' MM FRAME 10 TW
/:BOX XPOS '25' MM YPOS '0' MM WIDTH '0' MM HEIGHT '170' MM FRAME 10 TW
/:BOX XPOS '65' MM YPOS '0' MM WIDTH '0' MM HEIGHT '170' MM FRAME 10 TW
/:BOX XPOS '90' MM YPOS '0' MM WIDTH '0' MM HEIGHT '170' MM FRAME 10 TW
/:BOX XPOS '105' MM YPOS '0' MM WIDTH '0' MM HEIGHT '170' MM FRAME 10 TW
/:BOX XPOS '129' MM YPOS '0' MM WIDTH '0' MM HEIGHT '170' MM FRAME 10 TW
/:BOX XPOS '137' MM YPOS '0' MM WIDTH '0' MM HEIGHT '170' MM FRAME 10 TW
/:BOX XPOS '152' MM YPOS '0' MM WIDTH '0' MM HEIGHT '170' MM FRAME 10 TW
/:BOX XPOS '181' MM YPOS '0' MM WIDTH '0' MM HEIGHT '170' MM FRAME 10 TW
H:&wa_final-matnr& &wa_final-maktx& &wa_final-bismt& &wa_final-meins& &wa_final-labst(.0)& &wa_final-peinh& &wa_final-unit_price(C.0)& &wa_final-amount(C.0)& &wa_final-zmatkl&
call smartform in report like that
CALL FUNCTION 'OPEN_FORM'
EXPORTING
device = 'PRINTER'
dialog = ' '
form = 'ZMM_INVENTORY'
language = sy-langu
EXCEPTIONS
canceled = 1
device = 2
form = 3
OPTIONS = 4
unclosed = 5
mail_options = 6
archive_error = 7
invalid_fax_number = 8
more_params_needed_in_batch = 9
spool_error = 10
codepage = 11
OTHERS = 12.
IF sy-subrc <> 0.
ENDIF.
LOOP AT i_final INTO wa_final.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'MAIN_DATA'
window = 'MAIN'
EXCEPTIONS
element = 1
function = 2
type = 3
unopened = 4
unstarted = 5
window = 6
bad_pageformat_for_print = 7
spool_error = 8
codepage = 9
OTHERS = 10.
IF sy-subrc <> 0.
ENDIF.
ENDLOOP.
CALL FUNCTION 'CLOSE_FORM'.
as per the above code it is dynamically draw the line item s data.
this is helpful you
Regards,
Bhupal.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create a Main window with only 2 lines, Give a BOX command it will give u Border for entire Main window. For giving vertical lines Syntax is
/:BOX XPOS 16 CH YPOS 0 LN WIDTH '0' CM HEIGHT 2 LN FRAME 10 TW
It gives u a vertical line at 16 character. so for ur requirment add another command at another XPOS.
Try this below just below ur ITEM ELEMENT which has the display fields.
Main Window
____________________________________________________
/E ITEM_A
A,,,,&ITAB-ABC&,,&ITAB-XXX&,,&ITAB-CDE&,,&ITAB-GEF&
/:BOX FRAME 10 TW
/:BOX XPOS 16 CH YPOS 0 LN WIDTH '0' CM HEIGHT 2 LN FRAME 10 TW
/:BOX XPOS 26 CH YPOS 0 LN WIDTH '0' CM HEIGHT 2 LN FRAME 10 TW
/:BOX XPOS 36 CH YPOS 0 LN WIDTH '0' CM HEIGHT 2 LN FRAME 10 TW
/:BOX XPOS 46 CH YPOS 0 LN WIDTH '0' CM HEIGHT 2 LN FRAME 10 TW
Change XPOS according to ur requirement.
Now add another main window to the same page with changing UPPER margin, U can add upto 99 Main windows in one page.
So add upto ur Page is full.
-
For headings
Create a Variable window same as Main window, in place of fields, give descriptions.
-
Make sure that u give BOX command below the field declaration, if u give above, for last record it will not print box.
Regards
Bala Krishna
Edited by: Bala Krishna on Aug 20, 2008 10:31 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.