Skip to Content
0
Jan 05, 2006 at 05:03 PM

Advanced User Function

21 Views

Hi all,

I am new to XI and Java and hope that some can help me with the following problem:

I need to map two structures. One is a RFC function

module with two tables

material     (contains material data (key is matnr))
materialtext (material texts in more than one language (key is matnr textid language and line))

Source structure:

<E_MATERIAL>
      <item>
         <MANDT>201</MANDT>
         <MATNR>4711</MATNR>
         <ERSDA>01.01.2006</ERSDA>
		...
      </item>
      <item>
         <MANDT>201</MANDT>
         <MATNR>4712</MATNR>
         <ERSDA>02.01.2006</ERSDA>
		...
      </item>
</E_MATERIAL>
<E_MATERIALTEXT>
      <item>
         <MANDT>201</MANDT>
         <MATNR>4711</MATNR>
         <SPRAS>EN</SPRAS>
         <TDID>MVKE</TDID>
         <LINE>1</LINE>
         <TDLINE>textline 1</TDLINE>
      </item>
      <item>
         <MANDT>201</MANDT>
         <MATNR>4711</MATNR>
         <SPRAS>EN</SPRAS>
         <TDID>MVKE</TDID>
         <LINE>2</LINE>
         <TDLINE>textline 2</TDLINE>
      </item>
      <item>
         <MANDT>201</MANDT>
         <MATNR>4711</MATNR>
         <SPRAS>DE</SPRAS>
         <TDID>MVKE</TDID>
         <LINE>1</LINE>
         <TDLINE>Textzeile 1</TDLINE>
      </item>
</E_MATERIALTEXT>

The target structure looks like this:

<product> 
  <matnr>4711</matnr>
  <...>
  <descriptions>
    <description textid="MVKE" language="EN"
       <line number=1>textline 1</line>
       <line number=2>textline 2</line>
    </description>
    <description textid="MVKE" language="DE"
       <line number=1>Textzeile 1</line>
    </description>

  </descriptions>
</product>

The element <descritption> is optional and each text can consist of multiple lines and can be transmitted in multiple languages.

I have to check for each material, wether at least one line exists in materialtexts an generate an element <descriptions>.

That is not that difficult.

But the number of the next tag <description> is dependend of the four elements matnr tdid spras and line. How can I achieve this

mapping via a user defined function?

I searched the documentation and web for hours, but I can not find a hint how to solve this problem.

I tried to put the relevant values into a HashMap with key matnr and a inner class object (with the keys) as value.

That works well in Eclipse but not in XI.

Thanks in advance for any help!

Helmut