Skip to Content

SAP Script: move text from field to new line when displaying table

Hi everyone,

I'm traying to display an internal table in SAP Script and I met a problem when the field text is too long. And my question is very clear: how to move the text to new line?

The screenshot with the scenario: http://image.prntscr.com/image/26f1a37d835a48bca93e557a2dbbde96.png

The code:

/E TOP

/: BOX FRAME '0.5' PT

/: POSITION XORIGIN '1' CM YORIGIN '8' CM

/: BOX HEIGHT '0.5' CM FRAME '0.1' MM INTENSITY '20'

/: INCLUDE ZCPI_TABLE_HEADER OBJECT TEXT ID ST

/: BOX WIDTH '1.2' CM FRAME '0.1' PT

/: POSITION XORIGIN '2.2' CM YORIGIN '8' CM

/: BOX WIDTH '7.239' CM FRAME '0.1' PT

/: POSITION XORIGIN '9.439' CM YORIGIN '8' CM

/: BOX WIDTH '0.8' CM FRAME '0.1' PT

/: POSITION XORIGIN '10.239' CM YORIGIN '8' CM

/: BOX WIDTH '2.35' CM FRAME '0.1' PT

/: POSITION XORIGIN '12.589' CM YORIGIN '8' CM

/: BOX WIDTH '2.71' CM FRAME '0.1' PT

/: POSITION XORIGIN '15.299' CM YORIGIN '8' CM

/: BOX WIDTH '2.71' CM FRAME '0.1' PT

/E BODY

P2 &GS_ITEM-ITEM&,, &GS_ITEM-DESCR&

/E FOOTER

Thanks a lot!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Mar 30, 2017 at 11:03 AM

    Hi Petru,

    if you have such a problem you need to split your value into severals ( something like gv_part1 / gv_part2 ).

    I would recommend you when the progress of the form is not that far you should at least switch to smartforms, because there the runtime takes care about it and you don't have to worry at all.

    No matter what, if you have to stay at sapscript it depends on where the text comes from. If it is a internal texttable you can use this function module below:

    CALL FUNCTION 'FORMAT_TEXTLINES'
      EXPORTING
        formatwidth =  90    "Width of text needed for printing
        linewidth = 132
      TABLES
        lines = i_line       "Structure TLINE
    Add comment
    10|10000 characters needed characters exceeded