cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic File Generation

Former Member
0 Kudos

Hi,

I am trying to generate the file name dynamically, when i checkin sxmb_moni the message is successful but when i check in application server the file is not there. In this scenario i have used variable substitution option and adapter specific message attributes. Kindly suggest.

Thanks & Regards,

Sridhar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sridhar,

Check the Communication Channel Monitroing of your Receiver File Channel.Might be this channel gone under errors.Give that error description which the cahnnel is encoutnering the problem.

Cheers

Veera

Former Member
0 Kudos

Hi Veer,

Please find the details of my scenario below:

-


UDF----


//write your code here

String SourceFileName="Pur_Ord";

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

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

java.text.SimpleDateFormat formatter=new java.text.SimpleDateFormat ("yyyyMMdd");

java.util.Date day = new java.util.Date();

String dateformat=formatter.format( day );

String newfilename=SourceFileNamedateformata+".xml";

conf.put(key, newfilename);

return newfilename;

-


UDFclose----


DocNum -> UDF -> ClientDocID (Graphical mapping)

In Receiver Communication Channel

File Name Schema = %var%.xml

File Construction Mode = Create

Variable Substitution Check Box enabled

And passed varibale name = var and reference = payload:ALS,1,ClientDocID,1

And checked the Adapter specific attribute check box and file name check box

Regards,

Sridhar

nisarkhan_n
Active Contributor
0 Kudos

the field which takes the value from th UDF to get the filename (change the occurence from 0- unbounded) and also

var = payload:ALS,1,ClientDocID,1

is the ClientDocID is the filed that hold the value of the filename....i doubt ...i think you are not rfereing to the correct field which hold the data in variable substution...

pls post the target structure

reward points if usefull

Former Member
0 Kudos

Hi Nisar,

Please find the target structure below:

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

- <ns0:ALS xmlns:ns0="http://Replenishment.com">

- <DocHeader>

<ClientID></ClientID>

<ClientDocID></ClientDocID>

<UserID></UserID>

</DocHeader>

- <Request Type="PurchaseOrder" action="insert">

<ClientReference></ClientReference>

<DeliveryDate></DeliveryDate>

<Vendor></Vendor>

- <OrderLine>

<Request Type="PurchaseOrderItem" action="insert" />

<ExpectQTY></ExpectQTY>

</OrderLine>

</Request>

</ns0:ALS>

Regards,

Sridhar

nisarkhan_n
Active Contributor
0 Kudos

the correct value would be

<b>var = payload:ALS,1,DocHeader,1,ClientDocID,1</b>

DocHeader was missing check this and let me know

reward points if usefull

Former Member
0 Kudos

Hi Nisar,

Thank you very much.

Regards,

Sridhar

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Sridhar,

<i> And checked the Adapter specific attribute check box and file name check box</i>

No need to check this, uncheck this one and try to test the scenraio.You will get it this time.

Cheers

Veera

>>>Reward Points,if it is needful

Former Member
0 Kudos

Hi Experts,

Please find my sceraio details below:

This is Idoc To File Scenario

Source is the idoc and the mapping field name is DocNum

Target Structure is :

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

- <ns0:ALS xmlns:ns0="http://Replenishment.com">

- <DocHeader>

<ClientID></ClientID>

<ClientDocID></ClientDocID>

<UserID></UserID>

</DocHeader>

- <Request Type="PurchaseOrder" action="insert">

<ClientReference></ClientReference>

<DeliveryDate></DeliveryDate>

<Vendor></Vendor>

- <OrderLine>

<Request Type="PurchaseOrderItem" action="insert" />

<ExpectQTY></ExpectQTY>

</OrderLine>

</Request>

</ns0:ALS>

The below UDF is written on field level(ClienDocId)

-


UDF----


//write your code here

String SourceFileName="Pur_Ord";

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

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

java.text.SimpleDateFormat formatter=new java.text.SimpleDateFormat ("yyyyMMdd");

java.util.Date day = new java.util.Date();

String dateformat=formatter.format( day );

String newfilename=SourceFileNamedateformata+".xml";

conf.put(key, newfilename);

return newfilename;

-


UDFclose----


DocNum -> UDF -> ClientDocID (Graphical mapping)

Fieled name in the Idoc is DocNum

In Receiver Communication Channel

File Name Schema = %var%.xml

File Construction Mode = Create

Variable Substitution Check Box enabled

And passed varibale name = var and reference = payload:ALS,1,ClientDocID,1

And checked the Adapter specific attribute check box and file name check box

Regards,

Sridhar

Former Member
0 Kudos

Hi Sridhar,

Your refrence field is at 2nd position in your node, try like this reference = payload:ALS,1,ClientDocID,2 and let me know the result.

Cheers

Veera

Former Member
0 Kudos

Hi Veer,

Still it is not working.

Sridhar

Former Member
0 Kudos

Hi Sridhar,

Once check the value mentioned in variable subtitution and check your mapping whehter the field is populated with any values or not.

And check the below links for Variable subtiution.

/people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i - Dynamic File Name Part 1

/people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii - Dynamic File Name Part 2

Provide your target strucutre to check that whether your variable subtiution refrence is correct or not.

Cheers

Veera

Former Member
0 Kudos

Hi Sridhar

Check this Thread discuss the same

look at these also

/people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i --> <b>Dynamic File Name using XI 3.0 SP12 Part – I</b>

Thanks

nisarkhan_n
Active Contributor
0 Kudos

1. In SXMB_MONI -


>NoError

2. Check in the File Receiver adapter monitoring-----> there should be some error.....if the fie receiver adapter is no error thenfile shold come in the target directory.......

let me know these info

Former Member
0 Kudos

Hi Nisar,

When i checked in RWB the receiver adapter is throwing an error as "Could not process due to error: 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".

Please suggest what might be the problem.

Regards,

Sridhar