<?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 Incorrect document number reported by BAPI_ACC_DOCUMENT_POST in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/incorrect-document-number-reported-by-bapi-acc-document-post/m-p/843274#M44681</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using BAPI_ACC_DOCUMENT_POST to create various document types and periodically I&amp;#146;m getting the wrong document number reported as being created.  So for example the function module reports that it created document 100000605 but when I check the database it was actually created as document 100000607.  This appears to happen randomly.  Most of the time the document # returned is the correct one.  It is also not a situation where another user as grabbed that document # because the document # returned has not been created.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These are the steps leading to the FM call:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT SINGLE numkr FROM t003 INTO l_numkr&lt;/P&gt;&lt;P&gt;                WHERE blart EQ l_doc_type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'NUMBER_GET_NEXT'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        nr_range_nr                   = l_numkr&lt;/P&gt;&lt;P&gt;        object                        = 'RF_BELEG'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    QUANTITY                      = '1'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        subobject                     = l_comp_code&lt;/P&gt;&lt;P&gt;        toyear                        = l_fisc_year&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    IGNORE_BUFFER                 = ' '&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        number                        = l_number&lt;/P&gt;&lt;P&gt;[&amp;#133;]&lt;/P&gt;&lt;P&gt;    ADD 1 TO l_number.&lt;/P&gt;&lt;P&gt;    ls_documentheader-obj_key = l_number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        documentheader          = ls_documentheader&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        OBJ_KEY                 = L_OBJ_KEY&lt;/P&gt;&lt;P&gt;      TABLES&lt;/P&gt;&lt;P&gt;[&amp;#133;]&lt;/P&gt;&lt;P&gt;        return                  = lt_return&lt;/P&gt;&lt;P&gt;[&amp;#133;]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the document number returned by both &amp;#147;L_OBJ_KEY&amp;#148; and in the messages in &amp;#147;LT_RETURN&amp;#148; say it created &amp;#147;100000605&amp;#148; but in reality the document is &amp;#147;100000607&amp;#148;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I&amp;#146;m assuming that the document number returned by 'BAPI_ACC_DOCUMENT_POST will always be just be whatever number I feed it from &amp;#147;ls_documentheader-obj_key&amp;#148;.  (I also need to add 1 to "L_NUMBER" or else the document # reported as posted is always off by 1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This problem is creating a bit of an auditing problem for me as the logs I&amp;#146;m creating do not match what is in the database sometimes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm on an ECC 5.0 system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help,&lt;/P&gt;&lt;P&gt;-Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 May 2005 21:49:15 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-05-18T21:49:15Z</dc:date>
    <item>
      <title>Incorrect document number reported by BAPI_ACC_DOCUMENT_POST</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/incorrect-document-number-reported-by-bapi-acc-document-post/m-p/843274#M44681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using BAPI_ACC_DOCUMENT_POST to create various document types and periodically I&amp;#146;m getting the wrong document number reported as being created.  So for example the function module reports that it created document 100000605 but when I check the database it was actually created as document 100000607.  This appears to happen randomly.  Most of the time the document # returned is the correct one.  It is also not a situation where another user as grabbed that document # because the document # returned has not been created.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These are the steps leading to the FM call:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT SINGLE numkr FROM t003 INTO l_numkr&lt;/P&gt;&lt;P&gt;                WHERE blart EQ l_doc_type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'NUMBER_GET_NEXT'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        nr_range_nr                   = l_numkr&lt;/P&gt;&lt;P&gt;        object                        = 'RF_BELEG'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    QUANTITY                      = '1'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        subobject                     = l_comp_code&lt;/P&gt;&lt;P&gt;        toyear                        = l_fisc_year&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    IGNORE_BUFFER                 = ' '&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        number                        = l_number&lt;/P&gt;&lt;P&gt;[&amp;#133;]&lt;/P&gt;&lt;P&gt;    ADD 1 TO l_number.&lt;/P&gt;&lt;P&gt;    ls_documentheader-obj_key = l_number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        documentheader          = ls_documentheader&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        OBJ_KEY                 = L_OBJ_KEY&lt;/P&gt;&lt;P&gt;      TABLES&lt;/P&gt;&lt;P&gt;[&amp;#133;]&lt;/P&gt;&lt;P&gt;        return                  = lt_return&lt;/P&gt;&lt;P&gt;[&amp;#133;]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the document number returned by both &amp;#147;L_OBJ_KEY&amp;#148; and in the messages in &amp;#147;LT_RETURN&amp;#148; say it created &amp;#147;100000605&amp;#148; but in reality the document is &amp;#147;100000607&amp;#148;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I&amp;#146;m assuming that the document number returned by 'BAPI_ACC_DOCUMENT_POST will always be just be whatever number I feed it from &amp;#147;ls_documentheader-obj_key&amp;#148;.  (I also need to add 1 to "L_NUMBER" or else the document # reported as posted is always off by 1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This problem is creating a bit of an auditing problem for me as the logs I&amp;#146;m creating do not match what is in the database sometimes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm on an ECC 5.0 system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help,&lt;/P&gt;&lt;P&gt;-Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 May 2005 21:49:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/incorrect-document-number-reported-by-bapi-acc-document-post/m-p/843274#M44681</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-05-18T21:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect document number reported by BAPI_ACC_DOCUMENT_POST</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/incorrect-document-number-reported-by-bapi-acc-document-post/m-p/843275#M44682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;	I think your problem is that you are calling function module 'NUMBER_GET_NEXT' and passing in the new document number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can call BAPI_ACC_DOCUMENT_POST without passing in the document number and the function module should assign the next available document number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, you can look at OSS Note 561175 for internally assigning the Reference Procedure if needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, sorry if you already know this but, don't forget to call BAPIs BAPI_TRANSACTION_ROLLBACK or BAPI_TRANSACTION_COMMIT depending on whether there was an error or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike Vondran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2005 01:22:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/incorrect-document-number-reported-by-bapi-acc-document-post/m-p/843275#M44682</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-05-19T01:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect document number reported by BAPI_ACC_DOCUMENT_POST</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/incorrect-document-number-reported-by-bapi-acc-document-post/m-p/843276#M44683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;why do you use fm 'NUMBER_GET_NEXT' ?&lt;/P&gt;&lt;P&gt;-do you use a document type with external number range ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2005 06:05:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/incorrect-document-number-reported-by-bapi-acc-document-post/m-p/843276#M44683</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2005-05-19T06:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect document number reported by BAPI_ACC_DOCUMENT_POST</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/incorrect-document-number-reported-by-bapi-acc-document-post/m-p/843277#M44684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mike / Andreas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know I don't need to use NUMBER_GET_NEXT to be able to create a document but the problem is that if I don't supply BAPI_ACC_DOCUMENT_POST with a document number then the message returned in TABLE RETURN will also not have the correct document # in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I could just use something like "TEST000001BAPICALL" for OBJ_KEY but the message returned would be "Successfully created document TEST000001BAPICALL" which would be senseless to put on the execution log.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm thinking now that what I might have to do is call NUMBER_GET_NEXT after BAPI_ACC_DOCUMENT_POST and if the posting was successful, ignore the contents of TABLE RETURN.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2005 21:45:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/incorrect-document-number-reported-by-bapi-acc-document-post/m-p/843277#M44684</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-05-19T21:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect document number reported by BAPI_ACC_DOCUMENT_POST</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/incorrect-document-number-reported-by-bapi-acc-document-post/m-p/843278#M44685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't think you want to be calling NUMBER_GET_NEXT at all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are incrementing the document number range that is used by standard SAP.  In my opinion you should definitely not be doing this.  This will lead to gaps in the numbers for actual accounting documents created which auditors hate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you leave the object key initial (ie, don't pass a document number or something like TEST000001BAPICALL) then SAP will call NUMBER_GET_NEXT internally with the FI transaction and generate a number.  This should then be returned to you as the OBJ_KEY and also in your message as "Successfully created document 999999999".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In short, you should not pass the document number and the BAPI will generate one and return it to you.  This will always correspond to the actual document created in SAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, you should always avoid using NUMBER_GET_NEXT on standard number range objects where the underlying SAP master data or transaction object uses internal number assignment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 May 2005 22:31:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/incorrect-document-number-reported-by-bapi-acc-document-post/m-p/843278#M44685</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-05-19T22:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect document number reported by BAPI_ACC_DOCUMENT_POST</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/incorrect-document-number-reported-by-bapi-acc-document-post/m-p/843279#M44686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brad,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, the code was periodically creating gaps in the document numbers which as bothering me as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And you are right about not supplying OBJ_KEY.  When I first removed it I got the error message:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Required field OBJ_KEY was not transferred in parameter DOCUMENTHEADER"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But then I looked at my other parameters and I was filling in OBJ_TYP and OBJ_SYS as well.  I blanked out those parameters as well and it stopped complaining about not providing OBJ_KEY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the problem is solved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you !!!&lt;/P&gt;&lt;P&gt;-tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 May 2005 14:47:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/incorrect-document-number-reported-by-bapi-acc-document-post/m-p/843279#M44686</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-05-20T14:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect document number reported by BAPI_ACC_DOCUMENT_POST</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/incorrect-document-number-reported-by-bapi-acc-document-post/m-p/843280#M44687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, that really helped!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2012 19:09:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/incorrect-document-number-reported-by-bapi-acc-document-post/m-p/843280#M44687</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-06-12T19:09:32Z</dc:date>
    </item>
  </channel>
</rss>

