Detect the window is fully occupied in sapscript
I am currently working on a customized Transfer Order form using sapscript.
I understand in saprscript can pagebreak automaticall when the window is filled with records.
However, it does't remain the header on the first page. The subsequent pages doesnt have the header which display in the first page.
Nevertheless, I have managed to do so by initial the variable FLG_HU_PRINT.
Can someone tells me, how could the program detects when the window is fully occupied?
The reason why I need to know is I need to perform certain action (call a FORM) when it is happened.
At present, I am hardcoded line 13, the program will perform page break and initial the variable FLG_HU_PRINT.
DATA: lv_counter TYPE i. SORT XRLDRI BY TANUM VLTYP. LOOP AT XRLDRI lv_counter = lv_counter + 1. IF lv_counter >= 13. "<-----------How could the program determine when the window is fully occupied? call function 'CONTROL_FORM' exporting command = 'NEW-WINDOW'. CLEAR: lv_counter, FLG_HU_PRINT. ENDIF. IF NOT lv_tanum IS INITIAL AND NOT lv_vltyp IS INITIAL. IF lv_tanum <> XRLDRI-tanum OR lv_vltyp <> XRLDRI-vltyp. call function 'CONTROL_FORM' exporting command = 'NEW-WINDOW'. lv_tanum = XRLDRI-tanum. lv_vltyp = XRLDRI-vltyp. CLEAR: FLG_HU_PRINT. ENDIF. ELSE. lv_tanum = XRLDRI-tanum. lv_vltyp = XRLDRI-vltyp. ENDIF. PERFORM MULTI_PRINT. ENDLOOP.
Thanks in advance.