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

Problem with Import/ Export

Karan_Chopra_
Active Participant
0 Likes
2,593

I have problem with import / export statement

I have used the below statements.

I am using this in Badis but the problem is if two users use the transaction simultaniously

BADI 1

wa_indx-aedat = sy-datum.

  wa_indx-usera = sy-uname.

  wa_indx-pgmid = sy-repid.

 

  EXPORT ct_param FROM ct_param

    TO DATABASE indx(ab)

    ID 'CTPARAM'

    FROM wa_indx

    .

  BADI 2

    IMPORT ct_param TO  ct_param

    FROM DATABASE indx(ab)

    ID 'CTPARAM'.

  there is problem in data i.e if one user has exported and the other user has completed the

  transaction the previous user also sees the data data of latter user.

  the sequence is as below

  Export --- user1

  export --- user 2

  import --- user 2

  import --- user 1

 

This way user 1 has data of user 2 as it is already overwritten (export --- user2)

  How to solve this prob.

9 REPLIES 9
Read only

Former Member
0 Likes
2,035

Hi Karan,

Export to database index will not work for your requirement because it is a permanent storage in INDX table and you are using the same id. You can use simple export and import or get/set fm or method for your purpose.

EXPORT ct_param TO ct_param to MEMORY ID 'ZZMEM123'.

IMPORT ct_param FROM ct_param to MEMORY ID 'ZZMEM123'.

Make sure the variable name is same for both EXPORT and IMPORT.

Regards,

R

Read only

0 Likes
2,035

Hi, keep in mind that IMPORT/EXPORT Statements works only for passing variables among all internal sessions of an external session.

Please check this if it is ok according to this, then i can help you with the syntax.

Greetings.

Message was edited by: Marcos Carrasco

Read only

0 Likes
2,035

The users were using different user IDs but as INDX table does not have User Id as primary keys using export to database overwrites the entries.

If we use  EXPORT ct_param TO ct_param to MEMORY ID 'ZZMEM123' will this work with different IDs

What if the Users use a common SAP ID  but Different Machines. will it have individual memories or same will be overwritten as above.

Also what is SET/GET FM or any method for the same.


Read only

Former Member
0 Likes
2,035

Hi,

ID CTPARAM must be unique for each user id.

  EXPORT ct_param FROM ct_param

    TO DATABASE indx(ab)

    ID 'CTPARAM'

    FROM wa_indx

If that is not the case then multiple user who are using same ID will get locking Error in INDX table.

Read only

0 Likes
2,035

EXPORT ct_param FROM ct_param

    TO DATABASE indx(ab) is not working here as in INDX table user Id is not primary key and data gets overwritten.

Please confirm me  if

EXPORT ct_param TO ct_param to MEMORY ID 'CT_PARAM' will be working in this scenario.

If the events occur in this sequence with same User ID on different machines


  1.   Export ct_param TO ct_param to MEMORY ID 'CT_PARAM'--- user 1
  2.   Export ct_param TO ct_param to MEMORY ID 'CT_PARAM'--- user 2
  3.   Import ct_param TO ct_param to MEMORY ID 'CT_PARAM'--- user 2 ( Will it overwrite statement 1 memory ID data? )
  4.   Import ct_param TO ct_param to MEMORY ID 'CT_PARAM'--- user 1 ( Will it fetch statement 2 export data? )

Now I this case will the User 1 have data of User 2 in memory ID 'CT_PARAM' as User 2's Export (statement 2) might have overwritten User 1's Export (statement 1), so will the User 1 will get User 2's memory ID data ?

<removed by moderator>

Message was edited by: Thomas Zloch

Read only

rene_libbert
Explorer
0 Likes
2,035

Hi Karan,

with export to and import from memory ID never data will be exchanged between different users.

Don't know wether i understand your problem. If 2 BAdIs run in same internal session und you would like to pass data from one to the other, just use the same class for booth BAdI Impl. and put the data to static attributes.

Regards René


Read only

0 Likes
2,035

No the USERs are different means they are different machines but SAME SAP ID

What will be the data in that case will this work or not

Read only

0 Likes
2,035

have a look at http://help.sap.com/abapdocu_70/en/ABENMEMORY_ORGANIZATION.htm

memory ID depends on a user session. A second login with the same user ID is a second user session. To pass data between the 2 user sessions you have to use the DB.

Read only

0 Likes
2,035

Hi Karan,

What Rene has explained here is that one user having 2 separate logons have 2 different internal sessions and the data in memory is not copied.

Try this program by logging in form 2 different systems and look at the outputs. Check the results in Debug mode.

DATA lv_time TYPE sy-timlo.
lv_time  = sy-timlo.
EXPORT lv_time     TO MEMORY ID 'id'.
IMPORT lv_time = lv_time FROM MEMORY ID 'id'.
write lv_time.

Thanks,

Shambu

Message was edited by: Shambu VS