cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PO - variable substitution and SAP_XI_IDOC/IDOCXmlToFlatConvertor

arturtarabula
Explorer
0 Kudos

Dear All,

The PO environment is quite new for me.

I have created receiving communiction channel which uses SAP_XI_IDOC/IDOCXmlToFlatConvertor module, here is the configuration

and it is working fine. Then I wanted to specify filename based on the content of the IDoc, for instance:

And here is the problem, cause as I think the module

SAP_XI_IDOC/IDOCXmlToFlatConvertor is executed before, and the XML IDoc is already converted to Flat IDoc, and then the variable subsitution is not working, is there any workaround for this to?

Best regards,

Artur

Accepted Solutions (1)

Accepted Solutions (1)

manoj_khavatkopp
Active Contributor
0 Kudos

Hi Artur,

Yes you are right . The module execution takes place before your variable substitution hence you are getting error.

  • You may use Dynamic Config in your mapping.
  • Custom module to store the value from xpath .

Br,

Manoj

arturtarabula
Explorer
0 Kudos

Hi Manoj,

Thanks for suggestions. I consider to create process integration scenario like below.

1. the document will be write into filesystem with desired name using variable substition,

2. Then using another channel will be transformed into Flat IDocs and send to the provider.

What do you think?

Best regards,

Artur

manoj_khavatkopp
Active Contributor
0 Kudos

Hi Artur,

Yes this looks good as far as you don't have and restriction to create an additional interface for this.

If you are considering just to go with one flow all you need is to create MM and OM with 1:1 mapping with dynamic udf that's it.

Br,

Manoj

arturtarabula
Explorer
0 Kudos

Hi Manoj,

Yesterday I have been trying to figure your solution out, and I think I have got it.

I have created MM, as a source and target message I have selected the same IDoc message, then from the source I dragged DOCNUM, MESTYP, RCVPRN and as a target only DOCNUM, and in the middle I have put UDF like below. It is working perfectly 🙂

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

String fileName = mestyp + "_" + rcvprn + "_" + docnum + "_" + ".idoc";

conf.put(keyFileName, fileName);

return docnum;

Let me know if you have any suggestions to my solution, as I mentioned PO is something new for me, and honestly it is my first MM and UDF 😉

Best regards,

Artur

manoj_khavatkopp
Active Contributor
0 Kudos

Hi Artur ,

This looks perfect just make sure you have all IDOC fields are mapped 1:1 as there should not be any change in data . The only reason for going to MM is to set Dynamic UDF for File Name.

Take whatever input fields you need like DOCNUM, MESTYP, RCVPRN and perform the UDF . The above UDF looks perfect and map the output of the UDF to root note i.e "IDOC " in target structure.

And also make sure you enable " Adapter Specific Message Attributes " with Filename in receiver channel.

And the test end to end .

Br,

Manoj

arturtarabula
Explorer
0 Kudos

Hi Manoj,

Yes, I have mapped all fields 1:1 using the button "Map Selected Fields and Substructures if names are identical"

I already test it and it is working like I wanted, but instead of mapping it to root node "IDOC" I mapped it do DOCNUM, cause in the UDF I am taking as a arguments DOCNUM, MESTYP, RCVPRN, and I am returing the DOCNUM (unchangeD), so actually it is like 1:1 mapping for DOCNUM.

Best regards,

Artur

manoj_khavatkopp
Active Contributor
0 Kudos

Hi Artur,

Perfect! this is fine then.

Br,

Manoj

Answers (0)