2023 Nov 21 11:33 AM
Hi Folks,
please note that I have searched, and I don't believe this question is already answered; read it very carefully.
I have an invoice Smartform; it has the usual FIRST/NEXT pages. At the end of the MAIN window, I trigger a NEXT PAGE command which calls page T_AND_C. That all works fine; the invoice is output, including a footer secondary window which must be output before the T&Cs, and the new page is triggered.
Here's my problem. On page T_AND_C, I want to output a very long included text, which runs over 3 pages. If the window on page T_AND_C is a secondary window, only the first part of the text is output. To automatically call T_AND_C as the next page and allow the text to continue, the window has to be of type MAIN. But hey, you knew that, and so did I. The trouble is, if I specify the window as type MAIN, no text prints. It comes out blank.
So I debugged it, and this is what happens (in function group STXBC):
form process_non_main.
* ...
case docentry-tdwtype.
when c_wtype_main.
* don't process main window in this form, finish loop
exit.
when c_wtype_text.
case docentry-eventtype.
when c_event_top.
* header
perform process_top.
if otf[] is initial.
l_no_output = c_true.
endif.
when c_event_bottom.
* footer
perform process_bottom.
if otf[] is initial.
l_no_output = c_true.
endif.
when others.
* "real" non main window
perform process_text_window.
endcase.
The value DOCENTRY-TDWTYPE has a value of 'T' for text, but DOCENTRY-EVENTTYPE has a value of 'B', so it calls PROCESS_BOTTOM, which does nothing. The command PROCESS_TEXT_WINDOW is never reached.Here's the call stack at this point:8 FUNCTION /1BCDWB/SF00000081 9 FUNCTION SSFCOMP_PROCESS_DOCUMENT10 FORM PROCESS_WIN_AFTER_MAIN11 FORM PROCESS_NON_MAINSo, it seems to treat the main window in the additional page as a non-main window, which seems odd. I've never looked into this code before, and the logic isn't immediately obvious.I'd be most grateful for any constructive ideas. CheersJohn M.
2023 Nov 21 6:37 PM
When the main window ends, you can't resume it.
You must not end your main window if you want to automatically have the contents of "T_AND_C" continue on subsequent pages. You must have the contents of "T_AND_C" inside the main window, not in a secondary window.
2023 Nov 21 6:57 PM
Very long story but if I got the gist correctly, it seems like you're saying that even though there is a text in MAIN window, it comes out blank. Is that correct?
I've never debugged Smart Forms and don't find it particularly helpful because these forms are actually not that smart and just follow the rules you set up in the form configuration. My money is something is wrong there. I'd suggest to just look at all your form elements and mentally walk through the sequence and check all conditions. You could add some text elements temporarily and place them to trace the form logic.
If that doesn't work, I think it'll be very difficult for anyone to suggest a solution without seeing full form element list and conditions, which you haven't shared.
2023 Nov 22 9:38 AM
Hi Jelena,
you are correct; and I cannot tell you how many times I have checked the configuration.
My fix is to include the text in the standard 'NEXT' page main window and compromise on the positioning of the preceding footer window. It works, but just doesn't look so good...
Best
John