How to pad spaces at the end of a string

Hi All,
I am new to ABAP and need help to achieve this functionality
   I have to build a string with fixed lenth . my input string
  is always lesser than equal to X . I need to calculate and
   add that many spaces at the end of the input string .
  I tried to do this and getting the following error
    please help on this :
  if strlen( t_resultc ) < 525.
  RFILL(t_resultc,' ',525)
  endif.
  Error : Comma without preceding colon(after RFILL(T_RESULTC ?)
Q: Can I use RFILL with out Select statement in a ABAP program
Thanks & Regards
  KLK

Hi,
Try the following code but kindly make a note..
Note:-USE quote like this  ` `, Instead of normal single quotes ‘ ’
WHILE strlen( T_RESULTC ) < 525.            “Check the length   
   CONCATENATE  T_RESULTC ` ` INTO T_RESULTC. ”Add spaces at the end   
ENDWHILE.
Hope this helps,
Andrew

Similar Messages

  • How to add spaces at the end of record

    Hi Friends,
    i am creating a file which contains more than 100 records.
    In ABAP i have internal table with on field(135) type c.
    some time record have length 120, somtime 130 its vary on each record.
    but i would like to add space at the end of each record till 135 length.
    Can you please help me how to add speace at the end of record.
    regards
    Malik

    So why did you said that in your first posting? My glass sphere is out for cleaning...
    Instead of type c use strings and add spaces until they have the appropriate length.
    loop at outtab assigning <pout>.
      while strlen( <pout>-val ) < 135.
        concatenate <pout>-val `` into <pout>-val.
      endwhile.
    endloop.

  • Delete spaces on the right of a string of characters

    Hi,
    I'd like to know how to delete space on the right of a string of characters and ONLY the ones on the right in order I can get the real length of the string (I don't want to condense the spaces between words even though there's more than one).
    data: text(20).
    text = 'SAP Forum'
    In this case, if I use both DESCRIBE LENGTH and DESCRIBE OUTPUT LENGTH, the result will be 20, but the real length is 9.

    Use STRLEN( ), as described by the other posters.
    To delete space chars on the right of a string, use following static method:
    CALL METHOD cl_abap_string_utilities=>del_trailing_blanks
      CHANGING
         str = lv_text.

  • Preserve a single space at the end of line using spool command

    Hi,
    Can you please help me to write the result of an sql query into a file with the last column of the row ending with a single space?
    For example:
    COL1DATA|COL2DATA|COL3DATA<space1>
    As mentioned in the example the col3 value in the file should end with a single space. And there should not be any delimiters at the end of the row.
    I tried with set trimspool on/off. But, it didn't work. When I say trimspool on - it is trimming all the trailing spaces.
    When I say trimspool off - it is retaining all the trailing spaces to the size of the line.
    But, I do not wish to modify the file through shell commands once it is written thru spool. I mean I do not wish to append spaces to the end of a line using shell script or any other method.
    I do not wish to use other methods like UTL_FILE also.
    Please help me how to do it using spool command?
    Thank you.
    Ramana

    My requirement is that all the trailing spaces should be truncated except the last one in the row.Why?
    As you have discovered a single column in sqlplus, is always a fixed length regardless of the size of the data, if the length of the data varies the output is padded to the maximum or line size with spaces. The trim and trimpsool commands are there to remove all the spaces from the end of a line if there are any. There are no commands to trim all the spaces except one, or even to trim all the spaces except two, or three even.
    If you want such custom processing you should post process the file in the OS using sed, awk or perl or something designed for such things.

  • Adding space at the end of a ritchEditableText  line

    Hi!
    I found an interesting behaviour in my application.  I have a RichEditableText component with a fixed width . If I add text till almost the end of the line and then  insert spaces, the cursor get's stuck at the end of the line. My surprise was on retreiving the text from that line in the code, where all that spaces existed even if they were not visible in the app. So on screen you see let's say 3 spaces, but then you save the text you can get 10. If you keep inserting any letter the cursor will move itself to the next line, but this does not seem to be the case of " "(space).
    I tested it useing the following code. I'm useing 4.1 sdk.
    <s:RichEditableText id="richTxt"  width="100" height="500" change="richTxt_changeHandler(event)" />
    protected function richTxt_changeHandler(event:TextOperationEvent):void
                    var noOfLines:int = richTxt.textFlow.flowComposer.numLines;             
                    for (var i:int = 0; i < noOfLines; i++)
                        var startIndex:int = richTxt.textFlow.flowComposer.getLineAt(i).absoluteStart;
                        var seqLength:int = richTxt.textFlow.flowComposer.getLineAt(i).textLength-1;
                        var textLine:String = richTxt.text.substr(startIndex, seqLength);
    I try to set clipAndEnableScrolling=true; for richTxt but this thid not change anything.
    How can I retrieve only the visible text( with the corect number of spaces at the end of the line) from the RET in order to save it ?
    Thanks !

    Do you want to handle that space or just use the text value?
    If you just want to use the text value (i.e 1word - space)...u simply say CONDENSE <UR TEXT VARIABLE>.
    Else the other option is: Find the string length and then handle it the way u want.
    Or if u r sure that every word has that extra space, and u dont want that u can even use SHIFT RIGHT BY 1 PLACE in thet text variable.
    Hope this helps.
    Thanks
    Kiran

  • May I run "shrink DB/truncate free space from the end of file" at PROD?

    We have a SAP/MSS production system.
    The disk is full.
    We want to truncate the log file by:
    "shrink DB/truncate free space from the end of file"
    on the log file.
    How risk is it? Can we do it during production is running?
    Thanks! Points!

    Backup the log file (to save the data and keep a consistent backup) Then shrink the file. Its normal for the log not to shrink down to the size you want. Do not shrink past 1GB.
    DO NOT TRUNCATE - you are losing/dropping data and recovery will only be possible to the last on-line, or on-line plus last log/s.
    You can avoid a full log file by setting a 9002 trap - this will trigger a backup (like oraarch when you back up based on % full). Else you need to change the frequency of the backups for the logs to ensure the system never fills ups.
    You can Also add a second log file on a separate F/S if this occurs regular - which it shouldn't if you have a correct backup strategy.

  • Blank spaces at the end of an IDoc text field get lost when posted to R/3

    Hi Guys,
    I am facing the following issue:
    In an XML file-to-Idoc scenario, there are spaces at the end of a text field in the inbound XML file, which I can see when I open the inbound file with a text editor like notepad, and they are kept after XI mapping is executed (I can see them in message mapping simulator). However, it seems that these spaces get lost once the IDoc is posted to SAP R/3 and they are not visible on SAP R/3 side.
    Do you have any idea ? Thanks.
    Best Regards,
    Evaggelos Gkatzios

    That means SAP is removing the spaces from IDoc fields, where you spaces are not allowed. Does it create any problem?
    Thanks,
    Nabendu.

  • In Photoshop Elements 7, how do I free up the ends of a crop box independently?

    In Photoshop Elements 7, how do I free up the ends of a crop box independently?
    I require the end points to move independently to fit am image crop

    Thanks.
    You have helped tremendously!

  • Space at the end of a word

    Hello,
    Is there a way to recognize space sign at the end of a sentence?
    The meaning of that is that there is a word that somebody typed at the end of the sentence
    and after that pushed the space bar . When looking at the text inside the sap system the text looks fine,
    but when transferring to excel the text doesnt equal because the space at the end of the sentence.
    Please advise
    Yifat

    Do you want to handle that space or just use the text value?
    If you just want to use the text value (i.e 1word - space)...u simply say CONDENSE <UR TEXT VARIABLE>.
    Else the other option is: Find the string length and then handle it the way u want.
    Or if u r sure that every word has that extra space, and u dont want that u can even use SHIFT RIGHT BY 1 PLACE in thet text variable.
    Hope this helps.
    Thanks
    Kiran

  • Check space in the end to display warning message.

    I am currently working on validations on functional locations in the EDIT MASK. the code is already written for validations on to check for space in the beginning of the each level in the edit mask. however user requirement is that the program should produce warning messages for spaces regardless of where they appear in the Edit Mask. we have not validated to check for space at the end of each level.
    I have checked with condense ,shift string right deleting trailing spaces however I am not able to check for space at the end of levels.
    when i debugged the program the level8 length shows as 2 even though there is only one char in the level8. i
    could you please suggest any possible solution or any keywords that would help. you can go through the below code which is already written for checking space in the begining.
    here l_level1
    Level 8 errors
        l_length = STRLEN( l_level8 ).
    IF ( l_level8 = space AND l_dash_count > 6 ) OR
             l_dash_count > 7 OR
             l_length > 4.
          lt_mask_err-error = '8E'.
          APPEND lt_mask_err.
          l_errlvl8 = c_y.
        ENDIF.
    Level 8 Warning
        IF rb_bdc <> c_on AND p_warn = c_on AND
        ( l_level8 <> space AND l_level8+0(1) = space ).
          lt_mask_err-error = '8W'.
          APPEND lt_mask_err.
        ENDIF.
    i have added this code to display warning message using shift.
        l_lev8 = l_level8.                                                
        shift l_lev8 right.                                             
        l_length = STRLEN( l_lev8 ).                                    
        IF rb_bdc <> c_on AND p_warn = c_on AND                       
        ( l_lev8 <> space AND l_lev8+0(1) = space ).                    
          lt_mask_err-error = '1W'.                                     
          APPEND lt_mask_err.                                          
        ENDIF.

    You can use REGEX for string parsing, it is really handy. If you would like to test it out check out program "demo_regex_toy".
    Trailing space:
    FIND REGEX '[ ]+$' IN lv_text.
    leading space
    FIND REGEX '^[ ]+' IN lv_text.
    Any space
    FIND ALL OCCURRENCES OF REGEX '[ ]+' IN lv_text.

  • How to remove space below the table in smartforms

    how to remove space below the table in smartforms

    maintain a loop counter for item say count
    and in text editer write
    if count > 6
      new-page.
    endif.

  • EWA for java only systems - how to get ewa at the end

    Hi gurus,
    I have a solma system in which  all smd agent setup for portal was done and also all tasks (to collect data for EWA) are running well for ep systems aswel.
    We are at sps 17 in solman.
    I need to generated EWA for this portal system.I have no idea of how to generate it at the end.and i need that report routed to my mail.Some one please let me know how to generate EWA(after setup of every thing) and how to route it to mail address.
    Thank you.

    Hi ,
    Thanks for few inputs
    I have my EP system in system components in java (sub). and also in systems->netweaver->I have cinfigured my EP.But after this also I am unable to schedule it in DSWP.Can any one of you give some thoughts.(Seems I am missing some thing here - can any one let me know the procedure here to cross verify)
    Rohit,I followed that user guide with out missing a single point!.But still I am unable to pull my report..
    Tried manually with xml file(generated for EP from SM) and given it in DSM but it is saying no data available.
    Seems nothing is coming from my EP.
    Below are few exceptions in xml file.
    1) introscope data is missing
    Cannot find agent name Business-Sandbox_SEP_server0 for
    instance[IInstance: key=1178028371063144, type=[Server],
    nodeId=13865850, creation=Tue May 01 09:05:01 CDT 2007]
    for thie exception - not sure why my SM is not resolving EP's sid.
    Please not - SMD is  running fine in EP
    Any thoughts?
    2) PAR data is missing
    ORA-12505, TNS:listener does not currently know of SID given in connec descriptor
    The Connection descriptor used by the client was:
    Thank you.

  • Append a substring to the end of a string

    I'm trying to dynamically generate my "where" clause for a
    SQL query. I'd like to append a substring to the end of an existing
    string. I tried "ListAppend", but of course that puts a comma
    between the original string and the substring. I could use "Insert"
    string function, but it seems rather a hassle to have to LEN the
    existing string each time I want to append something to the end of
    it. Is there an easy way to append a substring to the end of a
    string?
    Here's an example of the code (using the "ListAppend" that
    doesn't work):
    <CFSET whereStmt = "ads.ad_duedate + INTERVAL 1 DAY >=
    NOW()">
    <cfswitch expression="#vendorSort#">
    <cfcase value="Yes"><CFSET whereStmt =
    ListAppend(whereStmt, " AND ads.ad_vendor =
    #AdSortBy#")></cfcase>
    </cfswitch>

    On additional suggestion...
    You can use WHERE 0=0 as the first comparison in your where
    clause. This obviously is always true. The benefit is now you can
    have as many if statements adding conditions you want without have
    to worry about generating an invalid sql statement such as WHERE
    AND userid = 5 ie
    <cfset var sql = "">
    <cfset sql = "SELECT * FROM Users WHERE 0=0 ">
    <cfif GetOnlyActiveUsers()>
    <cfset sql = sql & "AND Active = 1 ">
    </cfif>
    Note that there is a space at the end of every line to ensure
    separation of statements.

  • Need help in laoding flat file data, which has \r at the end of a string

    Hi There,
    Need help in loading flat file data, which has \r at the end of a string.
    I have a flat file with three columns. In the data, at the end of second column it has \r. So because of this the control is going to the beginning of next line. And the rest of the line is loading into the next line.
    Can someone pls help me to remove escape character \r from the data?
    thanks,
    rag

    Have you looked into the sed linux command? here are some details:
    When working with txt files or with the shell in general it is sometimes necessary to replace certain chars in existing files. In that cases sed can come in handy:
    1     sed -i 's/foo/bar/g' FILENAME
    The -i option makes sure that the changes are saved in the new file – in case you are not sure that sed will work as you expect it you should use it without the option but provide an output filename. The s is for search, the foo is the pattern you are searching the file for, bar is the replacement string and the g flag makes sure that all hits on each line are replaced, not just the first one.
    If you have to replace special characters like a dot or a comma, they have to be entered with a backslash to make clear that you mean the chars, not some control command:
    1     sed -i 's/./,/g' *txt
    Sed should be available on every standard installation of any distribution. At lesat on Fedora it is even required by core system parts like udev.
    If this helps, mark as correct or helpful.

  • How do i get rid of black space at the end of a video presentation?

    After creating a project in iMovie and burning it onto a DVD, I realized that when the movie was finished, it did not return to the Menu right away and instead it played 20 or so seconds of blackness that I can't seem to get rid of. Has anyone else had this problem? And how do i fix it? I have also checked if my any audio or narration tracks lengths were that long, and none were.
    Please help.
    MacBook Pro   Mac OS X (10.4.10)  

    In the course of your editing you may inadvertently have left a tiny scrap of audio or video way out at the end of your time line, with a large gap between it and the last clip in your movie. Your movie will play out until it reaches that scrap, leaving a large black gap at the end of the movie. Sometimes these scraps are so tiny that they are difficult to see and can be overlooked in normal view. Expand your time line view to its fullest extent and check to see if you can find such a scrap, left over from editing, and then delete it. It's worth a look, though you may not find anything. That's all I can think of, unless for some reason you have a 20 second long black clip at the end of your movie that you forgot to delete. (Don't laugh--it happened to me once.)
    Good luck in resolving your issue.

Maybe you are looking for