Right Justification on Content Conversion

Hi Guys,
I've created a receiver communication channel with content conversion to convert from the XML to a flat fixed length file. Unfortunately all the fields written to the file are left justified.
Eg writing the value "123" to a field that's ten characters long gets
123.......
Rather than
.......123
All that is in the content conversion section at the moment is the Record Set structure and the field lengths for each of the different record types.
Any ideas on how to force it to right justify the fields?
Many thanks,
John

Hi John,
I have done testing on my machine regarding formatting and everything works fine.
First of all you can use NameA.fieldContentFormatting = nothing in both sender & receiver FCC without any issue. Secondly if I am not guessing wrong then you are looking your Paylod in SXMB_MONI, if yes then you will NEVER see a content with any formatting.
For example if your content is like ......Sarvesh (6 space in the begining)
Then it will always look like <NAME>Sarvesh</NAME> and not like this
<NAME>      Sarvesh</NAME>
Check your data in either XI server directory using AL11 (if you are saving it there) or check at receiver side.
I hope this solves your problem as well as doubt.
Regards,
Sarvesh

Similar Messages

  • Right Justification in File Content Conversion

    I have a requirement where the data should be right justified in File content conversion of a Receiver Adapter .
    For example  it should be coming as   "      5864"  instead of "5864     ". Please help in completing this requirement.

    Hi Srinath
    AFAIK, there is no setting in FCC to achieve this. You can do this instead in the Message Mapping step by doing a right justify on that target fields.
    You can search for plenty of solutions on the internet to perform a right justify and include it in a UDF.
    Below is an example of a UDF of execution type single values with single input. It right justifies the String based on a total length of 15. You can change the field length according to your requirement.
    return String.format("%15s", input);
    Rgds
    Eng Swee

  • What are the right content conversion parameter in this receiver ?

    Hi experts,
    Can someone help me with setting right Content conversion parameter in the Receiver of File adpater(FCC).The output file must be fixed length text file.
    Here is the receiver structure:
    <Recordset>
        <Header>
           <f1>01</f1>
           <f2> </f2>
           <f3> </f3>
        </Header>
         <Body>
            <SubBody1>
                  <field1 />
                  <field2 />
                  <field3 />
                  <field4 />
                  <field5 />
            </SubBody1>
             <SubBody2>
                  <field6 />
                  <field7 />
                  <field8 />
                  <field9 />
                  <field10/>
            </SubBody2>
         </Body>
        <Trailer>
            <f1>03</f1>
            <f2> </f2>
            <f3> </f3>
       </Trailer>
    </Recordset>
    Also Body can occure multiple times in the file but still will have this structure...Header and Trailer can occure only once in file.
    What are the right content conversion perameters in this case?
    Appreciate your help asap!T
    Thanks
    Jon

    <Recordset>
        <Header>
           <f1>01</f1>
           <f2> </f2>
           <f3> </f3>
        </Header>
         <Body>
             <SubBody>
                  <field1 />
                  <field2 />
              </SubBody>
              <SubBody>
                  <field1 />
                  <field2 />
              </SubBody>
              <SubBody>
                  <field1 />
                  <field2 />
              </SubBody>
            </Body>
        <Trailer>
            <f1>03</f1>
            <f2> </f2>
            <f3> </f3>
       </Trailer>
    </Recordset>
    if this is the input structure then FCC goes like this ....
    Recordset:Header,Body,SubBody,Trailer
    Header.fieldFixedLengths – 10,20,30.. (based on you are structure fixed lengths)
    Header.endSeparator - 'nl'
    SubBody.fieldFixedLengths – 10,20,20  (based on you are structure fixed lengths)
    Body.endSeparator - 'nl'
    Trailer.fieldFixedLengths – 10,20,30….(based on you are structure fixed lengths)
    Trailer.endSeparator - 'nl'
    We might have to try out SubBody.endSeparator - 'nl' if Body.endSeparator - 'nl' does not insert a new line after each body record.
    Cheer's

  • How to force field to appear in input structure in content conversion

    Hi all,
    I am doing file content conversion in sender File adapter. Here is the structure
    Header
    Body
       field1 - length 2
       field2 - occurrence 1:1, length 3
       field3 - length 2
       field4  length 2
    Trailer
    Here is the fixed length file that is inputed into XI
    <b>header22   2211trailer</b>
    field2 occrence is 1:1 and as you se from the file example field2 from the body is empty(just space).But  When I do the content conversion I don;t have this field showing up in my structure!??!!
    I want to make sure that field2 appears even as empty field because that is screwing my mapping!?
    Can you please have any idea how to make sure that field is in my input structure when I pass spaces?Can I force it somehow?
    Thanks all.

    Hi Jon,
    Yes you are right.
    For Ex: ur XML is
    <1>a</1>
    <2>b</2>
    and sometime is there is no value ur FCC will become
    <1>a</1>
    So what you have to do is in the message mapping take the source element
    if <2> exists then <2>---->Target
    else
    <2>---->Constant(space)
    and this "exists" is a standard function in NodeFunctions.
    Regards,

  • Ignore record in JMS sender content conversion

    Hi,
    I am using JMS sender adapter with content conversion.
    In the input text file, I have to ignore the first record.
    for this, in Module tab I have given parameter like this:
    Plain2XML -> documentOffset -> 1
    so that it will not read the first record in the text file.
    But it is not working
    Please suggest the right way.
    Regards,
    Anil.

    It should be:
    xml.documentSkipFirstRows
    Regards
    Stefan

  • Content Conversion Issue - sender File adapter..!!

    Hi All ,
    Input file:
    GRP|HD|7001|7001A00443|012|
    GRP-LN|DTL|1|ZTAS|3|002|209782010|0001|EN
    GRP-LN|TXT|Customer: KR Test, Case 3
    GRP-LN|TXT|Power            : -2.25
    GRP-LN|DTL|2|ZTAS|4|002|209782035|0001|EN
    GRP-LN|TXT|Customer: CL Test, Case 4
    GRP-LN|TXT|Sphere Power            : -2.25
    T     7
    I have 4 segments (Header,Detail,Text,Trailer) with "|" as the field separator and HD,DTL,TXT,T are the Keyfields
    I need to get the xml structure like below heirarchy. Text segment has to come under Detail structure. Header,Detail and Trailer has to be in the same position.
    Recordset
    --Header
    --Detail
    Text
    --Trailer
    After completion of content conversion, I am getting the XML structure in the below format. All the segments are coming in the same hierarchy.
    Recordset
      -Header
      -Detail
      -Text
      -Trailer
    Text segment has to come under Detail segment. I used the below parameters for FCC.
    Recordset Structure: Header,1,Detail,,Text,,Trailer,1
    Recordset Sequence: Variable
    Header.fieldSeparator
    Header.keyFieldValue
    Header.fieldNames
    Detail.fieldSeparator
    Detail.keyFieldValue
    Detail.fieldNames
    Text.fieldSeparator
    Text.keyFieldValue
    Text.fieldNames
    Trailer.fieldSeparator
    Trailer.keyFieldValue
    Trailer.fieldNames
    Kindly suggest me wat went wrong and how to solve it by content conversion.?
    Thanks
    Deepthi

    Hi All,
    Thank you for your replies.
    I thought of doing it in mapping . My map is like
    DTL -
    > E1EDP01
    TXT----
    >  -
    EIEDPT2
    According to my scenario when ever DTL comes then E1EDP01 has to come and EIEDPT2 has to repeat untill next DTL comes.
    Ex: 1DTL and  4TXT segments .So the output will be..
    DTL -> E1EDP01
    TXT -
    > -
    EIEDPT2
    TXT  -
    > -
    EIEDPT2
    TXT  -
    > -
    EIEDPT2
    TXT -
    > -
    EIEDPT2
    DTL -> E1EDP01
    TXT -
    > -
    EIEDPT2
    TXT  -
    > -
    EIEDPT2
    TXT  -
    > -
    EIEDPT2
    TXT -
    > -
    EIEDPT2
    Right now I couldn't able to generate the above target XML. Everytime I am getting all the TXT segments under one DTL segment like below.
    DTL -> E1EDP01
    TXT -
    > -
    EIEDPT2
    TXT  -
    > -
    EIEDPT2
    TXT  -
    > -
    EIEDPT2
    TXT -
    > -
    EIEDPT2
    TXT -
    > -
    EIEDPT2
    TXT  -
    > -
    EIEDPT2
    TXT  -
    > -
    EIEDPT2
    TXT -
    > -
    EIEDPT2
    Any suggestions how we can get rid of in mapping?
    Thanks
    Deepthi

  • File Content Conversion : Sender Channel

    Hi
      I am trying to do content conversion in the Sender Channel from a flat file to a XML.
    My Target XML(message structure) looks like
    <H1>
      <H2>
          <D>Detail Record</D>
          <L1>line</L1>
          <L1>line</L1>
      </H2>
      <H2>
          <D>Detail Record</D>
          <L1>line</L1>
          <L1>line</L1>
      </H2>
    </H1>
    Here the element <H2> is only needed to group <D> and the following <L1> elements of each new occurrence of <D>.
    Now my problem is that the element <H2> is not getting created.
    and the message after content conversion is looking as follows
    <H1>
          <D>Detail Record</D>
          <L1>line</L1>
          <L1>line</L1>
          <D>Detail Record</D>
          <L1>line</L1>
          <L1>line</L1>
    </H1>        
    What should I do to get the desired result.

    @Yes Bhavesh you  are right.
    Hi Jai,
           I am trying the other way round.i.e from flat file to a XML message.As I said I was trying to do it for Sender Channel where is the after content conversion I want a XML file.The example is a what I framed out of my actual problem.
    if flat file is as follows ,
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    DetailRecord1
    Line1
    Line2
    Line3
    DetailRecord2
    Line4
    Line5
    then the XML must look like
    <H1>
    <H2>
    <D>DetailRecord1</D>
    <L1>Line1</L1>
    <L1>Line2</L1>
    <L1>Line3</L1>
    </H2>
    <H2>
    <D>DetailRecord2</D>
    <L1>Line4</L1>
    <L1>Line5</L1>
    </H2>
    </H1>
    I identify the different types records in the flat file
    as follows,
    Record starting with "Detail" is considered as <D> element
    Record starting with "Line"  is considered as <L> element.
    Hope I did clarify.

  • Encoding problem after File Content Conversion

    Hi SAP gurus!
    we're about exporting debitor data via PI into CSV files. Therefore we use a mapping to an intermediate structure. In the receiver file adapter a file content conversion is done into the target CSV format.
    We have a lot of data with eastern europe characters. Right after the mapping, everything is fine. All characters are processed correctly. After the file content conversion, the files written on the target system contain "?" instead of the special characters.
    Does anybody have any hint to fix this problem? We already tried to change the "file.encoding" parameter, but hasn't helped.
    Thanks in advance for your support!
    Cheers,
    Matthias

    Hello Satish,
    thanks for your reply.
    First, I have to explain, that the sender side isn't done by file adapter but IDoc adapter. So I cannot change the encoding on sender side.
    Both on IDoc and file side, the data is ok. Only when inserting the file content converion, the files become corrupted.
    Without using the FCC, tjhe target files are stored as UTF-8. When using FCC the files are stored as ANSI. (I tested this by opening the files in notepad and performing "Save As")
    Do you have further ideas?
    Cheers,
    Matthias

  • File adapter modules : Access to file data before content conversion

    I have a file sender channel for which content conversion in applied. The incoming file has data in comma separated values format.
    e.g.
    102366,Amol Joshi,DEPT1
    107752,XYZ PQR,DEPT2
    I want to access the the actual data in the file before content conversion takes place. Is it possible to access this data inside the adaper module? I tried creating an adapter module and put it before CallSAPAdapter,it still gets the XML after content conversion as the input data to the module.
    Any pointers?

    Hi Amol,
    I dont know if it is the right approach.
    But if u r not able to meet ur requirement u can do one work around.
    Use Message Transformation Bean to convert it once again in to CSV (flat file structure) and then proceed with ur module.
    There should be a better way than this.
    Hope we could find a better solution in the forum.
    Regards,
    Sudharshan

  • Need help in file content conversion complex structure

    Hi Guys ,
    Iam new to this file content conversion , Please let me know whether below requirement is possible .if yes than how ?
    Inbound XML file from Proxy
    <Data>
      <keyfield1>0011</keyfield1>
      <keyfield2>0012</keyfield2>
      <Keyfield3>0013</Keyfield3>
      <field1>Test1</field1>
      <field2>testfield1</field2>
      <field3>0001</field3>
    <Data>
      <keyfield1>0021</keyfield1>
      <keyfield2>0022</keyfield2>
      <Keyfield3>0023</Keyfield3>
      <field1>Test2</field1>
      <field2>testfield2</field2>
      <field3>0002</field3>
    output pgp flat file .
    pgp file format should be as below after file content conversion
      0011|0012|0013|Test1||||||
      0011|0012|0013|Testfield1||||||
      0011|0012|0013|0001||||||
      0021|0022|0023|Test2||||||
      0011|0012|0013|Testfield2||||||
      0011|0012|0013|0002||||||
    thanks a lot .
    Regards
    Prabhu

    Hi.
    Try this.
    First you need to use a message mapping  and create a target structure to convert a similar output  structure that do you want.  like this
    <Target>
    --  Field1
    --  Field2
    --  Field3
    --  Field4
    --  Field5
    --  Field6
    --  Field7
    --  Field8
    --  Field9
    </Target>.
    Then map
    keyfield1-> Field 1 ,keyfield2-> Field 2 , keyfield 3---> Field 3
    map  field1-> field4 .. for the others fields duplicate the Target node (right click)  and  map map  field2-> field5 ..etc.
    For the field 5 until field 9 map with constant ("'')
    Then in you receiver comunication channel put simple parameters. 
    Target.fieldSeparator = |
    Target.endSeparator = 'nl'
    Regards.

  • Idoc 2 file - file content conversion in receiver

    Hi,
    My scenario is idoc to file.
    if i want to use file content conversion at receiver side,
    so i need to create record set according to sender side data type or receiver data type?
    plz give some inputs reg. this.
    Thanks

    Hi,
    There is problem while refreshing in sap xi also.
    when i pass new parameter like 7 in my recordset structure,
    it is immediately reflecting in CC monitoring.
    error it is showing that '7'.
    but if i remove that in record set structure
    (after activating that in ID)
    even though
    if i stop and start my CC manually also,
    still it is showing that error in CC monitoring
    like '7'
    basic concept of this file content conversion is
    I have to keep at least field separator (ie 'nl' )for outer most node element ie Customer_copy and record set stru. as Customer_copy
    is it right?
    I tried my own way...still it is giving that error.
    what could my fieldSeparator, endSeparator, for ur last case plz tell me?
    Edited by: ruban R on Apr 22, 2008 3:01 AM

  • File content conversion on Sender Side

    Hi,
    I am doing file content conversion on sender side.when i am executing the scenario,i am getting the following error in sxmb_moni:
    Invalid at the top level of the document. Error processing resource 'file:///D:/Documents and Settings/...............
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?><!-- Inbound Message --> DOC_HEADER                     ...
    when i right click on the pyaload and select view source
    its displaying the whole flat file with the following line at the beginning:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?><!-- Inbound Message -->
    i have given all the parameters correctly....
    in sxmb_moni.....the error category is Mapping and the error id id EXCEPTION_DURING_EXECUTE
    Please help me with this error.
    thanks n regards,
    anuradha

    Hi !!
    The best way to debug would be to add TRACE statements in your mappigs. In both Graphical and java Mapping.
    Trace out the entire output of java mapping and see if this is the input that the next mapping expects.
    For trace , http://help.sap.com/saphelp_nw04/helpdata/en/c8/98e7d5c1620642973565ea3dd319d1/content.htm
    refr this links also
    Fatal Error: com.sap.engine.lib.xml.parser.ParserException: Name expected
    unsported character error in message mapping
    Re: HTTP to RFC Mapping error:com.sap.aii.utilxi.misc.api.BaseRuntimeException:
    Exception com.sap.aii.utilxi.misc.api.BaseRuntimeException
    Re: Outbound error
    Re: mapping error
    error in file to file
    have a look at this weblog on how to test your mapping
    /people/michal.krawczyk2/blog/2005/09/16/xi-how-to-test-your-mapping-in-real-life-scenarios
    Thanks !!!

  • File Content Conversion and Empty file issue

    Hello,
    The issue is :
    I have configured a file sender adapter with file Content Conversion. I have 2 kinds of records Header and Items.
    i have defined the 'Key Field Name' based on the first character of each line of my flat file and the values associated :
    Header.keyFieldValue = 1
    Item.keyFieldValue = 2
    Flat file example :
    1;Headerfield1;Headerfield2
    2;ItemField1;ItemField1;ItemField1;ItemField1;
    2;ItemField1;ItemField1;ItemField1;ItemField1;
    2;ItemField1;ItemField1;ItemField1;ItemField1;
    and everything works fine !
    But now imagine you receive a bad file like this :
    xxxxx;ohhohoh;llllll
    y;sdfsdfs;zezerz;zerzer
    e;zerzerze;zezerzerzer
    The result is : IS receive nothing and no alert is generated ?!!!???
    What i have seen is that the adapter doesn't find any corresponding value for keyFieldValue so it consider that the flat file is empty and i do nothing, the file is archived and that's all no alert is generated ????
    But i want to receive an alert for checking that the processed flat file was not correct !
    If anybody has an idea, it will be great !
    Regards,
    Vincent

    Hi Vincent.
    Sometimes it really #!@#%%#.. me off when customers excepts that XI will solve their whole organization interfacing problems (and the world hunger as well...:)...
    even when it comes to the responsible systems that creates the file(sometimes with bugs and problems even before XI came to the org.).as in every developed application or out of the box one, the application has to take care of its outputs and deal with errors. when it cant deliver what other systems expects her to  it has to inform some one...
    When it comes to the Adapter frame work XI expects the system in its landscape to be responsible for the data they send (well formed and with the defined  structure...IDocs,XML,flat files).
    as mentioned in my colleagues previous postings you can take care of data verification during mapping and so..
    I belive it is possible to monitor the incoming file before it is parsed to XML (not sure it is the right way to) and maybe we'll get a solution to that in the future (today we can monitor the comm. channel wether its  configures well or not,maybe it will be possible in the future to alert when an incoming file is empty)
    Regards.
    Nimrod

  • IMAP Sender channel, Content Conversion Module , target XSD structure issue

    Hi,
    I'm using the content conversion adapter module in my IMAP senderchannel , to transform a flat file into a IDOC ORDERS05 structure.
    I have some difficulties generating the right structure... how can I make a more deep structure ?
    My output is like this. All created segment is on the same level.
    <ORDERS05>
        <IDOC>
            <E1EDK01>
            <E1EDK03>
            <E1EDKA1>
            <E1EDK02>
            <E1EDKT1>
            <E1EDKT2>
            <E1EDKT2>
            <E1EDKT1>
            <E1EDKT2>
            <E1EDKT2>
        <IDOC>
    </ORDERS05>
    Here the E1EDKT2 should be a "level under" or "sub structure" to E1EDKT1, and not on the same level !
    The wanted result:
    <ORDERS05>
        <IDOC>
            <E1EDK01>
            <E1EDK03>
            <E1EDKA1>
            <E1EDK02>
            <E1EDKT1>
                <E1EDKT2>
                <E1EDKT2>
            <E1EDKT1>
                <E1EDKT2>
                <E1EDKT2>
        <IDOC>
    </ORDERS05>
    How can I solve this ????

    Hi,
    you can do it on adapter level too:
    but you cannot do it in standard content conversion I guess
    (if it has more then 2 levels)
    check this how you can do it:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/482aae19-0301-0010-3485-8efd618818d0
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Content Conversion for Item node under Header node

    Hi,
    Below is the file sample:
    0LBS00000000082011090707:30:13~0000000009
    4GBP55.67SB300005VISTADocNO1100DistChanPaymentDays
    5001QuanUoMNetPriceGrossPricePubDiv9781444724585201109071001.1
    5002QuanUoMNetPriceGrossPricePubDiv9781444724585201109071001.1
    4GBP55.67SB300005VISTADocNO1100DistChanPaymentDays
    5001QuanUoMNetPriceGrossPricePubDiv9781444724585201109071001.1
    1~7
    Record Type:Header Record(Always = 0),Min Occurrence:1,Max Occurrence:1
    Record Type:Sales Invoice Header Record (Always = 4),Min Occurrence:0,Max Occurrence:unlimited
    Record Type:Sales Invoice Item Record (Always = 5) ,Min Occurrence:1(per Sales Invoice Header Record)
    ,Max Occurrence:999999 (per Sales Invoice Header Record)
    Record Type:Trailer Record(Always = 1),Min Occurrence:1,Max Occurrence:1
    In content conversion:
    Record set structure:Header,1,SalesInvoiceHeader,(Star),SalesInvoiceItem,(Star),Trailer,1
    Key field name:RecordType
    Header.fieldSeparator ~
    Header.fieldNames RecordType,SendingSystem,FileNumber,CreationDate,CreationTime,NextFileNumber
    Header.keyFieldValue 0
    SalesInvoiceHeader.fieldSeparator ~
    SalesInvoiceHeader.fieldNames cordType,Currency,ExchangeRate,DocumentType,Customer,VistaDocNumber,PubDiv,DistChan,PaymentDays
    SalesInvoiceHeader.keyFieldValue 4
    SalesInvoiceItem.fieldSeparator ~
    SalesInvoiceItem.fieldNames RecordType,ItemNumber,Quantity,UoM,NetPrice,GrossPrice,PubDiv,Material,BillDate,VATAmount,VATRate
    SalesInvoiceItem.keyFieldValue 5
    Trailer.fieldSeparator ~
    Trailer.fieldNames RecordType,RecordCount
    Trailer.keyFieldValue 1
    ignoreRecordsetName true
    The Src str in ESR is
    1. Header
    2. SalesInvoiceHeader
    SalesIncoiveItem(Chlid node of SalesInvoiceHeader)......
    3. Trailer
    Provide some inputs
    Thnkx

    VJ,
    You are absolutely right it is not possible to get multiple hierarchy using file content conversion.
    Splitbyvalue function would not work in my scenario as I need to group FED records based on first few characters in the first column of FED records. I wrote a UDF to insert context change based on the column value.
    Thanks again for your help.
    Regards
    Haseeb

Maybe you are looking for