cancel
Showing results for 
Search instead for 
Did you mean: 

TextEdit UI for Long Text

Former Member
0 Kudos

Hi,

I have binded a TextEdit to a String Table. The purpose is to be able to save this texts as a Standard Text in the system. Noticed that it can only be appended as a new line in the String Table when user hits enter while entering the text.

Problem is, if the user keeps on entering texts without hitting enter, and there are >255 chars, the remainder texts will be truncated.

Is there anyway we can obtain the full text that are >255 chars entered by user, if he does not hit enter?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

As i think u are checking the data at run time. Please try printing that data in another Text Edit ui element for test purpose.

data is not getting truncated.

Former Member
0 Kudos

Hi guys, thanks for the replies. It has improved my understanding of the situation.

You are right pankaj, the data was not truncated. In debugging mode, I was viewing in Fast Display view. I changed to Tabular view and all the texts was shown.

My problem is, I am trying to transfer these texts to a Function Module. How am I able to transfer let's say, a 1000 char string into the FM? It seems that the FM does truncate after 255 char even for String parameters.

Or is there another better advise on how I can transfer long texts into a FM from web dynpro?

Note that this long text will be used to be saved as a Standard Text.

Thank you in advance!

Former Member
0 Kudos

hi ,

proceed like this :

1 suppose u have context node text_editor and 2 context attributes TEXT And TEXTNAME under it

suppose u have got the text in the variable *text_name * using get_static_attributes


  DATA lo_node        TYPE REF TO if_wd_context_node.
  DATA lo_element     TYPE REF TO if_wd_context_element.
  DATA ls_text        TYPE if_main=>element_text_editor.
 lo_node = wd_context->get_child_node( name = 'TEXT_EDITOR' ).
  lo_element = lo_node->get_element( ).
  lo_element->get_static_attributes( IMPORTING static_attributes = ls_text ).

2 we need to convert string table into table of type "TLINE" and vice versa while text data retrieval

so , Do data declarations like this :


  DATA lt_lines       TYPE TABLE OF tline.
  DATA lv_name        TYPE tdobname.

3 thn the FMs READ_TEXT and CONVERT_ITF_TO_STREAM_TEXT wud convert tline format to table for strings


    CALL FUNCTION 'READ_TEXT'
      EXPORTING
        id                      = 'ST'
        language                = sy-langu
        name                    = lv_name
        object                  = 'TEXT'
      TABLES
        lines                   = lt_lines
      EXCEPTIONS
        id                      = 1
        language                = 2
        name                    = 3
        not_found               = 4
        object                  = 5
        reference_check         = 6
        wrong_access_to_archive = 7
        OTHERS                  = 8.
    IF sy-subrc EQ 0.
* Convert tline format to table for strings
* for webdynpro context
      CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'
        EXPORTING
          language     = sy-langu
          lf           = 'X'
        IMPORTING
          stream_lines = ls_text-text
        TABLES
          itf_text     = lt_lines.
      lo_node->bind_element( ls_text ).
    ENDIF.
  ENDIF.

rgds,

amit

Former Member
0 Kudos

hi ,

to save the text use the FMs SWA_STRING_SPLIT ( String needs to be split into multiple lines of characters )

and SAVE_TEXT

I guess the following piece of code wud help


 DATA lo_node        TYPE REF TO if_wd_context_node.
  DATA lo_element     TYPE REF TO if_wd_context_element.
  DATA ls_text        TYPE if_main=>element_text_editor.
  DATA lv_string      TYPE string.
  DATA lt_str_comp    TYPE TABLE OF swastrtab.
  DATA ls_str_comp    TYPE swastrtab.
  DATA lt_lines       TYPE TABLE OF tline.
  DATA ls_tline       TYPE tline.
  DATA ls_header      TYPE thead.
  lo_node = wd_context->get_child_node( name = 'TEXT_EDITOR' ).
  lo_element = lo_node->get_element( ).
  lo_element->get_static_attributes( IMPORTING static_attributes = ls_text ).
  LOOP AT ls_text-text INTO lv_string.
* String needs to be split into multiple lines of characters
* of length 132 each to be passed to SAVE_TEXT FM.
    CALL FUNCTION 'SWA_STRING_SPLIT'
      EXPORTING
        input_string                 = lv_string
        max_component_length         = 132
      TABLES
        string_components            = lt_str_comp
      EXCEPTIONS
        max_component_length_invalid = 1
        OTHERS                       = 2.
    LOOP AT lt_str_comp INTO ls_str_comp.
      IF sy-tabix EQ 1.
        ls_tline-tdformat = '*'.
      ELSE.
        CLEAR ls_tline-tdformat.
      ENDIF.
      ls_tline-tdline   = ls_str_comp-str.
      APPEND ls_tline TO lt_lines.
      CLEAR ls_tline.
    ENDLOOP.
    CLEAR lt_str_comp[].
  ENDLOOP.
  IF ls_text-text_name IS NOT INITIAL.
    ls_header-tdobject   = 'TEXT'.
    ls_header-tdid       = 'ST'.
    ls_header-tdspras    = sy-langu.
    ls_header-tdname     = ls_text-text_name.
    CALL FUNCTION 'SAVE_TEXT'
      EXPORTING
        header   = ls_header
      TABLES
        lines    = lt_lines
      EXCEPTIONS
        id       = 1
        language = 2
        name     = 3
        object   = 4
        OTHERS   = 5.
    IF sy-subrc <> 0.
    ENDIF.
  ENDIF.

regards,

amit

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Try to use the below function modules to change from string table to tline format so that u can save the text using SAVE_TEXT function module.

CONVERT_STREAM_TO_ITF_TEXT

CONVERT_ITF_TO_STREAM_TEXT

Thanks,

Kalp.

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

you can refer the thread

[]

Priya

Former Member
0 Kudos

hi ,

for ur text edit u can bind it to a attrinute of type string or CHAR1024 as well .

Change the columns and row property to adjust your text edit width and height.

With STRING_TABLE rows from TextEdit are stored as table rows. A line break is always stored as a line feed in a STRING (CL_ABAP_CHAR_UTILITIES=>NEWLINE, ASCII decimal 10). The Web Dynpro framework carries out the conversion for the client platform.

Note that a string to be displayed in TextEdit, must only use a line feed as a line break.

Problem is, if the user keeps on entering texts without hitting enter, and there are >255 chars, the remainder texts will be truncated.

Is there anyway we can obtain the full text that are >255 chars entered by user, if he does not hit enter?

The text will be considered as a single line ie a WORD

refer this online help :

http://help.sap.com/saphelp_nw04/helpdata/en/29/9587677837be4ebab175ede37364a2/content.htm

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/06/45ee412e5e6324e10000000a1550b0/content.htm

regards,

amit