Dynamic File name using ASMA (Adapter Specific Message Attributes) in PI/XI

2023-12-14 05:38

本文主要是介绍Dynamic File name using ASMA (Adapter Specific Message Attributes) in PI/XI,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

转自:http://www.saptechnical.com/Tips/XI/ASMA/Index.htm

 

There has been an added feature from SP14 onwards to handle the Message Attributes dynamically using AdapterSpecificMessageAttibutes (e.g. Filename). This feature has been demonstrated with one of the example below using File adapter.  

Business case:

There was a requirement in one of our interfaces to get the   same file name that sender places in his FTP and get the same name as file name with the added time stamp separated by the “_ “(underscore) symbol on the target side.

Ex: Source side file name (DynamicPO.txt has to be converted to DynamicPO_<timestamp>.xml).  

Technical challenge:

Time stamp can be added at the end of the file name by specifying the Add Timestamp parameter .But our requirement is to put underscore between filename and time stamp which is not possible in the former case. To achieve this we can make use of ASMA and modify the file name according to our requirement.  

Procedure:

Design Part (IR):

Prerequisites:

All the required Interface objects have already been created,In the current case the message structures are:  

Source Structure

 

Target Structure

<!-- [if gte vml 1]><v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> <v:stroke joinstyle="miter"/> <v:formulas> <v:f eqn="if lineDrawn pixelLineWidth 0"/> <v:f eqn="sum @0 1 0"/> <v:f eqn="sum 0 0 @1"/> <v:f eqn="prod @2 1 2"/> <v:f eqn="prod @3 21600 pixelWidth"/> <v:f eqn="prod @3 21600 pixelHeight"/> <v:f eqn="sum @0 0 1"/> <v:f eqn="prod @6 1 2"/> <v:f eqn="prod @7 21600 pixelWidth"/> <v:f eqn="sum @8 21600 0"/> <v:f eqn="prod @7 21600 pixelHeight"/> <v:f eqn="sum @10 21600 0"/> </v:formulas> <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/> <o:lock v:ext="edit" aspectratio="t"/> </v:shapetype><v:shape id="_x0000_i1025" type="#_x0000_t75" style='width:137.25pt; height:150.75pt'> <v:imagedata src="file:///C:\DOCUME~1\SAPTEC~1\LOCALS~1\Temp\msohtml1\03\clip_image001.png" o:title=""/> </v:shape><![endif]-->

<!-- [if gte vml 1]><v:shape id="_x0000_i1026" type="#_x0000_t75" style='width:139.5pt;height:154.5pt'> <v:imagedata src="file:///C:\DOCUME~1\SAPTEC~1\LOCALS~1\Temp\msohtml1\03\clip_image003.png" o:title=""/> </v:shape><![endif]-->

Message mapping:  

  • Create an UDF and include the piece of code that captures the Filename and Timestamp from source side via ASMA. 

  • Modify them according to our requirement by adding the <Timestamp> at the end of <filename>.

  • Map the UDF to any of the top level node so that the modified filename will be available for the target communication channel.

UDF code: 

<!-- [if gte vml 1]><v:shape id="_x0000_i1027" type="#_x0000_t75" style='width:378pt;height:266.25pt'> <v:imagedata src="file:///C:\DOCUME~1\SAPTEC~1\LOCALS~1\Temp\msohtml1\03\clip_image005.png" o:title=""/> </v:shape><![endif]-->  

Code:

try {

String filename    = "";

String timestamp = "";

DynamicConfiguration conf1 = (DynamicConfiguration) container

    .getTransformationParameters()

    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

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

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

filename = conf1.get(key1);

timestamp = conf1.get(key2);

filename = filename.replaceAll( ".txt" ,"_" );

filename = filename+timestamp+".xml";

conf1.put(key1,filename);

return filename;

}

catch(Exception e)

{

     String exception = e.toString();

       return exception;

}

Configuration Part (ID):

à In the sender side communication channel, Mention *.txt as file name to pick all the txt files that will be placed in the source directory.

<!-- [if gte vml 1]><v:shape id="_x0000_i1028" type="#_x0000_t75" style='width:242.25pt;height:78pt'> <v:imagedata src="file:///C:\DOCUME~1\SAPTEC~1\LOCALS~1\Temp\msohtml1\03\clip_image007.png" o:title=""/> </v:shape><![endif]-->  

à Click on Advanced tab and check the Option “SetAdapterSpecificMessageAttributes ” in addition to that check the attribute that are required to be captured during run time. In our case File Name and Source File Time Stamp are required to be checked as shown in the below picture.

<!-- [if gte vml 1]><v:shape id="_x0000_i1029" type="#_x0000_t75" style='width:214.5pt;height:118.5pt'> <v:imagedata src="file:///C:\DOCUME~1\SAPTEC~1\LOCALS~1\Temp\msohtml1\03\clip_image009.png" o:title=""/> </v:shape><![endif]-->             

--> In the receiver communication channel Mention ‘ * ‘as File Name Scheme.

<!-- [if gte vml 1]><v:shape id="_x0000_i1030" type="#_x0000_t75" style='width:270.75pt;height:55.5pt'> <v:imagedata src="file:///C:\DOCUME~1\SAPTEC~1\LOCALS~1\Temp\msohtml1\03\clip_image011.png" o:title=""/> </v:shape><![endif]-->

à Click on Advanced tab and check the Option “SetAdapterSpecificMessageAttributes ” in addition to that check the attribute “File Name ” which will carry the modified value in the UDF in mapping as shown below.

<!-- [if gte vml 1]><v:shape id="_x0000_i1031" type="#_x0000_t75" style='width:3in;height:118.5pt'> <v:imagedata src="file:///C:\DOCUME~1\SAPTEC~1\LOCALS~1\Temp\msohtml1\03\clip_image013.png" o:title=""/> </v:shape><![endif]-->

à Create the Remaining IR objects as usual, save and activate them.  

Execution:

Now it’s the time to test the interface .Place the “.txt ” file in the source directory and execute scenario. After successful execution you will see the “.xml ” file (as my scenario is FCC to xml ) created by the name that in way it has been modified in the UDF using Dynamic Configuration .

Sender system

Receiver System

<!-- [if gte vml 1]><v:shape id="_x0000_i1032" type="#_x0000_t75" style='width:3in;height:51.75pt'> <v:imagedata src="file:///C:\DOCUME~1\SAPTEC~1\LOCALS~1\Temp\msohtml1\03\clip_image015.png" o:title=""/> </v:shape><![endif]-->

<!-- [if gte vml 1]><v:shape id="_x0000_i1033" type="#_x0000_t75" style='width:255pt;height:59.25pt'> <v:imagedata src="file:///C:\DOCUME~1\SAPTEC~1\LOCALS~1\Temp\msohtml1\03\clip_image017.png" o:title=""/> </v:shape><![endif]-->

 

<!-- [if gte vml 1]><v:shape id="_x0000_i1034" type="#_x0000_t75" style='width:153pt;height:51pt'> <v:imagedata src="file:///C:\DOCUME~1\SAPTEC~1\LOCALS~1\Temp\msohtml1\03\clip_image019.png" o:title=""/> </v:shape><![endif]-->

<!-- [if gte vml 1]><v:shape id="_x0000_i1035" type="#_x0000_t75" style='width:324pt;height:215.25pt'> <v:imagedata src="file:///C:\DOCUME~1\SAPTEC~1\LOCALS~1\Temp\msohtml1\03\clip_image021.png" o:title=""/> </v:shape><![endif]-->

Runtime Workbench:  

The checking of options ASMA in communication channel allows sender file attributes to be available in RWB as shown in the figure to see them Go to   sxmb_moni à click on the message à Inbound message à SOAP Header à Dynamic Configuration .  

File name and timestamp in SXMB_MONI (Before Modification ) :

<!-- [if gte vml 1]><v:shape id="_x0000_i1036" type="#_x0000_t75" style='width:342pt;height:144.75pt'> <v:imagedata src="file:///C:\DOCUME~1\SAPTEC~1\LOCALS~1\Temp\msohtml1\03\clip_image023.png" o:title=""/> </v:shape><![endif]-->

Go to sxmb_moni à click on the message à Call Adapter à SOAP Header à Dynamic Configuration .

File name in SXMB_MONI (After modification Modification using Dynamic Configuration):

<!-- [if gte vml 1]><v:shape id="_x0000_i1037" type="#_x0000_t75" style='width:425.25pt;height:204.75pt'> <v:imagedata src="file:///C:\DOCUME~1\SAPTEC~1\LOCALS~1\Temp\msohtml1\03\clip_image025.png" o:title=""/> </v:shape><![endif]-->

这篇关于Dynamic File name using ASMA (Adapter Specific Message Attributes) in PI/XI的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/491313

相关文章

Open a folder or workspace... (File -> Open Folder)

问题:vscode Open with Live Server 时 显示Open a folder or workspace... (File -> Open Folder)报错 解决:不可以单独打开文件1.html ; 需要在文件夹里打开 像这样

android java.io.IOException: open failed: ENOENT (No such file or directory)-api23+权限受权

问题描述 在安卓上,清单明明已经受权了读写文件权限,但偏偏就是创建不了目录和文件 调用mkdirs()总是返回false. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/><uses-permission android:name="android.permission.READ_E

bash: arm-linux-gcc: No such file or directory

ubuntu出故障重装了系统,一直用着的gcc使用不了,提示bash: arm-linux-gcc: No such file or directorywhich找到的命令所在的目录 在google上翻了一阵发现此类问题的帖子不多,后来在Freescale的的LTIB环境配置文档中发现有这么一段:     # Packages required for 64-bit Ubuntu

编译linux内核出现 arm-eabi-gcc: error: : No such file or directory

external/e2fsprogs/lib/ext2fs/tdb.c:673:29: warning: comparison between : In function 'max2165_set_params': -。。。。。。。。。。。。。。。。。。 。。。。。。。。。。。。。 。。。。。。。。 host asm: libdvm <= dalvik/vm/mterp/out/Inte

file-max与ulimit的关系与差别

http://zhangxugg-163-com.iteye.com/blog/1108402 http://ilikedo.iteye.com/blog/1554822

瑞芯微Parameter File Format解析

Rockchip android系统平台使用parameter文件来配置一些系统参数 主要包含:串口号:nandflash分区 固件版本,按键信息等; 如下是台电P98HD的parameter参数: FIRMWARE_VER:4.1.1        // 固件版本 //固件版本,打包 updata.img 时会使用到,升级工具会根据这个识别固件版本。 //Boot loader 会读取

超越IP-Adapter!阿里提出UniPortrait,可通过文本定制生成高保真的单人或多人图像。

阿里提出UniPortrait,能根据用户提供的文本描述,快速生成既忠实于原图又能灵活调整的个性化人像,用户甚至可以通过简单的句子来描述多个不同的人物,而不需要一一指定每个人的位置。这种设计大大简化了用户的操作,提升了个性化生成的效率和效果。 UniPortrait以统一的方式定制单 ID 和多 ID 图像,提供高保真身份保存、广泛的面部可编辑性、自由格式的文本描述,并且无需预先确定的布局。

论文精读-Supervised Raw Video Denoising with a Benchmark Dataset on Dynamic Scenes

论文精读-Supervised Raw Video Denoising with a Benchmark Dataset on Dynamic Scenes 优势 1、构建了一个用于监督原始视频去噪的基准数据集。为了多次捕捉瞬间,我们手动为对象s创建运动。在高ISO模式下捕获每一时刻的噪声帧,并通过对多个噪声帧进行平均得到相应的干净帧。 2、有效的原始视频去噪网络(RViDeNet),通过探

使用Azure Devops Pipeline将Docker应用部署到你的Raspberry Pi上

文章目录 1. 添加树莓派到 Agent Pool1.1 添加pool1.2 添加agent 2. 将树莓派添加到 Deployment Pool2.1 添加pool2.2 添加target 3. 添加编译流水线3.1 添加编译命令3.2 配置触发器 4. 添加发布流水线4.1 添加命令行4.2 配置artifact和触发器 5. 完成 1. 添加树莓派到 Agent Pool

error while loading shared libraries: libnuma.so.1: cannot open shared object file:

腾讯云CentOS,安装Mysql时: 1.yum remove libnuma.so.1 2.yum install numactl.x86_64