‎2009 Jun 17 8:08 AM
Hi Guru's,
I am having trouble with a sapscript in combination with the printprogram.
In my main window I need to print some variabele amount of lines. I created an element NEW_LINE
Within my ABAP I am doing a loop and within that loop I have a call to
WRITE_FORM with the paramters: type = 'TOP' element = 'NEW_LINE'.
This goes well for the first page. But for the next page of the same form the data disappeared and we're stil processing the same form. How can achieve that the NEW_LINE is printed on every page?
Best regards,
Guido Koopmann
‎2009 Jun 17 9:06 AM
Hi,
Small correction in your driver program will do, give the window = 'MAIN' in the function module write_form and remove the type = 'TOP'. or change it to type = 'BODY'
CALL FUNCTION 'WRITE_FORM'
EXPORTING
* type = 'TOP' " Remove this
element = 'TEST2'
window = 'MAIN'. " Add this
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.(or)
If your new-line text element is having a static text then try to take a variable window and mention the data in it and position it accordingly where you want that data to be printed. so the data will come in every page.
Thanks&Regards
Sarves
‎2009 Jun 17 9:06 AM
Hi,
Small correction in your driver program will do, give the window = 'MAIN' in the function module write_form and remove the type = 'TOP'. or change it to type = 'BODY'
CALL FUNCTION 'WRITE_FORM'
EXPORTING
* type = 'TOP' " Remove this
element = 'TEST2'
window = 'MAIN'. " Add this
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.(or)
If your new-line text element is having a static text then try to take a variable window and mention the data in it and position it accordingly where you want that data to be printed. so the data will come in every page.
Thanks&Regards
Sarves
‎2009 Jun 17 9:18 AM
Thank you for your reply but I didn't work.
The thing I am doing is.
Loop at itab into wa
CALL FUNCTION 'WRITE_FORM'
element = 'NEW_LINE'
window = 'MAIN'
Endloop
So on the first page all lines are printed, but on the second page of the same document the lines are not there.
I tried to do it with the addition type = 'TOP', this didn't work either.
Has anyone has got another idea on how to fix this?
Best regards,
Guido Koopmann
‎2009 Jun 17 9:31 AM
Hi,
Can you tell what are you trying to print in the text element new_line
Thanks&Regards
Sarves
‎2009 Jun 17 9:34 AM
Hi Koopmann,
I had a similar problem once long time back,
I did like this...
jtab[] = itab[]."Added this line
Loop at itab into wa
CALL FUNCTION 'WRITE_FORM'
element = 'NEW_LINE'
window = 'MAIN'
delete itab from wa. "Added this line
Endloop
Thanks & regards,
Dileep .C
‎2009 Jun 17 9:41 AM
Hi Dileep,
Can you tell me a bit more, becasue I am not getting what you did.
Best regards,
Guido Koopmann
‎2009 Jun 17 9:59 AM
Hi
I believe something is wrong in your script, I run this sample:
DATA: BEGIN OF ITAB OCCURS 0,
N1(3) TYPE N,
END OF ITAB.
DO 15 TIMES.
MOVE SY-INDEX TO ITAB.
APPEND ITAB.
ENDDO.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM = 'ZSCRIPT_MAX'
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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT ITAB.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'NEW_LINE'.
ENDLOOP.
CALL FUNCTION 'CLOSE_FORM'
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.In my script there 2 pages: the FIRST and the NEXT.
It works fine
Max
‎2009 Jun 17 10:30 AM
Hi Koopmann,
I dont know exactly the siyuation But I will let you know what happened to me...
It was a Label Printing,,,
Need to print 10 Labels (lets say 5 material labels for page)
When I written the code and printed,,,
Only the 5 labels were successfull,,,
the second page was not printed...
If printed sometimes it used to repeat the same first page values in second page,,,
Then I got a Idea, If I delete there will be no chance of repeating anymore,, So i did that..
I hoped that type answer could be a little helpfull for you. So just shared here.
Thanks & regards,
Dileep .C
‎2009 Jun 17 9:28 AM
Hi,
Open the script in debugging mode for the document which are not correct then only you can analyze the problem.