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

space after text

hi guys,

i have a string,

i want to display it with spaces at the end.

how do i do it?

say i have the following:

string1 type c.

string2 type c.

combined type c.

i want to combine string1 and string2 into combined with 10 spaces at the end of combined.

how?

tnx.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2008 at 08:45 AM

    Hi Laure

    Please check if the below code helps...

    -


    data : len type i.

    concatenate string1 string into combined.

    len = strlen( combined ).

    combined+len(10) = CL_ABAP_CHAR_UTILITIES=>SPACE_STR.

    -


    Kind Regards

    Ranganath

    PS : Reward points for all useful answers. 😊

    Edited by: Ranganath Ramesh on Jan 25, 2008 9:45 AM

    Edited by: Ranganath Ramesh on Jan 25, 2008 9:48 AM

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      hi Ranganath,

      the ascii technique works fine for me.

      all i have to do now is to figure out how to make the number of spaces dynamic (coz it's not always 10 as my sample indicates).

      thanks for the effort.

      10 points for you.

      tnx,

      laure

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2008 at 08:46 AM

    Hi,

    Try this

    Constants: c_space(10) type c value '10 spaces'.

    Concatenate str1 str2 c_space into string.

    Regards,

    Satish

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 25, 2008 at 09:11 AM

    concatenate v1 v2 into v3 separated by space.

    regards.

    santhosh reddy

    Reward if useful

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2008 at 09:15 AM

    try like this...

    DATA : l_space(10) value space.
    CONCATENATE string1 string2 l_space INTO combined.
    

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2008 at 09:20 AM

    Hi,

    Let suppose your string1 has length 5 char and string2 has length 3 char now you want 10 spaces in combined_string with these 2 strings, then you can do this

    data:string1(5) type c,

    string2(3) type c,

    combined_string(20) type c.

    CONCATENATE string1 string2 into combined_string separated by space.

    This will meet your requirement.

    Rgds,

    Bujji

    Add a comment
    10|10000 characters needed characters exceeded

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.