07-22-2014 11:26 PM
Hello experts,
I am facing a problem on an existent sapscritp.
The existent form contains the FIRST and NEXT page, the flow is: FIRST -> NEXT -> NEXT.
It was asked me to add one LAST page with terms and conditions (etc)...
I created the LAST page in the form.
At the program level, right before the "close_form", I added the command "control_form" > "new-page LAST".
The LAST page was printed (ok), however, the content of "sapscript-formpages" seemed to get lost (=0).
In consequence, all the existent conditions: "IF &PAGE(C)& EQ &SAPSCRIPT-FORMPAGES(C)&" (if current page = "last page") didn´t work anymore. The data/windows to be printed on the last of the FIRST/NEXT pages didn´t appear anymore.
Also, the "page" information get lost "Page 1/0".
Before my LAST page, the content of "sapscript-formpages" = 1 (currently only one page is displayed) and "Page 1/1" was fine.
After I added the command "control_form" > "new-page LAST", the "sapscript-formpages" = 0 and "Page 1/0" (?).
Does anybody knows why???
I tried other ways to print the LAST page such as:
1) Added an element /E called "lastpage" on MAIN window (also tried other windows that comes after the MAIN).
This element contained the command "new-page LAST".
I called this element on the program (after the last element printed).
Result: New-page LAST was "ignored". It passed by this on debug mode but nothing happened (the first page was totally ok but LAST page didn´t appear).
2) Added "start_form" > startpage = "last" and "end_form" (before "close_form").
Result: Error message when running the sapscript ("start_form is invalid, end_form is missing").
Obs: there was not "start_form" and "end_form" on the current program code.
Please, does anybody has an suggestion to help me solving this problem?
Thank you!
Tatiana
07-22-2014 11:59 PM
Hi Tatiana,
I would suggest to create a new element (/E) in the main window of the next page.
You can use the syntax:
/E NEW_PAGE
/: NEW-PAGE LAST
Then in your driver program, call the element once you printed all the relevant information.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'NEW_PAGE'.
you can have condition of sales in any of the window (Main_Window) of the last page.
Hope this helps. Let me know if you need more inputs.
Regards,
Abhi
07-22-2014 11:59 PM
Hi Tatiana,
I would suggest to create a new element (/E) in the main window of the next page.
You can use the syntax:
/E NEW_PAGE
/: NEW-PAGE LAST
Then in your driver program, call the element once you printed all the relevant information.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'NEW_PAGE'.
you can have condition of sales in any of the window (Main_Window) of the last page.
Hope this helps. Let me know if you need more inputs.
Regards,
Abhi
07-23-2014 1:27 PM
Hello Abhi,
Thank you for your help. Actually I tried this yesterday, it is the same of my explanation on number "1)", no?
Anyway, I am trying again...
- When I put the element /E NEW_PAGE and command /: NEW-PAGE LAST on the MAIN window, teh page counter is lost too. (On program I put the "write_form" for element "new_page") before "CLOSE_FORM".
- When I put the element /E NEW_PAGE and command /: NEW-PAGE LAST in other window of the FIRST/NEXT page (coming after the MAIN), it is ignored... (no Last Page is printed).
Really really strange.
Any other suggestion, please?
Tatiana
07-23-2014 1:35 PM
Hi Tatiana,
In Main window,
Delcare:
/E PAGE.
/: NEW-PAGE
In Editor.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'PAGE'
* FUNCTION = 'SET'
* TYPE = 'BODY'
* WINDOW = 'MAIN'
* IMPORTING
* 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
OTHERS = 10.
Regards,
Venkat.
07-23-2014 2:05 PM
Thank you Venkat.
The result of this was a new page (NEXT), correctly printed, but just it.
The last page was not printed.
I continue trying... In case of any other suggestion please let me know!
Tatiana
07-24-2014 3:54 PM
Hello experts,
Only to report that I finally got my sapcript working.
On my solution, at the printing program level, I added "start_form" and "end_form" between the current print logic.
Then, right before the current "close_form", I added one more "start_form" starting by "LAST", then I added "control_form" with command "new-page LAST", and finally "end_form" again.
Thanks for the helps.
Regards.
Tatiana
04-08-2021 5:07 AM
Yes, your solution works. It has helped me too.