cancel
Showing results for 
Search instead for 
Did you mean: 

Key Field Value in FCC

Former Member
0 Kudos

Hi Experts,

I have a scenario in PI, where I have 1 Header, n Data Records and 1 Trailer in the source file. This data is coming in CSV format.

I am using FCC to convert CSV into XML.

In the FCC, I have used keyFieldValue parameter. For the Header Record, the Key Field Value is constant "H"; for Trailer Record the key field value is constant "T".

However for Data Record, the key field value is not constant. The first character of Key field of Data Record will always be "D", but rest of the Alphabets can change.

Sample File:

"H","3.04",22/10/2009,16:31:12
"D2S",21/10/2009,20:00:26,"20044",00666,"S",1
"D2S",22/10/2009,14:26:20,"20044",00668,"S",1
"D0S",22/10/2009,08:33:34,"00044",04165,"S",1
"D0S",22/10/2009,11:59:59,"00044",04166,"S",1
"T",1393.27,1393.27,8

Here, first line is Header Line (Key Field Value "H"), Last Line is Trailer Line (Key Field Value "T") and all lines in between Header and Trailer are Data Records (Key Field Value starts with "D). I need to convert this file into XML.

I have no clue, if this can be converted into XML through FCC.

Any help will be highly appreciated.

Regards,

Varun

Accepted Solutions (1)

Accepted Solutions (1)

Shabarish_Nair
Active Contributor
0 Kudos

>

> Sample File:

>

"H","3.04",22/10/2009,16:31:12
> "D2S",21/10/2009,20:00:26,"20044",00666,"S",1
> "D2S",22/10/2009,14:26:20,"20044",00668,"S",1
> "D0S",22/10/2009,08:33:34,"00044",04165,"S",1
> "D0S",22/10/2009,11:59:59,"00044",04166,"S",1
> "T",1393.27,1393.27,8

>

> Here, first line is Header Line (Key Field Value "H"), Last Line is Trailer Line (Key Field Value "T") and all lines in between Header and Trailer are Data Records (Key Field Value starts with "D). I need to convert this file into XML.

>

> I have no clue, if this can be converted into XML through FCC.

> Any help will be highly appreciated.

>

>

> Regards,

> Varun

Write a simple module. The module will do a replace of the Dxx fields to D (you can use simple regex function for this)

After the module, use the messagetransformbean to do the FCC for you.

The module might sound complex, but trust me its a simple logic you need to implement and you can easily do the FCC with the messagetransformbean

Former Member
0 Kudos

Hi Shabarish,

Thanks for your valuable inputs.

Even I was also thinking of Adapter module but before going to that approach I just want to ensure that Adapter module can only be the solution for this requirement because my client will definitely not like this solution .

If this is the only solution, then atleast I can develop this module and show-case it to client.

One more favor Shabarish, I have never done FCC in Adapter Module. Would like to request you, if you can provide some links on messagetransformbean.

Regards,

Varun

Shabarish_Nair
Active Contributor
0 Kudos

if your client is not happy with the adapter module solution, then the next option is to do a record row level file reading and then use a java mapping to create your target message

/people/sravya.talanki2/blog/2005/08/16/configuring-generic-sender-file-cc-adapter

regarding messagetransformbean -

793922 describes the MessageTransformBean or refer - http://help.sap.com/saphelp_nw04/helpdata/en/24/4cad3baabd4737bab64d0201bc0c6c/content.htm

Former Member
0 Kudos

Hi,

One option could be using Java mapping.

/people/rahul.nawale2/blog/2006/07/18/java-mapping-an-alternate-way-of-reading-a-csv-file

/people/venkataramanan.parameswaran/blog/2006/12/12/java-mapping-to-handle-flat-files-in-sap-xi

Regards,

Sarvesh

Former Member
0 Kudos

Hi Shabarish,

If these are the only possible solutions for this requirement then I will prefer Custom Adapter Module because it's definitely more simpler then Java Mapping.

Now, I somehow will have to convince client for Custom module development

Well, thanks for all the suggestions.

Regards,

Varun

Answers (1)

Answers (1)

abhijitbolakhe
Advisor
Advisor
0 Kudos

Hi

Since D is the first character of data records...keep D as key field for data records

Record setstructure : header,1.data,*,Trailer,1

recordset per message as 1

Pls check the following link for more details

/people/shabarish.vijayakumar/blog/2006/02/27/content-conversion-the-key-field-problem

Regards

Abhijit

Former Member
0 Kudos

Hi Abhijit,

The incoming file is a comma separated file and in the key Field the value is not just "D"; it's a first character of key field value.

So, in FCC when I specify fieldSeparator as comma (,); then it will take D along with all the characters coming before next comma.

Jjust specifying D in the keyFieldValue parameter in FCC will not work.

I have also gone through the weblog provided by you. Unfortunately, the scenarios described in that blog are different from my scenario .

Regards,

Varun