<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: funspec in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/funspec/m-p/1810975#M347694</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Surendra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A good way is to use the Call Transaction and creating a Batch Input for errors treating.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eg :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Call transaction
  CALL TRANSACTION 'CT02' USING W_BDCDATA MODE 'N' UPDATE 'S'
                                 MESSAGES INTO W_MESSTAB.


* If subrc &amp;lt;&amp;gt; 0 : batch input session
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    W_COMPT_ERR = W_COMPT_ERR + 1.
    PERFORM ERROR_TREATMENT.
  ELSE.
    REFRESH W_BDCDATA.
  ENDIF.




*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  ERROR_TREATMENT
*&amp;amp;---------------------------------------------------------------------*
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 &amp;lt;&amp;gt; 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 &amp;lt;&amp;gt; 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 &amp;lt;&amp;gt; 0.
      MESSAGE E018.
    ENDIF.
  ENDIF.
ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This method is user-friendly and if there are errors, you can treat them using the traditionnal SM35.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erwan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Dec 2006 15:48:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-12-07T15:48:03Z</dc:date>
    <item>
      <title>funspec</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/funspec/m-p/1810972#M347691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi experts,&lt;/P&gt;&lt;P&gt;You are given functional specs for a BDC program&lt;/P&gt;&lt;P&gt;and you need to decide whether to write a method&lt;/P&gt;&lt;P&gt;call transaction or a session. How u will decide?&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Dec 2006 15:33:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/funspec/m-p/1810972#M347691</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-07T15:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: funspec</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/funspec/m-p/1810973#M347692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both methods are good.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For online report purposes, it is better using call transaction method since dealing with small numbers of transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ferry Lianto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Dec 2006 15:40:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/funspec/m-p/1810973#M347692</guid>
      <dc:creator>ferry_lianto</dc:creator>
      <dc:date>2006-12-07T15:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: funspec</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/funspec/m-p/1810974#M347693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Raju,&lt;/P&gt;&lt;P&gt;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)&lt;/P&gt;&lt;P&gt; and&lt;/P&gt;&lt;P&gt; if there is less data then we prefer call transaction method..&lt;/P&gt;&lt;P&gt;Hope it clears u..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't forget to Reward Points for all helpful answers..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Dec 2006 15:42:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/funspec/m-p/1810974#M347693</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-07T15:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: funspec</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/funspec/m-p/1810975#M347694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Surendra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A good way is to use the Call Transaction and creating a Batch Input for errors treating.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eg :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Call transaction
  CALL TRANSACTION 'CT02' USING W_BDCDATA MODE 'N' UPDATE 'S'
                                 MESSAGES INTO W_MESSTAB.


* If subrc &amp;lt;&amp;gt; 0 : batch input session
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    W_COMPT_ERR = W_COMPT_ERR + 1.
    PERFORM ERROR_TREATMENT.
  ELSE.
    REFRESH W_BDCDATA.
  ENDIF.




*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  ERROR_TREATMENT
*&amp;amp;---------------------------------------------------------------------*
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 &amp;lt;&amp;gt; 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 &amp;lt;&amp;gt; 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 &amp;lt;&amp;gt; 0.
      MESSAGE E018.
    ENDIF.
  ENDIF.
ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This method is user-friendly and if there are errors, you can treat them using the traditionnal SM35.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erwan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Dec 2006 15:48:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/funspec/m-p/1810975#M347694</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-07T15:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: funspec</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/funspec/m-p/1810976#M347695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Surendra,&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;1.Synchronous processing &lt;/P&gt;&lt;P&gt;2. Database update both synchronously and asynchronously&lt;/P&gt;&lt;P&gt;3. No batch input processing log(You can get the error messages automatically in a internal table &amp;lt;MESSTAB&amp;gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Important featurres:&lt;/P&gt;&lt;P&gt;1. Asynchronous processing &lt;/P&gt;&lt;P&gt;2. Transfers data for multiple transactions&lt;/P&gt;&lt;P&gt;3. Synchronous database update&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chetan.&lt;/P&gt;&lt;P&gt;PS:Reward points if this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Dec 2006 15:52:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/funspec/m-p/1810976#M347695</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-07T15:52:37Z</dc:date>
    </item>
  </channel>
</rss>

