cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP Mapping and Message Mapping

Former Member
0 Kudos

Hello

I want to do the followig mapping

File - > IDOC

field1 ->field_idoc1

field2 ->field_idoc2

field3 ->field_idoc3

field4 -> (based on an dictionary table in the R/3)

For the first 3 fields I will use message-mapping.

For field4 I heard about ABAP Mapping. Select with the value of field4 in an ABAP Table and response the new value to the mapping back.

Would both mappings in one Interface-Mapping work?

Regards

Christoph

Accepted Solutions (0)

Answers (2)

Answers (2)

udo_martens
Active Contributor
0 Kudos

Hi Christoph,

usually it would be a task for BPM but indeed, u can solve that with a ABAP mapping. Inside that mapping u call a function modul at R/3 (call function 'MyFunction' destination 'MyDest'...).

In one Interface Mapping u can refer as much Mapping Programs as u like. The result of one will be used as source 4 the next.

Regards,

Udo

Former Member
0 Kudos

Christoph , You can call them in sequence within an interface mapping, but cannot call one within another.

To make a lookup, you can write an RFC(which will make the lookup and return the result), call it in the message mapping using a JCO call(inside a user-defined function in message mapping) avoiding two mapping programs

If ur in SP13 , you can call an RFC commn channel from a message mapping to help make the lookup.

Regds

Saravana

Former Member
0 Kudos

Hello Saravana,

the JCO call sounds very good, but I'm not so familiar with Java Coding. Have you, or have someone an example how to call a RFC out of an user-defined function ?

Regards

Christoph

Former Member
0 Kudos

Christoph, There was an article previously available in articles section, now i dont find the link.

I have given a sample code below. You can find lot of sample JCO code provided along with the JCO library that can be downloaded from service.sap.com.

*************************************************

JCO.Repository mRepository;

JCO.Client mConnection = JCO.createClient(

sapClient,

userName,

password,

language,

hostName,

systemNumber );

// connect to SAP

mConnection.connect();

// create repository

mRepository = new JCO.Repository( "sample", mConnection );

// Create function

JCO.Function function = null;

IFunctionTemplate ft = mRepository.getFunctionTemplate("Z_TEST");

function = ft.getFunction();

// Obtain parameter list for function

JCO.ParameterList input = function.getImportParameterList();

// Pass function parameters

input.setValue( param1_value , "P_PARM1");

input.setValue( param2_value , "P_PARM2");

JCO.ParameterList tabInput = function.getTableParameterList();

JCO.Table inputTable = tabInput.getTable("T_PARM3");

inputTable.appendRow();

inputTable.setValue("test" , "IDOC");

}

mConnection.execute( function );

String ret = function.getExportParameterList().getString( "P_GEN_NUM" );

mConnection.disconnect();

return ret ;

***********************************************

Regds

Saravana

Former Member
0 Kudos

Hello Saravana ,

thanks for your help, but i guess i got lost.

I created a custumer function "rfc_test01"

public void rfc_test01(String[] a, ResultList result, Container container){

JCO.Repository mRepository;

JCO.Client mConnection = JCO.createClient(

300,

chch,

pas0111,

de,

sapm10a.aa.cust.de,

00 );

....

And added you coding into the body.

1. question:

Do I need to place "JCO.Repository mRepository;" into the field IMPORTS?

2. question:

Is this connection ok?

JCO.Client mConnection = JCO.createClient(

300,

chch,

pas0111,

de,

sapm10a.aa.cust.de,

00 );

3. question:

my function Z_CHA_TEST01 looks like:

import: im_field

export: ex_field

Regards

Christoph

Former Member
0 Kudos

Hi XI SDN Folks,

i have a doubt.

Using JCO , i will export P_GEN_NUM1.

i need to export remaining parameters also.

i need P_GEN_NUM1,P_GEN_NUM2,P_GEN_NUM3,P_GEN_NUM4,P_GEN_NUM5.

i don't like to call BAPI again and again for each field.

String ret = function.getExportParameterList().getString( "P_GEN_NUM1" );

is it possible to do this single Look up?

Please Help. Thanks in Advance