转自:https://blog.csdn.net/lyq123333321/article/details/52659114

(一)          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 .:

ABAP Memory ID的更多相关文章

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

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  2. Debug Intro

    The ABAP Debugger is used tool to execute and analyze programs line by line. Using it we can check t ...

  3. SAP ABAP exporting list to memory ...SUBMIT 程序传输屏幕参数

    SUBMIT report EXPORTING LIST TO MEMORY              AND RETURN. submit 关键字的作用就是在程序内部调用一个程序,and retur ...

  4. ABAP关键字SUBMIT的简单例子和学习小记

    网上有关SUBMIT实现程序调用的例子稍显复杂,而相关的参考和解释则不是很完善.本文给出一个SUBMIT的小示例程序(代码见文末),实现了最简单的程序间调用及返回值,以及SAP官方文档中相关内容的翻译 ...

  5. ABAP程序互调用:SUBMIT、CALL TRANSACTION、LEAVE TO TRANSACTION

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  6. ABAP开发顾问必备:SAP ABAP开发技术总结

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  7. SAP内存/ABAP内存/共享内存区别

    (1).读取和使用方法不同SAP内存使用SET/GET parameters方法:SET PARAMETER ID 'MAT' field p_matnr.GET PARAMETER ID 'MAT' ...

  8. [SAP ABAP开发技术总结]ABAP程序之间数据共享与传递

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  9. [SAP ABAP开发技术总结]选择屏幕——SELECT-OPTIONS

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

随机推荐

  1. Composer的安装以及替换为国内镜像

    Composer的安装以及使用国内镜像 Composer 学习网址 Composer官网 https://getcomposer.org/ Composer中文网 http://www.phpcomp ...

  2. sqlplus、exp、imp不是内部或外部命令,也不是可运行的程序

    oracle 想exp导出数据库,参考网上的作业,进入CMD命令,黑屏后输入命令出现EXP后出现EXP不能内部或外部命令. 网上找到下列解决方法 摘自:http://blog.csdn.net/suz ...

  3. 包,logging日志模块,copy深浅拷贝

    一 包 package 包就是一个包含了 __init__.py文件的文件夹 包是模块的一种表现形式,包即模块 首次导入包: 先创建一个执行文件的名称空间 1.创建包下面的__init__.py文件的 ...

  4. python - django (cookie)

    # """ Cookile: # 因为 HTTP 请求是没有状态的,每一次请求都是独立的 Cookile 的存储: # 保存在浏览器上的 键值对. # 服务器控制着响应, ...

  5. 60、springmvc-异步请求-返回Callable

    60.springmvc-异步请求-返回Callable @Controller public class AsyncController { @RequestMapping("async0 ...

  6. yum -y install 问题解决

    1.错误如下: Last login: Thu Jul 26 09:04:14 2018 from 192.168.3.250[root@diagbot01 ~]# yum -y install do ...

  7. start-stop-daemon 守护进程管理

    start-stop-daemon 守护进程管理 start-stop-daemon 作为系统自带,简单实用 结合systemctl,用起来很是不错. 示例 PIDFILE=/var/run/ngin ...

  8. dbcp_c3p0连接mysql8.0.13

    背景 学习数据库的使用,上次没有记录,现在都回忆不起来了,所以这次重新学的时候顺便记录下. 配置环境 win10 jdk11 idea mysql8.0.13 DBCP连接使用 用配置文件目前我连接不 ...

  9. Codeforces Round #597 (Div. 2)

    A - Good ol' Numbers Coloring 题意:有无穷个格子,给定 \(a,b\) ,按以下规则染色: \(0\) 号格子白色:当 \(i\) 为正整数, \(i\) 号格子当 \( ...

  10. Linux的MySQL安装和配置(详细)

    打开centos系统 输入root用户和密码(我的用户和密码都是root) 查看有没有安装mysql rpm -qa|grep mysql 没有返回任何信息说明没有安装 我是用的centos7,默认安 ...