<?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 Updating customized database table in BAPI in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-customized-database-table-in-bapi/m-p/1467597#M220093</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ' ve created a customized BAPI.The requirement for this BAPI is to update a z-table.&lt;/P&gt;&lt;P&gt;For this,I had used INSERT &amp;amp; UPDATE command (along with COMMIT &amp;amp; ROLLBACK stmt ) in the BAPI.&lt;/P&gt;&lt;P&gt;Please see the below coding &amp;amp; let me know whether it is right..to use the below coding to update a z_table in the BAPI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION z_bapi_submit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Adding new lines into ztable&lt;/P&gt;&lt;P&gt;    INSERT z_table FROM TABLE internal_table.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      COMMIT WORK.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;      ROLLBACK WORK.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Modifying the existing lines in ztable&lt;/P&gt;&lt;P&gt;    UPDATE z_table FROM TABLE internal_table.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      COMMIT WORK.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;      ROLLBACK WORK.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFUNCTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I use COMMIT &amp;amp; ROLLBACK stmts in the BAPI as above ?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Varalakshmi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 Sep 2006 13:31:56 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-09-04T13:31:56Z</dc:date>
    <item>
      <title>Updating customized database table in BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-customized-database-table-in-bapi/m-p/1467597#M220093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ' ve created a customized BAPI.The requirement for this BAPI is to update a z-table.&lt;/P&gt;&lt;P&gt;For this,I had used INSERT &amp;amp; UPDATE command (along with COMMIT &amp;amp; ROLLBACK stmt ) in the BAPI.&lt;/P&gt;&lt;P&gt;Please see the below coding &amp;amp; let me know whether it is right..to use the below coding to update a z_table in the BAPI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION z_bapi_submit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Adding new lines into ztable&lt;/P&gt;&lt;P&gt;    INSERT z_table FROM TABLE internal_table.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      COMMIT WORK.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;      ROLLBACK WORK.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Modifying the existing lines in ztable&lt;/P&gt;&lt;P&gt;    UPDATE z_table FROM TABLE internal_table.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      COMMIT WORK.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;      ROLLBACK WORK.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFUNCTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I use COMMIT &amp;amp; ROLLBACK stmts in the BAPI as above ?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Varalakshmi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Sep 2006 13:31:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-customized-database-table-in-bapi/m-p/1467597#M220093</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-04T13:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Updating customized database table in BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-customized-database-table-in-bapi/m-p/1467598#M220094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi varalakshmi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Can I use COMMIT &amp;amp; ROLLBACK stmts in the BAPI as above ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If we use, it will work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. BUT&lt;/P&gt;&lt;P&gt;3. Since it is a BAPI,&lt;/P&gt;&lt;P&gt;   it should not use any commit work&lt;/P&gt;&lt;P&gt;   (as per sap guidelines,&lt;/P&gt;&lt;P&gt;    bcos, then it will defeat the purpose&lt;/P&gt;&lt;P&gt;    of LUW)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. COMMIT WORK / ROLLBACK  &lt;/P&gt;&lt;P&gt;   will be done by the&lt;/P&gt;&lt;P&gt;    program, which is calling the bapi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. This bapi should only return,&lt;/P&gt;&lt;P&gt;   the errors, in an internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------" /&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;6. Instead of using INSERT or UPDATE,&lt;/P&gt;&lt;P&gt;   we can just use MODIFY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  like this&lt;/P&gt;&lt;P&gt; modify DBTAB from ITAB.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&lt;/P&gt;&lt;P&gt;(Modify will automatically take care&lt;/P&gt;&lt;P&gt;  of INSERT/UPDATE based upon&lt;/P&gt;&lt;P&gt;  the primary key combination of field values,&lt;/P&gt;&lt;P&gt;  found / not found in database table,&lt;/P&gt;&lt;P&gt;  as compared to work area)&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Sep 2006 13:46:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-customized-database-table-in-bapi/m-p/1467598#M220094</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-04T13:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: Updating customized database table in BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-customized-database-table-in-bapi/m-p/1467599#M220095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1) BAPI's should not have any commit/rollback statement. The Commit/Rollback should be performed in the calling program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Instead of using INSERT/UPDATE use MODIFY statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) Instead of Calling INSERT/UPDATE directly in the BAPI call Functional Module (type update, In update task), which will have the required database update statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Sep 2006 16:22:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-customized-database-table-in-bapi/m-p/1467599#M220095</guid>
      <dc:creator>former_member195698</dc:creator>
      <dc:date>2006-09-04T16:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Updating customized database table in BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-customized-database-table-in-bapi/m-p/1467600#M220096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Amit ,&lt;/P&gt;&lt;P&gt; Thanks for your reply.&lt;/P&gt;&lt;P&gt; I got valuable input from you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Varalakshmi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Sep 2006 04:57:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-customized-database-table-in-bapi/m-p/1467600#M220096</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-05T04:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: Updating customized database table in BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-customized-database-table-in-bapi/m-p/1467601#M220097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Abhishek ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Thanks for your valuable input .&lt;/P&gt;&lt;P&gt; Can you give me the Function module name that&lt;/P&gt;&lt;P&gt; is used to update the database table in update task ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Varalakshmi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Sep 2006 05:02:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-customized-database-table-in-bapi/m-p/1467601#M220097</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-05T05:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: Updating customized database table in BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-customized-database-table-in-bapi/m-p/1467602#M220098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Can you give me the Function module name that&lt;/P&gt;&lt;P&gt;is used to update the database table in update task &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Update TASK  is&lt;/P&gt;&lt;P&gt;a concept (way of calling any FM).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. In your case such concept is not required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. For making any FM, update task,&lt;/P&gt;&lt;P&gt;  we just have to click on the radiobutton&lt;/P&gt;&lt;P&gt;  ( in se37)&lt;/P&gt;&lt;P&gt;  in attributes  TAB of the FM.&lt;/P&gt;&lt;P&gt;  The radio button is : Update Module.&lt;/P&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;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Sep 2006 05:32:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-customized-database-table-in-bapi/m-p/1467602#M220098</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-05T05:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Updating customized database table in BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-customized-database-table-in-bapi/m-p/1467603#M220099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Amit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm now using the MODIFY stmt in the BAPI to update the z-table.&lt;/P&gt;&lt;P&gt;Can I use the below coding..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function z_submit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    modify z_table FROM TABLE internal_table.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Endfunction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I use the 'BAPI_TRANSACTION_COMMIT' &amp;amp; 'BAPI_TRANSACTION_ROLLBACK' in the BAPI itself &lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    modify z_table FROM TABLE internal_table.&lt;/P&gt;&lt;P&gt;    IF sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;      populate the RETURN table&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And leave the 'BAPI_TRANSACTION_COMMIT' &amp;amp; 'BAPI_TRANSACTION_ROLLBACK' to be called in the calling program ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Varalakshmi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Sep 2006 07:03:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-customized-database-table-in-bapi/m-p/1467603#M220099</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-05T07:03:52Z</dc:date>
    </item>
  </channel>
</rss>

