Skip to Content
avatar image
Former Member

Stateful ARFC2 connection between WebDynpro and R/3 system

Hello Everyone,

We recently upgraded our SAP Portal to NW 7.5 and we are using NWDS 7.5 now. Our projects models were upgraded to ARFC2. Since then we have some problems - If an ARFC2 model is executed to call Lock FM at backend, lock is set, but when the control is back to WD, the lock is released, and another problem is global variables in FM are reinitialized which would normally not be the case if the state of the user is maintained.

We wanted to use note 2216054, but we have already had the latest version of components and all models have scope type WD_APPLICATION_SESSION_SCOPE after migrations.
Our java app use some wd components from different projects and these projects have own models. So we call FM from one model to set lock, then work with FMs from another models and etc.

We decided to use note 2501389 in our FM calls. We begin every call from method beginJCoContext() and end call by endJCoContext(). But nothing changed. After it we moved method endJCoContext() in the wdDoExit(). And our lock isn't released, it is good, but we see problem with session - when user opens new window with the same application, he begins to work in the same luw in backend, and lock doesn't raise error as foreign lock. So we don't know how it use. Maybe it helps only in call sequence in one method.

I want to know if there is a way to call two or more RFC function modules in an backend via ARFC2 and have only one session in the backend? How to configure/implement stateful connection in ARFC2 model?

Thanks in advance for you suggestions!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Feb 14 at 10:10 AM

    Hello Olga,

    Please find the answers to your questions:

    1.

    Q.:I want to know if there is a way to call two or more RFC function modules in an backend via ARFC2 and have only one session in the backend?

    A.:

    This scenario should be implemented with different sessions. Once a session is not used any more, you need to to make the JCO connection IDLE and move it back to the pool. When there are multi-step logical units of work (LUWs), in which several function modules are executed in a row and are committed afterwards, the business application should begin and end the statefull connections based on the requirement.

    As you have found out, it has been introduced a new API 'disconnectAllStatefullSessions' at the same place where disconnectifAlive() is located.

    Calling this API during the exit of the application would make the JCO connection IDLE and hence available for usage for another RFC module.

    wdContext.current<model>InputElement().modelObject().modelInstance().disconnectAllStatefullSessions(); 

    Without this change, the lock to the backend table would release as soon as the response is sent back to WebDynpro Java.

    2.

    Q.: How to configure/implement stateful connection in ARFC2 model?

    A.:

    For any scope, ARFC2 model performs STATELESS RFC call! This is how the ARFC2 models, in FRAMEWORK.SCA 7.50, work.

    If there are multiple models using same JCO destination, then it is required to disconnect each connection by calling disconnectifAlive api.

    It is up to the application to begin and to end statefull call sequence for statefull scenarios.

    Call disconnectifAlive or disconnectAllStatefullSessions API during the exit of the application to avoid this issue(please refer note : 2316926 )

    Regards,

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thank you very much for answers!
      I have tried changing the scope of the models to UC_SCOPETYPE, but unfortunately nothing changed.

      Please, can you explain me how to set lock to the backend table in the begin of application and to make this lock active in r3 while application running (not in single call sequence)?

      If I understand correctly, I need to have active stateful connection for this goal. Otherwise (with stateless connection) I lose lock as soon as the response is sent back to WebDynpro Java. Right? I can create active stateful connection (which open while app working) only with methods from note 2501389. But how to use them when single call sequence is not enough for lock period, and you want to have active lock in r3 while application running? Is it realistic implement?
      Thanks in advance, Milen!