cancel
Showing results for 
Search instead for 
Did you mean: 

need to execute two FM in one session

Former Member
0 Kudos

Hello experts,

I need to execute two FMs in one session from webdynpro. I have created one model for the two FM. the second one do not have any dependency onthe first, it only commits (BAPI_TRANSACTION_COMMIT). How can i execute both in one session.

Points are confirmed.

Regards

Arindam

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

The error I see is that you have two models one for your data-changing RFCs and one for you commit-RFC. Two models normally always use two sessions (ergo. 2 connections) Your commit will not work for your data-changing RFCs if you use two models.

Put it all in one model and it will work.

If that is not possible take a look at the method setConnectionProvider of your model (IWDDynamiceRFCModel). But you probably do not need that.

J

Answers (5)

Answers (5)

Former Member
0 Kudos

I guess it dependes on the FM, but I have used a couple standard SD FM and then execute the corresponding commit/rollback with no problems

just make sure you use the same model ...and also to not end the connection (disconnectIfAlive) ...just in case

Former Member
0 Kudos

hi

if the second FM has to take time to execute before the first FM is executed completely ,

in webdynpro application , you have to make use of Threads to make the second FM which

performs a commit operation after the first FM ,

there are application using thread in webdynpro , you can search it in SDN

Former Member
0 Kudos

Hi,

You can execute one after the other.

//1st FM execution

wdContext.current<Request one>().modelObject().execute();

wdContext.nodeResponseOne().invalidate();

// 2nd FM Execution

wdContext.current<Request two>().modelObject().execute();

wdContext.nodeResponseTwo().invalidate();

Regards,

Jaya.

Former Member
0 Kudos

that does not help. actually the commit FM will enter data in SAP tables after the first FM is triggereed. If i trigger one after the other, it does not commit the data of first FM. the commit FM doesn't have any I?O structure. In essence, it will activatre the First FM. So need to be fired in one JCo session.

Former Member
0 Kudos

Hi,

I don't know how to achieve this requirement at webdynpro end.

Can't we develop a function module at ABAP side which will execute the two functional modules sequentially? And we consume that wrapper function module at webdynpro end.

Regards,

Jaya.

Former Member
0 Kudos

actually i am too late to discover it at a very critical time..the first FM is a standard FM and has lots of I?O params..to develop wrapper will take some time...need some way to do it from webdynpro

Former Member
0 Kudos

Did you try executing the two RFCs using the code mentioned in earlier posts?

Iw ould suggest to do that and let us know if that does not work?

former_member205363
Contributor
0 Kudos

Hi,

Two function module we can execute in a single click of a button. Just write code for executing two FMs in a single function.

This will execute one by one. following code for executing the FM

public void executeBAPI_FLIGHT_GETLIST( )

{

//@@begin executeBAPI_FLIGHT_GETLIST()

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try{

// 1st FM execution

wdContext.currentBapi_Flight_Getlist_InputElement().modelObject().execute();

wdContext.nodeOutput().invalidate();

// 2nd FM Execution

wdContext.currentBapi_Flight_BookTicket_InputElement().modelObject().execute();

wdContext.nodeOutput().invalidate();

}catch(WDDynamicRFCExecuteException e){

manager.reportException(e.getMessage(),false);

}

//@@end

}

Regards,

Lakshmi Prasad.

Former Member
0 Kudos

Hi Arindam

You can execute two RFC's one after other based on your functionality

Thanks

Tulasi