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

Export XKOMV structure

Former Member
0 Likes
2,315

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,864

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'.

9 REPLIES 9
Read only

Former Member
0 Likes
1,864

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.

Read only

Former Member
0 Likes
1,864

HI

Have you pass the values ZKOMV = XKOMV ?

I hope u have passed.

Read only

Former Member
0 Likes
1,865

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'.

Read only

0 Likes
1,864

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?

Read only

0 Likes
1,864

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...

Read only

0 Likes
1,864

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

Read only

0 Likes
1,864

Hi

Thats's ok but why don t you save them in the userò- exit without to' submit another programma?

Max

Read only

Former Member
0 Likes
1,864

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.

Read only

Former Member
0 Likes
1,864

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.