<?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: Examples for using function modules and BApis. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/examples-for-using-function-modules-and-bapis/m-p/3716978#M894792</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hai abhishek..&lt;/P&gt;&lt;P&gt;thx for the reply....&lt;/P&gt;&lt;P&gt;its fine...but why dont u help me in dealing with function modules..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thx,&lt;/P&gt;&lt;P&gt;reshali&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 May 2008 10:04:44 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-05-07T10:04:44Z</dc:date>
    <item>
      <title>Examples for using function modules and BApis.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/examples-for-using-function-modules-and-bapis/m-p/3716976#M894790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My Dear FRNDS,&lt;/P&gt;&lt;P&gt; I am very new to ABAP. And I have read the documentation for  function modules but i am not that clear to practice them.So I would be very happy if u people share a little bit of ur experience with me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please provide me some examples of all the use cases in function modules and specially exception handling.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Frnds, i am going to work with bapis so i feel practicing function module will give me a edge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and please tell me after calling a BAPI FM why we have to perform   'BAPI_TRANSACTION_COMMIT' and 'BAPI_TRANSACTION_ROLLBACK'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.Ur efforts  will be greatly rewarded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thx,&lt;/P&gt;&lt;P&gt;reshali&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2008 09:53:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/examples-for-using-function-modules-and-bapis/m-p/3716976#M894790</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-07T09:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Examples for using function modules and BApis.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/examples-for-using-function-modules-and-bapis/m-p/3716977#M894791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Most of the FMs have a return parameter, that specify that the FM call is successful or not. IF it is successful then call 'BAPI_TRANSACTION_COMMIT' to have a database commit or if it is not successful then revart the changes that are already done in database by 'BAPI_TRANSACTION_ROLLBACK' FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, both this FM calls generally behave like a normal database COMMIT or ROLLBACK. Only difference is that by BAPI you can update the database of a remort system so you need to commit/rollback in that syste. that is why we use 'BAPI_TRANSACTION_COMMIT' or 'BAPI_TRANSACTION_ROLLBACK'  instead of normal commit/rollback.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

        CALL FUNCTION 'BAPI_FIXEDASSET_OVRTAKE_CREATE'
          EXPORTING
            key                 = la_key
            testrun             = l_testrun
            generaldata         = la_generaldata
            generaldatax        = la_generaldatax
            inventory           = la_inventory
            inventoryx          = la_inventoryx
            postinginformation  = la_postinginformation
            postinginformationx = la_postinginformationx
            timedependentdata   = la_timedependentdata
            timedependentdatax  = la_timedependentdatax
            allocations         = la_allocations
            allocationsx        = la_allocationsx
            origin              = la_origin
            originx             = la_originx
          IMPORTING
            assetcreated        = la_assetcreated
          TABLES
            depreciationareas   = li_depreciationareas
            depreciationareasx  = li_depreciationareasx
            cumulatedvalues     = li_cumulatedvalues
            postedvalues        = li_postedvalues
            transactions        = li_transactions
            return              = i_return.

IF NOT i_return[] IS INITIAL.

        CLEAR: wa_return,
               wa_error_file,
               l_message.


        LOOP AT i_return INTO wa_return.

          IF wa_return-type   = 'S'.

            wa_error_file-type = wa_return-type.
            g_no_load = g_no_load + 1.

            IF l_testrun &amp;lt;&amp;gt; 'X'.

              CONCATENATE text-009 la_assetcreated-asset
                  INTO l_message.

              CLEAR: la_assetcreated.

              CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
            ELSE.

              l_message = text-064.
            ENDIF.

            EXIT.
          ELSE.

            IF l_message IS INITIAL.
              CONCATENATE l_message wa_return-message INTO l_message.
            ELSE.
              CONCATENATE l_message wa_return-message INTO l_message SEPARATED BY ','.
            ENDIF.

          ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2008 10:02:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/examples-for-using-function-modules-and-bapis/m-p/3716977#M894791</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-07T10:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: Examples for using function modules and BApis.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/examples-for-using-function-modules-and-bapis/m-p/3716978#M894792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hai abhishek..&lt;/P&gt;&lt;P&gt;thx for the reply....&lt;/P&gt;&lt;P&gt;its fine...but why dont u help me in dealing with function modules..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thx,&lt;/P&gt;&lt;P&gt;reshali&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2008 10:04:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/examples-for-using-function-modules-and-bapis/m-p/3716978#M894792</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-07T10:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: Examples for using function modules and BApis.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/examples-for-using-function-modules-and-bapis/m-p/3716979#M894793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have already given a example above. Another simple example is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  Z34332_BDC                              .

data: i_MATNRSELECTION type table of BAPIMATRAM,
      wa_MATNRSELECTION like line of i_MATNRSELECTION,
      i_MATNRLIST type table of BAPIMATLST,
      wa_MATNRLIST like line of i_MATNRLIST,
      i_return type table of BAPIRET2.

wa_MATNRSELECTION-MATNR_LOW = '000000000000000001'.
wa_MATNRSELECTION-MATNR_HIGH = '000000000000000055'.
wa_MATNRSELECTION-SIGN = 'I'.
wa_MATNRSELECTION-OPTION = 'BT'.
append wa_MATNRSELECTION to i_MATNRSELECTION.
clear : wa_MATNRSELECTION.


CALL FUNCTION 'BAPI_MATERIAL_GETLIST'
 TABLES
   MATNRSELECTION                     = i_MATNRSELECTION
   MATNRLIST                          = i_MATNRLIST
   RETURN                             = i_return
          .

clear: wa_MATNRSELECTION.


write: /'Material'.
loop at i_MATNRLIST into wa_MATNRLIST.
write: / wa_MATNRLIST-MATERIAL.
clear: wa_MATNRLIST.
endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What type of help u need in functional module?&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2008 10:11:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/examples-for-using-function-modules-and-bapis/m-p/3716979#M894793</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-07T10:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Examples for using function modules and BApis.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/examples-for-using-function-modules-and-bapis/m-p/3716980#M894794</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;&lt;/P&gt;&lt;P&gt;Please check this sample codes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BAPI_Z05DOGI_DELIVERY LIKE BAPIOBDLVHDRCON-DELIV_NUMB ,&lt;/P&gt;&lt;P&gt;BAPI_Z05DOGI_HEADER_DATA LIKE BAPIOBDLVHDRCON OCCURS 0 WITH HEADER LINE ,&lt;/P&gt;&lt;P&gt;BAPI_Z05DOGI_HEADER_CONTROL LIKE BAPIOBDLVHDRCTRLCON OCCURS 0 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;BAPI_Z05DOGI_ITEM_DATA LIKE BAPIOBDLVITEMCON OCCURS 0 WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;BAPI_Z05DOGI_ITEM_CONTROL LIKE BAPIOBDLVITEMCTRLCON OCCURS 0 WITH HEADER LINE ,&lt;/P&gt;&lt;P&gt;BAPI_Z05DOGI_RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR: BAPI_Z05D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&lt;P&gt;WAIT = 'X'&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;RETURN = BAPI_Z05DOGI_RETURN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go thru this link&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.planetsap.com/LIST_ALL_BAPIs.htm" target="test_blank"&gt;http://www.planetsap.com/LIST_ALL_BAPIs.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BAPI_TRANSACTION_COMMIT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Execute external Commit when using BAPIs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This method executes a COMMIT WORK command. It is required for&lt;/P&gt;&lt;P&gt;transactions developed externally to the R/3 System that change data in&lt;/P&gt;&lt;P&gt;the R/3 System via BAPI calls.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you call BAPIs in your program that change data in the R/3 System,&lt;/P&gt;&lt;P&gt;afterwards you must call this method to write the changes to the&lt;/P&gt;&lt;P&gt;database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;COMMIT WORK&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The statement COMMIT WORK completes the current SAP LUW and opens a new one, storing all change requests for the currenta SAP LUW in the process&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there are some FM that we use for creating trasaction . for example FM : that use for creating production order . if you execut the FM , the system will not create any data in the system so you need to excute the FM : BAPI_TRANSACTION_COMMIT to commit that creating the production order .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in case of commit work, that is a syntax in abap program . if you use this syntax after you insert ,update or delete table in the sap ,system will do it immediately otherwise the system will do it after execution is complete.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ROLLBACK WORK.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for confirming or undoing database updates. COMMIT WORK always concludes a database LUW and starts a new one. ROLLBACK WORK always undoes all changes back to the start of the database LUW. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raj.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2008 10:12:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/examples-for-using-function-modules-and-bapis/m-p/3716980#M894794</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-07T10:12:44Z</dc:date>
    </item>
  </channel>
</rss>

