on 11-17-2008 4:31 AM
I am learning sapscript, and I want to know how to write a print program for my own sapscript.
can anyone tell me how to do and why? if you have source code of a print program, please paste on the thread and explain how it works? thank you very much, I am very grateful of your answer!
Edited by: Matt on Nov 17, 2008 10:34 AM - subject edited
Hi Dawson
Better to search on sdn before posting , coz when we start a new topic for stating we can find relevent threads on main Topics.
Regards
Sachin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please use a more meaningful subject for your questions in future - please also read the Terms of Engagement for these forums
Thank-you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try this
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.
Rgds,
SaiRam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create Script in SE71.Then create one element in Main window.(/E TEST).
After that Create one Driver Program in SE38.In that u can write like this.
DATA : itab TYPE TABLE OF mseg WITH HEADER LINE.
SELECT * FROM mseg INTO TABLE itab UP TO 10 ROWS.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX = ARCHIVE_INDEX
ARCHIVE_PARAMS = ARCHIVE_PARAMS
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'ZTEST_NEW'----
Script Name
LANGUAGE = SY-LANGU
OPTIONS = OPTIONS
MAIL_SENDER = MAIL_SENDER
MAIL_RECIPIENT = MAIL_RECIPIENT
MAIL_APPL_OBJECT = MAIL_APPL_OBJECT
RAW_DATA_INTERFACE = '*'
SPONUMIV = SPONUMIV
IMPORTING
LANGUAGE = LANGUAGE
NEW_ARCHIVE_PARAMS = NEW_ARCHIVE_PARAMS
RESULT = RESULT
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
.
loop at itab.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'TEST'----
Element name in the Script
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
IMPORTING
PENDING_LINES = PENDING_LINES
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
.
*CALL FUNCTION 'END_FORM'
IMPORTING
RESULT = RESULT
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SPOOL_ERROR = 3
CODEPAGE = 4
.
ENDLOOP.
CALL FUNCTION 'CLOSE_FORM' -
Here no nedd to specify any one. Just call the function module.
IMPORTING
RESULT = RESULT
RDI_RESULT = RDI_RESULT
TABLES
OTFDATA = OTFDATA
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
.
After that u can write
&itab-matnr& &itab-mblnr&........ in SAP Script under text element(main window).Then Activate the Script.
Then Activate and Execute the SE38 Program.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
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.