‎2007 Oct 11 8:22 AM
Hi all,
Can anybody give the differenc between synchronus and asynchronu method with good example. (Flow)
with regards
anand
‎2007 Oct 11 8:28 AM
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
‎2007 Oct 11 8:24 AM
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.
‎2007 Oct 11 8:24 AM
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>
‎2007 Oct 11 8:28 AM
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