访问称为RFC的系统的堆栈内存 [英] Accessing stack memory of RFC-called system

查看:132
本文介绍了访问称为RFC的系统的堆栈内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当程序在SAP ECC中运行时,系统堆栈"存储所有全局变量,而与在单个会话中调用哪些模块/程序无关.

When a program is running in SAP ECC, the "system stack" stores all global variable irrespective of what modules/programs are called in that single session.

在调用启用RFC的功能模块(FM)时,将在被调用系统中创建一个新的系统堆栈,并且在被调用FM完成后,只能在ECC中检索在被调用FM中定义的导出参数.

When it's calling RFC-enabled Function Modules (FM), a new system stack is created in the called system and only the export parameters defined in the called FM can be retrieved in ECC when the called FM has finished.

是否可以在ABAP中访问另一个系统堆栈的全局变量?

Is there a way to access another system stack's global variables in ABAP?

例如,在我的情况下:

  • ECC系统中的FM BAPI_MATERIAL_AVAILABILITY通过RFC调用APO系统中的FM BAPI_APOATP_CHECK.
  • 当APO FM完成时,除了APO RFC功能模块中定义的参数之外,我还想访问APO系统堆栈的某些全局变量.我需要在ECC系统中访问GTC对象引用.
  • The FM BAPI_MATERIAL_AVAILABILITY in the ECC system calls via RFC the FM BAPI_APOATP_CHECK in the APO system.
  • When the APO FM finishes, I want to access some global variables of the APO system stack apart from the parameters defined in the APO RFC Function module. I need to access GTC object reference in ECC system.

PS:通常我们使用下面的ABAP语句从同一堆栈访问内存,但是当内存在另一个系统中时,它将不起作用:

PS: normally we use below ABAP statement to access memory from same stack, but it doesn't work when the memory is in another system:

ASSIGN '(PrgmName)Globalvariable' TO FIELD-SYMBOLS(<lo_data>).

推荐答案

由于在调用之后RFC连接没有自动关闭,因此用户会话的内存将在调用后立即保留,因此您可以调用自定义RFC您在APO系统中创建的启用了功能的功能模块,该功能模块访问所需的内存并返回其值.请注意,对象引用不能通过RFC传递.

As the RFC connection is not automatically closed after the call, the memory of the user session is retained, right after this call, so you may call a custom RFC-enabled function module that you create in the APO system, that accesses the memory you wish and return its value. Note that an object reference cannot be passed via RFC.

为了让您更好地理解,我改编了

So that you better understand, I adapted the official figure about memory areas to show how a RFC call reuses the memory when the connection is not closed between 2 ABAP systems:

传奇(箭头"1"和"2"):

Legend (arrows "1" and "2"):

  1. 在第一个RFC调用中,打开了一个连接,创建了一个新的用户会话,ABAP会话和内部会话.全局变量存储在内部会话内部名为(数据)对象"的块中.在呼叫结束时,将保留连接,包括第一个内部会话及其全局变量.
  2. 在下一个使用相同连接的RFC调用中(现有连接被重用),用户会话被重用(连同其ABAP和内部会话)以执行功能模块,因此它可以访问前一个的全局变量电话.

这篇关于访问称为RFC的系统的堆栈内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆