cancel
Showing results for 
Search instead for 
Did you mean: 

How to register a method associated with a function module

Former Member
0 Kudos

Hi,

I am trying to execute a method associated with a function module (in BWAFMAPP table)

when I create the outboundfactory instance like below:

OutboundContainerFactory outfactory = OutboundContainerFactory.getInstance();

It throws an exception with message as:

Method <method name> is not registered.....

Can anyone please help me....

Thanks

Deepak

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Deepak,

<b>1. First you write InboundProcessor for the method you want to call.</b>

import com.sap.ip.me.api.sync.InboundProcessor;

// For every method you want to call, there must be a InboundProcessor aasociated with it.

public class MyInboundProcessor implements InboundProcessor {

public String getMethodName() {

// In transaction ME_WIZARD you enter java name for the method.

// This is the name by which Mobile applications refer to method in R/3.

return "ENTER YOUR JAVA NAME FOR THE METHOD HERE";

}

public void process(InboundContainer container) {

// Write code here to read return data from the R/3

}

}

<b>2. Now register this processor to InboundProcessorRegistry.</b>

MyInboundProcessor processor = new MyInboundProcessor();

InboundProcessorRegistry.getInstance().register(processor);

<b>3.Now create OutBoundContainer.</b>

OutboundContainer container = OutboundContainerFactory.getInstance().createOutboundContainer(VisibilityType.SEPARATED,"JAVA METHOD NAME",OutboundContainer.TYPE_REQUEST);

<b>4. Add paramters values for the method to be called.</b>

container.addItem("ITEM1",itemValue);

<b>

5.Close the container.</b>

container.close();

<b>6. Start Synchronization</b>

SyncManager.getInstance().synchronizeWithBackend();

Former Member
0 Kudos

Hi Abhijit,

thanks for the responce,

But I have done all these 5 steps in the same manner,

But I am getting the Exception at

OutboundContainerFactory outfactory = OutboundContainerFactory.getInstance();

Can u please suggest some solution for this,

Can I do something at the time when I generate entry through ME_WIZARD,

Please rply,

thanks,

Deepak

Former Member
0 Kudos

hi Deepak,

Did you put entries in <b>BWAFMAPP and MEMAPPDEST</b> tables? you should refer this method name in your program.

Regards

Ak.

Former Member
0 Kudos

Hello Deepak ,

getInstance() method of OutboundContainerFactory class does not throw any exception.

Exception will be thrown by createOutboundContainer method of OutboundContainerFactory class. You can refer to MDK documentation for this.

<a href="http://media.sdn.sap.com/public/html/submitted_docs/MI/MDK_2.5/content/javadoc/com/sap/ip/me/api/sync/OutboundContainerFactory.html#getInstance()">getInstance & createOutboundContainer methods</a>

Check if your InboundProcessor's getMethodName method is returning the same name which is there in BWAFMAPP .

Also while creating outbound container i.e. at

createOutboundContainer method second parameter gives the same java method name.

Still if you find any problem then reply.

Former Member
0 Kudos

Abhijit,

actually I have made entry in BWAFMAPP not in other because RFC Destintion is set to default,

Also inspite of that my application is working now,

I dont know how that problem of method registration is solved by itself,

but ayways thanks for your efforts,

bye,

deepak,

Former Member
0 Kudos

hello deepak,

take note also that you have to register your processors

PRIOR to synchronization. you might want to implement a

SyncEventListener in your application that will register

your processor incase when it is not yet registered prior

to synchronization.

take note as well that InboundProcessing interface extends

Serializable. MI framework will try to serialize your

processor on the first time you register it. but if MI

encounters an exception during the serialization process,

it will be ignored. thus you need to listen to the SyncEvent

and register your processor if necessary.

hope this help.

regards

jo

Answers (0)