‎2006 Dec 07 3:33 PM
hi experts,
You are given functional specs for a BDC program
and you need to decide whether to write a method
call transaction or a session. How u will decide?
thanks in advance.
‎2006 Dec 07 3:40 PM
Hi,
Both methods are good.
Generally session method is better because the system will give a log and automatically create a new session if there are transactions failed. Also it is good to handle large amount of transactions and reprocessing the error.
For online report purposes, it is better using call transaction method since dealing with small numbers of transaction.
Hope this will help.
Regards,
Ferry Lianto
‎2006 Dec 07 3:42 PM
Hi Raju,
That is depends on the requirement, for example if the data is large, then we go for session method(coz, errors will take care implicitly-error log will be created-if any errors)
and
if there is less data then we prefer call transaction method..
Hope it clears u..
Don't forget to Reward Points for all helpful answers..
Thanks
Kumar
‎2006 Dec 07 3:48 PM
Hi Surendra,
A good way is to use the Call Transaction and creating a Batch Input for errors treating.
Eg :
* Call transaction
CALL TRANSACTION 'CT02' USING W_BDCDATA MODE 'N' UPDATE 'S'
MESSAGES INTO W_MESSTAB.
* If subrc <> 0 : batch input session
IF SY-SUBRC <> 0.
W_COMPT_ERR = W_COMPT_ERR + 1.
PERFORM ERROR_TREATMENT.
ELSE.
REFRESH W_BDCDATA.
ENDIF.
*&---------------------------------------------------------------------*
*& Form ERROR_TREATMENT
*&---------------------------------------------------------------------*
FORM ERROR_TREATMENT.
IF W_COMPT_ERR EQ '1'.
PERFORM TREAT_BDC TABLES WE_BDCDATA
USING P_BATCH ' ' 'O'.
ENDIF.
PERFORM TREAT_BDC TABLES WE_BDCDATA
USING ' ' 'CT02' 'I'.
ENDFORM.
*----------------------------------------------------------------------*
* FORM TREAT_BDC
**----------------------------------------------------------------------
* Error treatment creating a Bacth Input session
*-----------------------------------------------------------------------
* - wf_bdcdata: internal table type BDCDATA, *
* - wf_dossier: Batch Input session name *
* - wf_trans: transaction code *
* - wf_mode: O, I, OU C. *
*----------------------------------------------------------------------*
FORM TREAT_BDC TABLES WF_BDCDATA
USING WF_DOSSIER WF_TRANS WF_MODE.
* Open Batch Input
IF WF_MODE = 'O'.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
* DEST = FILLER8
GROUP = WF_DOSSIER
* HOLDDATE = FILLER8
* KEEP = FILLER1
USER = SY-UNAME
* RECORD = FILLER1
* IMPORTING
* QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11.
IF SY-SUBRC <> 0.
MESSAGE E016 WITH WF_DOSSIER.
ENDIF.
ENDIF.
* Call BDC_INSERT
IF WF_MODE = 'I'.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'CT02'
* POST_LOCAL = NOVBLOCAL
* PRINTING = NOPRINT
TABLES
DYNPROTAB = W_BDCDATA
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7.
IF SY-SUBRC <> 0.
MESSAGE E017 WITH WF_TRANS.
ENDIF.
REFRESH W_BDCDATA.
ENDIF.
* Closing Batch Input
IF WF_MODE = 'C'.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE E018.
ENDIF.
ENDIF.
ENDFORM.This method is user-friendly and if there are errors, you can treat them using the traditionnal SM35.
Regards,
Erwan
‎2006 Dec 07 3:52 PM
Hi Surendra,
Call Transaction is the faster of the two methods for BDC.This method is good enough if the no: of records processed is less.Some imp. features of the same are:
1.Synchronous processing
2. Database update both synchronously and asynchronously
3. No batch input processing log(You can get the error messages automatically in a internal table <MESSTAB> .
Batch Input is the recommended method if you have large data to be processed. Support for playing back and correcting sessions that contain errors, and detailed logging.
Important featurres:
1. Asynchronous processing
2. Transfers data for multiple transactions
3. Synchronous database update
Regards,
Chetan.
PS:Reward points if this helps.