cancel
Showing results for 
Search instead for 
Did you mean: 

User Java-Mapping Call SAP-Mapping

former_member301120
Active Participant
0 Kudos

Hello to all,

I've created a userdefined JAVA-Mapping (Everything works fine).

Is it possible to execute a SAP-default JAVA-Mapping in the userdefined JAVA-Mapping.

Are there any blogs about that? I haven't found any yet.

Thanks for your help.

Regards

Christian

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi to all,

has nobody made this yet?

Thanks for all suggestions

henrique_pinto
Active Contributor
0 Kudos

Hey Christian,

would you please try this?

Inside of your custom java mapping code, just refer to the standard java mapping class, set the relevant parameters and call the execute() method.


public class CustomMapping implements StreamTransformation {
  private Map param = null;
  private AbstractTrace trace = null;

  public void setParameter(Map param) {
    this.param = param;
  }

  public void execute(InputStream in, OutputStream out) {
  //...
  // Call the standard mapping
  StandardMapping mapping = new StandardMapping();
  mapping.setParameter(param);
  mapping.execute(in, out);
  //...
  }
}

The out object should hold the result from the execution of the standard mapping.

Also, for you to build this in NWDS, you'll have to export the .jar containing the StandardMapping class from the Integration Builder and add it as an external jar in your custom mapping project's class path.

Regards,

Henrique.

former_member301120
Active Participant
0 Kudos

Hello Henrique,

thanks for the soultion. It works. But now I have another issue.

The excute-method returns an outputstream. How can I convert this to an inputstream?

I'm a newbie at java.

Thanks

Christian

henrique_pinto
Active Contributor
0 Kudos

Just search on google, there are several solutions.

One possible solution is:


  public void execute(InputStream in, OutputStream out) {
  //...
  // Call the standard mapping
  ByteArrayOutputStream mapout = new ByteArrayOutputStream();
  StandardMapping mapping = new StandardMapping();
  mapping.setParameter(param);
  mapping.execute(in, mapout);
  InputStream mapin = new ByteArrayInputStream(mapout.toByteArray());
  //...
  }

Regards,

Henrique.

Former Member
0 Kudos

Just to understand the step

"mapping.execute(in, out);"

This will execute the standard graphical mapping and put the transformed message in the out object ?

What if there is no standard graphical mapping or what if there are more than one graphical message mapping ?

Could u please post the code for ur solution ?

henrique_pinto
Active Contributor
0 Kudos

Joseph,

the question here was to access a standard Java Mapping, not a graphical Mapping.

I have no clue on how to access graphical mappings from a Java mapping.

You could alternatively put them in sequence in the mapping chain, in the interface mapping. This way, the output of the graphical mapping would be the input of the Java mapping, and you could perform your transformations.

Regards,

Henrique.

Answers (4)

Answers (4)

former_member301120
Active Participant
0 Kudos

Hello,

IDEX-GE isn't the problem. In my Szenario I have several "imported Archives".

Each archiv contains 1 mapping at least.

Is it possible to execute a Java mapping from another Archiv in my Java mapping?

Regards

Former Member
0 Kudos

Hi,

It is possible to cascade different mappings in a single interface mapping. The condition is the output structure of your first mapping should be exactly similar to the structure of your second mapping input.

Is this this what you are looking for?

If not can you explain your requirement a bit more..

Regards,

Jai Shankar

former_member301120
Active Participant
0 Kudos

Hi,

I know this. My problem is the SAP-default Java mapping does not return the input structure needed for the next Java - Mapping. So I thought I could encapsulate the SAP Java mapping in a user defined Java mapping in order to keep the input structure und return the result of SAP Java mapping and the input structure. So my need is to execute the SAP mapping in my user defined mapping

Regards,

Christian

iaki_vila
Active Contributor
0 Kudos

Hi,

I never worked with IDEX-GE (Intercompany Data Exchange Extended – German Electricity) but i think that you can do a webservice with the java-mapping and you can use an abap proxy or a xi sender rfc to call it.

Regards.

former_member301120
Active Participant
0 Kudos

Hi,

we use the SAP-XI IDEX-GE Content provided from SAP. I've written a Java-Mapping and I would like to know, if it is possible to call a SAP java mapping (from which i don't have the source) in my user defined java mapping.

Regards

iaki_vila
Active Contributor
0 Kudos

Hi,

If i understand your question you want Abap-Mapping from java user-defined mapping. If you want use ABAP-Mapping you only must do the map from ABAP enviroment.

If you want call from java to abap you can use an RFC and the JCO connector.

Regards.

Message was edited by:

Iñaki Vila