Message Mapping - Sum of all Element1.Field1 where Element1.Field2 = X
Hi!
Has everyone an idee of how to do the following message mapping ?
My input message is :
E1EDP01
E1EDP26
QUALF = 001
BETRG = 5
E1EDP26
QUALF = 003
BETRG = 3
E1EDP26
QUALF = 002
BETRG = 5
E1EDP26
QUALF = 003
BETRG = 3
I want to get the sum of all E1EDP26.BETRG where E1EDP26.QUALF = "003". There can be more than one E1EDP26 with field QUALF = "003". So expected result is 6.
Thanks in advance,
Laurence
Input structure :
INVOIC02 1.1
IDOC 1.1
E1EDP01 0..999999
E1EDP26 0..20
QUALF 0..1
BETRG 0.11
Output structure :
root 1..1
GoodsDeclaration 1..1
Invoice 0..1
ExchangeRate 0..1
exchangeRate 0..1
currrency 1..1
exchangeDate 0..1
invoiceAmount 0..1
The target field root/GoodsDeclaration/Invoice/invoiceAmount must be mapped with the sum of fields BETRG belonging to nodes E1EDP26 with field QUALF = "003".
Sample :
<INVOIC02>
<IDOC>
<E1EDP01>
<E1EDP26>
<QUALF>001</QUALF>
<BETRG>5</BETRG>
</E1EDP26>
<E1EDP26>
<QUALF>003</QUALF>
<BETRG>1</BETRG>
</E1EDP26>
<E1EDP26>
<QUALF>002</QUALF>
<BETRG>5</BETRG>
</E1EDP26>
<E1EDP26>
<QUALF>003</QUALF>
<BETRG>2</BETRG>
</E1EDP26>
</E1EDP01>
</IDOC>
</INVOIC02>
In this case, target field root/GoodsDeclaration/Invoice/invoiceAmount must have the value 3 :
<root>
<GoodsDeclaration>
<Invoice>
<ExchangeRate>
<exchangeRate/>
<currrency/>
<exchangeDate/>
</ExchangeRate>
<invoiceAmount>3<invoiceAmount>
</Invoice>
</GoodsDeclaration>
</root>
Laurence
Similar Messages
-
Message Mapping - SUM a field per unique combination of 2 other fields?
I'm receiving a proxy with detail records, and I need to create a subtotals file. Here an example:
BEFORE MAPPING
<ROW>
<KOSTL>0000010300</KOSTL>
<POSID>DUMMY</POSID>
<FTE>0.51</FTE>
</ROW>
<ROW>
<KOSTL>0000010400</KOSTL>
<POSID>123</POSID>
<FTE>0.49</FTE>
</ROW>
<ROW>
<KOSTL>0000010400</KOSTL>
<POSID>DUMMY</POSID>
<FTE>0.72</FTE>
</ROW>
<ROW>
<KOSTL>0000010400</KOSTL>
<POSID>123</POSID>
<FTE>0.82</FTE>
</ROW>
<ROW>
<KOSTL>0000010300</KOSTL>
<POSID>DUMMY</POSID>
<FTE>0.18</FTE>
</ROW>
AFTER MAPPING:
<ROW>
<KOSTL>0000010300</KOSTL>
<POSID>DUMMY</POSID>
<FTE>0.59</FTE>
</ROW>
<ROW>
<KOSTL>0000010400</KOSTL>
<POSID>123</POSID>
<FTE>1.31</FTE>
</ROW>
<ROW>
<KOSTL>0000010400</KOSTL>
<POSID>DUMMY</POSID>
<FTE>0.72</FTE>
</ROW>
How do I create a new record for all unquie combinations of KOSTL and POSID? And total the FTE field for each line? Can this be done in a message mapping?Hello,
How do I create a new record for all unquie combinations of KOSTL and POSID? And total the FTE field for each line? Can this be done in a message mapping?
Yes, very much possible with or without UDF. See sample mapping below without using UDF:
For ROW:
KOSTL(set context to row) -> concat: -> sort: case insensitive ascending -> splitByValue:valueChanged -> collapseContext -> ROW
POSID(set context to row) -> /
For KOSTL:
KOSTL(set context to row) -> concat: ----------------> sortByKey: case insensitive ascending -> formatByExample -> collapseContext -> splitByValue:eachValue -> KOSTL
POSID(set context to row) -> / KOSTL(set context to row) ->/ /
KOSTL(set context to row) -> concat: -> sort: case insensitive ascending -> splitByValue:valueChanged -> /
POSID(set context to row) -> /
For POSID:
KOSTL(set context to row) -> concat: ----------------> sortByKey: case insensitive ascending -> formatByExample -> collapseContext -> splitByValue:eachValue -> POSID
POSID(set context to row) -> / POSID(set context to row) ->/ /
KOSTL(set context to row) -> concat: -> sort: case insensitive ascending -> splitByValue:valueChanged -> /
POSID(set context to row) -> /
For FTE:
KOSTL(set context to row) -> concat: ----------------> sortByKey: case insensitive ascending -> formatByExample -> sum -> splitByValue:eachValue -> FTE
POSID(set context to row) -> / FTE(set context to row) ->/ /
KOSTL(set context to row) -> concat: -> sort: case insensitive ascending -> splitByValue:valueChanged -> /
POSID(set context to row) -> /
Hope this helps,
Mark -
Message mapping response error
Hi..All,
i am doing RFC-SOAP scenario, in request message mapping i am giving the values at sender side executed, i am getting the fields at target side, in resonse message mapping giving the all fields at sender side,i executed , but in target side not getting any fields, pls suggest me.
****for helpful answers i will give points***********
thanks in advance,
PasiHi
when you do the RFC to SOAP scenario then you have to craete the two message mapping
one mapping will be b/w both the request messages
and other mapping will be b/w the response messages.
in the interface mapping you select the request message mapping in the request tab and response message mapping in the response tab.
both the message interfaces outbound as well as inbound interface of the synchronous type.
if u still face the problem please reply me back
Thanks
Rinku -
Changing datatype, afterwards Message-Mapping cannot produce target element
Hi,
we use PI/700.
I changed a working system by changing a datatype of an existing message (adding a new element). My interface mapping contains two mappings: an XSL-Mapping and afterwards a Message-Mapping.
My interface mapping looks like this:
Message-Type A ->
XSL-Mapping ->
Message-Type B ->
Message-Mapping ->
Message-Type B
When I test each mapping alone everything works fine (with the new element I added).
But if I test my interface mapping in IBD with both mappings together, I'll get an error:
"Cannot produce target element /MT_EDM_OUTBOUND_LASTGANG_TO_SAP/LASTGANG/MASSEINHEIT. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd".
Is it possible that XI has problems in refreshing the XSDs?
I tried this:
(1) I changed my Message-Mapping and now all elements are mapped 1:1 -> no success!
(2) Later I changed my Message-Mapping and build in "exists" with "if" to check whether the element "MASSEINHEIT" is generated by the XSL-Mapping -> It doesn't exists (??? - WHY? - when I test it, everything works fine)
(2) Afterwards I changed my interface mapping and take only the XSL-Mapping (without the following Message-Mapping) -> the element "MASSEINHEIT" exists now!
I'm totally confused!
Any ideas?
Regards
Wolfgang HummelHi,
If you have made structural changes to the data type..such as number of fields have decreased/increased..or some new fld altogether, then you have to activate the datatype..goto message mapping and then re-do the mapping...but if you have made "typo" changes like names have been changed, etc..then i think it should be alrite..i have sometimes made changes to my datatype, but after activating it, i had to redo the mapping..that was it!...the rest would fall into place:) No changes had to be made in the interface mapping..
Regards,
Sushumna -
Delete all the entries in target table when message mapping?
Hello Gurus,
I have a requirement in the project. When I do message mapping, I need to delete all the entries in the target table and then insert the new rows. From searching the old posts, I know it is possible without BPM. Can anyone please help me out? I really appreciated it.
Regards,
BaiHi Bai,
Check the below links:
http://help.sap.com/saphelp_nwpi711/helpdata/en/43/9519abb1146353e10000000a11466f/frameset.htm
Defining a DELETE Statement
http://help.sap.com/saphelp_nwpi711/helpdata/en/44/7b6e85fde93673e10000000a114a6b/content.htm
Thanks, -
My Droid Maxx deleted all my text messages by itself. I had all of them, got a phone call, and when I got off the call, all my texts where gone. Is there a way I can get them all back? I had a lot and some where really important to me. I turned the phone off and on again thinking that would bring them back because of some glitch but it didn't help. Does anyone know of a way to bring them all back?
It's very possible to get your messages back. Verizon Messages (app) from the Play Store has options both to restore and back up your messages. They can be downloaded as a file and saved on the device or SD card. By pulling the menu out from the left side and choosing "Restore Conversations", you can (hopefully) restore your lost messages but it says for 90 days. I hope this doesn't reach you too late.
-
Regarding Message Mapping in JDBC Scenario
Hello Experts,
I got struct up in message mapping. In message mapping we can able to see different types of Functions. So I need some clarifications on it. Functions are available like...
Conversions
Boolean
Node Functions
Constants
Date
Text
Static
Arithmetic
So please explain in simple for each functions.
Points will be rewarded.
Thank youHi
*Boolean*:-
And -- checks for 2condition, return a true value if both condition are satisfied
Or --checks for 2condition, return a true value if one condition is true.
Not - checks if the condition is not equal to.
Equals - Check whether 2 Boolean values are equal
NotEquals
If u2013 Returns second value if the first argument is true. otherwise returns third argument
If WithoutElse u2013 Returns value of second argument, if first argument is true.
Node Functions:-
createIf - Produces empty value if argument is true; Resultlist.SUPPRESS otherwise
removeContexts u2013 Produces plain stream of values with No context changes
replaceValue u2013 replaces value of source field to value specified in Function Properties.
Exists u2013 Returns true, if Node exists otherwise false
SplitByValue u2013 inserts context changes after event specified
collapseContexts u2013 Produces one empty string value out of each arguments context. All arguments are in one context
useOneAsMany u2013 Use First Argument as IS on same level as third argument. second argument defines when next value of first argument is used
sort u2013 sorts values in each context
sortByKey u2013 Sorts values in second queue by keys from first queue
mapwithDefault u2013 Inserts default values specified in the function properties into empty contexts
formatByExample u2013 Takes values from the first queue and inserts them in the structure of second queue.
Constants:-
Constant u2013 Generates constant value
CopyValue u2013 Takes specified value in argument stream and copies it an infinite number of times
Sender u2013 Sender System
Receiver u2013 Receiver System
Date:-
CurrentDate u2013 Return current date in specified format
DateTrans u2013 Transforms date from input format to output format
Dateafter u2013 Returns True if first date is after second otherwise false
DAteBefore - Returns True if first date is before second otherwise false
CompareDates u2013 Compares two dates
Text:-
Substring u2013 Returns substring depending upon the given parameters
Concat u2013 concatenates 2 strings inserting delimiter string parameter between them
Equals u2013 Check whether Strings are equal
indexOf2 u2013 returns the index where the second string is found for the first time in the first string
indexOf3 u2013 As with indexOf with 2 parameters, But starting search at the specified position
lastindexOf2 u2013 Returns the index where the second string is found for the last time in the first string
lastIndexOf3 u2013 As with lastIndexOf with 2 parameters starting search at the specified position
compare u2013 compares 2 strings lexicographically
replaceString u2013 Replaces each occurrence of pattern(2nd argument ) of source string(1st arg). By third string
length u2013 returns length of string
endsWith u2013 Tests whether string ends with specified suffix
startsWith2 u2013 Tests whether string starts with specified prefix
startsWith3 u2013 Tests whether string starts with specified prefix beginning at specified location
toUpperCase u2013 Converts all characters in string to upper case
trim u2013 Removes white space from both ends of string
toLowerCase u2013 Converts all characters in String to Lower case
Statistic:-
sum u2013 calculates sum of all numbers in each context
average u2013 calculates the average of all numbers in each context
count u2013 Counts number of values in each context
Index u2013 For each incoming value, this Function returns the index number of the incoming value in the context, String from the initial index and increasing by the increment defined in the parameters.
Arithmetic:-
Add u2013 add two values
Subtract u2013 subtracts second value from the first value
equalsA u2013 Returns true; If float numbers represented by argument strings are equal otherwise returns false
abs u2013 returns Absolute value of argument
sqrt u2013 Returns square root of the number
sqr u2013 Returns square of the number
sign u2013 Returns -1 if number is negative, +1 if positive, 0 if 0
neg u2013 Multiplies number to -1
1/x u2013 calculates 1/x
Power u2013 Returns value of the first argument to the power of the second argument
Less u2013 Returns true if the first number is less than the second number otherwise false
Greater - Returns true if the first number is greater than the second number otherwise false
Multiply u2013 Multiplies 2 values
Divide u2013 Divides first value by the second value
Max u2013 Returns maximum of 2 numbers
Min u2013 Returns Minimum of the 2 numbers
Ceil u2013 Returns the smallest (closest to the negative infinity) initial value that is not less than the argument and it is equal to the mathematical integer.
Floor - Returns the largest (closest to the negative infinity) initial value that is not Greater than the argument and it is equal to the mathematical integer.
Round u2013 Returns closest initial value to the argument
Counter u2013 Counts number of invocations. Initial value and increment defined by Parameters.
FormatNum u2013 Formats Number with given pattern.
Conversions:-
FixValues u2013 Creates a Local Table to perform a value Mapping
ValueMapping u2013 Define jump to Value Mapping table of Integration Directory.
Message Mapping(Node Function) Part-1
Message Mapping Simplified - Part I
Sravaya Talanki- Message Mapping(Node Function) Part-2
/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
Standard Functions
http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/frameset.htm
Advanced mapping function(mapwithdefault,formatbyexample,sort,sortbykey)
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9202d890-0201-0010-1588-adb5e89a6638
Hope this is useful
Saiyog
Edited by: Saiyog Gonsalves on Jul 11, 2008 1:14 PM -
Run Time Message Mapping error
Hello Experts,
I am working on JDBC to IDOC scenario. I am getting mapping error at SXMB_MONI and the error message is as below:
com.sap.aii.mappingtool.tf7.IllegalInstanceException: Cannot create target element /ZABCD01. Values missing in queue context. Target XSD requires a value for this element, but the target-field mapping does not create one. Check whether the XML instance is valid for the source XSD, and whether the target-field mapping fulfils the requirement of the target XSD at and so on.....
I tested in Message Mapping by entering the values and I am able to see the target structure with out any Mapping errors..
But when JDBC real time it got Runtime mapping error as above:
Source
tablename.Set -
1.1
row--
0.Unbound
a----
0.1
b----
0.1
Target
ZABCD01-----1.1
IDOC--
1.1
-Begin-----Required
XYZ--
0.1
a----
0.1
b----
0.1
Dont know where is the problem is: I tried with payload its giving the same error as runtime....
Payload looks as :
<?xml version="1.0" encoding="utf-8" ?>
- <set>
- <row>
<a>value</a>
<b>value</b>
</row>
</set>
Can any one faced same issue?
Thanks
RajeevHI Satish,
I created a new Datatype and tested wtih payload still the same..I am unable to create target node as IDOC segment is 0..unbound and below all fields are not not creating stilll they are mapped to source fileds.. what would be the reason?
IDOC structure is:
ZIDOC........................1....1
...IDOC........................1....1
.....BEGIN.....................Requied (I disabled this filed)
.....SEGMENT1.............1....1
.....SEGMENT2..............0...1
.........SUBSEGMENT1...0...99
..............FIELD1.............0....1
..............FIELD2..............0...1
..............FIELD3..............0...1
..........SUBSEGMENT2....0...1
..............FIELD4..............0...1
..............FIELD5..............0...1
JDBC strucute is
MT_XYZ
....set.................1...1
.....row...............0...unbound
......field1............0...1
......field2............0...1
......field3............0...1
......field4............0...1
I am not mapping all fields to respective fileds of source to target ...if I dont map ZIDOC and IDOC then mapping executing successful but I am not getting SUBSEGMENT1 and SUBSEGMENT2 with there fields values..
If I do test by entering values manually it populate all fields values with subsegments but when i copy the payload from SXMB_MONI then I am getting error and If I remove target node mappings I am unable to get subsegment and fileds populated..
How can I make FIELDS of IDOC to get populated??
Thanks
Rajeev
Edited by: rajeev raj on Aug 25, 2009 9:26 PM -
I got the following dump, when I executed the Message Mapping. Eventhough I have fixed the problem, I am not quite sure to read the dump, i.e by reading the dump I was not sure which FIELD has caused the Dump. could some one help me , how I can read a Dump and Pin point the Field that has caused the error. Thanks Friends.
Dump
Messages:
Exception:[java.lang.IllegalArgumentException: Cannot cast sUpPresSeD to float. ] in class com.sap.aii.mappingtool.flib3.Stat method sum[com.sap.aii.mappingtool.flib3.Plainer@2c2f6468]
com.sap.aii.utilxi.misc.api.BaseRuntimeException: Exception:[java.lang.IllegalArgumentException: Cannot cast sUpPresSeD to float. ] in class com.sap.aii.mappingtool.flib3.Stat method sum[com.sap.aii.mappingtool.flib3.Plainer@2c2f6468]
at com.sap.aii.mappingtool.tf3.rt.C2CFunctionWrapper.cacheContext(C2CFunctionWrapper.java:95)
at com.sap.aii.mappingtool.tf3.rt.C2CFunctionWrapper.gotoNextContext(C2CFunctionWrapper.java:45)
at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java(Compiled Code))
at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java(Compiled Code))
at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java(Compiled Code))
at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java(Compiled Code))
at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java(Compiled Code))
at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java(Compiled Code))
at com.sap.aii.mappingtool.tf3.AMappingProgram.start(AMappingProgram.java:287)
at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:63)
at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:232)
at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInternal(ServerMapService.java:432)
at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:170)
at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.execute(MapServiceBean.java:52)
at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0.execute(MapServiceRemoteObjectImpl0.java:259)
at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0p4_Skel.dispatch(MapServiceRemoteObjectImpl0p4_Skel.java:146)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java(Compiled Code))
at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java(Inlined Compiled Code))
at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java(Compiled Code))
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java(Compiled Code))
at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java(Compiled Code))
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java(Compiled Code))
at java.security.AccessController.doPrivileged1(Native Method)
at java.security.AccessController.doPrivileged(AccessController.java(Compiled Code))
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java(Compiled Code))
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java(Compiled Code))Karen,
I don't think these dumps are going to ever give you your answers directly. It's a good start. All you know from here is that the sum function broke. Where? Which one? Who knows? What I would do is go into SXMB_MONI and copy the data that was sent and broke this mapping. Then I would copy into the Integration Repository Message Mapping. I would click on the test tab in my Message Mapping and put the data in that I copied from SXMB_MONI and execute. I should get the same error. Then I would by process of elimination change the data in each of the mappings that use the sum function until I found the problem. XI tries to give smart messages, but sometimes you have to dig for your answers.
Hope that gives you at least one method of debugging.
- Emmett -
Message Mapping activation error-Source code has syntax errors in UDF
Hi all,
I wrote a small UDF for sum of 2 numbers:
import
udf.*
public String getsum(String a, String b, Container container) throws StreamTransformationException{
int c = Integer.parseInt(a);
int d = Integer.parseInt(b);
int e = packageDemo.getSum(c,d);
return e+"";}
In imported archives, i imported pack.jar
In D:\udf , I have packageDemo.java, packageDemo.class, aii_map_api.jar, pack.jar(has the other 3)
packageDemo.java :-
package udf;
public class packageDemo{
public static int getSum(int a,int b)
int c= a+b;
return c;
Did i miss anything?? Icant activate message mapping for 2 errors:-
1.package udf does not exist
2.Function getsum, Line 3:
cannot find symbol symbol : variable packageDemo location: class com.sap.xi.tf._xml_mm_int e = packageDemo.getSum(c,d); ^Note: /usr/sap/P7R/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapd4214d3099dc11dd9470001d090e4bbe/source/com/sap/xi/tf/_xml_mm_.java uses or overrides a deprecated API.Note: Recompile with -Xlint:deprecation for details.Note: /usr/sap/P7R/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapd4214d3099dc11dd9470001d090e4bbe/source/com/sap/xi/tf/_xml_mm_.java uses unchecked or unsafe operations.Note: Recompile with -Xlint:unchecked for details.2 errors
Edited by: NagaDurga Nannapaneni on Oct 16, 2008 1:07 PMHi ,
Think the error is coming because the content in imported archive is not being taken into message mapping at all...so package, class, method ..nothing is identified.
Can anyone suggest the solution..
Thanks,
Durga -
Report - to show sum of all the fields in a table
Hi,
I have a requirement that for a particular materil ex: SALT i should show the sum of qunatity i.e TMENGE , LMENGE, MMENGE.
for a particular material there is a condition on bais of which the values will be divided.
IF IT_PROD2-BWART = '103','104','
IT_PROD2-MENE GOES TO TMENGE,
SIMILARLY FOR 201','202','261','262',
IT_PORD2-MENGE GOES TO LMENGE
FOR IT-PROD2-BWART = 551','562'
IT_PROD2-MENGE GOES TO MMENGE.
So i should insert sum of all the qunatiy lmege, tmenge, mmenge into it_prod3 and display it.
i should disply only single reocrd for a particular material.
but i am getting all the reocrods for mutiple dates i.e for date 2007.05.01 i am getting 10 records for SALT and for date 2007.05.02 again different records whre single date is repeating and materil is repating and so on i want only single material and all the values should be sum.
below is my code.
SELECT werks_i AS werks
SUM( menge_i ) AS menge
matnr_i AS matnr
budat bwart_i AS bwart
FROM wb2_v_mkpf_mseg2
INTO CORRESPONDING FIELDS OF TABLE it_prod2
WHERE budat IN s_budat
AND matnr_i IN ('PULPIMPORT','PULPLOCAL','SULPHUR','ZINC',
'ZINCOXIDE','CHARCOAL','SALT','LIGNITE','STEAMCOALLCV','STEAMCOALHCV',
'LDO','FURNACEOIL')
AND bwart_i IN ('103','104','201','202','261','262','551',
'552')
GROUP BY werks_i menge_i matnr_i budat bwart_i.
SORT it_prod2 BY budat matnr.
date1 = s_budat-low.
date2 = s_budat-high.
WHILE date1 LE date2.
it_totstk1-month1 = date1.
date1 = date1 + 1.
APPEND it_totstk1.
ENDWHILE.
sort it_prod2 by matnr budat.
LOOP AT it_totstk1.
LOOP AT it_prod2. " WHERE budat EQ it_totstk1-month1.
tdat = it_prod2-budat.
if ( it_prod2-matnr = 'PULPIMPORT' OR it_prod2-matnr = 'PULPLOCAL') .
elseif ( it_prod2-matnr ='STEAMCOALLCV' OR it_prod2-matnr =
'STEAMCOALHCV' ).
tmatnr = 'STEAM COAL HCV'.
else. tmatnr = it_prod2-matnr.
endif.
IF it_prod2-bwart EQ '103'.
tmenge = tmenge + it_prod2-menge.
ELSEIF it_prod2-bwart EQ '104'.
tmenge = tmenge - it_prod2-menge.
ELSEIF it_prod2-bwart EQ '201'.
Lmenge = Lmenge + it_prod2-menge.
ELSEIF it_prod2-bwart EQ '202'.
Lmenge = Lmenge - it_prod2-menge.
ELSEIF it_prod2-bwart EQ '261'.
Lmenge = Lmenge + it_prod2-menge.
ELSEIF it_prod2-bwart EQ '262'.
Lmenge = Lmenge - it_prod2-menge.
ELSEIF it_prod2-bwart EQ '551'.
Mmenge = Mmenge + it_prod2-menge.
ELSEIF it_prod2-bwart EQ '552'.
Mmenge = Mmenge - it_prod2-menge.
ENDIF.
ENDLOOP.
it_prod3-budat = tdat.
it_prod3-matnr = tmatnr.
it_prod3-tmenge = tmenge.
it_prod3-lmenge = lmenge.
it_prod3-mmenge = mmenge.
APPEND it_prod3.
CLEAR : tmenge,tdat,tmatnr,lmenge, mmenge.
ENDLOOP.
<b>points will be rewarded</b>
Thanks & Regards,
Sunil kumar.data: sumf type i.
select sum( kbetr ) from konv into sumf where kinak <> 'A' group by konv.
write: sumf.
Message was edited by:
Ramu -
Creation of CDATA with message mapping
Hello all,
Is everyone absolutely sure that a cdata string cannot be created in the middle of an xml file using message mapping?
I have tried doing the XSL map in other blogs I even tried writing a whole XSL map in xml spy - yet xi complains about not finding this class file and that class file. I'm having a hard time believing that this is so hard to do in XI - especially when Microsoft web service implementation seem to long for data crammed into a string ( in my experience ).
Any help is GREATLY appreciated.
Thank you!!!
ScottHi Scott,
Pls follow the following steps to insert XML string into a single element:
Create a xsl file with the following data:
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <i><b>NSpace</b></i>>
<xsl:template match="/">
<namespace:name1>
<xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[]]></xsl:text><xsl:copy-of select="<b>//namespace:name</b>"/><xsl:text disable-output-escaping="yes"><![CDATA[]]]]></xsl:text><xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>
</namespace:name1>
</xsl:template>
</xsl:stylesheet>
In the above code I have removed xmlns:p2="http://frik.bcc.com.pl" which is not needed.
Also you have to put '<b>//</b>' before the target element from where you want to start creating XML string over here it is <b>name</b>. And <b>name1</b> is the element you want to store the XML string in.
So anything in the element <b>name</b> will be stored in <b>name1</b>
Regarding the <b>namespace:</b> To find out the namespace test your message mapping between the source and the target without adding XSLT mapping. After testing click on <b>'SCR'</b> tab present on top of the target window. There you will see <b>ns1: or ns2:</b> attached to each element. Replace <b>namespace</b> in the above code with <b>ns1: or ns2:</b>. And replace <b>NSpace</b> in the above XSL Header with the namespace in the SCR of test map.
So the final XSL file will look like that:
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <i><b>xmlns:ns1="http://sap.com/xi/HR"</b></i>>
<xsl:template match="/">
<<b>ns1:</b>name1>
<xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[]]></xsl:text><xsl:copy-of select="<b>//ns1:name</b>"/><xsl:text disable-output-escaping="yes"><![CDATA[]]]]></xsl:text><xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>
</<b>ns1:</b>name1>
</xsl:template>
</xsl:stylesheet>
Dont forget to put '//' before the target element.
This should work. Or pls put the source and target xml struct and we will assist you further.
Regards,
Ashish -
File-name not being fetched in a multi-message mapping by Dynamic Conf
In a scenario, i have a BPM which has a transformation step which contains a mutimapping ...means 2 messages mapped to 1 messgaes, here in the mapping i m using an UDF and written code to extract the file name from dynamic configuration.....
the problem is ...the same BPM contains another transformation step which contains a message mapping (which is not multi mapping), and here the code (UDF) works to fetch the file name...
the code is all correct....and it looks like
DynamicConfiguration conf = (DynamicConfiguration)
container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String sourceFileName = conf.get(key);
if (sourceFileName == null ){
sourceFileName = "ErrorFile.xml";}
return sourceFileName;Hi,
The scenario I am trying to test is a multi mapping scenario where I am trying to split one source message and create two target messages by using two different receiver interfaces, one for each message.
I am on PI 7.1 and when I test message mapping and operation mapping using the payload from SXMB_MONI, it is successful. Whereas when I test the scenario end to end I am getting the following error messages:
Operation Mapping
Employee_Out_SI_To_Employee1_In_SI_AND_Employee2_In_SI_OM
Name
Employee_Out_SI_To_Employee1_In_SI_AND_Employee2_In_SI_OM
Namespace
http://accenture.com/1:N_multi-mapping
Runtime error
Split mapping created no messages
Start tag ns0:Messages Add raw attribute xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge" Start tag ns0:Message1 Close tag ns0:Message1 Start tag ns0:Message2 Close tag ns0:Message2 Close tag ns0:Messages
Could someone please help
Cheers,
S -
Message mapping in sap pi 7.3
Hi all,
I am using SAP PI 7.3. In ESR, I have declared one source data type & message type and one target data type & message type. I have also completed message mapping. But in message mapping, If I do right click on the target message type, I am getting one option "Add variable" in the context.
Can anyone tell me what is the use of it?
Thanks & Regards,
MoumitaHi Moumita
This is mainly used to store some values in it and then use it later in the same mapping.
For example suppose there is a field which contains amount and it occurs in many times in the source structure.
So we can populate the sum of all this fields into this variable and later used that for populating any target field.
Another example is suppose we want to make an RFC look up in PI to store some data in ECC tables.
In that also we map the RFC look up function to this variable.
This variable will be not present in the map output.
Check this
SAP PI 7.1 Mapping Enhancements Series: Using Graphical Variable -
How to find length of integer elements using message mapping
Hi all,
How can I find the number of digits in an element using message mapping
XIerSatish,
Cause I have to write the code for 100 elements, I have decided to have a AUDF with two inputs;
1) for the element
2) for the length of the data type (I am passing length using Constant message mapping func).
Now when I change my UDF and try running it I get the following error:
<b><i>Start of test
Source code has syntax error: /usr/sap/B06/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map0999e66045cf11dcc83b4ebcfc11da82/source/com/sap/xi/tf/_MM_Recordcount1_.java:160: operator >= cannot be applied to int,java.lang.String if(Element_Name.length()>=Element_Length) ^ /usr/sap/B06/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map0999e66045cf11dcc83b4ebcfc11da82/source/com/sap/xi/tf/_MM_Recordcount1_.java:166: operator <= cannot be applied to int,java.lang.String for(int i=Element_Name.length();i<=Element_Length;i++) ^ 2 errors</i></b>
The code I have used is:
public String Include_Space(String Element_Name,String Element_Length,Container container)
{StringBuffer sb= new StringBuffer();
if(Element_Name.length()>=Element_Length)
return""Element_Name"";
else
for(int i=Element_Name.length();i<=Element_Length;i++)
if(i==Element_Name.length())
sb.append(Element_Name);
else
sb.append(" ");
return ""sb.toString()"";
Pls advice, where I am going wrong...
XIer
Message was edited by:
XIer
Maybe you are looking for
-
My MacBook Pro 17" was stolen on Feb. 22, 2012: Model # A***9; Serial #W8*******94 How do I flag this computer with you in case someone tries to bring it in for service? Thanks, Morris <Serial Edited by Host>
-
Hi, friends! In jdbc adapter, After i saved a communication channel and activated. In configuration it showing status as active, but in rwb in adapter monitoring it showing status as inactive(gray colour), please tell me can i change it into green c
-
Deal All, i am using field symbol here,while trying to assign the character value into field smybol. It is generating the error.cannot be converted into number ..so wht should be the type of the field symbol. field-symbol : <RATING> TYPE ANY. CONC
-
Why aren't my "File Types" accessible to all users? TS Win2k8R2
I am an Admin on a Windows 2008 R2 server, with Terminal Services installed. I want to have particular file associations created / active, so that any user who attempts to open particular files on this server users certain applications. I opened Cont
-
Why does my page look funny in IE?
My pages look fine in Safari and Firefox, but when I open them in Internet Explorer, there are these large white rectangular shapes that are semi-transparent at the top of my page. Can any one help figure this out? My site isn't finished by any means