on 08-21-2008 3:53 PM
hie guys
i want to print customer line items on sapscript and im looping at itab trying to print in the main window. but i get the error stated above. so i created the subsequent page because i know customer may have many line items, now how will the system know how many line items to print on one page and how to call the next page when the first is full up???
Hi,
You create two pages
FIRST page
NEXT page
In first page give like that
page: FIRST
next page: NEXT
In second page
page: NEXT
next page:NEXT
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'.
In SAP Scripts text editorgive
/: MAIN_DATA
I hope its help ful 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.
Next page is called automatically once main window in first page is completely filled. Make sure you maintain the next page attribute inside you form.
if you want to call next page based on some condition, you can either call it from you driver program, or by using
/: NEW-PAGE "inside your form
close 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.
hie guys i have managed to get around the obove problem but now wen i loop at an internal table populating a wrk area the header line for the internal table gets printed. i have asked this question b4 and i implemented the suggestions but the header line gets printed always.
is it the protect command in sapscript definition?
or the windopw heights?
or cud it be the definition of my internal table and work area?
or maybe is it because i must have an element in my main window because i had not defined one as yet??
has any one else experienced the same problem or is just me??
Hi,
Yes U need to define TEXT ELEMENT for line Items in SAPScript, Main window Text Editor, where u r displaying ur fields, and u should call that same ELEMENT in WRITE_FORM function module which u r giving in Loop and Endloop.
Ex:-
SAPScript, Main window Text Editor
/E ITEM
P1 &WA_ITAB-FIELD1&,,&WA_ITAB-FIELD2&
in Driver Program
Loop at itab into wa_itab.
CALL FUNCTION 'WRITE_FROM'
EXPORTING
ELEMENT = 'ITEM'
WINDOW = 'MAIN'
EXCEPTIONS
Others = 1.
Endloop.
Regards
Bala Krishna
Depending on The Height of the Main window, it will print No of records on one page, if main window is filled, it will check which is next page assigned when First page is filled and goes to that page and fills remaining data.
What r the Text Element u r using SAPScript for Line Items? How many SAPScripts u r using? AS we use START_FORM only if we have multiple SAPScripts to be printed.
In driver Program
Call Function 'OPEN_FORM'
Exporting
FORM = 'ZFORM'
LANGU = SY-LANGU
Exceptions
.
.
Loop at Itab.
Call Function 'WRITE_FORM'
Exporting
ELEMENT = 'ITEM'
WINDOW = 'MAIN'
Exceptions
.
.
Endloop.
Call Function 'CLOSE_FORM'
In SAPScript, in Main window
/E ITEM
P1 &ITAB-MATNR&,,&ITAB-DDDD&
Regards
Bala Krishna
Edited by: Bala Krishna on Aug 21, 2008 8:42 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.