Skip to Content
author's profile photo
Former Member

Concatenation of two strings

Hi,

I am facing one proble while concatenating two strings.

I declared var1 type char100,

var2 type char140,

var3 type char255.

I want to concatenate var1 var2 into var3.

But var3 is taking only 128 characters only.

so i am not getting full data into var3.

How i can acheive this.

Even in parameters i declard one parameter as

P_var1(255) type c,

In the selection screen, it is taking only 128 characters for the field.How i can declare more than 128 characters.

Thanks in Advance,

Best regards,

Pavan.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    Posted on Mar 03, 2005 at 12:11 PM

    Hi ,

    it works correct:

    REPORT zforum09 LINE-SIZE 255.

    DATA:

    var1 TYPE char100,

    var2 TYPE char140,

    var3 TYPE char255.

    *

    var1 = text-001. "100

    var2 = text-002. "132

    CONCATENATE var1 var2 INTO var3.

    WRITE:/ '001', 50 '050', 100 100, 150 150, 200 200, 250 250.

    ULINE.

    WRITE: / var1 COLOR 1.

    WRITE: / var2 COLOR 2.

    ULINE.

    WRITE: / var3 COLOR 3.

    BREAK-POINT.

    regards Andreas

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Mar 03, 2005 at 11:57 AM

    Hello Pavan,

    How can you be sure that the variable var3 is taking only 128 characters? Look at this code:

    REPORT  ZTEST no standard page heading line-size 260.
    
    data : w_string_length type i,
           w_string(260) type c.
    
    
    do 10 times.
      concatenate sy-abcde
                  w_string
            into w_string.
    enddo.
    
    w_string_length = strlen( w_string ).
    
    write :/  w_string_length.
    
    write : / w_string.

    Morale of the story : look at the line-size addition of your report statement.

    Regards,

    Anand Mandalika.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Mar 03, 2005 at 12:18 PM

    Hi Pavan,

    Regarding your question on parameters, it is not possible to have a <i><b>field</b></i> of length greater than 132 characters on any (selection)screen in SAP. In fact the F1 help for the parameters keyword clearly states this point. Please refer to that.

    If you need to have something of length more than 132, then you can think of a text-edit control.

    Hope that helps.

    Regards,

    Anand Mandalika.

    Add comment
    10|10000 characters needed characters exceeded