SAPScript BOTTOM Command

Have a SAPScript form with multiple paragraphs. In the original version I put a footnote at the bottom of a page by doing something like:

>/E FOOT_NOTE 
>/: BOTTOM 
>B1 <NR><I0><HL><IT> Some fixed text.</> 
>/: ENDBOTTOM 

That worked correctly. Now I am changing the form so that a number of paragraphs may or may not appear at the bottom of the page. Since I donu2019t know which paragraph may be first, I tried creating two new paragraphs:

>/E START_BOTTOM
>/: BOTTOM
>/*                                                              
>/E END_BOTTOM
>/: ENDBOTTOM

I call START_BOTTOM, then conditionally call whatever paragraphs are needed and finally call END_BOTTOM.

The problem is that the paragraphs simply continue on from the last line that was printed, not at the end of the page.

Had had also tried putting:

>/E START_BOTTOM

At the beginning of each paragraph that could appear at the end, and it worked to a point u2013 each paragraph appeared at the end, but overwrote whatever previous paragraphs were there.

How to control the BOTTOM command?

Answer:

Yes that's true, that Split in BOTTOM command doesn't work same as it works with the PROTECT.. ENDPROTECT.

But, after some research I got success.

Don't create any element in your MAIN window for BOTTOM / ENDBOTTOM.

Use the FM WRITE_FORM_LINES to append entire BOTTOM .. ENDBOTTOM lines. Like:

data: la_head like THEAD,
      lt_lines type standard table of TLINE,
      la_lines like line of lt_lines.

select single * from stxh into la_head
  where TDOBJECT = 'FORM'
    and TDNAME   = 'ZTEST_WATERMARK'
    and TDID     = 'DEF'
    and TDSPRAS  = sy-langu.

* Bottom Start
la_lines-tdformat = '/:'.
la_lines-TDLINE  = 'BOTTOM'.
append la_lines to lt_lines.

* Generic Text
la_lines-tdformat = '*'.
la_lines-TDLINE  = 'This is BOTTOM'.
append la_lines to lt_lines.

* Include Text1
la_lines-tdformat = '/:'.
concatenate '''' 'A1' '''' into la_lines-TDLINE.
concatenate 'INCLUDE ZTEST_NP OBJECT TEXT ID ST PARAGRAPH '
  la_lines-TDLINE into la_lines-TDLINE separated by ' '.
append la_lines to lt_lines.

* Include Text1
la_lines-tdformat = '/:'.
concatenate '''' 'A1' '''' into la_lines-TDLINE.
concatenate 'INCLUDE ZTEST_NP1 OBJECT TEXT ID ST PARAGRAPH '
  la_lines-TDLINE into la_lines-TDLINE separated by ' '.
append la_lines to lt_lines.

* Bottom End
la_lines-tdformat = '/:'.
la_lines-TDLINE  = 'ENDBOTTOM'.
append la_lines to lt_lines.

* Append lines to MAIN
CALL FUNCTION 'WRITE_FORM_LINES'
  EXPORTING
    FUNCTION                       = 'APPEND'
    header                         = la_head
*   TYPE                           = 'BODY'
    WINDOW                         = 'MAIN'
  tables
    lines                          = lt_lines
EXCEPTIONS
   FUNCTION                       = 1
   TYPE                           = 2
   UNOPENED                       = 3
   UNSTARTED                      = 4
   WINDOW                         = 5
   BAD_PAGEFORMAT_FOR_PRINT       = 6
   SPOOL_ERROR                    = 7
   CODEPAGE                       = 8
   OTHERS                         = 9
          .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Sapscripts Tips

Fast Links:
Other SapScipts Question
SapScript Question

ABAP Books
ABAP Certification, BAPI, Java, Web Programming, Smart Forms, Sapscripts Reference Books

SAP Scripts Tips
SAP Sapscripts Tips and Tricks

Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG. 
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk. 
 The content on this site may not be reproduced or redistributed without the express written permission of 
www.erpgreat.com or the content authors.