Skip to Content
author's profile photo Former Member
Former Member

ECATT_CONV_XSTRING_TO_STRING

Hello Friend,

I need to convert xString to String and I am planning to use ECATT_CONV_XSTRING_TO_STRING but the output for the functional module is of type string with 255 as a length.

what would happen if my input is longer than 255?

I have tested for couple of cases and found that my input got truncated to 255 chars.

Does anyone had any idea on this or any other alternative

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Nov 20, 2007 at 03:42 PM

    Hi Pranav,

    i dont think so. Just the test field has 255.

    check out this report:

    data:
    int type i,
    chr type string,
    str type string,
    xstr type xstring.
    
    do 300 times.
      int = int + 1.
      chr = int.
      concatenate
        chr
        str
      into
        str.
    enddo.
    
    CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
      EXPORTING
        im_xstring        = xstr
       IM_ENCODING       = 'UTF-8'
     IMPORTING
       EX_STRING         = str
              .
      write str+300(10)  

    It must dump if str is less than 255.

    Regards,

    Udo

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi PD,

      had to change the code:

      data:
      int type i,
      chr type string,
      str type string,
      xstr type ETXML_LINE_STR.
      
      *create a long string
      do 300 times.
        int = int + 1.
        chr = int.
        concatenate
          chr
          str
        into
          str.
      enddo.
      
      *convert to Xstring
      CALL FUNCTION 'ECATT_CONV_STRING_TO_XSTRING'
        EXPORTING
          im_string         = str
         IM_ENCODING       = 'UTF-8'
       IMPORTING
         EX_XSTRING        = xstr.
      
      *convert to string
      CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
        EXPORTING
          im_xstring        = xstr
         IM_ENCODING       = 'UTF-8'
       IMPORTING
         EX_STRING         = str.
      
      *offsett of 300 would dump if output only 255
      write: sy-subrc, str+300(10).

      Everything should be clear. XSTRING is created and longer as 255, as well the STRING. Program would dump in case of string less than 255.

      Regards,

      Udo

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.