cancel
Showing results for 
Search instead for 
Did you mean: 

Get IDoc-number from flat IDoc using dynamic configuration

Markus7
Participant
0 Kudos

Dear experts

In an IDoc2File scenario I have added the IDoc-number to dynamic configuration using the folling code in an UDF:

DynamicConfiguration conf = (DynamicConfiguration)

container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

conf.put(FileName, a);

The information is stored in the SOAP message

<SAP:DynamicConfiguration SOAP:mustUnderstand="1">

...

<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="DOCNUM">0000000000012345</SAP:Record>

...

</SAP:DynamicConfiguration>

Can anybody tell me how I can access this information in the "variable substitution" section of the CC? Perhaps something like "message:docnum"?

Additional information:

Taking the IDoc-number from the payload using e.g. "payload:ORDERS05,1,IDOC,1,EDI_DC40,1,DOCNUM,1" does not work, since the XML-IDoc has been converted to an flat-IDoc.

Thanks in advance for any good ideas

Markus

View Entire Topic
rodrigoalejandro_pertierr
Active Contributor
0 Kudos

why you need to do that, which use do you want to for the IDocnumber? will it be part of the file name? please explain a little more what you need to do?

i dont understand why you use DC and later want to access via variable substitution. as i can see the file name will have the idoc number coz is what you do in the udf.

container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

conf.put(FileName, a);

there you set the idoc number as the file name

if you want to use the idoc number in variable Substitution so, this value must be in the target structure

Edited by: Rodrigo Alejandro Pertierra on Sep 20, 2010 12:54 PM

Markus7
Participant
0 Kudos

DOCNUM shall be part of the filename. The payload is an IDoc in flat-format. For this reason I wanted to store the DOCNUM in the dynamic configuration.

Best regards

Markus

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

hi

if the IDOC number shall be part of the file name, if posible map the IDoc number to the target structure, if not possible you have to define the complete filename by dynamic configuration.

but take in mind if you use dynamic configuration you cannot use later variable substitution. you have to choose one.

Former Member
0 Kudos

> DOCNUM shall be part of the filename.

To achive this you don't need to do Variable substitution, As you are already using the Dynamic configuration therefore just map the output of Dynamic Configuration UDF to any parent node and then set the ASMA(Adapter Specific Message Attributes) settings in your receiver file adapter and tick the "File Name" check box. Now in the File Name input parameter use %filename% (you can use any name even your's) that's it.

At the other hand you can also go through this blog..

/people/jin.shin/blog/2007/04/27/sap-netweaver-xi-variable-substitution-with-adapter-specific-message-attributes-via-dynamicconfigurationbean

Markus7
Participant
0 Kudos

I tried to solve my problem as explained in the following article

http://wiki.sdn.sap.com/wiki/display/XI/CombiningthreedifferentaspectsofPIinoneshot

Doesn't this article use DC and variable substitution? Maybe I am using the term DC incorrectly.

What I do not completely understand in this article is the section below "Another Simple way".

It would be ok for me to define the complete filename by dynamic configuration.

Do I need to change the following UDF line?

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

How can I access filename?

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

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

in that sentence replace DOCNUM for the variable that contain the full file name. i mean if the file name would be:

MasterData12345.txt where 12345 is the Docnumber, so concat MasterData with the idocnumber and replace the sentence

String filename="";

filename="MasterData"DOCNUM".txt"

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

then in the CC put any value for file name coz PI will take the value defined in the UDF. you have to define the proper path for the file in the CC

better now?