SAP and ABAP Memory总结
生活随笔
收集整理的這篇文章主要介紹了
SAP and ABAP Memory总结
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
(一)??????????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內存使用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):EXPORT