How to pad a string with space or other character

length 14 string '00000000000155' turn to length 25 string '00000000000155         ' ,use space to pad string trail.
using following function:
CONCATENATE '00000000000155' '         ' into lv_string
but result is the lv_string ='00000000000155',the spaces were not added the string trail.
how to achieve this purpose padding string.
pls help me.
thank you.

Hi ,
Not sure what exactly you require, But in my understanding you need to add one more spave after the doknr no. Please refer this code which could be more useful.
data: lv_objkt like aeoi-OBJKT,
      lv_doknr like draw-doknr,
      lv_dokar like draw-dokar,
      lv_doktl like draw-doktl,
      lv_dokvr like draw-dokvr,
      lv_slen type i.
lv_dokar = 'DRW'.
lv_doknr = '00000000000155'.
lv_doktl = '000'.
lv_dokvr = '-'.
CONCATENATE lv_dokar lv_doknr INTO lv_objkt.
lv_slen = STRLEN( lv_objkt ).
lv_slen = lv_slen + 1.
lv_objkt+lv_slen(3) = lv_doktl.
CONCATENATE lv_objkt lv_dokvr INTO lv_objkt.
WRITE: lv_objkt.

Similar Messages

  • Padding a string with spaces

    How do you pad a string w spaces using "Format into a string" w/o typing /s/s/s/s/s for say 5 spaces ?
    Solved!
    Go to Solution.
    Attachments:
    printed output.PNG ‏6 KB
    wire diagram.PNG ‏11 KB

    Hi Clint,
    this way:
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to concatenate a string with spaces

    Dear experts,
    I would like to concatenate a string with three spaces, for example,
    CONCATENATE 'X' SPACE SPACE SPACE 'Y' INTO LV_RESULT.
    However, the result I got from executing the above statement is not 'X   Y' as I want, but rather 'XY'.
    I did try
    CONCATENATE 'X' '***' 'Y' INTO LV_RESULT.
    REPLACE '***' with '   ' INTO LV_RESULT.
    still doesn't work.
    How can I write ABAP code to archive such a result?
    Any idea would be appreciated.
    Vitthavat A.

    dear  Oliver Hütköper and koolspy,
    I tried your solutions, and it works.
    so i awarded points to you.
    anyway, while trying the 'respecting blanks', i got an error:
    "".", "IN BYTE MODE", "SEPARATED BY ..." or "IN CHARACTER MODE" expected"
    not sure what it means. but it's ok. the problem has been solved.
    thanks again.

  • Padding String with spaces -tried known methods but code not working!

    I am trying to figure out an easy way to pad a string with spaces at the end. The way that definitely works is a for loop where string = string + " "; until string is the length that I need. However, for several dozen strings this is a lot of unnecessary overhead. I've done some research and tried a few different things - yet none of them seem to actually pad the string.
    import org.apache.commons.lang.StringUtils;
    public class Test
         public static void main(String[] args)
              String one = "1234";
                    //print string at current lenght
              System.out.println(one+"*");
                    //try padding using String.format (in padRight method below)
              one = padRight(one,(8-one.length()));
              System.out.println(one+"*");
                    one="1234";
                    //try padding using StringUtils
              String tmp = StringUtils.rightPad(one, (8-one.length()));
              System.out.println(tmp+"*");
         private static String padRight(String s, int n)
              return String.format("%1$-" + n + "s", s);
    }I've researched and these are the two most common methods people are suggesting. I am using java 1.5 so the String.format should work.. however, when I run it (I use JBuilder) the output is always "1234*".... after I try to pad it the output should be "1234 *" (with 4 spaces between the 4 and *) . Any suggestions is greatly appreciated! Thanks in advance.

    Wow, I completely botched that... uncle_alice, thank you for clearing that up for me.
    pbrockway2 - thank you, I actually did peruse the Formatter documentation - I would never post without researching something first... but I must have read it with one eye shut because walked away with the impression that I needed to submit the difference. I obviously misunderstood the documentation.
    Thanks!

  • Pad a string with zeros ?

    Hello ABAP Experts,
    How to pad a string with zeros.. is there a direct method i can use.
    eg:
    string length is 8
    string is custnumb
    value is 588
    but i would like to see 00000588
    please suggest.

    You can simply move it to a TYPE n field also.
    data: n(8) type n.
    data: custnumb(8) type c value '588'.
    n = custnumb.
    custnumb = n.
    Regards,
    Rich Heilman

  • How to delete the file with space in name

    Hi
    I want to delete the file "test ex.txt" file.
    i run the following command in command prompt.i can delete the file successfully.
    /bin/rm -f /mnt/"test ex.txt"
    I want to run the command from java.So i am using the following code
    String cmd = "/bin/rm -f /mnt/\"test ex.txt\"";
         Runtime rt = Runtime.getRuntime();
    process = rt.exec(cmd);
    The file was not deleted.
    How to delete the file with space in name?
    Help me

    Use the form of exec that takes an array of command + args.
    arr[0] = "/bin/rm"
    arr[1] = "-f"
    arr[2] = "/home/me/some directory with spaces";Or use ProcessBuilder, which is the preferred replacement for Runtime.exec, and which Runtime.exec calls.

  • How to concatenate a string with single quotes

    Hi all,
        how to concatenate a string with single quotes to a variable.
    Sathya

    Hi sathyabama,
    1. simple
    2. use TILDE character <b>(`)</b>
       (just left to the '1' key)
    <b> `'mystring'`</b>
    3. just copy paste
    report abc.
    data : m(100) type c.
    concatenate `'amit mittal'` 'hello' into m separated  by space.
    write m.
    regards,
    amit m.

  • How to padding the zeroes and space befoer sending from XI to R3 system.

    Hi Experts,
       How to padding the zeroes and space befoer sending any data from XI to R3 during mapping, how to write a java code to implement this logic, please help me with the coding or any other alternative.
    thanks
    dhanush

    to pad spaces you need to write a simple UDF
    for right padding use the following
    while( inputField.length() < Integer.parseInt(totalLength))
    inputField = inputField + " ";
    return inputField;
    for left padding use the following
    while( inputField.length() < Integer.parseInt(totalLength))
    inputField = " " + inputField ;
    return inputField;
    Note:in the above examples <i>inputField</i> will be the input to UDF i.e. the sender field which you need to pad and send to receiver , and <i>totalLength</i> will be a constant i.e length of the field you want on receiver side after padding.
    also i m not a Java expert so please check for syntax and semantics for code:) to me it looks correct
    Thanx
    Aamir
    Message was edited by:
            Aamir Suhail

  • Use REGEXP_INSTR to find a text string with space(s) in it

    I am trying to use REGEXP_INSTR to find a text string with space(s) in it.
    (This is in a Function.)
    Let's say ParmIn_Look_For has a value of 'black dog'. I want to see if
    ParmIn_Search_This_String has 'black dog' anywhere in it. But it gives an error
    Syntax error on command line.
    If ParmIn_Look_For is just 'black' or 'dog' it works fine.
    Is there some way to put single quotes/double quotes around ParmIn_Look_For so this will
    look for 'black dog' ??
    Also: If I want to use the option of ignoring white space, is the last parm
    'ix' 'i,x' or what ?
    SELECT
    REGEXP_INSTR(ParmIn_Search_This_String,
    '('||ParmIn_Look_For||')+', 1, 1, 0, 'i')
    INTO Position_Found_In_String
    FROM DUAL;
    Thanks, Wayne

    Maybe something like this ?
    test@ORA10G>
    test@ORA10G> with t as (
      2    select 1 as num, 'this sentence has a black dog in it' as str from dual union all
      3    select 2, 'this sentence does not' from dual union all
      4    select 3, 'yet another dog that is black' from dual union all
      5    select 4, 'yet another black dog' from dual union all
      6    select 5, 'black dogs everywhere...' from dual union all
      7    select 6, 'black dog running after me...' from dual union all
      8    select 7, 'i saw a black dog' from dual)
      9  --
    10  select num, str
    11  from t
    12  where regexp_like(str,'black dog');
           NUM STR
             1 this sentence has a black dog in it
             4 yet another black dog
             5 black dogs everywhere...
             6 black dog running after me...
             7 i saw a black dog
    5 rows selected.
    test@ORA10G>
    test@ORA10G>pratz
    Also, 'x' ignores whitespace characters. Link to doc:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/conditions007.htm#i1048942
    Message was edited by:
    pratz

  • How to create a String with a specific size?

    how to create a String with a specific size?
    For example I want to create different Strings with the size of 100 , 1000 or 63k byte?

    String are immutable so just initialize it with the number of characters you want.
    You might want to look at java.lang.StringBuffer and see if that's what you want.

  • How to print a string with out using main method??

    how to print a string with out using main method??
    if we can tell me with example?
    thanks in adavance
    raja

    Hi,
    actually there's none. The UITableView class needs to "know" the tableView's height so either it can calc <number of rows> times <row height> or it has to sum the height of each single row.
    If the row which needs to be of different size always is the first or the last row you can user a tableHeader or tableFoot view.
    Regards
    Dirk

  • How to change wildcard "_" (underscore) to some other character ?

    Hello Tech Gurus,
    I want to search for "_"( underscore) in a string using LIKE function.
    The query is:
    Select col1,col2
    from table1
    where col1 LIKE ('%ABC_%');
    I want to search for string 'ABC_'. But, If I use '%ABC_%' the last underscore will be taken as wildcard.
    How can I change wildcard underscore to any other character.
    Or is there any other way/function to search for underscore in a string.
    Thank you for your time.
    Pramod

    Hope This Solves yr Problem
    select * from b;
    A B
    1 ABC_
    2 ABC_D
    3 ABCD
    select b from b where b LIKE 'ABC\_%' ESCAPE '\';
    B
    ABC_
    ABC_D
    select b from b where b LIKE 'ABC\__%' ESCAPE '\'
    B
    ABC_D
    Ashok

  • How do I set the number pad to work with spaces?

    It has worked with other OSs but with Mavericks 10.9.5 (and from what I here, Yosemite) you can not use the number pad to change spaces. I know I can use the numbers across the top or the arrows, I just find it quicker and ergonomic to use the number pad. As many spaces I use this is very inconvenient to be reaching across the keyboard. Is there a way to fix this. I went to the preferences but could not find anything there to change. Maybe Apple could fix this in there next update.

    Apple doesn’t routinely monitor the discussions. These are mostly user to user discussions.
    Send Apple feedback. They won't answer, but at least will know there is a problem. If enough people send feedback, it may get the problem solved sooner.
    Feedback

  • How to split a string with linefeed character ( LF ) as a delimiter in VB6?

    Hi. I am writing a small program in VB 6.0. 
    I have a string named Data and it contains few characters along with <LF> in it. ( <LF> is a new line/line feed character).
    I want to split this string with <LF> as delimiter and store the tokens in an array. I tried with split function and its giving me type mismatch error. Can anyone tell me how to do it?
    I am giving the pseudo-code below.
    Dim Data as string
    Data = "hello, how are you<LS>good morning guys <LS> hi"
    Dim strarray() as stringMsgbox(Data)
    strarray = split(Data, "<LS>")
    When i see the Data in message box before split function, it shows up in different lines like this:
    hello, how are you
    good morning   guys 
    hi
    I want the final array strarray to be like this:   strarray(0) = "hello, how are you"
    strarray(1) = "good morning   guys "
    strarray(2)  = " hi"
    The spaces can be as it is. Just i need the string to be delimited wherever <LS> is there.
    Please help me as soon as possible. Though it is small one, i am stuck here.
    Thanks in advance,
    Satya.

    Hello,
    This forum is for VB.NET, please check the following resources
    http://www.vbforums.com/forumdisplay.php?1-Visual-Basic-6-and-Earlier
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/6a0719fe-14af-47f7-9f51-a8ea2b9c8d6b/where-to-post-your-vb-6-questions?forum=vbgeneral
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

  • How to get a string with fixed length

    I want to implement something like movechar() of c in java. I want to return a string which has a fixed length that contains the given string and spaces for remaining length.
    Please let me know how can I implement it.
    Thanks & Regards,
    Nasrin.n

    Do you mean padding a String?
          * This method pads the string s to size n using char c to make up for missing characters.
         public static String padString(String s, int n, char c, boolean paddingLeft) {
              StringBuffer str = new StringBuffer(s);
              int strLength = str.length();
              if (n > 0 && n > strLength) {
                   for (int i = 0; i <= n; i++) {
                        if (paddingLeft) {
                             if (i < n - strLength) str.insert(0, c);
                        else {
                             if (i > strLength) str.append(c);
              return str.toString();
         }

Maybe you are looking for

  • Aperture iPhoto library storage

    Just a little bit of background. I have two computers (iMac and Macbook) and I currently use iPhoto on both. I sync the libraries using Chronosync. I am thinking about buying AP3 and installing it on the iMac but I still want to be able to sync its l

  • Dynamic memory allocation

    Hi, guys, does anyone know whether I can use dyanmic memory allocation on the Real time system with "call library function" node. DLL is programmed using C language. Thanks. Machman

  • Refund not allowed for poor quality

    I have learned that even though my Skype number does not work correctly and there is poor quality on the line, it can never be refunded, and apparently Skype don't guarantee that it will even work properly according to customer support. After three h

  • Authorization errors in IX2-DL

    Hello I have a problem with my network storage I recently bought. I connected and configure it, try to store some data, try to download a torrent and everything works fine. Till I upgreaded software. New software needs users and admins to work, so I

  • How do I place a fixed image and show it between two pages like the Global on Page 3 (LOE)?

    How do I place a fixed image and show it between two pages like the Global on Page 3 (LOE)?