4 Replies Latest reply: Sep 19, 2007 8:45 PM by April Erickson RSS

concatenate strings without trim space

Frank Dehle
Currently Being Moderated

Hi, i am looking for a Method in ABAP that concatenate strings without trim space on any string.

 

I will send a PDF-Document from the archivelink as attachment in an  E-Mail, but the archivelink function deliver the document in lines with 1024 character und the input function for the attachment of the E-Mail need the document in lines with 255 character.

 

I think, concatenate all lines und seperate them, but sometimes i lose a space.

 

I try some solutions:

 

DATA l_document(65535) TYPE c.

DATA line_doc_length TYPE i.

 

  line_doc_length = 0.

  LOOP AT archivobject INTO wa_archivobject.

    l_document+line_doc_length = wa_archivobject.

    line_doc_length = line_doc_length + 1024.

  ENDLOOP.

 

That solution match, but the max length of the document is 65535 character.

 

I try the same with a dynamic Object like 'Create Data ...', but in this case it is not allowed to use an offset.

 

Thanks for help

 

Frank Dehle

  • Re: concatenate strings without trim space
    aRs .
    Currently Being Moderated

    Hi,

     

    Why don't you declare as string

     

    DATA l_document TYPE string.

     

    aRs

    • Re: concatenate strings without trim space
      Frank Dehle
      Currently Being Moderated

      Hi,

       

      thanks for your response, but this was my first try. The one and only command that i found in ABAP to concatenate strings, is 'CONCATENATE' and this command has no option for no trim space und that is, I think, the main problem.

       

      The second problem is, I can't found a function to set the length of a parameter from type string und you receive a compiler error by use offsets and/or length on parameter from type string.

       

      DATA l_document TYPE string. "<<<<<<<<< I try your suggestion

      DATA line_doc_length TYPE i.

       

      line_doc_length = 0.

      LOOP AT archivobject INTO wa_archivobject.

      l_document+line_doc_length = wa_archivobject. "<<<<<<<<<<<<<<< Error

      line_doc_length = line_doc_length + 1024.

      ENDLOOP.

       

      original message from compiler:

      - At the write position, you cannot use offset and length specifications with fields of type "STRING" or "XSTRING". -          

                      

      Thanks

       

      Frank Dehle

Actions