<?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: MB_DOCUMENT_BADI and bapis/commit work in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/mb-document-badi-and-bapis-commit-work/m-p/3099020#M735302</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;when calling the BAPI call it in background task..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'&lt;/P&gt;&lt;P&gt;          IN BACKGROUND TASK&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;Thanks&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Nov 2007 02:48:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-11-27T02:48:28Z</dc:date>
    <item>
      <title>MB_DOCUMENT_BADI and bapis/commit work</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mb-document-badi-and-bapis-commit-work/m-p/3099018#M735300</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 need to book an invoice while executing MIGO. I use the class MB_DOCUMENT_BADI and the method MB_DOCUMENT_UPDATE, where I call BAPI_INCOMINGINVOICE_CREATE. Unfortunately it does not work (it exits debugger), as it seems that the material document has not been created yet ( but inside the badi I have already MBLNR...) . I tried to use BAPI_TRANSACTION_COMMIT before creating invoice, but it also exits. Can use those BAPIs inside MB_DOCUMENT_UPDATE? &lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Anna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Nov 2007 12:18:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mb-document-badi-and-bapis-commit-work/m-p/3099018#M735300</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-21T12:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: MB_DOCUMENT_BADI and bapis/commit work</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mb-document-badi-and-bapis-commit-work/m-p/3099019#M735301</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looks like the invoice creation fails because it tries to reference a material document that doesn't exist yet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you could try is to call BAPI_INCOMINGINVOICE_CREATE in a subroutine that is in a Z-program, and in method MB_DOCUMENT_UPDATE, you'd call that subroutine ON COMMIT. This would wait until your transaction does a COMMIT and only then it would execute the registered subroutine which then should be able to find the material document.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Method MB_DOCUMENT_UPDATE.&lt;/P&gt;&lt;P&gt;  Perform CALL_INVOICE_CREATE(ZPROG) Using &amp;lt;parameter list&amp;gt;&lt;/P&gt;&lt;P&gt;    ON COMMIT.&lt;/P&gt;&lt;P&gt;Endmethod.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Program ZPROG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Form CALL_INVOICE_CREATE Using &amp;lt;parameter list&amp;gt;.&lt;/P&gt;&lt;P&gt;  Call Function BAPI_INCOMINGINVOICE_CREATE&lt;/P&gt;&lt;P&gt;    EXPORTING...&lt;/P&gt;&lt;P&gt;    IMPORTING...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Call Function BAPI_TRANSACTION_COMMIT.&lt;/P&gt;&lt;P&gt;Endform.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2007 01:20:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mb-document-badi-and-bapis-commit-work/m-p/3099019#M735301</guid>
      <dc:creator>Tamas_Hoznek</dc:creator>
      <dc:date>2007-11-27T01:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: MB_DOCUMENT_BADI and bapis/commit work</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mb-document-badi-and-bapis-commit-work/m-p/3099020#M735302</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;when calling the BAPI call it in background task..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'BAPI_INCOMINGINVOICE_CREATE'&lt;/P&gt;&lt;P&gt;          IN BACKGROUND TASK&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;Thanks&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2007 02:48:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mb-document-badi-and-bapis-commit-work/m-p/3099020#M735302</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-27T02:48:28Z</dc:date>
    </item>
  </channel>
</rss>

