cancel
Showing results for 
Search instead for 
Did you mean: 

Idoc to file problem with DynamicConfiguration

Former Member
0 Kudos

HI SAP Guru's

I have a iDoc to File scenario and the output file requirement is bit tricky.

output file should be xx_Region_iDoc Number_YYYYMMDDHHMMSS

I been through couple of blogs but non of them mentioned about the iDoc all of them showed the about the FileName in FileAdapter.

I believe it is only possibly via Dynamic configuration.

I need to extract E1EDKA1/LAND1, DOCNUM from Source IDoc Structure and then concat it with Date and generate the output file name.

I cannot even get the iDoc Number i.e. DOCNUM via Dynamic Configuration.

I was trying this method but it didn't work.

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

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

String ourSourceFileName = conf.get(key);

return ourSourceFileName;

-


Can somebody please let me know how to achieve this and how?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi,

I have used Dynamic Configuration in one of the IDOC TO FILE scenario and its perfectly working fine. Just cross chk ur configurations.

Under ESR : use the code provided by Ramkumar .

Under ID: make an entry of Dynamic configuration module under File Receiver communication channel module tab(give correct details like parameter name and value) and chk ASMA(under Advanced mode).

It will surely work.

Thanks

Amit

Former Member
0 Kudos

Hi Amit,

will it be possible for you to send me the screen shot of the interface because I tried couple of time in IDOC to File but it didn't work for me.

If screen shot is not possible then could you please explain me the step by step configuration and if it works I will give you full points because there are so many others who mentioned that it works but nobody mentioned how and exact steps in IR and ID.

I will be very thankful to you if you could please solve this problem.

I am really struggling with this Dynamic Configuration.

Thanks,

Iqbal

Former Member
0 Kudos

Hi,

a) Under ESR: create one udf with 2 input parameters

String Name = "xx_" + a + "_" + b;

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

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

conf.put(key, Name);

return "";

Map this udf:

1 input

2 input -


> UDF -


> Target Header(MT name)

b) Under ID: go to receiver CC -> under Module tab :

Make an entry under Processing Sequenece :(make it as a 1 sequence)

AF_Modules/DynamicConfigurationBean Local Enterprise Bean 1(as module key)

Module Configurations:

1 key.0 write http://sap.com/xi/XI/System/File FileName

1 value.0 message.interface

c) Under Parameter tab-> Advanced :

Enable Variable substitution chkbox: make an entry under the table like this:

variable name: var1

Reference: message:interface_name

d) Check ASMA also.

I dont think that i have mentioned anything different, plz proceed as mentioned above it will work.

Still not clear then plz give me ur mail id ...will mail u the screen shots.

Thanks

Amit

Former Member
0 Kudos

Hi amit,

is it possible for you to forward me the screen shot now.

I will be more than happy.

Please forward me now, so that I will solve my problem.

Once again thank you so much for your help.

it is not allowed to mentioned mail address so could you please click on my account and and then GOTO business card and there you will find the email address.

I really appreciate if you could please do it now.

Thanks,

Iqbal

Former Member
0 Kudos

muiqbal / hotmail /co/ uk

Former Member
0 Kudos

Please resend the mail as I didn't get any jpg files and I am unable to view.

I urgently need it so please forward it asap.

Waiting for your reply.

former_member309357
Participant
0 Kudos

Hello,

  When I am trying with IDOC - Flat File (SFTP) using standard module, and capturing the IDoc number and Shipment type in the file name using above method, getting the error as below :

25.08.2014 08:16:17.971ErrorAdapter Framework caught exception: param key.0 has illegan value
25.08.2014 08:16:17.971ErrorMP: exception caught with cause java.lang.IllegalArgumentException: param key.0 has illegan value
25.08.2014 08:16:17.972ErrorDelivering the message to the application using connection SFTP_http://sap.com/xi/XI/SFTP failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.lang.IllegalArgumentException: param key.0 has illegan value.

Please let me know the valuable inputs.

Thanks

Ravi

Former Member
0 Kudos

Hi Amit Srivastava,

I am facing same issue.. could you please share the screen shots with me. it would be helpful for me to learn this configuration and fix this issue.  Please mail it to  vinothbe@hotmail.com

many thanks..

Vinoth

Answers (7)

Answers (7)

Former Member
0 Kudos

I am having a similar issue. The idoc coming in from the source has multiple segements and i need to create the file at the target server based on the field - FILTER2 value.

So far I have tried variable substitution and ASMA but still not able to create multiple files from PI.

Can you please share the screenshot with me as well ?

mradul0489@gmail.com

Former Member
0 Kudos

Hi,

If you are using PI 7.1 , then you can use the global variable. Concatenate the Land and Docnum from the IDoc segments and map it to a Gloabl variable.

Then map the global variable as the input to the UDF to Dynamically generate the Filename along with the Timestamp.

Enable Variable substutution in ID and use this output as the variable to create the Filename.

Regards,

Sarvesh Desai

Former Member
0 Kudos

could you please explain in detail along with the steps.

what I am doing now is

taking 3 arguments i.e. land1, DocNum, current date and you the above Dynamic Configuration but I am getting error in RWB

Message processing failed. Cause: com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: The Adapter Message Property 'FileName' was configured as mandatory element, but was not supplied in the XI Message header

because I am doing IDoc to File interface and how do i get the Filename , very confusing.

Could you please tell in detail both the parts IR and ID.

Waiting for your reply.

former_member183908
Active Contributor
0 Kudos

Hi Iqbal,

-->This is error is because you have selected the ASMA for receiver FILE communication channel and it is expecting the FILENAME in the Header.

-->But in your case source is an IDOC which we will not configure any adapter.........

-->When we select the ASMA on both sender and receiver adapter sides the header details will be displayed and the values will be populated in their respective values.From their the receiver adapter will access the values.You can see this in the PipeLine steps in SXMB_MONI.But in your case it will not possible (as per my knowledge).

--> Try with this approach, map the required fileds like DOCNUM,REGION,DATE.....from IDOC to Target strucutre in the mapping

and use the variable substitution option in the reciever FILE adapter.

In the FileNameSchema use %var1%_%var2%_%var3%.xml (i am not sure about this just try with this ).

Select the check box Enable and provide

variable name Reference

var1 MT_Inbound,1,Details,Info,number,1

var2 MT_Inbound,1,Details,Info,region,1

var3 MT_Inbound,1,Details,Info,date,1

Thanks

Former Member
0 Kudos

Hi Pavan,

Thanks for your email.

I am getting this error now in RWB

Message processing failed. Cause: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Unable to clone File Adapter receiver channel for parallel processing

Interface

IDoc -


PI 7.11 -


FTP

I have done the following.

IR

Mapped E1EDKA1/LAND1 concat E1EDK1/DOCNUM concat CurrentDate -


> unused Target Field and then disabled the field.

ID

Variable Subsitution

Variable Name Reference

var1 MT_Inbound,1,Details,Info,number,1

var2 MT_Inbound,1,Details,Info,region,1

var3 MT_Inbound,1,Details,Info,date,1

File Name Scheme : XX_%var2%_%var1%_%var3%.xml

could you please what I am doing wrong and why I am getting this error.

Thank you for your help.

Former Member
0 Kudos

Hi Iqbal,

As u have already concatinated "E1EDKA1/LAND1", " E1EDK1/DOCNUM" and "CurrentDate" to a unused variable then use that unused variable in the dynamic configuration section like as follows:

var1 -- > payload:<name of the message type>,1,<unused variable name>,1

and in file name write: XX_%var1%.xml

Thanks,

Nayan

Former Member
0 Kudos

Hi Nayan,

Thanks for your informative reply.

I would like to know is there anyway I can do this with Dynamic Configuration because I have been through many blog and no one mentioned about the IDoc all of them mentioned about the File.

In regards to Variable Substitution is good but my case is slightly different. In my case the Document Number is not mapped to any target side field it is only present in the Source so is there any way I can pick-up the values from Source payload rather than target payload.

or i can used any unused filed to mapped by don't display in output because this is for my reference and don't want this to appear on the target file.

Please can somebody tell me the different between Dynamic Configuration and Variable Substitution.

Former Member
0 Kudos

HI

Create a UDF Function and mapped to Root node.

In the UDF use return "".

(Dynamic configuration method PUT will taken care of file name creation)

DocNum + Date -- > UDF---> Target Root node

Regards

Ramg

Former Member
0 Kudos

I tried your method but got this error

Message processing failed. Cause: com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: The Adapter Message Property 'FileName' was configured as mandatory element, but was not supplied in the XI Message header

because my interface is iDoc to File so there is no File Name and that's why I am getting this error.

I have to is there any other way , I believe I can do it with variable substitution.

if you go through the notes on the previous page you will findout that I tried many ways but none of them worked according to the requirement.

I hope you can advice me some other way.

Former Member
0 Kudos

you were using filename scheme like this:

XX_%var2%_%var1%_%var3%.xml

(look for your answer in the chain where you mentioned this)

try using %var2%_%var1%_%var3%.xml

if the above works then your problem can be solved.

Otherwise you can always write a Java module and deploy it on the server and put it in module chain to establish filename.

regards

Former Member
0 Kudos

you were using filename scheme like this:

XX_%var2%_%var1%_%var3%.xml

(look for your answer in the chain where you mentioned this)

try using %var2%_%var1%_%var3%.xml

if the above works then your problem can be solved.

Otherwise you can always write a Java module and deploy it on the server and put it in module chain to establish filename.

regards

Former Member
0 Kudos

you were using filename scheme like this:

XX_%var2%_%var1%_%var3%.xml

(look for your answer in the chain where you mentioned this)

try using %var2%_%var1%_%var3%.xml

if the above works then your problem can be solved.

Otherwise you can always write a Java module and deploy it on the server and put it in module chain to establish filename.

regards

Former Member
0 Kudos

Hi

You have to use "Put" instead of get method.

Your code will be as below ,

Parameter : REGION, DOCNUM



String newFname = "xx_" + REGION + "" + DOCNUM + "" + CURRENTDATE;

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
 
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");


String ourSourceFileName = conf.put(key,newFname);

return "";

Regards

Ramg

Former Member
0 Kudos

.

Former Member
0 Kudos

Hi Iqbal,

If you are using PI 7.1, see the below comments suggested by Sarvesh:

If you are using PI 7.1 , then you can use the global variable. Concatenate the Land and Docnum from the IDoc segments and map it to a Gloabl variable.

Then map the global variable as the input to the UDF to Dynamically generate the Filename along with the Timestamp.

Enable Variable substutution in ID and use this output as the variable to create the Filename.

In case of PI 3.0 /7.0, see the below comments suggested by Farooq:

First of all I believe dynamic configuration will not work for Idoc adapter. I haven't tried it yet, but I am wondering how u can read idoc sender adapter parameter using Dynamic configuration. As suggested, write a UDF to override the file name.

>> Please can somebody tell me the different between Dynamic Configuration & Variable Substitution

Variable substitution allows you to name your target file dynamically with some value in the message payload.

Dynamic configuration means at runtime we are changing the values.

Variable substitution requires you to have the filename as part of your target payload.

As long as you have no issues with having the file name as part of your payload when you transfer it to your target system, variable substitution can be used.

Regards,

Abid

Former Member
0 Kudos

Hi,

If I am not wrong, you can achieve it by using both Dynamic configuration and Variable substitution.

For Variable substitution refer: /people/sameer.shadab/blog/2005/09/23/an-interesting-usage-of-variable-substitution-in-xi

Regards,

Abid

Former Member
0 Kudos

Hi,

First of all I believe dynamic configuration will not work for Idoc adapter. I haven't tried it yet, but I am wondering how u can read idoc sender adapter parameter using Dynamic configuration. As suggested, write a UDF to override the file name.

Regards,

Farooq

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

Hi

you should create an UDF which receive 3 parameters.

1) the IDoc Number (DOCNUM)> get the IDoc number from the segment EDIDC>DOCNUM

2) CurrentDate,-->StandarFunction currentDate

3)Region (LAND1)

In your UDF create in a variable you file name concatenating all parameters values.

then call this code:

String fileName ="";

fileName="xx_" + REGION + "_" + DOCNUM + "_" + CURRENTDATE;

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

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

String ourSourceFileName = conf.get(key);

return ourSourceFileName;

Hope it helps

Rgds

RP

Edited by: Rodrigo Alejandro Pertierra on Jun 15, 2010 3:46 PM

Former Member
0 Kudos

Hi Rodrigo,

I have done the UDF with 3 inputs and mapped it with header of Target side and now would like to know about the setting in File Adapter.

1. Could tell me what do I need to write in "File Name Scheme" , I am using *.xml , is it right?

2. I also check the Use Adapter Specific Message Attributes,

Fail if Adapter-Specific Message Attributes Missing

FileName

Could you please tell me is there anything else I need to do because I have been through couple of blogs and all of them mentioned about File but not about the IDoc.

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

Except you who mentioned this

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

I am bit confused about the FileName because there is no FileName in IDoc;

I found these information in IDoc Dynamic Configuration

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

- <!-- Receiver Determination

-->

- <SAP:DynamicConfiguration xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">

<SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="SNDPOR">SAPDGE</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="SNDPRN">DGE008</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="SNDPRT">LS</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="RCVPOR">A000000012</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="RCVPRN">CITIPHMX</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="RCVPRT">B</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="MESTYP">PAYEXT</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="IDOCTYP">PEXR2002</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/System/IDoc" name="CIMTYP">ZPEXR2002</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/Message/30" name="CALLER_CODEPAGE">4102</SAP:Record>

</SAP:DynamicConfiguration>

Please comment.

balaji_pichaimuthu
Active Participant
0 Kudos

Hi ,

This is different solution all together.. The idoc will first stored as a xml file. The it will transfered to PI via file channel. what i meant is create a port type XMLfile Using this port type we can store idoc as xml file in directory .

when u creating a xml file port it will ask a directory.. give a application server directory. then it will ask function module name.. write function module which store the idoc as xml file as per ur filename schema . Then give the functional module in the XML file port . Also give the outbound file as ".xml" in XML file port.

The function module will have 4 import parameters namely say like datatype, directory,filename and control, the associate type will be EDIPO-ACTRIG,EDIPO-OUTPUTDIR,EDIPO-OUTPUTFILE and EDIDC respectively and emport parameter will pathname like EDI_PATH-PTHNAM where EDIPO contains the values which are mentioned in the XML file port.

In ID the interface look like a file to file scenario. The sender file pick the file from the folder which is mentioned in the XML file port in we21.

Regards,

Balaji

Edited by: Balaji Pichaimuthu on Jun 16, 2010 12:04 PM

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

im sorry because i was wrong. you cannot use Dynamic configuration. in your case you must use Variable Substitution. once you create the file name in the UDF. you must map this value in a target field.

later when configuring CC receiver select property Variable Substitution and configure this:

FOR EX:

First colum--> fileName

second Colum-->payload:<MT_FILE>,1,FileData>,1,FILENAME,1

<MT_FILE>

....<FileData>

-


<FILENAME>

later in FIle Name of the file in the CC you must put %file%.txt

RP

Shabarish_Nair
Active Contributor
0 Kudos

not sure why you are not going for the dynamic configuration in your case.

Its is pretty easy and definitely works for an IDoc to File scenario (i dont know why people are giving wrong ideas that it doesnt work)

please refer this blog for help - /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name

you will ahve to write a UDF with the required input fields from the source and then do the required string manipulation to create the file out. there are sample code in the blog for help.

also in case u face any issues with the file adapter use this blog to troubleshoot - /people/shabarish.vijayakumar/blog/2007/07/26/troubleshooting-the-file-adapter-last-updated-on-02-july10

Former Member
0 Kudos

Hi Vijay,

I don't know why I am getting this error

Message processing failed. Cause: com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: The Adapter Message Property 'FileName' was configured as mandatory element, but was not supplied in the XI Message header

I am wondering how can I use filename in idoc because there is no filename exist in idoc so how the Dynamic Configuration will generate/get the file name.

If possible could you please example me in bit details especially the ID part.

I tried many times but it didn't work.

Thanks,

Iqbal

Former Member
0 Kudos

Hi

Did you select the "Adapter specific message attributes"?

In ID part

if not got to receiver File adapter > Advanced> Adapter specific message attributes

select the Filena option.

Regards

Ramg

Former Member
0 Kudos

Hi,

I was trying this method but it didn't work.

Have you selected the option ASMA in receiver File channel? Your code looks fine.

Regards,

Neetesh

Former Member
0 Kudos

Could you please tell me how to do variable substitution in ID.

I have done the UDF but don't know what to do in ID except ASAM

Shabarish_Nair
Active Contributor
0 Kudos

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

manipulate the filename by writing the UDF and having the input field as the IDoc number from the EDIDC segment