cancel
Showing results for 
Search instead for 
Did you mean: 

Need XML for loading data into SAP

Former Member
0 Kudos

I need to load data into SAP through a java program using iDoc. I have formed an XML to load Material data into SAP. But when i run the java program an iDoc is created but there is no data in the iDoc and the error displaying is given below.

EDI: Syntax error in IDoc (mandatory segment missing)

EDI: Partner profile not available.

Please guide me whether there is any problem with my XML content or connection or any other factor. In case xml content is wrong please provide me the correct xml.

My XML content is given below.

<MATMAS05>

  <IDOC BEGIN="1">

  <IDOCTYP>MATMAS05</IDOCTYP>

  <MESTYP>MATMAS</MESTYP>

  <EDI_DC40 SEGMENT="1">

  <TABNAM>EDI_DC40</TABNAM>

  <MANDT>800</MANDT>

  <DOCNUM>0000000001108034</DOCNUM>

  <DOCREL>731</DOCREL>

  <STATUS>53</STATUS>

  <DIRECT>2</DIRECT>

  <OUTMOD></OUTMOD>

  <IDOCTYP>MATMAS05</IDOCTYP>

  <MESTYP>MATMAS</MESTYP>

  <SNDPOR>SAPEC3</SNDPOR>

  <SNDPRT>LS</SNDPRT>

  <SNDPRN>ECW_00_800</SNDPRN>

  <RCVPOR>SAPEC3</RCVPOR>

  <RCVPRT>LS</RCVPRT>

  <RCVPRN>ECW_00_800</RCVPRN>

  <CREDAT>20120913</CREDAT>

  <CRETIM>120430</CRETIM>

  <SERIAL>20120913120217</SERIAL>

  </EDI_DC40>

  <E1MARAM SEGMENT="1">

  <MSGFN>018</MSGFN>

  <MATNR>R-B223</MATNR>

  <ERSDA>20020307</ERSDA>

  <ERNAM>BURMANM</ERNAM>

  <LAEDA>20030430</LAEDA>

  <AENAM>TIEMANN</AENAM>

  <PSTAT>KCVEPDALQBG</PSTAT>

  <MTART>HALB</MTART>

  <MBRSH>M</MBRSH>

  <MATKL>001</MATKL>

  <BISMT>IDES-100-200</BISMT>

  <MEINS>PCE</MEINS>

  <BLANZ>000</BLANZ>

  <WRKST>GG-25</WRKST>

  <EKWSL>1</EKWSL>

  <BRGEW>2.500</BRGEW>

  <NTGEW>2.500</NTGEW>

  <GEWEI>KGM</GEWEI>

  <VOLUM>0.000</VOLUM>

  <TRAGR>0001</TRAGR>

  <SPART>01</SPART>

  <WESCH>0.000</WESCH>

  <LAENG>0.000</LAENG>

  <BREIT>0.000</BREIT>

  <HOEHE>0.000</HOEHE>

  <PRDHA>001000010500000100</PRDHA>

  <ERGEW>0.000</ERGEW>

  <ERVOL>0.000</ERVOL>

  <GEWTO>0.0</GEWTO>

  <VOLTO>0.0</VOLTO>

  <FUELG>0</FUELG>

  <STFAK>0</STFAK>

  <MHDRZ>0</MHDRZ>

  <MHDHB>0</MHDHB>

  <MHDLP>0</MHDLP>

  <VPSTA>KCVEPDALQBGZX</VPSTA>

  <MSTDE>00000000</MSTDE>

  <MSTDV>00000000</MSTDV>

  <COMPL>00</COMPL>

  <GEWTO_NEW>0.0</GEWTO_NEW>

  <VOLTO_NEW>0.0</VOLTO_NEW>

  <WRKST_NEW>GG-25</WRKST_NEW>

  </E1MARAM>

  </IDOC>

</MATMAS05>

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

HAL9000
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Rajakumari,

I recommend to use the latest JCo patch level 3.0.13 and Java IDoc Class Library 3.0.12.

In the JIDocLib you will find a method IDocDocument.checkSyntax() which will show you which segment type is missing.

You may also check in the ABAP back-end system manually with using transactions WE30 and/or WE60.

In this case at least mandatory segment type E1MAKTM is missing.

Best regards,

Stefan

Former Member
0 Kudos

Hi Stefan,

        Thanks for your reply. I am using the versions you have mentioned. When i use IDocDocument.checkSyntax(), i am getting the following error.

com.sap.conn.idoc.IDocSyntaxException: (1) IDOC_ERROR_SYNTAX: Missing mandatory field: MessageType (MESTYP)

But in the attached XML content, MESTYP tag is present. I have given MESTYP tag in E1MARAM segment and tested it. But facing the same error.

Please guide me to proceed further.

HAL9000
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Rajakumari,

referring to your posted IDoc-XML the fields IDOCTYP and MESTYP belong to the EDI_DC40 segment and must be moved there.

There are no fields at IDOC level. All fields must be part of a segment, in this case the EDI_DC40 segment which is a special segment representing the IDoc's control record.

With using the com.sap.conn.idoc.IDocXMLProcessor you may also render your IDocDocument object to IDoc-XML and see what's really in there (it is not clear how you have built this IDocDocument object).

Best regards,

Stefan

Former Member
0 Kudos

I have modified the XML as you have advised but still facing the same error.

I have rendered the XML and it is given below.

<?xml version="1.1"?>

<MATMAS05>

<IDOC BEGIN="1">

<EDI_DC40 SEGMENT="1">

<IDOCTYP>MATMAS05</IDOCTYP>

<CREDAT>20150722</CREDAT>

<CRETIM>155038</CRETIM>

</EDI_DC40>

<E1MARAM SEGMENT="1"/>

</IDOC>

</MATMAS05>

Please give me a correct XML content if there is anything wrong with the actual XML. Thanks in advance.

HAL9000
Product and Topic Expert
Product and Topic Expert
0 Kudos

This is a nearly empty MATMAS05 IDoc.

I don't know what you have done for filling your previously posted XML data into it. I have to assume: nothing!

If you need a real life IDoc create it from some ABAP system. Furthermore I already told you where to lookup IDoc definitions and meta data in an ABAP system.

Regarding your XML content I suggest to use the IDocXMLProcessor for parsing it, correcting it and continue from this point with your development.


Former Member
0 Kudos

Thanks for your reply Stefan.

I have modified my java code and iDoc was created for the given material.

But there is a problem in loading it to SAP. The status i am getting is 'iDoc in processing'.

But i am getting the following error.

'Immediate Processing was Canceled

Message no. EA183

Diagnosis

The IDoc is supposed to be immediately transferred to the application for processing.

An error has occurred as described below:

Immediate IDoc inbound processing should occur using the server group ''.

However, using this server group results in the exception communication_failure or system_failure.

The following error message is displayed:

Error when opening an RFC connection (CPIC-CALL: 'ThSAPOCMINIT' : cmRc=20 thRc=497

Procedure

Use report RBDAPP01 to transfer the IDocs to the application.

Procedure for System Administration

Find the detailed error description in the system log and, if possible, eliminate the cause of the error.'

Please anyone guide me further to load the iDoc into SAP.

HAL9000
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Rajakumari,

when I look at your latest question I have to assume that all your Java programming related questions have been solved.

Therefore it would be fair to mark the appropriate answer as being correct and this question to be answered.

Regarding your latest questions this forum does not really fit and you probably won't find the right experts here.

I suggest to ask your ALE/EDI configuration related questions here:

http://scn.sap.com/community/abap/connectivity/content

Best regards,

Stefan

Answers (0)