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

diff between sync and async

Former Member
0 Likes
941

hai all

ihave confusion regarding synchronous and asynchronous with respect to session and calltransaction methods plz clear my confusion.

thanks in advance.

mounika

7 REPLIES 7
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
791
Read only

Former Member
0 Likes
791

Hi Mounika,

Check this out

This clears your doubt

Call transaction <tcode> using <BDCTAB>

Mode <A/N/E>

Update <b><S/A></b>

Messages into <MSGTAB>.

Parameter – 1 is transaction code.

Parameter – 2 is name of BDCTAB table.

Parameter – 3 here you are specifying mode in which you execute transaction

A is all screen mode. All the screen of transaction are displayed.

N is no screen mode. No screen is displayed when you execute the transaction.

E is error screen. Only those screens are displayed wherein you have error record.

Parameter – 4 here you are specifying update type by which database table is updated.

<b>S is for Synchronous update in which if you change data of one table then all the related Tables gets updated. And sy-subrc is returned i.e., sy-subrc is returned for once and all.

A is for Asynchronous update. When you change data of one table, the sy-subrc is returned. And then updating of other affected tables takes place. So if system fails to update other tables, still sy-subrc returned is 0 (i.e., when first table gets updated).</b>

Parameter – 5 when you update database table, operation is either successful or unsuccessful or operation is successful with some warning. These messages are stored in internal table, which you specify along with MESSAGE statement. This internal table should be declared like BDCMSGCOLL, a structure available in ABAP/4. It contains the following fields:

Reward if it helps

Regards,

Santosh

Read only

abdul_hakim
Active Contributor
0 Likes
791

hi bhatya,

<b>Asynchronous processing:</b>

Your program doesn't wait for the called transaction to be completed.As soon as your program calls a transaction it will start carrying out other works.This will result in faster execution.

<b>Synchronous Processing:</b>

Your program wait for the called transaction to be completed.Unless the called transcation is completed your program wont resume processing.Processing will be slow compared to asynchrounous approach..

Cheers,

Abdul Hakim

Mark all useful answers..

Read only

Former Member
0 Likes
791

hi mounika,

The UPDATE addition determines the processing mode for batch input processing. You can specify a character-type object for upd. Its possible content and its effect are displayed in the following table. Without use of one of the additions UPDATE or OPTIONS FROM, the effect is the same as if upd had the content "A".

<b>Asynchronous update</b>. Updates of called programs are executed in the same way as if in the COMMIT WORK statement the AND WAIT addition was not specified.

<b>Synchronous processing</b>. Updates of the called programs are executed in the same way as if in the COMMIT WORK statement the AND WAIT addition had been specified.

<b> Local update.</b> Updates of the called program are executed in such a way as if the SET UPDATE TASK LOCAL statement had been executed in it.

Other As for "A".

check these thread..

hope this helps,

do reward if it helps,

priya.

Read only

Former Member
0 Likes
791

Hi mounika,

In synchronous mode until and unless all the related database tables for the transaction are committed the control does not return to the program which does the call transaction, whereas in asynchronous mode it does not wait for the update of all the related tables and returns to the program. So the problem which you can face in case of asynchronous update typically can be using any system variable or database for the value passed/ updated by the call transaction. E.g. if you have created a customer through internal No assignment, after the successful update the SY-MSGV1 stores the number generated. So in case if you use asynchronous update and try to fetch the value of SY-MSGV1 after call transaction, it will not return you correct values as the database is yet not updated..!!!!! but ASYNCRONOUS mode is faster than synchronous mode.

Also check this link:

http://www.sappoint.com/abap/bdcconcept.pdf

Hope this helps.

regards,

keerthi.

Message was edited by: keerthi kiran varanasi

Read only

Former Member
0 Likes
791

HI,

Synchronous Update

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. The following diagram illustrates the synchronous update process:

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.

Asynchronous Update

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.

The following diagram shows a typical 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:

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.

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.

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.

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.

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.

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.

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.

Regards,

Laxmi.

Read only

Former Member
0 Likes
791

hi all,

thanku for u r replies. they really helped me a lot.

regards,

mounika.