Field optional in Content Conversion

Hi,
This is my data structure
Field1
Field2
Field3.
I have two source systems which is sending the data.
One of the source system sends only Field1 and Field 3, while another source system sends Field1,Field2 and Field3.
Should i make the field2 as optional and handle it in content conversion , or would i require separate mapping.
If this needs to be handled in CC, let me know how.

Hi Daniele,
Instead of using the standard funciton , i created a UDF for handling this situation.
My logic is UDF is like
   //write your code here
int Size = Integer.parseInt(Truncate_Size);
String Return_Value = "";
     if  (!("".equals(Input)) )
          if  (Input.length() > Size )
               Return_Value = Input.substring(0,Size);
          else
               Return_Value = Input.substring(0, Input.length());
     else
          for(int i = 0; i< Size ; i++)
          Return_Value = Return_Value + " " ;
return Return_Value;
SO in this case also , it should be able to handle empy source element. But it is not working.

Similar Messages

  • Skip field in file content conversion (file adapter)

    hy guys,
    I have a log file and want to convert it into xml. that works fine.
    the problem is: can I skip some fields that I do not need in the xml with file content conversion
    the fields I want to skip are the same in every record of the log file.
    thanks.

    Ralf,
    You can only ignore lines in the begiining of the file using Document Offset option.
    If you have the unwanted field in the end of the record and you are in SPS12 (PI 7.0), you can use the option additionalLasstFields in FCC parameters. have a look into the blog /people/sukumar.natarajan/blog/2007/06/12/content-conversion-in-sender-file-adapter--2-new-useful-parameters
    Easier, is to ignore those fields in mapping.
    Also, you can try to remove those fields using a shell script which can be called from the File adapter.
    Regards,
    Jai Shankar

  • Key field in File Content Conversion

    Is Keyfield must be unique in FCC ?

    Hi,
    Check this to get more Clarity abt the Key Field Usage
    Content Conversion ( The Key Field Problem )
    Regards
    Seshagiri

  • Ignore fields in File Content Conversion

    Hi all,
    I need to read first 9 fields in Content conversion from text file and ignore all the others.The problem is I don't know exactly the number of fields(it varies from file to file).
    I try to use the following in my content conversion:
    item.fieldSeparator = ;
    item.fieldNames = "Names of item fields"
    item.lastFieldsOptional = NO
    ignoreRecordSetName = true
    Now it works with files with 9 fields,but doesn't with more than 9...
    I tried with item.lastFieldsOptional = YES as well but it didn't help...
    Anyone any suggestions?
    Thanks in advance

    The problem is I don't know exactly the number of fields(it varies from file to file).
    >>>> then how do you write your FCC ? because the mandatory parameters fieldFixedLengths or fieldSeparator and the fieldNames will expect a defined set of values and not dynamic.maybe you can read the file record row kind and then  extract the fields u need.
    item.lastFieldsOptional
    >>>
    this is to ignore only the last field.
    <i>xml.lastFieldsOptional=YES|NO
    This parameter specifies whether the last fields can be omitted (YES) or not (NO) in a CSV structure. If you do not make a specification, the default value is NO.</i>

  • Wild Card as key field value in Content Conversion

    Hi,
         Can any one please tell me that can a wild card such as '*' be used as key field value.
    Thnx,
    Pravesh Puria.

    Hi Pravesh
    For the file name in the sender file adapter you can use the '*' or '?'(as a placeholder for exactly one character)
    You can also enable the "Advanced Selection for Source File" in the sender file adapter, where you can do two things:
    a)you can specify an exclusion mask for the file name specified above.
    b)you can specify/lits multiple directories with a file name and an associated exclusion mask, e.g. in file name you put ".txt" and in the associated exclusion mask "a". The every file with ".txt" except "a" will be fetched from that directory. 
    Try it out.
    Regards,
    Goekhan

  • Ignore field in file content conversion

    Hello,
    I have scenario from RFC to CSV file
    The RFC Structure is:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <rfc:Z_PORTAL_PRICING_PURCH_PRICE xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
    <LAND>NL</LAND>
    - <PURCH_PRICE>
    - <item>
    <MATNR>000000073280004000</MATNR>
    <NETPR>4500.00</NETPR>
    <PEINH>1</PEINH>
    <MEINS>EA</MEINS>
    <WAERS>EUR</WAERS>
    </item>
    - <item>
    <MATNR>000000073280004600</MATNR>
    <NETPR>70.00</NETPR>
    <PEINH>1</PEINH>
    <MEINS>EA</MEINS>
    <WAERS>EUR</WAERS>
    </item>
    - <item>
    <MATNR>000000073280004700</MATNR>
    <NETPR>140.00</NETPR>
    <PEINH>1</PEINH>
    <MEINS>EA</MEINS>
    <WAERS>EUR</WAERS>
    </item>
    - <item>
    <MATNR>000000073280004750</MATNR>
    <NETPR>4750.00</NETPR>
    <PEINH>1</PEINH>
    <MEINS>EA</MEINS>
    <WAERS>EUR</WAERS>
    </item>
    </PURCH_PRICE>
    </rfc:Z_PORTAL_PRICING_PURCH_PRICE>
    I want to create file like this:
    000000073280004000,4500.00,1,EA,EUR
    000000073280004600,70.00,1EA,EUR
    000000073280004700,140.00,1,EA,EUR
    000000073280004750,4750,1,EA,EUR
    How can I ignore from the field "LAND"?
    How can I return the items?
    Thank you
    Elad

    Hi!
    Then your target structure may have a "cardinality" of "1...1". That is regardless of the amount of elements in your source structure the target structure only contains one element/record.
    What you need is "0.. n" or "1...n"
    Change your Datatype and/or mapping and it will work.
    Hope this helps!
    Regards,
    Volker

  • DT for File Content Conversion scenario

    Hi Guys,
    I am working on IDOC to file scenario in which I want to know which type of DT should I go for?
    DT_Type
    ....Row
    ......Filed1
    ......Filed2
    ......Field3
    ...Row
    DT_Type
    Or
    DT_Type
    ..Details
    ....Row
    ......Filed1
    ......Filed2
    ......Field3
    ...Row
    ..Details
    DT_Type
    I am going for Receiver Content conversion as I need to produce Flat like, I have about 30 filed names and I am wondering is it possible not ot mention field names in Content conversion?
    What is the parameter to place to get a new line after each record? I am using row.endSeparator as 'nl' I am getting some special character instead of starting a new record in next line.
    Thanks
    Rajeev

    HI,
    The SOURCE IDOC strcuture is:
    IDOCNAME----
    1..1
    >IDOC--
    1..1
    >BEGIN--
    required
    >EDI_DC40--
    1..1 (it has sub nodes but not required)
    >E1KNAM1--
    1..1
    >SEGMENT----
    Required
    >Werks----
    0..1
    >Z1KNU2----
    0..1 (SUB SEGMENT OF E1KNAM1)
    >ZNUM----
    0..1
    >Z1ADD----
    0..7 (SUB SEGMENT OF E1KNAM1)
    >PostCode----
    0..1
    >E1KAVVM----
    0..999(SUB SEGMENT OF E1KNAM1)
    >VTWEG----
    0..1
    >LOVEM----
    0..1
    >E1KAVPM----
    0..999(SUB SEGMENT OF E1KNAM1)
    >KUNN2----
    0..1
    >Z1KAN--0..1 (SUB SEGMENT OF E1KAVPM---(SUB SEGMENT OF E1KNAM1))
    >NAME1----
    0..1
    Target File structure is:
    MT_Type----
    1..1
    Row--
    0..Unbound
    Filed1----
    0..Unbound
    Filed2----
    0..Unbound
    Filed3----
    0..Unbound
    Filed4----
    0..Unbound
    Filed5----
    0..Unbound
    Filed6----
    0..Unbound
    if IDOC contains one IDOC data then it has to generate one file .. If IDOC contains more than one IDOC information then it has to generate one file with multiple IDOC informaiton in it.
    how this can be achieved?
    Thanks
    Rajeev

  • Content conversion problem

    Hi gurus
    I sem to have a really silly problem
    I'm only getting the FIRST field  on file content conversion and no new line
    here's a part of the XML file from the payload manifest
    <?xml version="1.0" encoding="UTF-8" ?>
    - <rfc:Z_XI_005_RFC xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
    - <IP_CUSTOMER_HEADER>
    - <item>
      <CUSTOMERID>100853</CUSTOMERID>
      <COMPANY>Bram Van Tuyl Coldstore</COMPANY>
      <SHORT_NAME>VAN TUYL</SHORT_NAME>
      <SALES_REGION>EUROP</SALES_REGION>
      </item>
      </IP_CUSTOMER_HEADER>
      </rfc:Z_XI_005_RFC>
    I've defined the following parameters in the content conversion
    Recordset sructure   item
    content conversion parameters
    item.fieldSeparator       ;   (a semi colon)
    item.endSeparator      'nl'  
    if I look in my file all i get is
    100853
    where's the rest of the data ????
    When I don't use content conversion   xml file is generated correctly.
    Any ideas
    I am at 100% loss to see what's wrong here as this should be an EASY automatic conversion.
    (the input structure is all character)..
    Max pts to anyone who solves this
    Cheers
    jimbo

    the file is identical
    payload from  inbound message
    for example
    <rfc:Z_XI_005_RFC xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
    - <IP_CUSTOMER_HEADER>
    - <item>
      <CUSTOMERID>1000001</CUSTOMERID>
      <COMPANY>One-time ship-to</COMPANY>
      <SHORT_NAME>ONE-TIME</SHORT_NAME>
      <STREET />
      <STREET2 />  .......
    Paylioad under Receiver Grouping
    <rfc:Z_XI_005_RFC xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
    - <IP_CUSTOMER_HEADER>
    - <item>
      <CUSTOMERID>1000001</CUSTOMERID>
      <COMPANY>One-time ship-to</COMPANY>
      <SHORT_NAME>ONE-TIME</SHORT_NAME>
      <STREET />
      <STREET2 />
    etc
    text file 100001;1000001........  etc
    There's no Payload that I can see under the response (checkered flag) where it says processed successfully.
    cheers
    jimbo

  • File content conversion for Pipe delimited file

    Hi
    i have a scenario ( file-xi-proxy) in whch file is coming in a pipe delimited.
    my data type is like
    DT_ XXXXX
    AwardInfo
    Header contains some fileds
    DetailRecord contains some fileds
    trailer contains some fields
    what are content conversion parameters i have to use
    venkat

    Sedamkar,
    Expecting you have one header, multiple details and one trailer then give recordset structure in sender file communication channel as:
    Header,1,DetailRecord ,*,trailer,1
    In content conversion you should give parameters:
    Header.fieldSeparator : |
    Header.endSeparator : 'nl'
    DetailRecord.fieldSeparator : |
    DetailRecord.endSeparator : 'nl'
    trailer.fieldSeparator : |
    trailer.endSeparator : 'nl'
    You may need to change the parameters also according to your strcuture and the file layout. See this SAP help for file content conversion:
    http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
    Regards,
    ---Satish

  • Content conversion JMS adapter

    Hi
         I have a flat file which is read by JMS adapter. I am using content conversion in the JMS adapter.
    There are 10 fields in the flat file,i want to read only 3rd and 5th fields.Is this possible?Can i specify the start end position of a flat file field in the content conversion.
    looking forward to your ideas.......
    Thanks
    kumar

    OH.  Well that makes a difference then. 
    Are the records fixed-width, or delimited?  If they are fixed width, just set the last attribute as "filler" and give it the combined length of all the fields that are after the nth one you want.  If it's delmited... Let me test out what happens if there are more fields in the data than are set up... I think it might throw them away, but I have to check. 
    amy

  • Skipping fields during content conversion

    is it possible to skip fields during content conversion in file sender adapter?
    The case is, the CSV file contains 300+ field and i only need 10. Therefore i have created a datatype with those 10 field.
    I was hoping to skip the fields i do not need during content conversion.
    If this is not possible i see no other than to create a datatype with 300+ fields by hand. Which will take all day!
    Hopefully there is a solution, since i could not find what i needed on the SAP Help or SDN.
    Thanks in advance for all your time!

    Hi M,
    is it possible to skip fields during content conversion in file sender adapter?
    No .. this is not possible during FCC.
    The case is, the CSV file contains 300+ field and i only need 10. Therefore i have created a datatype with those 10 field.
    Hopefully there is a solution, since i could not find what i needed on the SAP Help or SDN.
    Well, you can give it a shot. There are freewares available on internet, which can transform the CSV file to XSD. Then you can import that XSD structure in ESR.
    The only point is that your source CSV file must be having the header (with all field names on it).
    I had done this with another integration tool, no idea how it will work with PI. But it's worth giving it a try.
    If this is not gonna happen, then you have no other option but to create complete DT manually or use adapter module (not recommended for such cases).
    Regards,
    Neetesh

  • File Content Conversion(SenderFileadapter) fields parameters

    Hi all
               I am doing aFile to File scenario,
    Using content Conversion at SENDER FILE adapter
    my source message type is as :  
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_Cnet_Source xmlns:ns0="http://abc.com/Cnet">
       <<b>HeaderPayment</b>>
          <First_Payt_Doc/>
          <Beneficiary_email_id/>
       <<b>/HeaderPayment</b>>
       <<b>AdviceFormat</b>>
           <Client_Code/>
          <Payment_Document_No/>
          <Document_Date/>
       <<b>/AdviceFormat</b>>
       <<b>LineItem</b>>
         <Title1/>
          <Title3/>
       <<b>/LineItem</b>>
       <<b>FILENAME</b>>
          <FNAME/>
       <<b>/FILENAME</b>>
    </ns0:MT_Cnet_Source>
    it has 3 structures :HeaderPayment(0,1),AdviceFormat(0,1),LineItem(0,unbounded)
    in Recordsetstructure i gave= HeaderPayment,1,AdviceFormat,1,LineItem,1
    in FCC parameters i used
    HeaderPayment.fieldname... =First_Payt_Doc,Beneficiary_email_id
    HeaderPayment.fieldseperator ='nl'
    HeaderPayment.endseperator ='nl'
    ignorerecordset = true
    similarly for rest 2 structure also
    my source text  file is type :
    we0023
    [email protected]
    xyc
    acd
    21/05/2007
    10034
    acccd
    payment
    i tried alot of options,refering sdn..still on reading the file value are not coming in the designated fields...
    Thanks &Regards,
    ajay

    You are Right i correct it but i sxmb_moni
    i get as <HeaderPayment>
    <First_Payt_Doc/>
    </HeaderPayment>
    <AdviceFormat>
    <Client_Code/>
    </AdviceFormat>
    <LineItem>
    <Title1/>
    </LineItem>
    <FILENAME>
    <FNAME/>
    </FILENAME>
    <HeaderPayment>
    <First_Payt_Doc/>
    <Beneficiary_email_id/>
    </HeaderPayment>
    <AdviceFormat>
    <Client_Code/>
    <Payment_Document_No/>
    <Document_Date/>
    </AdviceFormat>
    <LineItem>
    <Title1/>
    <Title3/>
    </LineItem>
    <FILENAME>
    <FNAME/>
    </FILENAME>
    <HeaderPayment>
    <First_Payt_Doc/>
    <Beneficiary_email_id/>
    </HeaderPayment>
    <AdviceFormat>
    <Client_Code/>
    <Payment_Document_No/>
    <Document_Date/>
    </AdviceFormat>
    <LineItem>
    <Title1/>
    <Title3/>
    </LineItem>
    <FILENAME>
    <FNAME/>
    </FILENAME>
    <First_Payt_Doc/>
    <Beneficiary_email_id/>
    </HeaderPayment>
    <AdviceFormat>
    <Client_Code/>
    <Payment_Document_No/>
    <Document_Date/>
    </AdviceFormat>
    <LineItem>
    <Title1/>
    <Title3/>
    </LineItem>
    <FILENAME>
    <FNAME/>
    </FILENAME>
    <HeaderPayment>
    <First_Payt_Doc/>
    <Beneficiary_email_id/>
    </HeaderPayment>
    <AdviceFormat>
    <Client_Code/>
    <Payment_Document_No/>
    <Document_Date/>
    </AdviceFormat>
    <LineItem>
    <Title1/>
    <Title3/>
    </LineItem>
    <FILENAME>
    <FNAME/>
    </FILENAME>
    <HeaderPayment>
    <First_Payt_Doc/>
    <Beneficiary_email_id/>
    </HeaderPayment>
    <AdviceFormat>
    <Client_Code/>
    <Payment_Document_No/>
    <Document_Date/>
    </AdviceFormat>
    <LineItem>
    <Title1/>
    <Title3/>
    </LineItem>
    <FILENAME>
    <FNAME/>
    </FILENAME>
    <First_Payt_Doc/>
    <Beneficiary_email_id/>
    </HeaderPayment>
    <AdviceFormat>
    <Client_Code/>
    <Payment_Document_No/>
    <Document_Date/>
    </AdviceFormat>
    <LineItem>
    <Title1/>
    <Title3/>
    </LineItem>
    <FILENAME>
    <FNAME/>
    </FILENAME>
    <HeaderPayment>
    <First_Payt_Doc/>
    <Beneficiary_email_id/>
    </HeaderPayment>
    <AdviceFormat>
    <Client_Code/>
    <Payment_Document_No/>
    <Document_Date/>
    </AdviceFormat>
    <LineItem>
    <Title1/>
    <Title3/>
    </LineItem>
    <FILENAME>
    <FNAME/>
    </FILENAME>
    <HeaderPayment>
    <First_Payt_Doc/>
    <Beneficiary_email_id/>
    </HeaderPayment>
    <AdviceFormat>
    <Client_Code/>
    <Payment_Document_No/>
    <Document_Date/>
    </AdviceFormat>
    <LineItem>
    <Title1/>
    <Title3/>
    </LineItem>
    <FILENAME>
    <FNAME/>
    </FILENAME>
    <First_Payt_Doc/>
    <Beneficiary_email_id/>
    </HeaderPayment>
    <AdviceFormat>
    <Client_Code/>
    <Payment_Document_No/>
    <Document_Date/>
    </AdviceFormat>
    <LineItem>
    <Title1/>
    <Title3/>
    </LineItem>
    <FILENAME>
    <FNAME/>
    </FILENAME>
    <HeaderPayment>
    <First_Payt_Doc/>
    <Beneficiary_email_id/>
    </HeaderPayment>
    <AdviceFormat>
    <Client_Code/>
    <Payment_Document_No/>
    <Document_Date/>
    </AdviceFormat>
    <LineItem>
    <Title1/>
    <Title3/>
    </LineItem>
    <FILENAME>
    <FNAME/>
    </FILENAME>
    <HeaderPayment>
    <First_Payt_Doc/>
    <Beneficiary_email_id/>
    </HeaderPayment>
    <AdviceFormat>
    <Client_Code/>
    <Payment_Document_No/>
    <Document_Date/>
    </AdviceFormat>
    <LineItem>
    <Title1/>
    <Title3/>
    </LineItem>
    <FILENAME>
    <FNAME/>
    </FILENAME>
    <HeaderPayment>
    <First_Payt_Doc/>
    <Beneficiary_email_id/>
    </HeaderPayment>
    <AdviceFormat>
    <Client_Code/>
    <Payment_Document_No/>
    <Document_Date/>
    </AdviceFormat>
    <LineItem>
    <Title1/>
    <Title3/>
    </LineItem>
    <FILENAME>
    <FNAME/>
    </FILENAME>
    the header payment should not repeat....
    Regards
    Ajay

  • File content conversion Receiver with no key fields

    hi all,
              I have a header structure with four fields all varying and also  item structure with varying fields .. how do i go about to solve this .. as the regular Content Conversion uses key fields.. but there are no such key fields here... kindly help in this regard to proceed

    If you dont have a key field, then the only option to read the file and convert it to XML would be in a record row format.
    Here each line will go as one field in the XML. You will have to use some logic in your mapping to extract the right field.
    Ref: /people/sravya.talanki2/blog/2005/08/16/configuring-generic-sender-file-cc-adapter
    but in case your is a receiver File adapter then key fields are not required.
    ref: /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion

  • 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,

  • Key field from content - Sender file adapter content conversion

    I am reading a source CSV file that has this structure. All rows in the source file are the same structure: line items of a PO. But there will be multiple POs in a single file, identified by the PO number as one column in the file.
    PONum,LineItemNum,Qty,Description
    001,1,34,Carrots
    001,2,17,Apples
    001,3,22,Bananas
    002,1,4,Mangos
    002,2,9,Coconuts
    003,1,44,Grapes
    Goal is to generate 3 messages, one for each PO:
    <po>
         <num>001</num>
         <line_items>
              ... 3 line items for PO # 001 ...
         </line_items>
    </po>
    <po>
         <num>002</num>
         <line_items>
              ... 2 line items for PO # 002 ...
         </line_items>
    </po>
    <po>
         <num>003</num>
         <line_items>
              ... 1 line item for PO # 003 ...
         </line_items>
    </po>
    Is there any way to use the Content Conversion Key Field Name to group the line items into the correct 3 messages? "Key Field Name" expects a static identifier for each type of row; but mine varies by the PO number in the content.
    Or do I need to do this in the mapping? If so, what is the easiest way to split 1 large message of all line items into multiple target messages based on the PO number? (I assume this is better than sending individual line item messages and aggregating them later, as long as the file size is OK.)
    Thanks in advance!
    RBL
    Edited by: Robert Burfoot-Lobo on Apr 8, 2009 11:43 AM

    Hi Robert,
    If ur goal is to split into 3 messages one for each PO, you can go for message split and using graphical mapping you can achieve that.
    Within the message mapping go to the tab Messages.
    Change the occurrence of the target message to 0..unbounded.
    Also this link may help you.
    /people/claus.wallacher/blog/2006/06/29/message-splitting-using-the-graphical-mapping-tool
    Regards,
    Madhu

Maybe you are looking for