<?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: Alternative for WAIT-Statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-wait-statement/m-p/4623515#M1089103</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I inserted a check on the created document to proof it manually&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 01 Nov 2008 21:06:33 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-11-01T21:06:33Z</dc:date>
    <item>
      <title>Alternative for WAIT-Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-wait-statement/m-p/4623512#M1089100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a problem I'm using a BAPI for reversing an production confirmation. This BAPI creates to a goods movement (MSEG). I make directly after the call of the BAPI a Commit Work (with the BAPI-FM).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So now I have to select the table AFWI which contains the value of the created material document (MSEG-MBLNR). But I do not get the correct number. It seems that I select a temporary-number and after a few seconds then the correct number is saved in the database table. I think the creation of the number is done by the SAP in a V2-execution (asyncron).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But now my question: Which options do I have to get the correct number? For testing I have implemented a WAIT-statement with 2 seconds, but I can not gurantee that this time will always be enough. What if there are may  update records to be handled in this time?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What can I do to really always get the correct document number?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Max Maier on Oct 12, 2008 3:02 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Oct 2008 13:01:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-wait-statement/m-p/4623512#M1089100</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-12T13:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative for WAIT-Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-wait-statement/m-p/4623513#M1089101</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;Looks Strange......Are you using the FM BAPI_TRANSACTION_COMMIT after your BAPI? If that is the case then you will always get the Correct Document Number......Getting a temporary number looks different to me...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Oct 2008 13:17:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-wait-statement/m-p/4623513#M1089101</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-12T13:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative for WAIT-Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-wait-statement/m-p/4623514#M1089102</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;yes I use this function module. Here a fragment of my coding:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

* BAPI to reverse/cancel the production confirmation
  CALL FUNCTION 'BAPI_PROCORDCONF_CANCEL'
    EXPORTING
      confirmation        = iv_conf
      confirmationcounter = iv_counter
    IMPORTING
      return              = ls_return
      locked              = lv_locked
      created_conf_no     = ev_conf
      created_conf_count  = ev_counter.

* Error in Processing
  IF ls_return-type = 'E' OR
     ls_return-type = 'A'.

    MESSAGE ID ls_return-id TYPE ls_return-type NUMBER ls_return-number
            WITH ls_return-message_v1 ls_return-message_v2
                 ls_return-message_v3 ls_return-message_v4
            INTO me-&amp;gt;log_dummy.
    me-&amp;gt;log_add_message( me-&amp;gt;log_normal ).
    EXIT.

* Locked state
  ELSEIF lv_locked = 'X'.

    MESSAGE e017(zh) WITH iv_conf iv_counter
      INTO me-&amp;gt;log_dummy.
    me-&amp;gt;log_add_message( me-&amp;gt;log_normal ).
    EXIT.

* Sucessfull processing
  ELSE.

    MESSAGE s018(zh) WITH iv_conf iv_counter
      INTO me-&amp;gt;log_dummy.
    me-&amp;gt;log_add_message( me-&amp;gt;log_normal ).

  ENDIF.

* Making COMMIT WORK
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait = 'X'.

* Addition wait is necessary so that the right material document can be
* selected
  WAIT UP TO 2 SECONDS.

* Selection of material document created by BAPI
  SELECT * FROM afwi
    INTO TABLE lt_afwi
    WHERE rueck = ev_conf
      AND rmzhl = ev_counter.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can see the incorrect doc number because I write the result of the selection in a own Z-Table, and there I can see the number selected by the statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0000001763&lt;/P&gt;&lt;P&gt;0000001752&lt;/P&gt;&lt;P&gt;--&amp;gt; created incorrect numbers (and also the document year is initial in this case)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a correct doc number would be for example: 4900250619 (with doc year 2008)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Max Maier on Oct 12, 2008 3:21 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Max Maier on Oct 12, 2008 3:24 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Oct 2008 13:21:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-wait-statement/m-p/4623514#M1089102</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-12T13:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative for WAIT-Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-wait-statement/m-p/4623515#M1089103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I inserted a check on the created document to proof it manually&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Nov 2008 21:06:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-wait-statement/m-p/4623515#M1089103</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-01T21:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative for WAIT-Statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-wait-statement/m-p/4623516#M1089104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Max&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please explain more in detail how you solved this problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Dec 2008 06:30:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-wait-statement/m-p/4623516#M1089104</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-04T06:30:27Z</dc:date>
    </item>
  </channel>
</rss>

