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

Import data from file - parallel processing

Former Member
0 Likes
1,071

ABAP program, Z_IMPORT, import data from txt files (exported from an external system) in DB SAP via BAPI. I would like to prevent parallelism, ie more than one Z_IMPORT cannot be running simultaneously. It seems to me that this is The Most elegant way to avoid concurrent access of process Z_IMPORT to files on disk, that contain data to be imported. The program Z_IMPORT launches with SAP scheduler time, but also can be launched by hand. BAPI_TRANSACTION_COMMIT can be with or without "WAIT", according to the user's choice, setting the corresponding parameter.

If there are traffic lights on the processes in ABAP? How do you solve?

A piece of sample code greatly appreciated would be.

Thanks in advance,

Serena

1 ACCEPTED SOLUTION
Read only

madhu_vadlamani
Active Contributor
0 Likes
951

Hi Serena,

Can you explain in detail what is traffic lights here.We can keep traffic lights green,yellow and green lights.If you give more details then easy to help.

Regards,

Madhu

6 REPLIES 6
Read only

madhu_vadlamani
Active Contributor
0 Likes
952

Hi Serena,

Can you explain in detail what is traffic lights here.We can keep traffic lights green,yellow and green lights.If you give more details then easy to help.

Regards,

Madhu

Read only

0 Likes
951

Thanks, madhurao123!

1. I wanted to know which ones are synchronization objects and how to use (such as: blocking, semaphors ....) in SAP for that two processes (for example, two programs) Z_INPUT can not access the same object at the same time.

2. How do you solve this situation: Run 1. Z_INPUT program, after which run 2. Z_INPUT program. This second understands that there is another program Z_INPUT runned and (second) ends immediately.

Ciao,

Serena

Read only

0 Likes
951

As Arseni wrote, use a lock object. (ref [SAP Lock Concept |http://help.sap.com/saphelp_nw04/helpdata/en/7b/f9813712f7434be10000009b38f8cf/frameset.htm])

Choice an object to lock and identify the FM that performs the lock, choice an object that is not required by another program in a productive environment.

- program - E_EPROG -> ENQUEUE_EPROG

- database table - E_TABLEE -> ENQUEUE_TABLEE

At the start of execution of the program try to lock the object, if already locked, an other instance of the report is running, you can exit, or wait in a loop.

At the end of program a DEQUEU<lock_object> or a COMMIT/ROLLBACK can release the lock, but the end of the job will also release it.

Regards,

Raymond

Read only

0 Likes
951

Raymond, thank you. I need loock of the process Z_INPUT.

Could you explain this

"choice is not an object That required by another program in a productive environment."

If I'm wrong in choosing the object can do damage into productive environment?

Read only

0 Likes
951

No damage will occur, as you locked an object, a user that requires the same lock will get a message like "data locked by another user", and will not be able to perform some updates, no damage will occur. (Actually it is what we want, the second job will get this message (sy-subrc ne 0) and leave)

You could lock via ENQUEUE_TABLEE a table that does not exist (so nobody will try to lock it) there is no existence-check in lock FM.

Regards,

Raymond

Read only

arseni_gallardo
Active Participant
0 Likes
951

Serena,

I guess that the best solution is to use lock objects. You could use ES_PROG or a copy of it. At the beginning of your Z_IMPORT you must call that associate lock function module and at the end you must call the unlock function module. If you use ES_PROG they would be ENQUEUE_EPROG and DEQUEUE_EPROG.

Kinf regards