`

<转>SAP and ABAP Memory总结

    博客分类:
  • abap
阅读更多

 

1、读取哈使用方法不同
SAP内存使用SET/GET parameters方法;
ABAP内存使用 EXPORT 和 IMPORT 方法;

2、共享范围不同
SAP内存可以被所有的主session访问,内存数据可以同一个session中不同程序之间,或者不同session之间;
ABAP只能在同个session的不同程序之间共享数据;

3、作用范围不同
SAP内存在整个终端session时间内都有效;
ABAP内存只能在一个session时间内有效;

4、使用一般原则
SAP内存用于屏幕默认值输入;
abap内存用于模块之间传替数据

Difference Between SAP and ABAP Memory

Can any one tell me what is the difference between ABAP Memory and SAP Memory?

Answers 1:-

Within a main session, when ever you start an application program, it opens up an internal sessions with in the main session. The internal session has a memory area that contains the ABAP program and its associated data. So when ever you want to pass data between two internal sessions, then you can use ABAP Memory (i.e import, export).

When comes to SAP memory (also known as global memory), if the data has to be passed b/w two main sessions, we can use SAP Memory(SPA/GPA Parameters). SAP Memory can also be used to pass data b/w internal sessions.

Neelima

Answers 2:-

SAP Memory
SAP memory is a memory area to which all main sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session, or to pass data from one session to another. Application programs that use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters can be set either for a particular user or for a particular program using the SET PARAMETER statement. Other ABAP programs can then retrieve the set parameters using the GET PARAMETER statement. The most frequent use of SPA/GPA parameters is to fill input fields on screens

ABAP/4 Memory
ABAP memory is a memory area that all ABAP programs within the same internal session can access using the EXPORT and IMPORT statements. Data within this area remains intact during a whole sequence of program calls. To pass data
to a program which you are calling, the data needs to be placed in ABAP memory before the call is made. The internal session of the called program then replaces that of the calling program. The program called can then read from the ABAP memory. If control is then returned to the program which made the initial call, the same process operates in reverse.

SAP memory
The SAP memory, otherwise known as the global memory, is available to a user during the entire duration of a terminal session. Its contents are retained across transaction boundaries as well as external and internal sessions. The SET PARAMETER and GET PARAMETER statements allow you to write to, or read from, the SAP memory.

ABAP/4 memory
The contents of the ABAP/4 memory are retained only during the lifetime of an external session (see also Organization of Modularization Units). You can retain or pass data across internal sessions. The EXPORT TO MEMORY and IMPORT FROM MEMORY statements allow you to write data to, or read data from, the ABAP memory.

(二) Passing data from one ABAP program to another
1. You have to define an internal table ITAB in program AAA.
2. In the program AAA you export your ITAB to the memory.
EXPORT ITAB TO MEMORY ID 'TD' (ID is the name of memory, you don't need to create it ).
3. In program BBB you have to declare The same table (same table's name and same fields).
4. In BBB you can import ITAB :
IMPORT ITAB FROM MEMORY ID 'TD'
5. Now you can export it to AAA after modifications.
EXPORT ITAB TO MEMORY ID 'TD'
6. In AAA :
IMPORT ITAB FROM MEMORY ID 'TD'
This solution is independant to SUBMIT.
(三) Example:
两个程序010和011,选择屏幕是一样的. 010是ALV行显示的,011是WRITE显示的.需要达到的效果是: 点击:MATNR字段则将010的选择屏幕传到011的选择屏幕中去;点击VBELN,则将当前行的VBELN传到011的选择屏幕中去.
Program:010
1.定义010的选择屏幕:
selection-screen begin of block b1 with frame title bt1.
parameters PL_BUKRS like VBRK-BUKRS memory id P_BUKRS default '1000'.
select-options PI_KUNRG for VBRK-KUNRG.
select-options PI_FKDAT for VBRK-FKDAT.
select-options PI_VBELN for VBRK-VBELN.
select-options PI_VGBEL for VBRP-VGBEL.
selection-
screen end of block b1.
2.010中定义USERCOMMAND事件:
form user_command using i_ucomm like sy-ucomm is_selfield type slis_selfield.
case i_ucomm.
when '&IC1'.
CASE is_selfield-fieldname.
WHEN 'VBELN'.
read table itab index is_selfield-tabindex. "change
EXPORT ITAB-VBELN TO MEMORY ID 'PT_VBELN'.
EXPORT is_selfield-fieldname TO MEMORY ID 'PP_FIELD'.
CALL TRANSACTION 'ZF011' AND SKIP FIRST SCREEN.
WHEN 'MATNR'.
EXPORT is_selfield-fieldname TO MEMORY ID 'PP_FIELD'.
EXPORT PI_KUNRG to memory id 'PP_KUNRG'. "add
EXPORT PI_VGBEL TO MEMORY ID 'PP_VGBEL'. "add
EXPORT PI_VBELN to memory id 'PP_VBELN'. "add
EXPORT PI_FKDAT TO MEMORY ID 'PP_PKDAT'. "add
CALL TRANSACTION 'ZF011' AND SKIP FIRST SCREEN.
ENDCASE.
endcase.
endform. "user_command
3.011中定义选择屏幕(这里就不需要定义MEMORY ID):
selection-screen begin of block b1 with frame title bt1.
parameters PL_BUKRS like VBRK-BUKRS memory id PP_BUKRS default '1000'.
select-options PI_KUNRG for VBRK-KUNRG .
select-options PI_FKDAT for VBRK-FKDAT.
select-options PI_VBELN for VBRK-VBELN .
select-options PI_VGBEL for VBRP-VGBEL .
selection-screen end of block b1.
4.011中接收010中传过来的值
DATA : ME_VBELN LIKE VBRK-VBELN .
DATA : ME_FIELD(30) TYPE C . 定义ME_FIELD是为了接收is_selfield-fieldnameMEMORY ID 'PP_FIELD',因为MEMORY不是一个字段,也不是一个内表,只能用这种方式来传输
CLEAR :ME_VBELN ,ME_FIELD.
IMPORT is_selfield-fieldname = ME_FIELD FROM MEMORY ID 'PP_FIELD'.
IF ME_FIELD = 'VBELN'.
IMPORT ITAB-VBELN = ME_VBELN FROM MEMORY ID 'PT_VBELN'.
ELSE .
IMPORT PI_VBELN = PI_VBELN from MEMORY ID 'PP_VBELN'.
ENDIF .
IMPORT PI_FKDAT = PI_FKDAT FROM MEMORY ID 'PP_PKDAT'.
IF NOT ME_VBELN IS INITIAL . 表示选择了VBELN
PI_VBELN-SIGN = 'I'.
PI_VBELN-OPTION = 'EQ'.
PI_VBELN-LOW = ME_VBELN . 只选择单值,所以传LOW就可以拉
APPEND PI_VBELN .
ENDIF .:




What is the code to send internal table to abap memory?

This code is from which program you want to export to the ABAP memory:

export ist_resb to memory id 'ZPPC0122_FD'.

where ist_resb is the internal table name &
ZPPC0122_FD is the include name of my program ZPPC0122.

This code is from which program you want to import from the ABAP memory

import *ist_resb *= ist_resb from memory id 'ZPPC0122_FD'.

where *ist_resb This internal table is the importing program internal table.*
ist_resb This internal table is the exporting program internal table.

But remember in both the program you have defined the same internal table with same structure

Nowadays Export & Import statement is OBSOLETE it gives SLIN CHECK ERROR in SAP 6.0 Version.

test
<script type="text/javascript"></script>
分享到:
评论

相关推荐

    SAP(ABAP面试题目

    在 ABAP 内存(ABAP Memory)交换中,用于将数据复制到 ABAP 内存的语句是 EXPORT to MEMORY ID &lt;id&gt;,用于将数据从 ABAP 内存复制到程序中的语句是 IMPORT from MEMORY ID &lt;id&gt;。在 ABAP 内存间进行交换的数据必须...

    abap新手边练边学

    - `FORM &lt;subr&gt; [USING &lt;f1&gt; &lt;f2&gt; …] [CHANGING &lt;f1&gt; …]` - `PERFORM &lt;subr&gt; [USING &lt;f1&gt; &lt;f2&gt; …] [CHANGING &lt;f1&gt; …]` 其中,`USING` 后面接的是那些在子程序中不会被改变的变量;而 `CHANGING` 后面则接的...

    SAP ABAP 面试题

    - **IMPORT from MEMORY ID &lt;id&gt;:** 用于将数据从ABAP内存复制到程序中。 - **注意事项:** 使用ABAP内存进行数据交换时,必须确保两个程序中都有相同的数据声明。 #### 四、授权对象 **授权检查** - **定义:*...

    ABAP技术总结

    另外,ABAP程序间的数据共享与传递也是集成的重要方面,包括使用EXPORT/IMPORT语句和SAP/ABAP Memory技术。 6. SAP与大数据技术的融合 当前,SAP系统也在不断融合大数据技术,比如HANA、Hadoop、Spark等。ABAP技术...

    SAP-ABAP培训课件.pptx

    SAP ABAP是一种高级业务应用程序编程语言,广泛用于开发SAP R/3和SAP NetWeaver系统。在ABAP中,面向对象编程(OOP)是其现代化发展的一个重要组成部分,它引入了类似Java、C++和Smalltalk等语言的特性。ABAP ...

    ABAP Development for SAP HANA

    SAP HANA is a complete, high-end database for all SAP applications and, at the same time, an innovation platform for completely new types of real-time applications (in the area of healthcare, for ...

    ABAP面试题目ABAP面试题目

    在使用 ABAP 内存的程序间进行数据交换时,使用 EXPORT to MEMORY ID &lt;id&gt; 语句将数据复制到 ABAP 内存,使用 IMPORT from MEMORY ID &lt;id&gt; 语句将数据从 ABAP 内存复制到程序中。 4. 授权对象(Authorization ...

    abap的应聘面试题

    `EXPORT to MEMORY ID &lt;id&gt;`将数据复制到内存,`IMPORT from MEMORY ID &lt;id&gt;`则将数据从内存导入到程序。交换的数据需在两个程序中声明并保持数据结构一致。 4. **授权对象与授权检查** 授权对象是安全机制的一...

    ABAP 面试题

    ABAP 面试题知识点总结 ABAP 面试题中涉及到多个重要的知识点,本节给出详细的知识点总结。 一、锁对象(Lock Object)和 Function Module * 锁对象是用于锁管理的重要工具,创建锁对象时,系统会自动生成两个 ...

    ZUI2_JSON2_/UI2/CL_JSON_ui2/cl_json_abap_Ui2_cl_json_zui2_json_源

    IF sy-subrc &lt;&gt; 0. "处理错误 ENDIF. ``` 在这个例子中,`DESERIALIZE`方法将JSON字符串解析并填充到`lt_person`表中。如果解析过程中出现错误,如语法错误或内存不足,异常会被抛出。 在实际开发中,我们可能会...

    ABAP Documentation

    ABAP(Advanced Business Application Programming)是SAP公司开发的一种编程语言,主要用于构建企业级的应用程序,尤其是在SAP R/3和SAP S/4HANA系统中。ABAP文档是学习和理解ABAP编程的关键资源,它包含了语言的...

    ABAP程序相互调用

    我们可以使用SAP MEMORY或ABAP MEMORY来传递内表数据。例如: ```abap EXPORT T_ITAB TO MEMORY 'ZHR_IT0008'. ``` 在被调用的程序中,我们可以使用IMPORT关键字来导入数据。例如: ```abap IMPORT T_ITAB FROM ...

    ALV报表 abap报表

    INCLUDE &lt;LIST&gt;. TYPE-POOLS: SLIS. DATA: i_fieldcat_alv TYPE SLIS_T_FIELDCAT_ALV, i_layout TYPE SLIS_LAYOUT_ALV, i_fieldcat TYPE SLIS_FIELDCAT_ALV, i_events TYPE SLIS_T_EVENT, w_events LIKE LINE ...

    基于SAP和TOC的瓶颈识别

    基于 SAP 和 TOC 的瓶颈识别 本文主要讨论基于 SAP 和 TOC 的瓶颈识别,旨在解决离散制造企业中的瓶颈问题。TOC 理论强调瓶颈的持续改善和产销率的最大化,而 SAP 生产管理系统可以判定生产瓶颈。通过将工艺研发及...

    SAP-MRP计划库存发运报表DEMO

    该报表的开发使用了SAP的ABAP语言,通过调用外部函数ZFM_PP_GETDATE实现日期计算和汇总显示。 报表功能 SAP-MRP计划库存发运报表DEMO具有以下功能: * 将MD04中的单个物料功能整合为多物料汇总显示 * 实现汇总...

    SAP内存管理

    SAP内存可以分为两大类:私用内存(Local Memory)和公用内存(Shared Memory)。这两类内存都存在于虚拟内存(Virtual Memory)中。 ##### 虚拟内存(Virtual Memory) 虚拟内存是由操作系统为SAP系统分配的内存区域,...

    A Developer's Guide to Protecting Memory

    对于ABAP开发者而言,掌握如何使用ABAP Memory Inspector等工具是非常必要的,这不仅能提高开发效率,还能确保系统的稳定运行。在未来的工作中,开发者应时刻关注内存管理的重要性,不断探索新的解决方案,以应对日...

    SAP的CRM模块安装指南、安装手册

    此部分涉及SAP TREX (Text Retrieval and Exchange) 系统的安装,但具体内容未提供。通常包括安装前准备、安装步骤及后续配置等流程。 #### 五、配置Java到ABAP的连接 这部分内容涉及到Java与ABAP之间的连接配置,...

Global site tag (gtag.js) - Google Analytics