Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member181955
Contributor
0 Kudos


*Executing Multiple Mapping Programs*

We know the feature of interface mapping which can execute multiple mapping programs consecutively. This blog talks about the execution of multiple mapping programs in interface mapping. When you find the complexity in mapping, with help of this feature we can divide up the mapping into multiple mapping programs. +Could be helpful for beginners+. Example: AMR (Automated Meter Reading) to SAP-ISU (Industry Solution utilities). AMR generates fixed length files in FTP server from there PI should pick the files and converts into BAPI calls. +AMR Fixed Length text file should be converted into BAPI XML.

+ *Possible ways:*

1. This can be done with java mapping without FCC.

2. With FCC can be done (Single message mapping) *

3. Multiple Mapping programs* (Java mapping and message mapping without FCC) *Multiple mappings in one interface mapping:* There are two mapping programs are taken as mentioned below, these are executed in the order of top to bottom. 1.Java mapping which takes fixed length source files and generates source xml file (MT_AMR_Source). 2.Message mapping, it takes the source xml file (MT_AMR_Source) generated by Java mapping, as input, and generates BAPI xml file. 1. Java Mapping: /**  * *@author* PNemalikanti */

*import* java.io.BufferedReader;

*import* java.io.InputStream;

*import* java.io.InputStreamReader;

*import* java.io.OutputStream;

*import* java.util.Map;

*import* com.sap.aii.mapping.api.*;

*public* *class* AMR *implements* StreamTransformation { *private* Map param; *public* *void* setParameter(Map param)

{ *this*.param = param;             }

*public* *void* execute(InputStream in ,OutputStream out)

{

*try*                  String inLine=*null*;

BufferedReader bin = *new* BufferedReader(*new* InputStreamReader(in));

*while*((inLine = bin.readLine())!=*null*)

{                     String profileNo=*null*;

String fromDate=*null*;

String fromTime=*null*;

String fromOffset=*null*;

String toDate=*null*;

String toTime=*null*;

String toOffset=*null*;

String profileVal=*null*;

String status=*null*;

String unit=*null*;"+profileNo+""+fromDate+""+fromTime+""+fromOffset+""+toDate+""+toTime+""+toOffset+""+profileVal+""+status+""+unit+"").getBytes());                     out.write("".getBytes());

}

out.write("".getBytes());

}

*catch* (Throwable e)

{               }             } }

*+Note:+* Java mapping gives input source xml file to message mapping. 2. Message Mapping:(Generates BAPI XML ) "

Interface Mapping: +Java Mapping and Message Mapping are registered here.+

" *

source fixed lenth file

B

API XML:*

  • SAP Managed Tags: