cancel
Showing results for 
Search instead for 
Did you mean: 

How can we call a BAPI from a scheduler?

Former Member
0 Kudos

My project involves reading some data from R/3 and send a mail at regular intervals. I intend to use a schedular for that but dont know how to call a BAPI there. Is there a better way to go about it?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Scheduler Task->Portal Service->RFC or BAPI

You still have one issue which is IPortalComponentRequest. Portal service doesn't have access to it but you can get around it by setting up a SAP system for usermapping and then mapping that userid to a generic userid. Example code:

private IConnection getConnection(

String alias)

throws Exception {

IUser user =

UMFactory.getUserFactory().getUserByLogonID("Administrator");

IConnectorGatewayService cgService = (IConnectorGatewayService) PortalRuntime.getRuntimeResources().getService(IConnectorService.KEY);

ConnectionProperties prop = new ConnectionProperties(user.getLocale(), user);

return cgService.getConnection(alias, prop);

}

thanks.

sridhar

Murali_Shanmu
Active Contributor
0 Kudos

Do you mean to say that, you have a java program that talks to a BAPI at fixed regular intervals and accordingly BAPI send mails out ?

And you are trying to find a way to schedule this Java program ?

Regards

Murali

Former Member
0 Kudos

no, actually BAPI simply returns the records and then the java program (in scheduler) has to send mail.my question is , how can we call that BAPI from the scheduler? It would be really helpful if u could provide a code example.