Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Sap Memory

Former Member
0 Likes
1,776

hello,

according to the documentation of SAP MEMORY it says the value will be reatained bwtween transactions and also between internal and external sessions. but when i call the function module in updated task , and when i try to get the paarmeters it is not able to get it is retruning sy-subrc as 4. so what has to be done.

cheers

19 REPLIES 19
Read only

FredericGirod
Active Contributor
0 Likes
1,611

Hi,

if you speak about shared memory, yes, you can read it from anywhere.

Rgd

Frédéric

Read only

0 Likes
1,611

hai,

how to make pass it to shared memory.

chhers

Read only

0 Likes
1,611

From the SAP docs (in SE38)

TYPES: BEGIN OF ITAB3_TYPE, 
          CONT(4), 
       END OF ITAB3_TYPE. 
DATA: INDXKEY LIKE INDX-SRTFD VALUE 'KEYVALUE', 
      F1(4), F2 TYPE P, 
      ITAB3 TYPE STANDARD TABLE OF ITAB3_TYPE WITH 
                 NON-UNIQUE DEFAULT KEY INITIAL SIZE 2, 
      WA_INDX TYPE INDX. 

* Before export, fill the data fields 
* before CLUSTR. 
WA_INDX-AEDAT = SY-DATUM. 
WA_INDX-USERA = SY-UNAME. 
* Export der Daten. 
EXPORT F1    FROM F1 
       F2    FROM F2 
       ITAB3 FROM ITAB3 
       TO SHARED BUFFER INDX(ST) FROM WA_INDX ID INDXKEY.

I have asked here, question about shared memory, I will try to find the link

---

Here a long link about shared memory :

and in bonus another one

Fred

Message was edited by: Frédéric Girod

Read only

Former Member
0 Likes
1,611

Hi,

You can use IMPORT and EXPORT .

Sample code.

  • Exporting to the ABAP/4 Memory

EXPORT ALL_CUSTOMERS ALL_BOOKINGS

TO MEMORY ID 'CUSTBOOK'.

Similarly you can use.

IMPORT ALL_BOOKINGS TO NEW_BOOKINGS

FROM MEMORY ID 'CUSTBOOK'.

Cheers

Sunny

Read only

0 Likes
1,611

hai,

ya i ahve used it but it is not able to retrive the values.

cheers

Read only

hymavathi_oruganti
Active Contributor
0 Likes
1,611

how u r trying to get parameters?

in SAP MEMORY, we should use set parameter id and get parameter id statements but not export and import.

export/ import -


abap memory

set parameter id/ get parameter id -


sap memory

export to shared buffer/ import from shared buffer----


global memory.

1.two different programs of same tcode are said to be in abap memory. ex two reports in se38. so to trasnfer data between two reports we use export/ import. <b>submit</b> statement is used.

2. two different transactions will be in SAP MEMORY

ex se38, se11 will be in sap memory.

so when we try to call a transaction with <b>call transaction</b>, we use SET PARAMERT ID/ GET PARAMETER ID

statements which are used to access data in SAP MEMORY

3. Two different logons are said to be in external memory.

external memory is super set of sap memory and in turn sap memory is subset of abap memory.

Read only

hymavathi_oruganti
Active Contributor
0 Likes
1,611

how u r trying to get parameters?

in SAP MEMORY, we should use set parameter id and get parameter id statements but not export and import.

export/ import -


abap memory

set parameter id/ get parameter id -


sap memory

export to shared buffer/ import from shared buffer----


global memory.

1.two different programs of same tcode are said to be in abap memory. ex two reports in se38. so to trasnfer data between two reports we use export/ import. <b>submit</b> statement is used.

2. two different transactions will be in SAP MEMORY

ex se38, se11 will be in sap memory.

so when we try to call a transaction with <b>call transaction</b>, we use SET PARAMERT ID/ GET PARAMETER ID

statements which are used to access data in SAP MEMORY

3. Two different logons are said to be in external memory.

external memory is super set of sap memory and in turn sap memory is subset of abap memory.

Read only

0 Likes
1,611

hai,

actaully waht iam doing is in the user exit iam calling a function mocule in the UPadted task and i am trying to get the value of invoice document number which is not happening.

cheers

Read only

0 Likes
1,611

HOW U R TRYING TO GET THE VALUE?

i mean, i might have written some coding for that rt!!,

Read only

0 Likes
1,611

hai Hymavathi,

the user exit that i am using is not stopping before the invoice number is generated, infact it is stopping before the invoice number is generated. so whati am doing is i am calling a fucntion module in the updated task to capture the invoce number after it is saved in the database. using get parameter id of Belnr of mIra Transaction. but in my fucnvtion module when i try to get the valure nothing is retrived.

cheers

Read only

0 Likes
1,611

Kumar,

I think you go in a wrong way. Using parameter ID to get the result will never work. Just because the parameter ID is instance dependent. That means, if you have 2 sessions (connexion) with the same user, you could have 2 different values for a same parameter ID.

Rgd

Frédéric

Read only

0 Likes
1,611

can u post the code, so that we can check it once

Read only

0 Likes
1,611

hai,

my fucntion module is something in this way.

FUNCTION ZV_ZPAYTDOCU_UPADTE.

*"----


""Update function module:

*"

""Local interface:

*"----


DATA : WA_ZPAYTDOCU TYPE ZPAYTDOCU,

WA_ZPAYTDOCU1 TYPE ZPAYTDOCU,

WORKID TYPE ZPAYTDOCU-WORKID,

WA_ZFT_NEWGEN_ID TYPE ZFT_NEWGEN_ID.

DATA V_VBN TYPE RBKP-BELNR.

GET PARAMETER ID 'RBN' FIELD V_VBN.

IMPORT ZPAYTDOCU-WORKID TO WORKID

FROM MEMORY ID 'key'.

WA_ZPAYTDOCU-SAPDOC = V_VBN.

WA_ZPAYTDOCU-WORKID = WORKID.

INSERT INTO ZPAYTDOCU VALUES WA_ZPAYTDOCU.

ENDFUNCTION.

Read only

0 Likes
1,611

1.check whether 'RBN' is correct parameter id or not for that field V_VBN. u can check in the dataeelement.

2. u r using

<b>IMPORT ZPAYTDOCU-WORKID TO WORKID

FROM MEMORY ID 'key'.</b>

where the export statement there, i mean in which program??

y r u using import/ export, it will not work in case of sap memory, check is there any para,eter id for workid.

3. debug the fn module and check whter values are coming into ZPAYTDOCU

Read only

0 Likes
1,611

hai,

i ahve debugged and checked in the table ZPAYTDOCU it has not been inserted.

the user exit is in SAPLMGMM Program that is (MGMM) function Group and Our Function Module is in (ZVIN1) function Group.

i have checked the Parameter id it is 'RBN' only.

cheers

Read only

0 Likes
1,611

THEN PROBABLY BECAUSE OF THAT IMPORT, check where r u exprting value?

Read only

0 Likes
1,611

hai,

i have commented that import statement (bcos it was not a key field in the table ZPAYTDOCU but still i am not able to get the Parameter value of RBN it is retruning Sy-subrc as 4, when i tryed to Debug.

cheers

Read only

0 Likes
1,611

Again ...

you are using the wrong command :

"ABAP memory

The contents of the ABAP 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. "

Read only

Former Member
0 Likes
1,611

Dear friends,

This is my first reply to ths community. I found that each & every tip given here is useful in one or other way. But we have to combined those tips to get a complete solution.

My problem was that my client needed a different Number Range at Purchase Order level as well as at Purchase Requisition Level.

<b>Purchase Order Number Range Exit :</b>

Enhancement : M06B0003

Exit : EXIT_SAPMM06B_001

INCLUDE : ZXM06U18

ZTABLE : ZPONR

STRUCTURE OF ZPONR :

***************************************************

FIELD DATA ELEMENT

MANDT MANDT

WERKS WERKS_D

BSART ESART

BSTYP BSTYP

NUMKI NUMKI

***************************************************

CODE :

if sy-tcode = 'ME51N' or sy-tcode = 'ME51'.

tables : EBAN.

select single * from ZPONR into ZPONR

where werks = NEBAN-WERKS

AND BSART = NEBAN-BSART

AND BSTYP = NEBAN-BSTYP.

if sy-subrc = '0'.

RANGE = zponr-NUMKI.

endif.

endif.

************************************************************************************

<b>Purchase Requisition Number Range Exit :</b>

This is the real problematic thing for those who don't know how to work with BADI (as I don't know) ...

Enhancement : MEREQ001

First Exit : EXIT_SAPLMEREQ_005

Include : ZXM02U05

Second Exit : EXIT_SAPLMEREQ_009

INCLUDE : ZXM02U09

ZTABLE : ZPONR

STRUCTURE OF ZPONR :

***************************************************

FIELD DATA ELEMENT

MANDT MANDT

WERKS WERKS_D

BSART ESART

BSTYP BSTYP

NUMKI NUMKI

***************************************************

In the first exit, I pick the values of Plant(WERKS), Purchasing Document Type(BSART) & Purchasing Document Category(BSTYP) & put them to SAP SHARED BUFFER because in the main exit i.e., the second exit, where I have to assign the number range, the Values of Item level data i.e. WERKS, BSART & BSTYP are in the form of Object Oriented Objects in BADI, & we can't fetch the single value, so here in the first exit , I took their values & export them to shared memory & in that main exit, I'll fetch them from the shared memory, in that case I don't have to go through the complex BADI operations.

<b>CODE FOR First Exit : EXIT_SAPLMEREQ_005

Include : ZXM02U05</b>

DATA : variable1 TYPE mereq_item-werks.

DATA : variable2 TYPE mereq_item-bsart.

DATA : variable3 TYPE mereq_item-bstyp.

variable1 = im_data_new-werks.

variable2 = im_data_new-bsart.

variable3 = im_data_new-bstyp.

EXPORT variable1 TO SHARED BUFFER indx(st) ID 'ZMOHIT1'.

EXPORT variable2 TO SHARED BUFFER indx(st) ID 'ZMOHIT2'.

EXPORT variable3 TO SHARED BUFFER indx(st) ID 'ZMOHIT3'.

<b>Code for Second Exit : EXIT_SAPLMEREQ_009

INCLUDE : ZXM02U09</b>

IF sy-tcode = 'ME51N' OR sy-tcode = 'ME51'.

TABLES : eban, zponr.

DATA : variable1 TYPE mereq_item-werks.

DATA : variable2 TYPE mereq_item-bsart.

DATA : variable3 TYPE mereq_item-bstyp.

IMPORT variable1 FROM SHARED BUFFER indx(st) ID 'ZMOHIT1'.

IMPORT variable2 FROM SHARED BUFFER indx(st) ID 'ZMOHIT2'.

IMPORT variable3 FROM SHARED BUFFER indx(st) ID 'ZMOHIT3'.

select single * from ZPONR into ZPONR

where werks = VARIABLE1

AND BSART = VARIABLE2

AND BSTYP = VARIABLE3.

if sy-subrc = '0'.

EX_RANGE = zponr-NUMKI.

endif.

endif.

          • IF YOU NEED HELP REGARDING THIS, YOU CAN SEND ME A MAIL AT MY ID, i.e., MOHITGROVER.MCA@GMAIL.COM.