Appending spaces after a CHAR field

Hi,
We are generating a fixed width pipe delimited flat file in our project and hence to keep the width constant for every record, we need to append spaces after the individual values in the records. Some of these infoobjects are not ALPHA converted. This ALPHA conversion can be done at the field level routines by executing "CONVERSION_EXIT_ALPHA_INPUT" but this works only with numbers. For character fields like Name or address, we need a way to append the balance number of spaces to the value of the info object.

This is sample:-
data : a type i,
         b type i,
         t type i.
a = strlen ( source ).
b = strlen ( target ).
t = b - a.
result+0(t) = source.
please check this.

Similar Messages

  • DG4ODBC adds black spaces after every character

    I am trying to set up HS using Oracle 10.2.0.5 on RHEL5 (64 bit), FreeTDS, and MS SQL Server.
    The ODBC Driver works fine:
    [oracle@phsbe1pr ~]$ isql sfasql_freetds_dsn sqlSinfoOne ***
    | Connected! |
    | |
    | sql-statement |
    | help [tablename] |
    | quit |
    | |
    SQL> select name, len( name ) from sys.objects where object_id < 20 ;
    ---------------------------------------------------------------------------------------------------------------------------------------------+
    | name | |
    ---------------------------------------------------------------------------------------------------------------------------------------------+
    | sysrscols | 9 |
    | sysrowsets | 10 |
    | sysallocunits | 13 |
    | sysfiles1 | 9 |
    | syspriorities | 13 |
    | sysfgfrag | 9 |
    ---------------------------------------------------------------------------------------------------------------------------------------------+
    SQLRowCount returns 6
    6 rows fetched
    SQL> quit
    [oracle@phsbe1pr ~]$
    [oracle@phsbe1pr ~]$ tsql -S SFASQL_FreeTDSName -U sqlSinfoOne -P ***
    locale is "en_US.UTF-8"
    locale charset is "UTF-8"
    using default charset "UTF-8"
    1> select name, len( name ) from sys.objects where object_id < 20
    2> order by 1
    3> go
    name
    sysallocunits 13
    sysfgfrag 9
    sysfiles1 9
    syspriorities 13
    sysrowsets 10
    sysrscols 9
    (6 rows affected)
    1> exit
    [oracle@phsbe1pr ~]$
    But when I use the dblink i got every string doubled with spaces after every char:
    [oracle@phsbe1pr ~]$ sqlplus / as sysdba
    SQL*Plus: Release 10.2.0.5.0 - Production on Mon Jul 23 17:22:25 2012
    Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> set linesize 120
    SQL> column name format a40
    SQL> select "name", length ( "name" )
    2 from sys.objects@sfasql_link
    3 where "object_id" < 20
    4 order by 1
    5 /
    name LENGTH("NAME")
    s y s a l l o c u n i t s 26
    s y s f g f r a g 18
    s y s f i l e s 1 18
    s y s p r i o r i t i e s 26
    s y s r o w s e t s 20
    s y s r s c o l s 18
    6 rows selected.
    SQL>
    What can I do ?
    Mi init.ora is:
    HS_FDS_CONNECT_INFO = SFASQL_DSN
    HS_FDS_SHAREABLE_NAME = /usr/lib64/libodbc.so
    HS_FDS_TRACE_LEVEL = off
    HS_FDS_TRACE_FILE_NAME=/tmp/odbc_hs_sfa.trc
    HS_FDS_SQLLEN_INTERPRETATION = 32
    set ODBCINI=/etc/odbc.ini
    adn odbc.ini contains:
    [SFASQL_DSN]
    Description = sqlserver
    Driver = FreeTDS
    # Servername = SFASQL_FreeTDSName
    Server = phsspbe.perfumeholding.intra
    Address = 172.17.0.45
    Port = 1433
    Database = SFA_INTERSCAMBIO
    TDS_Version = 8.0
    Language = us_english
    TextSize = 1999
    PacketSize = 1470
    ClientCharset = ISO-8859-1
    DumpFile = /tmp/odbc_sfasql_dsn.log
    DumpFileAppend = Yes
    DebugFlags =
    Encryption = off
    #Trace = Yes
    #TraceFile = /tmp/odbc_sfasql_dsn.trc
    Thank you for every answer!
    Andrea

    1. Please add to the gateway init file HS_NLS_NCHAR=UCS2
    Then test again with a new SQL*Plus session.
    When it continues to fail, what's the character set of the Oracle database being used and how did you set the NLS_LANG in your environment?

  • Want to display a space after last field in the output txt file

    hi
    I want to display a space after last field in the output txt file which is generaed by my program on utility server the last field lengyt we have defined is four and in database it is of three characters and requirement is to disppaly the last fourth field as space in the output file w hich is not shown as the txt file automatically gets closed at the third place as it is the last field in the record and ind atabase records are of therss char only but user wants to display this fourth position in the notepad output file as space ( which is last field in the output file)
    eg
    name house  street country
    record output coming in file
    ram   h3      street3  thn      now this thn which is last field the notepad get closed at thn only
    i want to display one space in last field for the whole of output file
    ie ram      h3   street3  thn(space)
        sham   h4  street4   sgp(space)  so on......
    we need to show this space in the output file as blank
    regards
    Arora

    hi Atish
    i am using
    loop at gt_sagadr_outtab into wa_sagadr_outtab
    move wa_sagadr_outtab-country to wa_sagadr_text+223(226).
    endloop
    in this last field ie country i need to display the last 226 as blank as only country key is two char in database so the last space is not shown
    i am not unsing the fM as tolb by  you
    and afterwards
    i am usning
    Concatenate 'Sagadr_' sy-datum sy-uzeit '.dat' into gv_filename_sagadr.
    CALL FUNCTION 'FILE_GET_NAME'
      EXPORTING
      CLIENT                        = SY-MANDT
        LOGICAL_FILENAME              = gc_lfile
        OPERATING_SYSTEM              = SY-OPSYS
        PARAMETER_1                   = gc_param1
        PARAMETER_2                   = gc_send
        PARAMETER_3                   = gv_filename_sagadr
      USE_PRESENTATION_SERVER       = ' '
      WITH_FILE_EXTENSION           = ' '
      USE_BUFFER                    = ' '
      ELEMINATE_BLANKS              = 'X'
      IMPORTING
      EMERGENCY_FLAG                =
      FILE_FORMAT                   =
        FILE_NAME                     =  gv_filepath_sagadr
    EXCEPTIONS
      FILE_NOT_FOUND                = 1
      OTHERS                        = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    and lastly
    open dataset gv_filepath_sagadr for output in text mode encoding default.
        if sy-subrc eq 0.
         loop at gt_sagadr_text into wa_sagadr_text.
         transfer wa_sagadr_text to gv_filepath_sagadr.
         endloop.
        endif.
       close dataset gv_filepath_sagadr.
        if sy-subrc = 0.
        message S002 with gv_filepath_sagadr. "Files & created on Application server
        endif.
    SO NOT SURE WHERE TO USE THE CODE AND HOW

  • Trailing space in char field

    Hello there,
    I am a BW developer and I am currently having an issue with trailing spaces in an ABAP routine.
    This is the situation (example... In real life I use larger char fields):
    - From a source I get a text line that is let's say max. 60 characters long.
    - In BW I split this line into 3 parts and save those in the short text fields of 3 different InfoObjects. Short text is defined as CHAR 20.
    - Later on I can display the text line I just split up as one line of text again. I need to do this because BW can only store texts with acertain length.
    - Now it is possible that the text line I get has a blank at position 20. I need to keep this blank in the first of my 3 parts. But since it is a character field, the blank is ignored and only the first 19 characters are saved.
    Question:
    How can I manage to save all first 20 characters in the first of the three CHAR 20 fields, including any trailing blanks?
    The fields have to be defined as CHAR because that is the definition of text fields in BW. (data type RSTXTSH, to be exact)
    Example:
    Incoming text line (Notice, the character at position 20 is a blank):
    "blabla1111blabla111 blabla2222blabla2222blabla3333blabla3333"
    After splitting it into three parts, I get this:
    Part 1: "blabla1111blabla111" (no trailing blank)
    Part 2: "blabla2222blabla2222"
    Part 3: "blabla3333blabla3333"
    What I need is this:
    Part 1: "blabla1111blabla111 " (with trailing blank)
    Part 2: "blabla2222blabla2222"
    Part 3: "blabla3333blabla3333"
    Any help will be greatly appreciated
    Thanks and regards,
    Stefan

    Hi Stefan,
    As Stefan Seeburger already said you can use RESPECTING BLANKS to get that.
    DATA: i_input TYPE c LENGTH 60,
           e_part1 TYPE c LENGTH 20,
           e_part2 TYPE c LENGTH 20,
           e_part3 TYPE c LENGTH 20,
           v_space   TYPE c LENGTH 1,
           e_partfull TYPE c LENGTH 60.
    i_input = 'blabla1111blabla111 blabla2222blabla2222blabla3333blabla3333'.
    SPLIT i_input AT v_space INTO: e_part1 e_part2 e_part3.
    e_part1 = i_input(20).
    e_part2 = i_input+20(20).
    e_part3 = i_input+40(20).
    DATA: lv_length TYPE i.
    lv_length = STRLEN( e_part1 ).
    CONCATENATE e_part1 e_part2 e_part3 INTO e_partfull RESPECTING BLANKS.
    DATA: lv_length2 TYPE i.
    lv_length2 = STRLEN( e_partfull ).
    BREAK-POINT.
    Cheers!

  • White space after flowed layout/expandable fields?

    Hi,
    I have a few pages on a form with a flowed layout where the text fields expand.The problem I am having is when the text field expans and continues on the following page,its leazing an entire white space right after it.Is there a way to do this so eventhough the text field expands onto the next page,the content on the next page continues right after the expanded field without a page of white space?
    Thanks.

    Hi,
    You need to check Allow page breaks within content option for the subform. Object > Subform >  Allow page breaks within content.
    By default even for the field this option would be checked if it is not You need to do samething even for the field.
    This would work.
    -Vjay

  • 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

  • Why have to append spaces when data type is char?

    I have a tabe MyTable which has tow columns(code char(8),name varchar2(16)) and there is one record ('003','mike') in the table,I retrieve the table use the code :
    ......//get database connection
    String sql = "SELECT * FROM MyTable where code = ?";
    PreparedStatement st = conn.prepareStatement(sql);
    st.setString(1,"003");
    ResultSet rs = st.executeQuery();
    ......//other code
    I cann't retrieve the record,I have to append 5 space to the parameter to get data: st.setString(1,"003 ").
    When column's data type is char , I have to append spaces to the parameter values? why?

    or if you want to do it at the API level, you can use the Oracle extension
    OraclePreparedStatement.setFixedCHAR
    public void setFixedCHAR(int paramIndex,
                             java.lang.String x)
                      throws java.sql.SQLException
        Use this method when binding to a CHAR column in the
    where clause of a Select statement. A non padded
    comparision will be done unlike in setCHAR and setString
    case. Not particularly needed for an insert as the
    database will pad it.
    Parameters:
    paramIndex - index of the bind variablex - the literal/variable to be bound.like..,
    String sql = "SELECT * FROM MyTable where code = ?";
    PreparedStatement st = conn.prepareStatement(sql);
    ((oracle.jdbc.OraclePreparedStatement)st).setFixedCHAR(1, "003");
    pstmt.executeQuery();Regards
    Elango.

  • Space after Integer, String etc.

    Hello,
    i have a problem in one of my Webapplications. Is it possible to suppress the Space after an integer or string variable using the print directive? i.e.:
    Date counter type i.
    counter = 1.
    <%=counter%> would result in "1 "
    whereas
    Date counter type n.
    counter = 1.
    <%=counter%> would result in "1"
    Is it somehow possible to use an Integer variable without the space?
    Greetz
    Daniel

    Im using the counter as an extension of the name of an input field:
    <INPUT type="text" name="field_<%=counter%>">
    it should result in:
    <INPUT type="text" name="field_1">
    but it results in
    <INPUT type="text" name="field_1 ">
    This makes it difficult for me to get values of the field in OnInputProcessing because of the appended space at the end of the name. Is it somehow possible to supress this behavior?

  • BufferedReader Problem (inserting space after every character)

    (This is a message I sent to an Aglet forum, however I thought maybe someone here could help me with the BufferedReader problem...with the spacing...read below)
    -Blake
    ok here's what I'm attempting to do.
    I have a Master Aglet that creates a slave which is dispatched to a remote site. The Slave then opens a log file, reads it, and then is supposed to read the file line by line and send each line as a message back to the Master. As the master receives each line it appends the line to the window it created earlier.
    I don't know what the problem is...it won't display the log file in the master window.
    It does display each line on the console window.I added a println() function to make sure the String array was getting the information. There is a small problem with that as well because it inserts a space after EVERY character (BufferedReader problem??)...what is up with that? for example:
    If the log file looked like: This is a log file entry.
    the console looks like this when it is printed: T h i s i s a l o g f i l e e n t r y .
    .... I had done something in a similiar program...and it worked just fine. here's some source code:
    <b>Master:</b>
    else if (msg.sameKind("Log")) {
    try {
    //println for testing purposes
    System.out.println(msg.getArg());
    appendMessage(" " + msg.getArg() + "test \n");
    } catch (Exception e) {
    System.out.println(e.toString());
    <b>Slave: </b>
    File log = new File("C:\\Aglets2.0.2\\public\\WINDOWSUPDATE.log");
    FileReader fr = null;
    try{
    fr = new FileReader(log);
    } catch (FileNotFoundException e) {
    System.out.println(e);
    BufferedReader br = new BufferedReader(fr);
    //Get filename of log
    try {
    Message msg = new Message("FileName", log.getName());
    mProxy.sendOnewayMessage(msg);
    } catch (InvalidAgletException iae) {
    System.out.println(iae.toString());
    } catch (Exception e) {
    System.out.println(e.toString());
    //read each line of file and send back to Master as a message
    try{
    int i = 0;
    while ((s = br.readLine()) != null) {
    i++;
    count = i;
    for (int j = 0; j < count; j++)
    System.out.println(s[j]);
    //send message back to Master Aglet with log file information
    try {
    Message msg = new Message("Log", s[j]);
    mProxy.sendMessage(msg);
    } catch (InvalidAgletException iae) {
    System.out.println(iae.toString());
    } catch (Exception e) {
    System.out.println(e.toString());
    //close file reader
    fr.close();
    } catch (IOException e) {
    System.out.println(e.toString());
    }

    actually i did declare s, you just don't see it there because i only posted some of the code....
    I fixed the "spacey" problem by using a FileInputStream instead of a bufferedreader....
    like this (i'll post the whole code here:
    public class Slave extends BlindAglet {
        AgletProxy mProxy = null;
        boolean back = false;
            char[] c = new char[1000];
        BufferedReader br = null;
        int count;
        // Do some tasks when the aglet is created
        public void onCreation(Object init) {
            // Must make a note of the master here
            mProxy = (AgletProxy)init;       
            // Add our own listener and adapter
            addMobilityListener(
                new MobilityAdapter() {
                    // Using this as a safety check in case we get caught in a loop in the same host
                    public void onArrival(MobilityEvent event) {                   
                        try {
                            mProxy.sendMessage(new Message("NewSlaveProxy", getAgletContext().getAgletProxy(getAgletID())));                                                            
                        } catch (InvalidAgletException iae) {
                            System.out.println(iae);
                        } catch (NotHandledException ex) {
                            System.out.println(ex);
                        } catch (MessageException ex) {
                            System.out.println(ex);
                        //Are we back to origin?
                            if(back) {         
                                 back = false;     
                                try{
                                     FileWriter fw = new FileWriter("test.txt");                                                                  
                                 for (int i = 0; i < count; i += 2){ 
                                           fw.write(c);
                             fw.close();
                        } catch (IOException e) {
                                  System.out.println(e);
                                  dispose();
                             dispose();
    ); /* End of Adapter */
    public void run() {
         // Are we at home base?
    if (atHome()) {
    try {
    dispatch(new URL("atp://darklord:4434"));
    } catch (Exception e) {
    System.out.println(e.toString());
         try{
         File log = new File("C:\\Aglets2.0.2\\public\\WINDOWSUPDATE.log");
         FileInputStream f0 = new FileInputStream(log);
    //Get filename of log
    try {
         System.out.println(log.getName());
    Message msg = new Message("FileName", log.getName());
    mProxy.sendOnewayMessage(msg);
    } catch (InvalidAgletException iae) {
    System.out.println(iae.toString());
    } catch (Exception e) {
    System.out.println(e.toString());
              //read each line of file and send back to Master as a message
              try{               
         int size = f0.available();
         int i = 0;
         for (i = 0; i < size; i++) {
              c[i] = (char) f0.read();
    //send message back to Master Aglet with log file information
                             try {
                        Message msg = new Message("Log", c[i]);
                        mProxy.sendOnewayMessage(msg);
              } catch (InvalidAgletException iae) {
                             System.out.println(iae.toString());
                        } catch (Exception e) {
                             System.out.println(e.toString());
    count = i;
              } catch (IOException e) {
                   System.out.println(e.toString());
                   } catch (FileNotFoundException e) {
                   System.out.println(e);
         back = true;      
         returnHome();
    * Returns true if the current host is our origin
    public boolean atHome() {
    if (getAgletInfo().getOrigin().equals(getAgletContext().getHostingURL().toString()))
    return true;
    else
    return false;
    * Allows a slave to contact it's master and ask for a retraction.
    public void returnHome() {
    try {
    Message msg = new Message("RetractMe");
    msg.setArg("url", getAgletContext().getHostingURL());
    msg.setArg("id", getAgletID());
    mProxy.sendOnewayMessage(msg);
    } catch (InvalidAgletException iae) {
    System.out.println(iae.toString());
    } catch (Exception e) {
    System.out.println(e.toString());
    * Return a reference to our Master's proxy
    public AgletProxy getMasterProxy() {
    return mProxy;
    } /* End of Class

  • 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

  • How to remove spaces after description.

    hi all,
    i need to supress spaces after writing material description and i want to keep comma after description.
    but it displays comma after field length (i e after  40 chars).But i need to keep comma after description it self.
    example like this.
    GR Number- 4900000400,
    Batch Number-            ,
    Material number- P0001016,
    Material description- Returnable Pallet,
    Vendor:            ,
    GR Date: 16.02.2010 ;
    Not Like this...
    GR Number- 4900000400 ,
    Batch Number-            ,
    Material number- P0001016           ,
    Material description- Returnable Pallet                        ,
    Vendor:            ,
    GR Date: 16.02.2010 ;
    after  posting message the comma comes after desc in both the cases...but it wont in SAP
    Appriciate your help.

    Hi,
       Use condense statement.
    Regards,
    Srini.

  • COPA structure cross 50  char-How to add more char fields in the sturcture

    Hi SAP CO Guru's,
    I am facing one problem in COPA characteristics, I have created the characteristics however in the KEA0 structure where we have already exhaused max limit of 50 char, hence system is not allowing to add these new fields in the structure.
    I need help for getting addition 2 fields into structure.
    I have one more option where few Char fields are not usable, can be remove from the structure if we can not increase the limit of 50 Char in the structure but system is not allowing me th remove the already selected Char fields.
    Thanks in Advance.
    Uday Suryawanshi
    SAP FICO consultant, Pune

    Hi Uday
    There is a way you can increase the limit.. refer the note given above
    However, SAP wont take the responsibility of any thing that happens later on.. It is completely your headache....
    So, better rename the Chars and use them....
    If you are still in DEV Client, delete COPA docs posted till now.. refer Note 21207... This helps you to delete a char if posted data exists
    I personally would prefer to rename and reuse.. After all, recycling is encouraged these days
    Br, Ajay M

  • Space after Number

    The code I used to display carton dimension in Packing List is:
    &<FS_VBPLK>-LAENG(C.0)&X&<FS_VBPLK>-BREIT(C.0)&X&<FS_VBPLK>-HOEHE(C.0)&
    The output text is 10 X20 X30 , there's an extra space after each number. How can I get 10X20X30 ?

    Hi
      Normally the (C) after the variable to use to compress the variable but looks like it is not working because you have multiple variables that you are printing and because of the size of the variables you might be getting the spaces.
    I am not sure if this can be done in the script itself but you can do it using subroutines in script.
    In the form you need to call a perform like below:
    /:PERFORM join_fields IN PROGRAM zreport
                /:USING &vari1&
               /:   &vari1&
                /:CHANGING &vari3&
                /:ENDPERFORM  
    In the program you need to concatenate the variables in one field and compress no-gaps and display the value.
    Regards,
    Himanshu

  • "Space After" Between Paragraphs

    Hi,
    Is there a way in InDesign to set "Space After" and "Space Before" like you can in Quark?
    I tried to look in all of the menus and couldn't find anything. It's probably there, just can't find it yet.
    Please advise.
    Thanks.

    The one on the left is space before, the one ont he right is space after. It's the same field whether you access it through the control panel or the paragaph panel. Note that the control panel is in paragraph mode, not character mode (In CS3 or CS4 the control panel may show these controls in either mode, depending on screen size and customizations, but they'll always be there in paragraph mode unless you've tuned them off).

  • Inserting white space after comma, full stop, etc...

    Hello,
    I have a text file. I want to add a blank space after all commas, full stops, exclamation marks and etc in that file.
    How can I do that?
    Edited by: user13223181 on Oct 5, 2010 2:55 AM

    suri_java wrote:
    you read the text file and append to buffer read and [program Example|http://www.roseindia.net/java/beginners/java-read-file-line-by-line.shtml] and change the file as per your requirement .
    I hope its helpful . Code examples on that site are largely flawed in the extreme. What's worse, they don't even respond to feedback or implement suggested improvements.
    db

Maybe you are looking for