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

bdc-update

Former Member
0 Likes
550

Hi all,

Can anybody give the differenc between synchronus and asynchronu method with good example. (Flow)

with regards

anand

1 ACCEPTED SOLUTION
Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
490

Hi Anand

Synchronous: calling program doesnot continue to execute until the called program has finished execution

ASynchronous 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'

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.

reagrds

ravish

<b>plz reward if helpful</b>

Regards,

Sree

3 REPLIES 3
Read only

Former Member
0 Likes
490

hi,Synchronus data processing is that in which the program calling the update task waits for the update work process to finish the update before it continues processing.

In Asynchronus update the callng program does not wait for update work process to finish the update and continues as normal.

A BDC done with sessions is always synchronus.

A BDC with call transaction is by default asynchronus

unless you define it explicitly as

call transaction 'XXXX' ...... update 'S'.

( If you donot define update option it is defaulted to "A" ).

The update method is of importance when one transaction locks data which may be required by a subsequent transaction . The subsequent transaction will fail if data is locked from previous one. An example would be you are creating sales order for same material in succession ( with asynchronus update ). Quite likely that some of transactions would fail due to material locked.

For large volume of data Call Transaction will be faster but you have no restart capability here. Suppose from 1000 transactions 100 fails . You will have to run the BDC program again exclusing the ones which wrere successful. However with session method you have the option to process the error transactions again in SM35 . So if you are sure that errors will not occur use call transaction else use session method.

Read only

Former Member
0 Likes
490

Hi

<b>synchronous updating</b>

DO.

………

PERFORM FILL_BDC_TAB.

CALL TRANSACTION ‘FK02’

USING BDC_TAB

MODE ‘N’

UPDATE ‘S’.

IF SY-SUBRC < > 0.

WRITE: /‘ERROR’.

ENDIF.

ENDDO.

With synchronous updating, we can check SY-SUBRC to determine the success of the transaction and the actual update to the database.

<b>asynchronous updating</b>

DO.

………

PERFORM FILL_BDC_TAB.

CALL TRANSACTION ‘FK02’

USING BDC_TAB

MODE ‘N’

UPDATE ‘A’.

IF SY-SUBRC < > 0.

WRITE: /‘ERROR’.

ENDIF.

ENDDO.

With asynchronous updating, we can check SY-SUBRC to determine the success of the transaction only, not the actual update to the database.

<b>reward if usefull</b>

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
491

Hi Anand

Synchronous: calling program doesnot continue to execute until the called program has finished execution

ASynchronous 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'

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.

reagrds

ravish

<b>plz reward if helpful</b>

Regards,

Sree