Subroutine to remove preceding spaces in a field

Hi,
I am from SAP BW.
Can anyone help me to write a sub routine to remove preceding spaces in a field .
The data is in excel sheet which we need to load into info cube. But as the data in the field contains preceding spaces,its unable to load and showing an error.
I need to write a sub routine for that.
Awaiting ur response.
Thnx
kapil

Hi,
use fm CONVERSION_EXIT_ALPHA_OUTPUT
or commands :
-pack
-shift val left deleting leading space
A.
Message was edited by:
        Andreas Mann

Similar Messages

  • Removing Leading Spaces in the field to be displayed

    Hi,
    Could you please tell me how to remove leading spaces in currency field in write statement?
    the length of the field cannot be changed by writing fieldname(length).
    is there any other method to do the same. the length should vary according to the amount in the field.
    Ragards,
    Krutika

    hi,
    please use "SPLIT "  or condense  .
    eg:  SPLIT wa_bseg-hzuon at space into wa_bseg1-hzuon l_space.
    to better understand refer this code:
    IF it_mhnd IS NOT INITIAL.
      SELECT hzuon bukrs gjahr augdt augbl
      FROM Bseg
      INTO TABLE it_bseg
      FOR ALL ENTRIES IN it_mhnd
      WHERE belnr = it_mhnd-belnr
        AND bukrs = it_mhnd-bukrs
        AND gjahr = it_mhnd-gjahr
        AND umskz = 'E'.
    endif.
    data: l_space type char6.
    loop at it_bseg into wa_bseg.
      SPLIT wa_bseg-hzuon at space into wa_bseg1-hzuon l_space.
      wa_bseg1-bukrs = wa_bseg-bukrs.
      wa_bseg1-hzuon = wa_bseg-belnr.
      wa_bseg1-hzuon = wa_bseg-gjahr.
      wa_bseg1-hzuon = wa_bseg-umskz.
      append wa_bseg1 to it_bseg1.
      clear: l_space, wa_bseg1.
    endloop.
    IF it_bseg1 IS NOT INITIAL.
          SELECT belnr bldat
            FROM bsad into table it_bsad
            FOR ALL ENTRIES IN it_bseg1
            WHERE belnr = it_bseg1-hzuon
            AND   bukrs = it_bseg1-bukrs
            AND   augbl = it_bseg1-belnr.
    endif.
    regards
    rahul
    Edited by: RAHUL SHARMA on Jan 5, 2009 12:19 PM
    Edited by: RAHUL SHARMA on Jan 5, 2009 12:20 PM

  • Write subroutine to remove single space after string

    Hi Expert,
    I am loading Master Data for Inventory , but due to space after my Material record (eg . Correct record - L20233   Error record - "L20233 " ) space sfter 3 charector . it is throughing me error. after edting records in PSA i am able load it further to 0material . Can anyone please help me in writing routine at Transformation level to remove space while loading . Step by step approach is highly appreciated.

    i have implemented start routine and it is working perfectly for loading data stage, But it is not able to delete records which is already exists. Probable reason it PERTICULAR MATERIAL USED AT SEVERAL PLACES is it correct ? --- 1
    Regarding this try checking if the keys you're comparing to delete the records is correct
    finally i have decided to add extension to material as original material suppose W02005 . Then while loading it will remove space from behind and add DONOTUSE to it so final it looks like W02005DONOTUSE .
    Regarding this point, this can be achieved easily in the routine itself. Just check the length of the material field and append this based on your condition.
    You can append like this
    concatenate material 'DONOTUSE' into materlal.
    Hope this is what you are looking for.
    Regards,
    Joe

  • Removing leading spaces

    How can I remove leading spaces on a field before it is saved to the database. I know that I need to use the LTrim function. However, I am unsure as to where.
    thanks.

    though there are plenty of ways you could do this depending on your page's setup, a simple implementation of this in a wizard-generated form on a table would be to put a Computation on your page for that item that fires with a "Computation Point" of after submit. so if you had a form on the Emp table, and you wanted to ltrim your P1_JOB item, you could do it using an after submit computation with a "Type" of "SQL Expression" where the body of your computation would simply be...
    ltrim(:P1_JOB)
    ...hope this helps,
    raj

  • How to remove space between two fields in emergency primary contact.

    How Can I remove a space between the two fields.IN emergency primary contact there are certain field called "C/O" and a i have added one text for this field inside that.But it is taking a big space between the "C/O" field and the text view.Plz suggest how I can re,move this?Also How Can I add new transparent container  with the end user personalization in the emergency contact field.

    Hi Peddi
    In my structure pannel I have simpleSearchPanel below that only i have the two lov fields ex: emp_no and emp_name . how to set the spacer between this From which Region where can find the spacer bean what proerty do i need to set
    Thanks
    AT

  • Remove blank spaces in a text field?

    How can I remove blank spaces in a text field? Some text fields have a lot of blank fields that need to be removed so that I can report only on the text.
    CRXI
    Edited by: Burton Roger on Feb 10, 2009 5:48 PM

    Ex:
    "Hi,
    I have a need for monthly service desk reporting.
    Please provide data on single sheet.
    Thank you"
    I would like to shrink it down to -
    Hi, I have a need for monthly service desk reporting. Please provide data on single sheet. Thank you"

  • New to MSSQL - need help with a query to remove spaces within a field

    After data conversion the leading and trailing spaces were removed from the data in the "tag" column.  However spaces in the middle of the column were not removed.  Tag data must be unique.  When I run an update script I get the
    message that "Cannot insert duplicate key in object 'mytablename'.   This tells me that my data looks like this:
    AAAAA[space][space]BBBBB --unique tag
    AAAAA[space]BBBBB -- unique tag
    If I remove the spaces from each I will have duplicates.  Therefore I'd like to update the records as follows:
    AAAAABBBBB --unique tag
    DUP-AAAAABBBBB -- unique tag
    How can I write a script that not only removes the spaces but also identifies the duplicate record?

    Hello,
    You can use the logic below. This would prefix DUP-n where n would be 1 to total number of duplicates values. This is just in case if you have more than one duplicate records.
    create table #duptest (TestData varchar(800), constraint p unique( TestData))
    insert #duptest (TestData) values ('CCCC DDDDD'),('AAAAA BBBBB'),('CCCC DDDDD'),('AAAAA BBBBB'),('AAAAA BBBBB')
    SELECT
    testdata AS ExistingData,
    ISNULL('DUP' + CONVERT(VARCHAR(10),NULLIF(ROW_NUMBER() OVER(PARTITION BY REPLACE(testdata,' ','') ORDER BY (SELECT NULL))-1,0))+'-','') + REPLACE(testdata,' ','') AS UniqueData
    FROM #duptest
    --sIbu

  • Removing extra spaces from a long document

    Hello
    I have seen a number of find/change and GREP formulas to do similar things. I have NO scripting or coding experience and have labored to understand GREP.
    So I am a little afraid to use it as I don't know what all the modifiers refer to (I do have a printout of some neat GREP cheatsheets like Mike Witherell's that I can absorb until I obtain a good reference )
    I need something I can copy and paste into either find/change or GREP dialog that will do the following in less than 12 steps (hopefully) without doing something catastrophic like removing all of my paragraph marks (which I almost did using someones GREP expression)
    No spaces before any comma, period, exclamation mark, question mark, colon, semicolon
    One space only after any of those
    One Space before any opening parenthesis and one space after the closing parenthesis
    No space after the opening parenthesis or before the closing parenthesis
    Remove any double or extra spaces ( en, em etc.)
    Remove any commas before parentheses
    Remove any spaces after a paragraph mark
    I think that's it
    I did find this one recently (Maybe Jongware?)
    [~m~>~f~|~S~s<~/~,~3~4%]{2
    Which from my dim understanding addresses em, en, flush and hair space ,  nonbreaking space ,figure space,third space--not sure of the rest. Really this is way over my head.
    I know this will be a piece of cake for you guys
    Thanks

A: Removing extra spaces from a long document

Peter is too modest, he's doing just great.
No space BEFORE-One Space after ---period,semicolon,colon, exclamation, question mark,CLOSING Parenth,Bracket,Brace, single & Dbl. quotation marks
Find (\s)([.,;:!\)\]\}~}~]])
Replace with $2
No space AFTER-One Space Before----OPENING bracket,brace,parenthesis,Dbl & single quotes
Find ([\[\{\(~{~[])(\s)
Replace with $1
These remove the space before/after but do not automatically add a space after/before.
In the first case, you could add a space right after the '$2' in the Replace With string, but it already may have a space, in which case you suddenly have two. One alternative is to optionally remove it with the Find string (add it as an optional match) and always add it with the Replace string, but remember that this string will only be found if there is a space preceding it. That way you'd only check the space after in cases where there was a bad space before.
So I propose you add another two find/changes to add the space, only when necessary.
One Space After: find
([.,;:!\)\]\}~}~]])(?!\s)
replace:
$0 [followed by one single space]
One Space Before: find
(?<!\s)([\[\{\(~{~[])
replace:
[one single space] $0
Color-coding with my WhatTheGrep might make it just a tad clearer what's going on in that jumble of codes:
(1 [ .,;:! \) \] \} ~} ~] ] 1) (?!! \s !)
and
(?<!<! \s <!) (1 [ \[ \{ \( ~{ ~[ ] 1)
(Orange is lookahead/lookbehind, blue is a regular escaped character, pink is an InDesign special character, green is normal grouping parentheses, and lavender is a character group.)

Peter is too modest, he's doing just great.
No space BEFORE-One Space after ---period,semicolon,colon, exclamation, question mark,CLOSING Parenth,Bracket,Brace, single & Dbl. quotation marks
Find (\s)([.,;:!\)\]\}~}~]])
Replace with $2
No space AFTER-One Space Before----OPENING bracket,brace,parenthesis,Dbl & single quotes
Find ([\[\{\(~{~[])(\s)
Replace with $1
These remove the space before/after but do not automatically add a space after/before.
In the first case, you could add a space right after the '$2' in the Replace With string, but it already may have a space, in which case you suddenly have two. One alternative is to optionally remove it with the Find string (add it as an optional match) and always add it with the Replace string, but remember that this string will only be found if there is a space preceding it. That way you'd only check the space after in cases where there was a bad space before.
So I propose you add another two find/changes to add the space, only when necessary.
One Space After: find
([.,;:!\)\]\}~}~]])(?!\s)
replace:
$0 [followed by one single space]
One Space Before: find
(?<!\s)([\[\{\(~{~[])
replace:
[one single space] $0
Color-coding with my WhatTheGrep might make it just a tad clearer what's going on in that jumble of codes:
(1 [ .,;:! \) \] \} ~} ~] ] 1) (?!! \s !)
and
(?<!<! \s <!) (1 [ \[ \{ \( ~{ ~[ ] 1)
(Orange is lookahead/lookbehind, blue is a regular escaped character, pink is an InDesign special character, green is normal grouping parentheses, and lavender is a character group.)

  • How can I remove ASCII text from a field when I use it in a query

    How can I remove ASCII text from a field when I use it in a query?
    I am running a select statement on a table that appears to have ASCII text in some of the fields. If I use these fields in the where statement like the code below nothing returns:
    SELECT FIELD1 FROM TABLE1 WHERE FIELD1 IS NULL
    But the field looks empty if I do a straight select without the where clause. Additionally, one of the fields has text but appears to be padded out with ASCII text, which I need to strip out before I can use this field in a where or join statement. I have tried using a trim, ltrim, rtrim, to_char, nvl, decode and nothing works. When I use excel to run the same query it looks as if these ASCII fields are boxes.
    I have asked our DBA team to see what they can do to prevent these from going into the table, but in the mean time I still need to run this report.
    Do you have any suggestions?

    Can you provide an example? I've been trying (for
    example) "select translate(' test one', ascii(' '),
    'X') from dual" with no luck.
    Thank you.To replace space, you should query like this:
    select translate(' test one', chr(32), 'X') from dual instead of select translate(' test one', ascii(' '), 'X') from dual Thanks,
    Dharmesh Patel

  • How to remove target node if source field value is empty SAP PI Mapping

    Hello,
    how to remove target node if source field value is empty in graphical Mapping.
    Like if
    MIddle name in source filed is empty, I would like to eliminate target field from out put XML.
    Thank you
    John

    Hi Jhon,
    If you want to remove all empty tags and you dont to complicate your message mapping, you can use a XSL, after the message mapping,  to remove all the empty tags:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:template match="node()|@*">
            <xsl:copy>
                <xsl:apply-templates select="node()|@*"/>
            </xsl:copy>
        </xsl:template>
        <xsl:template match="*[not(@*|*|comment()|processing-instruction())
         and normalize-space()='' ]"/>
    </xsl:stylesheet>
    Regards

  • Needs to remove Balnk spaces in the report next to data

    Dear SDN's,
    Report is displaying as below,my end user wants to remove blank spaces which has no data.
    Ex: In C1 sales is 10,but profit is blank.so profit wont be display for C1.Similar for C2 sales wont be displayed & profit shoud display.
    Customer      Sales      Profit
    C1     10      
    C2          15
    C3     20     
    We can do zero supression when we have '0' in the blank space.but we have 'Blank' not '0'.
    We can remove the whole column when the whole column is 'Blank'.But is there a way if we want to not see the blank spaces.
    Thanks and Kind Regards,
    Lakshman Kumar G

    Hi Lakshman,
    To display Blank as Zeros,
    The Fourth Value which u hve given i.e Zero as default text ,select this and in the below Field .e Show Zero ,type there as 0(ZERO).
    Also alternate could be ,try this
    Create a CKF for each KF with formula KF Not Equal to*0
    OR
    KF EQ 0*KF.
    I am not suire on the Hiding of KF individually with Zeros Values.
    Rgds
    SVU

  • Simple??? Want "INSERT" function to return blank space after a field, how?

    All,
    Am I just having a brain fart? I have a situation where I have a field that needs to return just one space, or a value that has a space before and after it.
    Example:
    In the text ==> I am<field>going to the office. <-- notice no space between am, <field> and going
    I want it to say if FALSE, then "I am *not* going to the office."
    If true, then "I am going to the office."
    If true, I'm simply RETURN(""); <-- This returns a blank space
    If FALSE, I have tried:
    ret="not"
    RETURN(" " & ret & " ");
    This returns "I am notgoing to the office". <-- Notice no blank space after "not"?
    I've tried
    ret="not";
    ret2=(" " & ret);
    RETURN(Insert(ret2, 3, " "));
    Still the same result. What's strange is, if I do a RETURN(Insert(ret2, *2*, " "));, then it returns "I am no tgoing to the office" <-- Notice the space between the "o" and the "t"?
    Ideas?

    Trailing spaces are often removed from data. In your case, the easiest thing to do will be to use what is called the "hard space" character instead of a "real" space. This is key code ALT+0160. For all intent and purposes, it looks like a space and will print as a space, but since it is not technically the space (0032) character, it will not be trimmed from your projects. Just open the quotes, turn off the NUMLOCK and hold down the ALT key and type 0160 and then release the ALT key. This will add the hard space into your string. Then if you are like me, you will have to remember to turn the NUMLOCK back on.
    " not "
    I'm not sure how this will post into this message, but the example above is using hard space characters.
    Edited by: user9976634 on Dec 5, 2012 12:52 PM

  • Remove blank spaces

    Dear Forum,
    Field bkpf-xblnr is 16 char. I need to remove the space before and after in case user does not enter at the first position.
    example, user enter the value bb1234567bbbbbbb during the entry screen in bkpf-xblnr where i will put 1234567 to another new variable in my program.
    May I know what can i do?
    Thanks

    Dear,
    we use a keyword in SAP ABAP called CONDENSE with an addition NO-GAPS to remove all blank spaces in a char type data object..
    so for you..
    condense bkpf-xblnr no-gaps
    will work
    more help at
    http://help.sap.com/abapdocu_70/en/ABAPCONDENSE.htm

  • Need to remove the space between  af:panelGrouplayout & af:panelBox

    Hi All,
    I am using JDeveloper 11.1.1.6.
    My Scenario is I need to stretch some fields for all the browsers so I am using Panel box inside the panelStretchLayout<f:facet  name=center>.
    It's working fine.But Some Scenarios need to show header items  above panel box .So I try to add panelGroupLayout in <f:facet name=top> .It's stretching fine but always it's showing space between <af:panelBox>.
    How can I remove the Space between <af:panelGroupLayout > & <af:panelBox>?
    My Codes like this ,,
      <af:panelStretchLayout id="psl1" inlineStyle="margin-top:30px;">
                  <f:facet name="top">
                    <af:panelGroupLayout id="pgl4" layout="vertical"
                                         inlineStyle="background-color:red;">
                      <af:panelGroupLayout layout="horizontal" id="pgl1">
                        <af:outputText value="Day" id="ot1"/>
                        <af:outputText value="Week" id="ot2"/>
                        <af:outputText value="Month" id="ot3"/>
                        <af:outputText value="Year" id="ot4"/>
                      </af:panelGroupLayout>
                    </af:panelGroupLayout>
                  </f:facet>
                  <f:facet name="center">
                    <af:panelDashboard columns="1" rowHeight="100%" id="pd1">
                      <af:panelBox id="pb1" showDisclosure="false"
                                   showHeader="never"></af:panelBox>
                    </af:panelDashboard>
                  </f:facet>
                </af:panelStretchLayout>
    Thanks...

    You have not specified explicit height for the top facet, so its height is 50px (which is the default height for "top" and "bottom" facets if they exist). You can specify an exact height for the top facet using the "topHeight" property of the <af:panelStretchLayout> tag:
    <af:panelStretchLayout ... topHeight="25px">
    Alternatively, you can specify height "auto" in order to instruct the component to calculate the height automatically depending on the content within the facet:
    <af:panelStretchLayout ... topHeight="auto">
    Note, that specifying an "auto" height puts little overhead to the layout manager which has to calculate the height first and to render the panel after that.
    Dimitar

  • FM to remove Leading spaces

    Hi,
      Can any tell me how to remove the leading spaces from the variable with sample code or any function module.
    I have field which is of 40 characters. slpit that into two different variables first 4 and rest 36 characters.
    But there is possibility that 5 character (which will be the first character out of 36) is a space.
    I want to remove that space from that as i have to compare this after removing the space with another variable.
    Pls tell me how to do this? is there any Function module or any other way.

    Hi Hema,
    1. we can use
       CONDENSE
       REPLACE
    2. Just see the documentation on this. F1
    3. Both functionality is different
       as the name suggests.
    4. U can use as per ur requirement.
    regards,
    amit m.

  • Maybe you are looking for

    • Can't read the base station configuration

      I just set up my AirPort Express using the Airport Utility, connected to Comcast high-speed Internet service. for some strange reason, the base station still has the "amber light blinking," while I seem to have no trouble with Internet connection (I'

    • ISO Boot Camp Windows 8.1 Install

      Hi, I just purchased Windows 8.1 from the Microsoft Store as a digiital download. It came as an .exe, so using a friend's PC I installed the Media Creator program from Microsoft in order the generate the files needed to boot install from a flash. The

    • How can I get Mail to capitalise the first letter of a sentence?

      Hello all, this is my first time using apple Support Community.  i am a new apple user and have just got my first MacBookPro (its wonderful).  however, i am having some difficulties.  How can i get Mail to capitalize the first letter of a sentence an

    • HT4528 Why does my phone say invalid SIM?

      My phone says invaild SIM. I cannot text, call, or connect to the internet!!! What is the problem??

    • FCPX: How to Achieve Weird Effect

      I found an effect in a video I would like to do but how would I do this? You can see the outlining effect at 00:03 in this video. http://youtu.be/Ay1Jvwwk4Qs