‎2010 Dec 02 11:53 AM
Hi all,
How can I pass the XKOMV structure in run-time to a memory id and import it? A user exit is written for VA01 transaction and it has the condition values accessible in XKOMV. I want to import this structure in other program and access some condition values in run-time. how can I do that? I have tried writing
data : zkomv type TABLE OF komv.
import zkomv from memory id 'TMPKOMV'.
in the calling program and
EXPORT xkomv to MEMORY id 'TMPKOMV'.
in the exit where XKOMV has values while creating a sales order. it shows zero record in zkomv.
Please let me know the correct way of doing this.
thanks in advance,
Binita
‎2010 Dec 02 12:07 PM
for exporting internal table data use
data : zkomv type TABLE OF komv,
ykomv type table of komv.
append lines of xkomv to ykomv.
EXPORT zkomv = ykomv to MEMORY id 'TMPKOMV'.for importing data use
data : zkomv type TABLE OF komv,
ykomv type table of komv.
import zkomv = ykomv from memory id 'TMPKOMV'.
‎2010 Dec 02 11:57 AM
If the program that you want to execute your check in has access (in the call stact) of the main program that uses this structure then you can use the following code: -
FIELD-SYMBOLS <XKOMV> type XKOMV.
constants c_XKOMV( ) value '(MAIN_PROGRAM)XKOMV'.
assign (c_XKOMV) to <XKOMV>.
You will need to replace the 'MAIN_PROGRAM' with the main program name of where XKOMV is defined.
‎2010 Dec 02 11:58 AM
HI
Have you pass the values ZKOMV = XKOMV ?
I hope u have passed.
‎2010 Dec 02 12:07 PM
for exporting internal table data use
data : zkomv type TABLE OF komv,
ykomv type table of komv.
append lines of xkomv to ykomv.
EXPORT zkomv = ykomv to MEMORY id 'TMPKOMV'.for importing data use
data : zkomv type TABLE OF komv,
ykomv type table of komv.
import zkomv = ykomv from memory id 'TMPKOMV'.
‎2010 Dec 02 1:00 PM
Thanks a lot Vinod, It worked !! YKOMV now has value after I import it. but i still don't understand one thing. why should I declare the tables with same name while importing and exporting. there is no connection between these two programs. isn't memory id 'TMPKOMV' enough?
‎2010 Dec 02 3:12 PM
I don't understand why you need to do that though? It sounds like some sort of hack workaround in update/output processing. It's good that you got the solution you were looking for but sometimes if you state your actual requirement, you might get a better one...
‎2010 Dec 04 11:47 AM
Thanks for the feedback Brad. the actual requirement is as I stated, I have a user exit written on VA01 transaction. in runtime, I get the condition values in XKOMV structure. This VA01 transaction is run through BDC from some other program. So, I want to save some five condition's values somewhere and access those values after BDC is through and the call is return to the program. So while the User Exit is triggered, I am saving those values as Vinod suggested, exporting it to some Memory ID and Importing the same in my program. I hope I have explained well..
Thanks,
Binita
‎2010 Dec 04 1:02 PM
Hi
Thats's ok but why don t you save them in the userò- exit without to' submit another programma?
Max
‎2010 Dec 02 12:17 PM
Example
REPORT ztest1.
DATA: name TYPE char20 VALUE 'name'.
EXPORT name TO MEMORY ID 'TEST'.
SUBMIT ztest2 AND RETURN.
REPORT ztest2.
DATA: name TYPE char20.
IMPORT name FROM MEMORY ID 'TEST'.
IF sy-subrc = 0.
WRITE: / name.
ENDIF.
‎2010 Dec 02 12:39 PM
SAP provides a mechanism for storing data values, including tables, in one program and retrieving those values in another program, even on another application server, through the use of tables like table INDX. Depending upon how your programs are being executed, you might want to research use of "INDX-like" tables on SCN.
Additionally, you might want to look at what SAP calls "shared objects", which would make your data available to any program on the same server for a defined period of time.