(一)          Difference Between SAP and ABAP Memory  
(1)、读取和使用方法不同
SAP内存使用SET/GET parameters方法;
SET PARAMETER ID 'MAT' field p_matnr.
GET PARAMETER ID 'MAT' field p_matnr.

ABAP内存使用 EXPORT 和 IMPORT  方法;

export p_matnr = p_matnr to memory id 'ZTESTMAT'.
import p_matnr = p_matnr from memory id 'ZTESTMAT'
(2)、共享范围不同
SAP内存可以被所有的主session访问,内存数据可以在同一个session中不同程序之间,或者不同session之间共享数据;
ABAP内存只能在同个session的不同程序之间共享数据;
(3)、作用范围不同
SAP内存在整个终端session时间内都有效;
ABAP内存只能在一个session时间内有效;
(4)、使用一般原则
SAP内存用于屏幕默认值输入;
ABAP内存用于模块之间传替数据
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-fieldname的MEMORY 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 .

SAP and ABAP Memory总结相关推荐

  1. 程序间数据共享与传递(3):EXPORT/IMPORT、SAP/ABAP Memory

    ABAP Memory(同一用户的同一窗口Session) l  保存数据 EXPORT[FROM ]  [FROM ] ... TO MEMORY ID <</span>key&g ...

  2. 程序间数据共享与传递(1):EXPORT/IMPORT、SAP/ABAP Memory

    EXPORT 语句 EXPORT {p1 = dobj1 p2 = dobj2 ...} | {p1 FROM dobj1 p2 FROM dobj2 ...} | (ptab)  TO | { ME ...

  3. ABAP Memory/SAP Memory/Shared Buffer/Database

    ABAP 提供了IMPORT/EXPORT 和 SET / GET PARAMETER 语句,可对用户内存/服务器内存/数据库进行存储和访问.不过可能很多人对此还不是很了解,下面我们通过实例来测试它们 ...

  4. SAP Memory ABAP Memory超级详细解析

    以前做enhancement的时候用过parameter id 和 memory id, 但很多其他语法用法我是没接触过的, 今天看了Palm同鞋做的文档SAP Memory & ABAP M ...

  5. 如何在 SAP BTP ABAP 编程环境里直接调用 ABAP On-Premises 系统的 RFC 函数

    首先登录 ABAP On-Premises 系统,运行事物码:aco_proxy,为 RFC 函数 RFC_SYSTEM_INFO 和 RFC_READ_TABLE, 生成代理类元数据,格式为 xml ...

  6. 我的第一个SAP PROXY ABAP Program(SAP PO 开发五)

    登陆PO服务器,启动JAVA客户端三步(SAP PO 开发一) 搭建一个WebService接口环境(SAP PO 开发 二) 用SAP PO连通一个WebService接口(SAP PO 开发 三) ...

  7. 程序间数据共享与传递(2):EXPORT/IMPORT、SAP/ABAP Memory

    IMPORT语句 IMPORT {p1 = dobj1 p2 = dobj2 ...} | {p1 TO dobj1 p2 TO dobj2 ...} | (ptab)  FROM | { MEMOR ...

  8. SAP中ABAP格式与JSON格式互转方法研究

    一.JSON概念 JSON(JavaScript Object Notation) 是一种轻量级的 数据交换 格式. JSON数据格式示例: { "学生": [ {"姓名 ...

  9. ABAP memory中的Export和Import

    可以用于SUBMIT方式调用其他ABAP程序后,数据只能通过某个透明表暂存,在由主程序查询透明表取得结果的情况, 用memory中的Export和Import的好处是不用在通过透明表转数据了,先把子程 ...

最新文章

  1. 一起谈.NET技术,OnLoad与Page_Load的差异分析
  2. [置顶] 【C#】 Socket通讯客户端程序
  3. pyppeteer有java版本吗_Pyppeteer中文文档_序言_安装_基本使用及注意事项
  4. 云服务器显示隐藏文件,云服务器显示隐藏文件
  5. Python输出当前时间
  6. VMware 安装LINUX系统(一)
  7. datagrid 什么时候结束编辑_小规模纳税人免税政策什么时候结束?有答复了
  8. 数值类型小数点后是否可以接零问题
  9. android-x86 下载地址
  10. 谷粒学院【网上教育】总结
  11. 人物-李彦宏:李彦宏
  12. Java教程(一)---JDK和Maven安装配置
  13. 量化投资知识,量化交易
  14. 机械设计:机械加工中获得工件尺寸精度的常用方法!
  15. 基于BP神经网络PID控制+Simulink仿真
  16. 如何给程序添加数字签名 sign
  17. 渗透测试成功的8个关键
  18. Matlab使用-meshgrid函数(网格矩阵)
  19. 非常时期的情人节,只能云表白了
  20. 获取文件哈希值_图解:什么是哈希?

热门文章

  1. 你是别人眼中的废物产品经理吗?
  2. 《Linux内核原理与分析》第三周作业
  3. 10.19文件管理课程笔记
  4. Git与Github操作指南(入门)
  5. shell中trap捕捉到信号的处理
  6. 期望文件系统格式在“1”到“4”之间;发现格式“6”
  7. java基础知识回顾之java Thread类学习(七)--java多线程安全问题(死锁)
  8. iptables中文man文档
  9. ubuntu apache 完全删除
  10. 理清竞争关系与互补关系,转自“XIAOTIE”