ABAP memory/SAP memory/Shared Buffer/Database

Source: Internet
Author: User
Tags server memory
ABAP provides import/export and set/get parameter statements to store and access user memory, server memory, and database. However, many may not know much about this. Next we will test their differences and relationships through examples. 1. After a user logs on to ABAP memory, a maximum of six windows can be opened for one system. This is known as external mode in SAP. In the same window Program You can call transaction/submit or Code Jump to another program, which is called internal mode. The call stack of internal mode can be at most 9 layers. ABAP memory is data that can be shared between internal modes, but not between external modes. Example. Create program a, enter: Data matnr type matnr. Import matnr from memory ID 'ytest _ matnr '. Write matnr.
Matnr = '000000 '.
Export matnr to memory ID 'ytest _ matnr '. submit y_program_a. "Call program a to run B directly, and find that program A has read the value from ABAP memory and output it to list. note: (1) debug and run the Goto-system area-ABAP memory statement after the B-to-Export Statement. You can view a piece of memory named ytest_matnr. (2) If B and a run in different windows, a will not be able to access the data. When the user inputs/N to exit the current program, the memory value will also be cleared. (3) This statement is applicable to data sharing during call transaction/submit, and is also commonly used in user exit, similar to defining global variables. 2. SAP memory mentioned external mode above. Therefore, data sharing between them must be performed using the set/get parameter statement, instead of the export/import mode. Example. Create program a, input: Data matnr type matnr. Get parameter ID 'test' field matnr. Write matnr. Create program B, input: Data: matnr type matnr.
Matnr = '000000 '.
Set parameter ID 'test' field matnr. After program B is run in window 1 and closed, program a is run in window 2, and it is found that program a still reads the sap memory value. Note: (1) during debugging, you can view ytest and its corresponding values through goto-system area-SAP memory. (2) The value of set/get parameter is related to this login. It will not expire after the user logs out. When a user logs in, the system loads the data to sap Memory Based on the settings under user profile-own data-parameter. (3) The parameter ID can be defined in further characteristics in data element. This parameter ID can be read as the default value when the field is used as the screen element. For example, va03 automatically displays the created order number. 3. Shared Memory/Shared Buffer all described above are user memory. How can we achieve data sharing between different users? Shared memory or shared buffer can be used, which is the memory shared by all users on the server. For the differences between shared memory and shared buffer, you can view the help in F1. If export shared buffer is used, it must be imported to the shared buffer. The import shared memory cannot be used. The opposite is true. Example. Create program a and enter:

Data matnr type matnr. Import matnr from shared buffer indx (AA) ID 'ytest _ matnr '. Write matnr. Create program B, input: Data: matnr type matnr.
Matnr = '000000 '.
Export matnr to shared buffer indx (AA) ID 'ytest _ matnr '. first run program B on user 1's computer, then run program a on user 2's computer, and find that user 2 can read the value. Note: (1) since it is the shared space of all users on the server, this value will be saved until the server is shut down and restarted, unless the user uses the delete statement to clear it. In fact, this is a bit similar to enqueue/dequeue. (2) Databases can also share data, but server sharing must be faster. Theoretically, it is suitable for online games. (3) indx is a table in the system that meets the specific format requirements. However, this does not mean that the Export/Import Statement will add records to the table indx. It only means that the server uses the indx structure to manage the shared memory of the table. 4. As mentioned above, shared buffer does not access the database, but database should be used to access the database. Create a program and enter the code: Data: matnr type matnr.
Matnr = '000000 '.
Export matnr to database indx (AA) ID 'ytest _ matnr '. Execute the program, and then view the table indx in SE16. A record with relid = AA, srtfd = ytest_matnr is added. If the export data volume is large, multiple new entries are added. The field value srtf2 of these entries increases from 0. The difference between export database and common database operations is that it is suitable for operations with large data volumes. The System Automatically splits it into multiple records and stores them in the database, such as slices or documents. On the contrary, the system will automatically combine these records into a whole.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.