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: 

synchronous & asynchronous

Former Member
0 Kudos

What is the difrence between synchronous & asynchronous methods. what is the logit behind this?

Thanks.

Khan

1 ACCEPTED SOLUTION

Former Member
0 Kudos

<b>Asynchronous processing</b> - Transfers data for multiple transactions

<b>Synchronous processing</b> - Transfers data for a single transaction .

so now

<b>BDC Session</b> : - Asynchronous processing - Transfers data for multiple transactions - Synchronous database update During processing, no transaction is started until the previous transaction has been written to the database. - A batch input processing log is generated for each session - Sessions cannot be generated in parallel.

<b>BDC CALL TRANSACTION</b>: -Synchronous processing - Transfers data for a single transaction - Synchronous and asynchronous database updating both possible The program specifies which kind of updating is desired. - Separate LUW for the transaction The system performs a database commit immediately before and after the CALL TRANSACTION USING statement. - No batch input processing log is generated.

reward points if it is usefull....

Girish

5 REPLIES 5

Former Member
0 Kudos

Hi ,

Synchronous Update : This means say if u have 10 records to update and the processing is going on in a loop the Synchronous update will wait till each update is actually done in the data base and then it will move on the next record's updation.

Asynchronous : In This mode, the updates are lined one after the other and the system doesn't wait for the updates to actually happen. These updates are then triggered by an internally scheduled job which then actually updates the data in the databse.

reward points for useful answers

Former Member
0 Kudos

Hi,

A Asynchronous updating. In this mode, the called transaction does not wait for any updates it produces to be completed. It simply passes the updates to the SAP update service. Asynchronous processing therefore usually results in faster execution of your data transfer program.

Asynchronous processing is NOT recommended for processing any larger amount of data. This is because the called transaction receives no completion message from the update module in asynchronous updating. The calling data transfer program, in turn, cannot determine whether a called transaction ended with a successful update of the database or not.

If you use asynchronous updating, then you will need to use the update management facility (Transaction SM12) to check whether updates have been terminated abnormally during session processing. Error analysis and recovery is less convenient than with synchronous updating.

S Synchronous updating. In this mode, the called transaction waits for any updates that it produces to be completed. Execution is slower than with asynchronous updating because called transactions wait for updating to be completed. However, the called transaction is able to return any update error message that occurs to your program. It is much easier for you to analyze and recover from errors.

L Local updating. If you update data locally, the update of the database will not be processed in a separate process, but in the process of the calling program. (See the ABAP keyword documentation on SET UPDATE TASK LOCAL for more information.)

ReGARDS

Former Member

hi

<b>Synchronous:</b> calling program doesnot continue to execute until the called program has finished execution

<b>ASynchronous</b> calling program continue to execute irrespective of the fact that the called program has finished execution or not.

example



CALL FUNCTION 'ABAP4_CALL_TRANSACTION' STARTING NEW TASK 'TEST'
  EXPORTING
    tcode                   = 'SM59'
  EXCEPTIONS
    call_transaction_denied = 1
    tcode_invalid           = 2
    OTHERS                  = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


CASE sy-subrc.
  WHEN 2.
    WRITE 😕 ' transaction doesnot exist'.

ENDCASE.

WRITE: / ' Demo For Asynchronous Transaction End'

<b>if u dont write STARTING NEW TASK 'TEST' then its synchronous call because the transaction sm59 will open in another session in case of asynch call rest of the prog continues to execute . while in sync call sm59 opens in same session ie until the trxn doesnot execute the prog does execute further. hope it clears ur doubt.</b>

reagrds

ravish

<b>plz reward if helpful</b>

Former Member
0 Kudos

<b>Asynchronous processing</b> - Transfers data for multiple transactions

<b>Synchronous processing</b> - Transfers data for a single transaction .

so now

<b>BDC Session</b> : - Asynchronous processing - Transfers data for multiple transactions - Synchronous database update During processing, no transaction is started until the previous transaction has been written to the database. - A batch input processing log is generated for each session - Sessions cannot be generated in parallel.

<b>BDC CALL TRANSACTION</b>: -Synchronous processing - Transfers data for a single transaction - Synchronous and asynchronous database updating both possible The program specifies which kind of updating is desired. - Separate LUW for the transaction The system performs a database commit immediately before and after the CALL TRANSACTION USING statement. - No batch input processing log is generated.

reward points if it is usefull....

Girish

Former Member
0 Kudos

Hi,

<u><b>Asynchronous Update</b></u>

A typical R/3 installation contains dialog work processes and at least one update work process. The update work processes are responsible for updating the database. When an ABAP program reaches a COMMIT WORK statement, any function modules from CALL FUNCTION... IN UPDATE TASK statements are released for processing in an update work process. The dialog process does not wait for the update to finish. This kind of update is called asynchronous update.

For example, suppose a user wants to change an entry in a database table, or add a new one.

He or she enters the necessary data, and then starts the update process by choosing Save. This starts the following procedure in the ABAP program:

1. Firstly, the program locks the database entry against other users, using the enqueue work process (or the message server in the case of a distributed system). This generates an entry in the lock table. The user is informed whether the update was successful, or whether the lock could not be set because of other users.

2. If the lock is set, the program reads the entry that is to be changed and modifies it. If the user has created a new entry, the program checks whether a record with the same key values already exists.

3. In the current dialog work process, the program calls a function module using CALL FUNCTION... IN UPDATE TASK, and this writes the change details as an entry in table VBLOG.

4. When the program is finished (maybe after further dialog steps), a COMMIT WORK statement starts the final part of the SAP LUW. The work process that is processing the current dialog step starts an update work process.

5. Based on the information passed to it from the dialog work process, the update work process reads the log entries belonging to the SAP LUW from table VBLOG.

6. The update work process passes this data to the database for updating, and analyzes the return message from the database. If the update was successful, the update work process triggers a database commit after the last database change and deletes the log entries from table VBLOG. If an error occurred, the update work process triggers a database rollback, leaves the log entries in table VBLOG, flags them as containing errors, and sends a SAPoffice message to the user, who should then inform the system administrator.

7. The corresponding entries in the lock table are reset by the update work process.

Asynchronous update is useful when response time from the transaction is critical, and the database updates themselves are so complex that they justify the extra system load of logging them in VBLOG. If you are running a transaction in a background work process, asynchronous update offers no advantages.

<u><b>Synchronous Update</b></u>

In synchronous update, you do not submit an update request using CALL FUNCTION... IN UPDATE TASK. Instead, you use the ABAP statement COMMIT WORK AND WAIT. When the update is finished, control passes back to the program. Synchronous update works in the same way as bundling update requests in a subroutine (PERFORM ON COMMIT). This kind of update

is useful when you want to use both asynchronous and synchronous processing without having to program the bundles in two separate ways.

Use this type of update whenever the changed data is required immediately. For example, you may want to link SAP LUWs together where one LUW depends on the results of the previous one.

Regards,

Bhaskar