cancel
Showing results for 
Search instead for 
Did you mean: 

Need FCC Content Conversion parameters help

former_member200386
Active Participant
0 Kudos

Hi Experts,

I am working on FCC content conversion scenario. Where I need to pick the .csv files and convert into XML file. My source file structure will be like this.

"InvoiceNumber","InvDate","InvoiceAmount","VendorNumber","CheckIdentifier","CheckDate","PaymentAmount","InternalComments","RemittanceNotes"

"19251087",01-DEC-12,1725.07 ,"1000002780","1012989",15-MAR-13,1725.07 ,,

"19251090",01-DEC-12,820.17 ,"1000002780","1012989",15-MAR-13,820.17 ,,

"19251091",01-DEC-12,609.31 ,"1000002780","1012989",15-MAR-13,609.31 ,,

"3946417",01-DEC-12,1938.23 ,"1000003686","0020063147",15-MAR-13,1938.23 ,,

"514488068120112",01-DEC-12,131.58 ,"1000007578","000937",15-MAR-13,131.58 ,,

in my file sender comm channel  which FCC parameters i need to use  to pick the fields. I need your valuable inputs

Thanks & Regards,

Pavan

Accepted Solutions (1)

Accepted Solutions (1)

Bhargavakrishna
Active Contributor
0 Kudos

Hi Pavan,

You can use the following parameters..

change Record.fieldnames :

InvoiceNumber,InvDate,InvoiceAmount,VendorNumber,CheckIdentifier,CheckDate,PaymentAmount,InternalComments,RemittanceNotes.

Document name: specify the message type of file.

Document namespace: specify the name space which you have created for the scenario.

Record structure as you specified in your message type.

Hope it will helpful..

Regards

Bhargava krishna

former_member200386
Active Participant
0 Kudos

Hi Bhargav,

I have created my comm channel as you mentioned. I am able to pick the file successfully. I am facing some issue with receiver file is not converted into XML properly.

here the output XML message.i have used ASMA parameters in my comm channel configuartion.

<?xml version="1.0" encoding="UTF-8"?>

<ns0:output xmlns:ns0="http://testfile2file"><gad><InvoiceNumber>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</InvoiceNumber></gad><gad><InvoiceNumber>&lt;ns0:output xmlns:ns0=&quot;http://testfile2file"><gad><InvoiceNumber>&quot;InvoiceNumber&quot;</InvoiceNumber><InvDate>&quot;In...

here is my comm channel config

Record.fieldSeparator,
Record.endSeparator'nl'
Record.fieldNamesInvoiceNumber,InvDate,InvoiceAmount,VendorNumber,CheckIdentifier,CheckDate,PaymentAmount,InternalComments,RemittanceNotes
ignoreRecordsetNametrue

Thanks & Regards,

Pavan

former_member200386
Active Participant
0 Kudos

Hi Bhargav,

After unchecking the asma option  , i am able to see the output file in xml format. but i want use same source filename schema for  target also. I know we can achieve this dynamic configuration UDF in my mapping ,but i never done this before. can you guide me how to  create a UDF?

my requrement is lkne this if source file 123. csv then my output file name will be 123_yyMMdd.xml

Thanks & Regards,

Pavan

Bhargavakrishna
Active Contributor
0 Kudos

Hi Pavan,

Also Add the below parameters in content conversion parameters an see.

Record.fieldSeparator = |

Record.endSeparator = 'nl'

Record..keyFieldInStructure = ignore

Also refer this post

http://saptechnical.com/Tutorials/XI/Contentconversion/page2.htm

http://scn.sap.com/message/5854463

Hope it will helpful..

Regards

Bhargava krishna

former_member200386
Active Participant
0 Kudos

Hi Bhargav,

My scenario is working fine after i unchecked the ASMA option, But i need to use  i need to use same name schema at the target end also. for example source file like this 123.csv my target file will 123_yyMMDD.xml. Please help how can i achieve this.

Thanks & Regards,

Pavan

Bhargavakrishna
Active Contributor
0 Kudos

Hi Pavan,

You can achieve this by using variable substitution or UDF

Refer below link for the same.

http://scn.sap.com/message/13969105#13969105

Regards

Bhargava krishna

former_member200386
Active Participant
0 Kudos

HI Bhargav,

I used the below code

DynamicConfiguration conf = (DynamicConfiguration) container

    .getTransformationParameters()

    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");

//get current date

Date date = new Date( );

var_Filename = conf.get(key) + dateFormat.format(date);

conf.put(key, var_Filename);

I am getting this error when i am testing the mapping

17:57:06 Start of test  

  Source text of object Message Mapping: mm_mapping | http://testfile2file has syntax errors:

17:57:08 End of test

anupam_ghosh2
Active Contributor
0 Kudos

Hi Pavan,

            Did you add below  import statements ?

import java.text.DateFormat;

import java.text.SimpleDateFormat;

Adding the import statements might resolve the problem.

Regards

Anupam

ambrish_mishra
Active Contributor
0 Kudos

Pavan,

you can simply pass the currentDate (standard Date) in the format you like to the UDF and simply append to the file name with underscore instead of using Calendar class.

Ambrish

former_member200386
Active Participant
0 Kudos

Hi Ambirsh,

this is my first UDF . I have created my UDF like this

Name:DynamicFileName

Title:DynamicFileName

ExecutionType:SingleValues

Type : Arugurement Var1 String

and here is my code for the UDF

DynamicConfiguration conf = (DynamicConfiguration) container

    .getTransformationParameters()

    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");

//get current date

Date date = new Date( );

var_Filename = conf.get(key) + dateFormat.format(date);

conf.put(key, var_Filename);

I have taken my variable as current date and mapped to UDF and mapped to Target node.


I am getting this below error.

19:54:20 Start of test  

  Source text of object Message Mapping: mm_mapping | http://testfile2file has syntax errors:

19:54:22 End of test

ambrish_mishra
Active Contributor
0 Kudos

Hi Pavan,

There is always a first time.

For the UDF, your target can be any node, which you have to create once.

You need to pass current date in format you need yymmdd to the function.

Here is your code assuming your argument is called Var1.

String var_FileName = new String();

DynamicConfiguration conf = (DynamicConfiguration) container

    .getTransformationParameters()

    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

var_FileName = conf.get(key) + "_"+ Var1;

conf.put(key,var_FileName);

return "";

Hope it helps!

former_member200386
Active Participant
0 Kudos

Hi Ambrish,

Thanks for your response. I have added your code in my UDF . 

my mapping is like this currentdate--->UDF--->Targetnode. I am getting this error

ambrish_mishra
Active Contributor
0 Kudos

Hi Pavan,

You must have named your parameter. Either change the parameter name to Var1 or change the code

var_FileName = conf.get(key) + "_"+ <whatever name you gave>;

Ambrish

former_member184789
Active Contributor
0 Kudos

Hi,

Just a small thing. If you are using dynamic configuration in UDF, you should not test it in message mapping. Test it end to end.

former_member200386
Active Participant
0 Kudos

Hi Adarsh,

I tried to test the interface end end. my output file is coming like this

ALXN_PAYMENT_03192013.csvjava.text.SimpleDateFormat@d547ad40 , Not the desired format i want.

Thanks & Regards,

Pavan

Bhargavakrishna
Active Contributor
ambrish_mishra
Active Contributor
0 Kudos

Pavan,

The code we discussed did not work ?

Ambrish

former_member200386
Active Participant
0 Kudos

Hi Ambrish,

I used your code. after i tested the interface my output file name is coming like this

ALXN_PAYMENT_03192013.csvjava.text.SimpleDateFormat@d547ad40 , Not the desired format i want.

Thanks ,

Pavan

ambrish_mishra
Active Contributor
0 Kudos

Pavan,

Just double click on the currentDate box and you can choose the format you want.

Ambrish

former_member200386
Active Participant
0 Kudos

Hi Ambrish.,

I have checked the date format as you told.

my mapping is like this

currentdate(yyMMdd)--->UDF--->Target field

Thanks & Regards,

Pavan

ambrish_mishra
Active Contributor
0 Kudos

What is the result ?

former_member200386
Active Participant
0 Kudos

i am getting the output file name is like this

ALXN_PAYMENT_03192013.csvjava.text.SimpleDateFormat@d547ad40

ambrish_mishra
Active Contributor
0 Kudos

Hi Pavan,

In current date, put format as yyMMdd. This should work. I tested in my machine.I hope you have not used any SampleDate format variable in the code. No need to import any other class.

I read your requirement again.

if source file 123.csv then my output file name will be 123_yyMMdd.xml

So you need to strip out 123 from the file name 123.csv, you will get when you do conf.get(key) and append _yyMMdd and extension .xml

Try it else paste your code here and I will modify.

Ambrish

former_member200386
Active Participant
0 Kudos

Hi Ambrish,

Thanks for your concern, i changed my date format to yyMMdd and tested the scenario. i am getting my outputfile name like this. ALXN_PAYMENT_03192013.csvjava.text.

i'll tell you my requirement.

my source file name will be like this ALXN_PAYMENT_03192013.csv

i need to add current date (yyMMdd) using dynmaic file configuartion.now my desired output file name will be like this ALXN_PAYMENT_03192013_yyMMdd.xml

my UDF code is below.

String var_FileName = new String();

DynamicConfiguration conf = (DynamicConfiguration) container

    .getTransformationParameters()

    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

var_FileName = conf.get(key) + "_"+ var1;

conf.put(key,var_FileName);

return "";

ambrish_mishra
Active Contributor
0 Kudos

Here is the modified code:

String originalFileName = new String();

String newFileName = new String();

DynamicConfiguration conf = (DynamicConfiguration) container  .getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

originalFileName = conf.get(key);

newFileName = originalFileName.substring(0,originalFileName.indexOf('.'))+"_"+ var1+".xml"

conf.put(key,newFileName);

return "";

Hope this works!

Ambrish

former_member200386
Active Participant
0 Kudos

Hi Ambrish,

Thanks for help, Now i am getting the output file name as i wanted.  Your code works perfect.

Thanks & regards,

Pavan

Answers (2)

Answers (2)

former_member184789
Active Contributor
0 Kudos

Hi,

You can also try below code. Map the output of this code to the top node of the target structure.

         String oldFilename = "";

         String newFilename = "";

         String newFilename2 = "";

         DynamicConfiguration conf = (DynamicConfiguration) mapParameters.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);  

           DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");

           oldFilename = conf.get(key);   

           DateFormat dateFormat = new SimpleDateFormat("yyMMdd");

           newFilename2 = oldFilename.replaceAll(".csv","");

           newFilename = newFilename2+"_"+dateFormat+".xml";      

           conf.put(key, newFilename);

           return "";

Former Member
0 Kudos