‎2005 Sep 14 5:26 PM
Hi,
I am working on SAP Script.
I have to print the details of one operation and then next operation and so on.
<b>Now, if the space on the page is very less so as to accomodate the complete details of next operation on same page then it should go on next page otherwise the same operation along with it details should continue on the page.</b>
<b>How do I achieve this ? I guess I have to use protec-endprotect ? Do I have to write this as control command in SCRIPT EDITOR or write it in abap driver program ?</b>My sample code is as follows:
LOOP AT IAFVC.
LOOP AT IRB.
IF IRB-VORNR = IAFVC-VORNR.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'COMPONENT_LISTING'
WINDOW = 'MAIN'.
ENDIF.
ENDIF.
ENDLOOP.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'PRT_LABELS'
WINDOW = 'MAIN'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'AVOT' "Text ID
language = 'E' "Laguage
name = XTDNAME2 "Text name
object = 'AUFK' "text object
tables = IT_TEXTS. "Int.table
LOOP AT IT_TEXTS.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'OPERATION_LONG_TEXT'
WINDOW = 'MAIN'.
ENDLOOP.
ENDLOOP.
So the each operation number will keep on looping and its respective details will be printed.
<b>Note: Its not a paragraph that I want to protect using protect-endprotect but its the complete operation detail with different elements.</b>
‎2005 Sep 14 5:32 PM
Hi Tushar,
You need to put PROTECT...ENDPROTECT in your SAP Script screen code. Then the written elements within will always be printed on one page, never split across two.
Gill
‎2005 Sep 14 5:33 PM
Hi
If you want to protect the text elements you called into loop, you should use it in you program:
CALL FUNCTION CONTROL_FORM
EXPORTING
COMMAND = 'PROTECT'.
LOOP AT..
CALL FUNCTION WRITE
.....
ENDLOOP.
CALL FUNCTION CONTROL_FORM
EXPORTING
COMMAND = 'ENDPROTECT'.
Max
Message was edited by: max bianchi
‎2005 Sep 14 5:34 PM
‎2005 Sep 14 6:13 PM
Hi
I guess PROTECT ENDPROTECT will not work across TEXT ELEMENT boundaries . It will work for only one text element . You can combine all the text elements into one
and use IF condition in SAPSCRIPT itself to supress some of the lines if required. Use PROT ENDPROT on this one text element only ( either in program or in SAPSCRIPT).
Cheers