File to Idoc : Java Mapping
Hi Experts,
The scenario is file to idoc. In the file i'll be getting name,value pairs. For ex:
Structure is
MT
....Root(1..unbounded)
............Name
............Value
File contains:
Vishal....1
Raj.........2
RFC......10
Rahul.....20
Azhar....15 and so on..
I need to loop through the file. When Name="RFC", I need to make an RFC call with Value as it's input. RFC returns 4 values which will be used for mapping.
Then I need to continue looping through the file. On encountering a particular Name, I need to map corresponding Value to target field.
For this, I should have 2 mappings. One to read the file and the other for mapping. I've never used RFC and Java mapping, Can someone provide me a link or a solution for this?
Thanks,
Vishal
Hi,
You can do this using a UDF.
first let the source message contain first line and last line which you want to eliminate.
change the context of the Value to MT ..
start a for loop in UDF ignoring first & last line like
for(int i = 1; i< input.length() - 1; i++) // here i = 1 & not zero & input length is -1 so that first & last field eliminates
//carry on string operation to separate name & value on delimeter space
String name = input<i>.subString(0,.... to the indexOf space);
//similar for value also....
now you have name & value
check for name == 0052
if(name == 0052)
perform rfc lookup
else
Similar Messages
-
ATTRIBUTE_IDOC_METADEATA Error: File to IDOC Java Mapping
I have done a Java Mapping from File to Idoc and I get the following error in sxmb_moni:
<SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
<SAP:Category>XIAdapter</SAP:Category>
<SAP:Code area="IDOC_ADAPTER">ATTRIBUTE_IDOC_METADATA</SAP:Code>
<SAP:P1>I::000</SAP:P1>
<SAP:P2 />
<SAP:P3 />
<SAP:P4 />
<SAP:AdditionalText />
<SAP:ApplicationFaultMessage namespace="" />
<SAP:Stack>Fehler: I::000</SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
The Idoc structure that I generate in my mapping makes no fullfil of the IDOC tags.
For example:
<IDOC BEGIN="1">
<EDI_DC40 SEGMENT="1">
<TABNAM/>
<MANDT/>
<DOCNUM/>
<DOCREL/>
<STATUS/>
<DIRECT/>
<OUTMOD/>
<EXPRSS/>
<TEST/>
<IDCOTYP/>
<CIMTYP/>
<MESTYP/>
<MESCOD/>
<MESFCT/>
<STD/>
<STDVRS/>
<STDMES/>
<SNDPOR/>
<SNDPRT/>
<SNDPFC/>
<SNDPRN/>
<SNDSAD/>
<SNDLAD/>
<RCVPOR/>
<RCVPRT/>
<RCVPFC/>
<RCVPRN/>
<RCVSAD/>
<RCVLAD/>
<CREDAT/>
<CRETIM/>
<REFINT/>
<REFGRP/>
<REFMES/>
<ARCKEY/>
<SERIAL/>
</EDI_DC40>
Should I complete these values in my mapping program?
Which values should I complete?
Thank You.Antonio,
you can ignore whole EDIDC Segement make disabled in our mapping still it works . but the problem is not with this is our meta data chekc in IDX2 t/c code of XI box.
it has some problem the strcuture you generate and R/3 accepts are not same their is mismatch in structure
Regards
Sreeram.G.Reddy
Message was edited by:
Sreeram Reddy -
Hello,
I want to add the time stamp in the file name in JAVA map.
Actually we are directly writing the file on to the file system from Java map and also giving its output to other map.
So we need when we write the file on the file system the file name should be ABC_timestamp.
Can anyone help me how to do this in Java Map.
Thanks and Regards
HemantHi,
>>>Actually we are directly writing the file on to the file system from Java map and also giving its output to other map.
are you sure you want to do this?
this is highly inadvisable as mappings do not support restarts and any error handling
further more what if the mapping will crash but the file will be created?
if you restart the mapping you will get a second file?
I'd recomment not doing anything like that - maybe think about your scenario once more ?
Regards,
Michal Krawczyk -
File to IDOC aggsales mapping doubt Urgnt
Hello,
Im working for a retail client and the requirement is the File to IDOC scenario where Im stuck up in the mapping.
The inbound is a flat file of structure
EDI_DC40
E1WPU01
E1WPU02
E1WPU03
E1WPU04
The target IDOC structure is as follows
WPUUMS01
--IDOC
EDIDC40
E1WPU01
E1WPU02
E1WPU03
E1WPU04
The problem is with the target segment E1WPU03. This E1WPU03 is actually an optional one in the source inbound flatfile.
So the source will be like this
EDI_DC40
E1WPU01
E1WPU02
E1WPU03
E1WPU04
E1WPU02
E1WPU04
E1WPU02
E1WPU03
E1WPU04
So in the target I need to create the 03 segment if and only if it occurs in the source.
I tired these following but didnt work for me.. what happens is The 03 segment which should come in the third 02 segment actually comes int he second one.
any suggestions if this is possible in message mapping or should I go for an xslt
I tried this one.
SourceE1WPU03 >exists> if withoutelse>then "constant'> targetE1WPU03
Thanks
Prasanna> any suggestions if this is possible in message mapping or should I go for an xslt
No, this is not possible with graphical mapping tool.
You need to have a pre-mapping for this.
I recommend Java mapping with SAX parser.
you can easily change the input structure to:
EDI_DC40
-E1WPU01
--E1WPU02
---E1WPU03
E1WPU04
--E1WPU02
E1WPU04
--E1WPU02
---E1WPU03
E1WPU04 -
Accessing a File in a Java Mapping
Hi,
I am accessing one Random Access File through Java Mapping Program. This is working fine in Eclipse.
But when I imported that jar file to IR, it is throwing FileNotFound Exception while trying to test through Interface Mapping.
Actually it is not showing any error message but by research I understood that. Can any one please help me in this regard?
One more thing, I used the same scenario for other interface. It is working fine.
Please help me to chase this mistery.
Thanks,
Yogi.Hi,
I think I am giving relative path only not direct path. I am just mentioning the path from my proj name. I am not specifying any local directories. For your Information, I am mentioning the path like below:
"ProjectName/SomeName/File_Name.txt"
Thanks,
Yogi. -
File to IDOC. Mapping doubts...
Hi XI Gurus..
I'm doing a file to IDOC scenario.. I've a filed called Master Number and Sequence number..
First I've to sort the file based on Master number. based on this sorted file I must sort the sequence numbers.
For example:
0011232 01
0011232 00
0011231 01
0011232 01
0011231 00
after first sort
0011232 01
0011232 00
0011232 01
0011231 01
0011231 00
after second sort
0011231 00
0011231 01
0011232 00
0011232 01
0011232 01
Now in mapping I must create one IDOC for every set of Master number. In the IDOC a segment must repeat for every sequence number.. i.e For 0011231 there must 2 sequence segments i.e 00 and 01, and 0011232 also must have 2 sequence segments i.e 00 and 01hi,
please try the following mapping,
for creating the IDOC based on Message Number
message No-->removecontext->sort>spiltbyvalue(for value change)-->collapscontext---->EDIDD(IDOC TAB).
to create the SEGMENT based on the Sequence number please try the following mapping.
Sequence no-->removecontext---->sortbykey(key as messageNo)
>formatbyexample(first queue is message no and second queue is sequence no)---->splitbyvalue(for each value)-->segment(IDOCsegment).
regards,
navneet -
File to IDOC: mesage mapping
Hi!
I am implementing File to Idoc scenario.
I use in file a element "createdate". The same one does exist on Idoc side and hase type "xsd:string".
Which type should have the element in data type?
a) xsd:string
b) xsd: date
c) it does no matter
Thank you!Hi!
Thank you!
Could you please explain why the option within message mapping "map the same structure..." is inactive in my case?
Is that a bug?
I am on SAP NetWeaver 7.0 SP 14 .
Thank you! -
Reg: File to Idoc Hierarchial mapping
Hi Experts,
We have a scenario of flat file to idoc where in we have 4 segments(01 to 04)(with hierarchies) in source file to be mapped to idoc. We have followed Riaz blog http://www.riyaz.net/blog/xipi-convert-flat-file-to-deeply-nested-xml-structures-using-only-graphical-mapping/.on mapping flat file to deeply nested structures .
We have encountered one unique issue in the intermediate level mapping where, when assigning hte id numbers, the instances of one segment are grouped together. This is creating a problem.
Ex: in source str we have nodes in the order
01
02
03
04
02
03
04 and so on..
After the test of intermediate mapping, it shows teh follw sequence:
01
02
02
03
03
04..
The node seq in the target str should have been similar to that of the source.. but here its not so..
if i am using just one instance of 01 till 04 nodes.. the final xml str is created perfect.. Can any please let me know what could be the possible error??
Or please let me know if there is any other simple procedure to finish this.
Thanks in advance, awaiting your reply..
Best Regards,
GiriHi,
Please go through the following links..
http://wiki.sdn.sap.com/wiki/display/XI/SampleJAVAMappingcodeusingPI7.1+API
http://wiki.sdn.sap.com/wiki/display/XI/UsingPI7.1APIforJavamapping
and also,
http://help.sap.com/saphelp_nwpi71/helpdata/en/bd/c91241c738f423e10000000a155106/content.htm
If u get any doubt u can post the problem....
Babu -
My sender File structure is like this..
MT_Sender
-Recordset 0 to Unbound
--Header 1 to 1
---field1
---field2
---fieldx
--GL_Account 0 to Unbound
---field1
---field2
---fieldx
---Cust_Item 0 to Unbound
field1
field2
fieldx
Curr_Item 0 to Unbound
field1
field2
fieldx
and I am mapping it to Idoc segments..
Here my confusion is for Header segment in Idoc I am mapping Header in my structure ..but it is giving mapping conversion error.
I tried node to node and Recordset to node both are giving error.
Can any one clear it NODE level mapping to IDOC structute.
ACC_document
IDOC
Begin
NODE1
NODE2
NODE3
NODEx
Regards,
Ramesh...Any inputs on it
This info from sxmb_moni
com.sap.aii.utilxi.misc.api.BaseRuntimeException: RuntimeException in Message-Mapping transformation: Cannot produce target element /ACC_DOCUMENT03/IDOC. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd at
com.sap.aii.mappingtool.tf3.AMappingProgram.start(AMappingProgram.java:406) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:142) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMapp.....
SXMB_MONI payload is
<?xml version="1.0" encoding="utf-8" ?>
- <ns:MT_FI_SENDER xmlns:ns="Http://xyz.com">
- <ns:Recordset xmlns:ns="Http://xyz.com">
- <Header>
<USERNAME>OBTE-MM</USERNAME>
<COMP_CODE>2000</COMP_CODE>
<DOC_DATE>20091015</DOC_DATE>
<PSTNG_DATE>20091015</PSTNG_DATE>
<DOC_TYPE>DR</DOC_TYPE>
<REF_DOC_NO_LONG>7578</REF_DOC_NO_LONG>
</Header>
- <GL_account_item>
<ITEMNO_ACC>0000000001</ITEMNO_ACC>
<GL_ACCOUNT>0003101110</GL_ACCOUNT>
<ACCT_TYPE>S</ACCT_TYPE>
<DOC_TYPE>DR</DOC_TYPE>
<COMP_CODE>2000</COMP_CODE>
<FISC_YEAR>2009</FISC_YEAR>
<PROFIT_CTR>0000002002</PROFIT_CTR>
<DE_CRE_IND>H</DE_CRE_IND>
</GL_account_item>
- <Customer_Item>
<ITEMNO_ACC>0000000002</ITEMNO_ACC>
<CUSTOMER>0000000092</CUSTOMER>
<COMP_CODE>2000</COMP_CODE>
</Customer_Item>
- <GL_Currency_Items>
<ITEMNO_ACC>0000000001</ITEMNO_ACC>
<CURR_TYPE>00</CURR_TYPE>
<CURRENCY>INR</CURRENCY>
<AMT_DOCCUR>6000</AMT_DOCCUR>
</GL_Currency_Items>
</ns:Recordset>
</ns:MT_FI_SENDER>
Regards,
Ramesh.
Edited by: Sreeramoju Ramesh on Oct 15, 2009 1:28 PM -
File to idoc HRMD_A06 mapping
Hi,
My scnerio is to map file with an idoc. In my file I hav infotype 14 records. With following file structure.
mesgtype
item
pernr
begda
endda
lgart
betrg
I have taken this simple infotype instead of taking complex one's like actions. once I am through with this thn I will consider other infotypes.
Idoc which I am using is very complicated HRMD_A06. There are many mandatory fieldin the idoc.
Now during mapping I have mapped the above fields of file withe corressponding fields of idoc.
And for For the E1PLOG E1PORIG E1PITYP segments I have provided following data :
Plan Version ( 01 )
Object Type (P- Person),
Object ID (mapped with PERNR ),
Operation (I - Insert Mode)
But when I test the mapping I get the following error:
:39:56 Start of test Mapping object MM_FILE2IDOC incomplete. Unable to continue execution
Structure with min!=max without mapping
16:39:56 End of test
Kindly assist me with this scneario, if possible provide me the proper mapping details.
Regards,
LokeshHi,
TABNAM, DIRECT, IDOCTYPE,CIMTYPE, MESTYPE, SNDPRT,SNDPOR, SNDPRN, RCVPRT,RCVPRN,RCVPOR are all mandatory fields.
Map them with constants according to their type.
Thanks,
Sonalisa -
Flat file to idoc MATMAS05 - mapping
Hi,
I want to create 2 Idocs from one recordset.
Can any one tell me how do I map this Recordset to an Idoc?
Example source and target IDOC structures:
Source:-
<Recordset>
<SA010>
<IDENTS>1234</IDENTS>
<BEZ>Dummytxt</BEZ>
</SA010>
<SA088>
<IDENTS>1234</IDENTS>
<MARC1>010</ MARC1>
<MARC2>020</MARC2>
</SA088>
</Recordset>
Target:-
<MATMAS05>
<IDOC BEGIN="1">
<E1MARAM SEGMENT="1">
<MATNR>1234</MATNR>
<E1MARCM SEGMENT="2">
<WERKS>010</WERKS>
</E1MARCM>
</E1MARAM>
</IDOC>
</MATMAS05>
<MATMAS05>
<IDOC BEGIN="1">
<E1MARAM SEGMENT="1">
<MATNR>1234</MATNR>
<E1MARCM SEGMENT="2">
<WERKS>020</WERKS>
</E1MARCM>
</E1MARAM>
</IDOC>
</MATMAS05>
Thanks and Regards,
ErenHello Varun,
My flat structure:
<Recordset>
<b><SA010></b>
<i><IDENTS>1234</IDENTS>
<BEZ>Dummytxt</BEZ></i>
<b></SA010></b>
<b><SA088></b>
<IDENTS>1234</IDENTS>
<i><MARC1>010<>
<MARC2>020</MARC2></i>
<b></SA088></b>
</Recordset>
The MATNR field is <IDENTS>. I can pick the value from node <SA010> or <SA088>.
Thanks -
Importing jar files for Java mapping ?
Hi Guys,
I am developing a java mapping by using Eclipse. I want to know <b>where can i find the jar files of xi which i need to import into Eclipse to develop the Java Mapping</b>.
I need to use the external jar files for this Java Mapping and once i am done with the mapping, <b>How can import the external .jar files into XI</b>
any hep would be really appreciated
Thanks,
sriniSri,
check <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions's XI FAQ</a> for the location of .jar of mapping API.
<b>5. Where can I find aii_map_api.jar to create my Java mapping?</b>
After you have created your java mapping class, export your project to a .jar file and import this .jar into Imported Archives (under Mapping node) in Integration Repository.
Regards,
Henrique. -
Can any one give me the simple file 2 file scenario with abap and java mapping?
Hi Venugopal,
<u><b>
ABAP Mapping
</b></u>I suggest you also go through these links to know more on ABAP Mapping:
https://websmp101.sap-ag.de/~sapdownload/011000358700003082332004E/HowToABAPMapping.pdf
/people/ravikumar.allampallam/blog/2005/02/10/different-types-of-mapping-in-xi
/people/r.eijpe/blog
ABAP Mapping Vs Java Mapping.
Re: Message Mapping of type ABAP Class not being shown
Re: Performance of mappings (JAVA, XSLT, ABAP)
Refer to following SDN Demo which explains the need and how to do the ABAP mapping.
https://www.sdn.sap.com/irj/sdn/docs?rid=/webcontent/uuid/110ff05d-0501-0010-a19d-958247c9f798#jdi [original link is broken]
This document will help you to create ABAP Mapping.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e3ead790-0201-0010-64bb-9e4d67a466b4
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how%20to%20use%20abap-mapping%20in%20xi%203.0.pdf
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5c46ab90-0201-0010-42bd-9d0302591383
<u><b>
JAVA Mapping</b></u>
These are two article links on Java mapping i hope this will help u:
http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/java%20proxies%20and%20sap%20xi%20-%20the%20inside%20story%2c%20part%201.pdf
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/java%20proxies%20and%20sap%20xi%20-%20the%20inside%20story%2c%20part%20ii.pdf
Also go through these Blogs,
/people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping
/people/michal.krawczyk2/blog/2005/02/25/simple-java-code-in-graphical-mapping--xi
Regards,
Abhy -
How to get Idoc acknowledgment in File to Idoc scenario
Hi All,
Please give suggestions about the below mentioned scenario:
Scenario: FileXI- ECC - Data from File is converted to various IDocs and posted in SAP. (No BPM used)
Problem: Exception Handling > > We want a message back from SAP system telling us that out of 100 IDocs that were sent, n were posted successfully and rest failed along with the error description. How can this be achieved?
Regards,
XIerPls go thruough these links also
Please see the below links
/people/prateek.shah/blog/2005/06/08/introduction-to-idoc-xi-file-scenario-and-complete-walk-through-for-starters
/people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping
/people/pooja.pandey/blog/2005/07/27/idocs-multiple-types-collection-in-bpm
/people/stefan.grube/blog/2006/09/18/collecting-idocs-without-using-bpm
unable to import from SLD
/people/sravya.talanki2/blog/2005/08/17/outbound-idocs--work-around-using-party
/people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping
/people/sravya.talanki2/blog/2005/10/27/idoc146s-not-reaching-xi133-not-posted-in-the-receiver-sap-systems133
/people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change
/people/ravikumar.allampallam/blog/2005/02/23/configuration-steps-required-for-posting-idocsxi
http://help.sap.com/saphelp_nw04s/helpdata/en/6a/e6194119d8f323e10000000a155106/content.htm
idoc settings /people/ravikumar.allampallam/blog/2005/02/23/configuration-steps-required-for-posting-idocsxi
idoc erros - http://help.sap.com/saphelp_nw04s/helpdata/en/6a/e6194119d8f323e10000000a155106/content.htm
/people/saravanakumar.kuppusamy2/blog/2005/01/20/configuration-tips-for-a-business-serviceintegration-process-to-send-back-ale-audit-idoc
<b>IDOC Acknowledgements</b>
R/3 IDOC ->XI-> ORACLE Error Handling
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/903a0abc-e56e-2910-51a8-9dc616df56eb
/people/kannan.kailas/blog/2005/12/07/posting-multiple-idocs-with-acknowledgement
/people/udo.martens/blog/2005/09/30/one-logical-system-name-for-serveral-bpm-acknowledgements
Regards
Abhishek Agrahari -
Hello,
Can any one explain Java mapping when I am sending PO to reciever system? And what are the necessary requirements? And what are the transction codes we will use for this?
Plz...........
Thank youHi,
Java mapping can be used when you have complex mapping structures.
We can do most of the times for our requirements through Graphical mapping.
When the structures are very complex to build you can go for SAX (Simple API for XML) or DOM (Document Object Model) parsers.
Message mapping internally generates DOM parser.
Java Mapping in XI
https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=java+mapping&adv=false&sortby=cm_rnd_rankvalue#
SAP Network Blog: Implementing a Java Mapping in SAP PI
/people/carlosivan.prietorubio/blog/2007/12/21/implementing-a-java-mapping-in-sap-pi
Java Mapping (SAP Library - Partner Connectivity Kit)
http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
SAP Network Blog: XI Java Mapping Helper (DOM)
/people/alessandro.guarneri/blog/2007/03/25/xi-java-mapping-helper-dom
SAP Network Blog: Testing and Debugging Java Mapping
/people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio
Binary Conversion in XI - Java Mapping - Code Gallery - Wiki
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/binary%2bconversion%2bin%2bxi%2b-%2bjava%2bmapping
SAP Network Blog: "JAVA MAPPING", an alternate way of reading a CSV file
/people/rahul.nawale2/blog/2006/07/18/java-mapping-an-alternate-way-of-reading-a-csv-file
Difference in using java,xslt,message mapping
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii
/people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping
/people/amol.joshi2/blog/2006/03/10/think-objects-when-creating-java-mappings
http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/43/09b16006526e72e10000000a422035/frameset.htm
/people/venkataramanan.parameswaran/blog/2006/12/12/java-mapping-to-handle-flat-files-in-sap-xi
Thanks
Swarup
Maybe you are looking for
-
Error in sending mail 2nd time, Where is the fault- Help Please
Hi friends, I had written a program to send mail. Everything is fine, when i send first time. But if I try to send mail 2nd time, It gives the error: Exception in Connect: IOException while sending message Here is the complete code what i had written
-
Doubt In File Content Conversion
HI, I need a help on creating a header line with tab spaces example name <tabspace> NO <tabspace> EMP ID i know the option of using addHeaderLine but in this how to leave the tab spaces between the header fileds. i have tried
-
Slideshows? In Premiere Elements 12?
I used to create slideshows using sound fx, music, and my stillimages (photos)....not video in my iMovie program. Then I burn them to DVD's and can share with others. Is it possible to do that in Adobe Premiere Elements 12? I downloaded the trail ver
-
I have a macbook and want to connect it to a projector with a 15 pin vga. The converter cables I see for sale are "Display port" to VGA. Is a display port a USB plug and is it compatible with a Macbook?
-
Problems reading other wireless network.
Hello everyone, I am writing this message because in the last weeks I have been having a problem with my wireless network on my macbook. Every time that I open the computer it reads another network first and not the one that is mine. My other compute