`
shz2008bj
  • 浏览: 488486 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

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]-->

分享到:
评论

相关推荐

    ASMA实习任务二.ipynb

    ASMA实习任务二.ipynb

    Asma:https的镜像

    Asma是用于Linux的简单Arma 3启动器。 主要目的是提供一个GUI,用于选择启动游戏所用的修改。 此外,可以切换一些常见的游戏选项,在使用之间会记住这些选项。 请注意,Asma可能在macOS上起作用,但这未经测试。 ...

    asms-master.zip_ASMS_asma_asms算法_asms跟踪算法

    标签中的"asma"可能是ASMS的缩写错误,但在这里我们主要关注的是ASMS和其跟踪算法。ASMS跟踪算法的应用不仅仅局限于VOT挑战,还可以广泛应用于监控系统、自动驾驶车辆、无人机等需要实时目标跟踪的领域。 总的来说...

    NJSON是一个Go程序包,它通过JSON Path解组/解码嵌套的JSON-Golang开发

    =`{“ name”:{“ first”:“ Mohamed”,“ last”:“ Shapan”},“ age”: 26,“ friends”:[{“ name”:“ Asma”,“ age”:26},{“ name”:“ Ahmed”,“ age”:25},{“ name”:“ Mahmoud”,...

    论文研究 - 紫苏水提取物的作用

    这项研究的目的是提供科学的证据来证明Schumanniophyton magnificum(ASMa)的茎皮水提物对未成熟雌性Wistar大鼠的性成熟和生育能力的治疗作用。 将40只未成年雌性大鼠随机分为4组,每组10只动物,并以0(蒸馏水),...

    sigmod2011全部论文(3)

    Emerging Trends in the Enterprise Data Analytics: Connecting Hadoop and DB2 Warehouse (Page 1161) Fatma Özcan (IBM Almaden Research Center) David Hoa (Silicon Valley Lab) Kevin S. Beyer (IBM Almaden ...

    华硕AP1710-S5服务器

    其核心亮点在于华硕自行研发的服务器网络管理系统(ASMA+ASWM),这套系统能够实时监控服务器的运行状况,包括系统温度、电压和风扇速度,以确保服务器在最优状态下运行。 华硕AP1710-S5提供了强大的存储能力,配置...

    中国旧衣服网全套模板,完整无错destoon 4.0-utf-8

    压缩包内的文件名可能代表了不同的模板组成部分,如asma_6751可能是一个特定页面的CSS或图片文件,而“中国旧衣服网wl”可能是网站的某个子目录或者特定的页面文件。在实际使用中,用户需要按照一定的结构将这些文件...

    Linux高性能集群-硬件和网络体系结构[收集].pdf

    - **管理节点(Management Node)**:监控集群状态,管理网络和ASMA(Advanced System Manager Adapter),用于接收计算节点报警和SNMP Trap。 - **存储节点(Storage Node)**:存储大量数据,可能需要RAID保护和高速...

    php.zip_zip

    "ASMA"可能是其中一个子文件的缩写,具体用途可能包括类库、数据库脚本、模块名称或者是特定功能的标识。由于信息有限,无法给出更详细的解释,但可以推测这可能是一个关键的组件或者是一段代码的别名。 在开发过程...

    matlab终止以下代码-coco-gbea:包含GBEA套件的COCO平台的实例

    R.Sampaio,Asma Atamna,Konstantinos Varelas,Umut Batu,Duc Manh Nguyen,Filip Matzner,Anne Auger。 比较连续优化器:Github上的numbbo / COCO。 Zenodo,2019年3月。 要开始使用GBEA套件,请参阅 提供了一...

    matlab下运行java代码-coco:数字黑匣子优化基准框架

    R.Sampaio,Asma Atamna,Konstantinos Varelas,Umut Batu,Duc Manh Nguyen,Filip Matzner,Anne Auger。 比较连续优化器:Github上的numbbo / COCO。 Zenodo,2019年3月。 重新实现了原始的Comparing Continous ...

    Quill 是一个 3D QED-PIC 代码,用于模拟电磁辐射和粒子与等离子体的相互作用_C++_代码_下载

    QUILL(I ntense L aser-p L asma 相互作用中的QU antum 效应模拟器)是俄罗斯下诺夫哥罗德应用物理研究所开发的全三维平行粒子细胞 (PIC) 代码。据我们所知,这是第一个使用蒙特卡罗 QED 方法来研究电子-正电子级联...

    汇编工具ASM汇编工具ASM汇编工具ASM汇编工具ASM

    6. **生成目标文件**:汇编完成后,汇编器会生成一个目标文件(Object File),其中包含机器码、符号表和其他元数据,这个文件可以被链接器进一步处理。 7. **宏处理**:某些高级汇编器支持宏,允许程序员定义和...

    对抗样本对生物医学图像分割深度学习模型的影响

    具体来说,我们通过提出自适应分割掩码攻击(ASMA)将这些模型的脆弱性暴露给对抗样本。 这种新颖的算法可以制作有针对性的对抗样本,这些样本具有(1)目标对抗掩码和预测之间的高交叉联合率,以及(2)在大多数...

    TrailBuddies:使用GPS和Kmeans的Windows Phone应用

    TrailBuddies IFI / IAM PLIM项目2015/2016 ##贡献者Dhane Asma: [任务待定] Boussarsar Nizar: [任务待定] Chammam Raed: [任务待定] ##工具与环境Microsoft VisualStudio 2015社区版运行Windows 8.1的HTC 8S...

    Linux高性能集群-硬件和网络体系结构[借鉴].pdf

    - **管理节点(Management Node)**:控制和监控集群的整体状态,运行管理软件,如ASMA,用于系统管理。 - **存储节点(Storage Node)**:存储大量数据,提供高速数据传输,通常配备RAID保护和高性能网络连接。 - **...

    祷告时间「Prayer Times」-crx插件

    该扩展程序的托管服务已更改为其他服务器,以防扩展程序停止工作,请重新安装版本2.2.0:-添加了Abdelrahman来自迪拜的Al-Hindi Athan(感谢Asma Tahir的建议)-对扩展版本2.1.3进行了一些增强:-更新了扩展版本...

Global site tag (gtag.js) - Google Analytics