Application Development 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: 

Import / export statements fails sometimes in loop process

ronaldo_aparecido
Contributor
0 Kudos
908

hello community

I start a function call via call transaction from a Z program, but first I send a value to memory and within an ehancement I get the value from memory and use it within the call transaction. And it works ok.

The problem is that the bulk processing of multiple records seems to be causing the import not to work sometimes, does anyone know how I can replace the import command with something else? if it is a table, what would be the cleaning logic?

5 REPLIES 5

EnnoWulff
Active Contributor
0 Kudos
724

There might be some issues with your process. If something sometimes does not work properly then often the booking process is to blame.

Maybe you call a BAPI that creates an object and afterwards you select the created data from the database. This might not work sometimes if the booking process is too slow (e.g. because of high system usage).

In this case try SET UPDATE TASK LOCAL before calling the BAPI.

Maciej_Domagała
Contributor
0 Kudos
724

When you use such technique as you mentioned (export some data to ABAP memory before calling a transaction and then import from ABAP memory within that transaction) - and you perform several such "export/call" operations in a loop - then you should make sure that you either:

- export data to ABAP memory ID in every loop pass - not just in some of the loop passes (and for some other loop passes you skip the export at all);

- OR: within you transaction being called - in the code that performs "import from memory id" - you also clean the data which has been previously exported to ABAP memory (by performing either "free memory id" or by exporting empty data - whichever is more suitable for you).

This way you can guarantee that your loop will never call a transaction while the ABAP memory contains data exported by some of the previous loop passes. If this is not guaranteed in your code, this can be a reason of the problems you observe.

Another question: how can you replace the import command with something else:

- Instead of using "export/import to memory id" you can use your own function group created for this purpose. You can create a function group consisting of two function modules, say: 'Z_EXPORT_SOMETHING' and 'Z_IMPORT_SOMETHING'. Fm Z_EXPORT_* will get some data on input and store them in the global data of your function group - and fm Z_IMPORT_* will just read that global data of the function group and return them to the caller. This can be another technique which basically does the same thing as export/import statements - but you are still responsible for proper clearing of the data being exported if you are going to call all of that stuff in a loop.

regards

Sandra_Rossi
Active Contributor
0 Kudos
724

There's nothing wrong with Import, except if you don't consider the limitations = should be on same server (memory is not shared, it's not database).

You need to find a way to know when it doesn't "work sometimes", and investigate why, instead of just asking for another solution.

Is it a CALL TRANSACTION for dialog or for batch input? Do you have several application servers?

ronaldo_aparecido
Contributor
0 Kudos
724

sandra.rossi is a call transaction for batch input one aplication server

Sandra_Rossi
Active Contributor
0 Kudos
724

So you are using CALL TRANSACTION with batch input.

I checked if it could be an issue, but it works the same way as the classic CALL TRANSACTION (in dialog), it's executed in the same application server (ABAP documentation: "When the transaction is called, the ABAP program linked to the transaction code is loaded in a new internal session of the current call sequence. The session of the calling program and the current SAP LUW are retained. ").

It's probably due to the way your program works. You delete the memory somewhere or you open a new external session (RFC, update task, etc.) I can't say.

I never heard of an ABAP bug concerning EXPORT/IMPORT with memory, but you can open a ticket at SAP support.

NB: I did a test to be sure, running the CALL TRANSACTION with batch input twice, I didn't see any bug. My line with IMPORT works all the time.