cancel
Showing results for 
Search instead for 
Did you mean: 

How to change payload data

Former Member
0 Kudos

Hello,

The Scenario is Idoc-file, we are generating XML file at target.

The requirement is to have IDOC number in file name eg. "File_IDOCNUMBER_datetimestamp.xml".

but in target file structure we have no separate field to map the IDOC number.

Kinldy help me, or give some possible solution

Regards,

Anu Singhal

Accepted Solutions (1)

Accepted Solutions (1)

Shabarish_Nair
Active Contributor
0 Kudos

Simple. Use dynamic configuration along with adapter specific attributes.

Have these as reference;

/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14

http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm

Former Member
0 Kudos

Thanks fro your quick reply,

But my scenario is from IDoc to file, I have tried with the same but it gives the error in Communication channel monitoring as there is no parameter like * u201Chttp://sap.com/xi/XI/System/Fileu201D,

u201CFileNameu201D* when sender is IDOC.

Could you please suggets some alternative solution.

Shabarish_Nair
Active Contributor
0 Kudos

did you enable ASMA for the receiver file adapter?

Also please paste the code here that you are using currently.

Did you have a look at my code? Check if that works.

Former Member
0 Kudos

Hey,

you need to check for the file receiver adapter ASMA properties not idoc adapter

that will definitely work for your requirement

Rajesh

Former Member
0 Kudos

Thanks,

the code worked perfectly fine!!!

Former Member
0 Kudos

Hi Vijay,

The code that you have sent me yesterday worked perfectly fine, but now it is giving me error in mapping

"Runtime Exception in Message mapping transformation": Java .lang.NullPointer Exception.

Can you please help me to know why the mapping is giving error now.

Regards,

Anu

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Anu,

Think your question is how to use payload date to generate part of the outpu file name ?

If so I would suggest to use the Variable Substitution in the CC.....

For usage see :

http://help.sap.com/saphelp_nw70/helpdata/EN/bc/bb79d6061007419a081e58cbeaaf28/frameset.htm

Hope this helps !

Regards, Jelmer

Former Member
0 Kudos

Mapping worked successfully but it is giving error now

Former Member
0 Kudos

What is the error you are getting?

Rajesh

Former Member
0 Kudos

I am facing the strange error scenario works sometime and sometime it dont work...

Please help..

SudhirT
Active Contributor
0 Kudos

Hi Anu,

this is really strange,actually the code you are using for UDF is the correct one , to figure out the problem you can compare the input payloads for either of the cases(success/failure) and in mapping editor test both the payloads after removing this dynamic UDF.

Thanks!

Shabarish_Nair
Active Contributor
0 Kudos

Note that the file name will be populated during runtime only.

Hope you are not testing the mapping independently.

What is the error you get now? Can you describe more?

Also ref: /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name

Former Member
0 Kudos

Thanks Sudhir,

It was problem with IDOC data

Shabarish_Nair
Active Contributor
0 Kudos

>

> The requirement is to have IDOC number in file name eg. "File_IDOCNUMBER_datetimestamp.xml".

create a simple UDF. Suppose to the UDF you are passing two input values

a - IDOCNUMBER from the IDoc

b - datetimestamp

in your case your code will be something like;

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

DynamicConfigurationKey key = DynamicConfigurationKey.create(
    u201Chttp://sap.com/xi/XI/System/Fileu201D,
    u201CFileNameu201D);

    String MyFileName = "File_" + a + "_" + b + ".xml";
    conf.put(key, MyFileName);
}