Showing results for 
Search instead for 
Did you mean: 

SMARTFORM - Part of variable content missing in otf file

0 Kudos

Hi colleagues,

In my smartform, I have variables, defined as STRING, which contains HTML coding to generate URL links in the final document.

The variable is correct and ends with '</a>'.

But in the otf file, the result is sometimes wrong. The variable is splitted into several lines (no problem), but the last line is somehow shorted... I only get '</'.

Due to that, end of URL is not recognized and the whole content below this unless link appears as part of the link.

This seems to be related to the length of the variable content.

If it is short enough (but this I could not insure), the code is complete and everything works fine.

Does this means that my url should be splitted to never exceed a certain limit (254 or 255 chr).?

thansk for your help,


Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Check this code to split the string by 255 size.

FORM append_string_by_length  USING xv_str.

  DATA: lv_strlen TYPE i.
  DATA: lv_start TYPE i.
  DATA: lv_end TYPE i.
  DATA: lv_pos TYPE i.

  CONCATENATE cl_abap_char_utilities=>newline xv_str
         INTO xv_str.
  CONDENSE xv_str.

  lv_strlen = STRLEN( xv_str ).

  IF lv_strlen GT 255.

    lv_start = 0.
    lv_end = 255.

    WHILE lv_start LT lv_strlen.

      lv_pos = lv_end - lv_start.
      APPEND xv_str+lv_start(lv_pos) TO gt_objbin.
      lv_start = lv_end.
      lv_end = lv_start + 255.

      IF lv_end GT lv_strlen.
        lv_end = lv_strlen.

    APPEND xv_str TO gt_objbin.


Here GT_OBJBIN is the Attachment file content to be sent in mail.

Answers (3)

Answers (3)

0 Kudos

We finaly show the full url instead of a text so it's easier for the user to realize that split as generated a unncessary 'blank'.

0 Kudos


Thanks for feedback.

Lengh is the issue. If I split the single varaible into several to only have 255 chars in each of them, it is possible to not loose part of the content.

I try to put the two variables (part1 and part2) on the same line in SMARTFORM without any separators. This has exactly the same effect than if I use one varaible which exceed 255 chars. The content of the 2nd one is lost in the OTF.

I then insert a blank between them, and I do not loose anything in the OTF.

Unfortunatelly, due to the separator, the URL is also split in 2 parts on my final content, which is not really good.

Splitting the label is not beautiful, but not dangerous. Adding one space in the URL may leads to not working link.

I will try to consider this issue when preparing the content from the OTF file.

If you have any hints what to consider, I would appreciate.

Kind Regards,


Former Member
0 Kudos

HI Barbara,

Yes your problem does seem to be coz of the length issue. Have a chck inserted in the code to split the variable content at 255 Char.

Hope this helps! Share your results with us please!