<?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 BAPI_GOODSMVT_CREATE in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-goodsmvt-create/m-p/5413049#M1242928</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am using "BAPI_GOODSMVT_CREATE" to post 344 Movement Type. When I am running the program(foreground), sometimes it is running successfully and sometimes it is giving errors saying &lt;EM&gt;Material XXXXX is currently blocked&lt;/EM&gt;. When I run this program in debug mode to see what is happening, it is running successfully. Following is my code. Anybody please let me know if there is an issue. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at 344_data.

    refresh: i_item, i_return.
    clear: i_header, i_headret, i_item, i_return.

*--- Start Transaction
    CALL FUNCTION 'TRANSACTION_BEGIN'
         IMPORTING
              TRANSACTION_ID = l_tid.

*--- Set up document header data.
    i_header-pstng_date = sy-datum.
    i_header-doc_date   = sy-datum.
    i_header-pr_uname   = sy-uname.

*--- Set up document item data.
    i_item-move_type  = '344'.                 "Movement Type
    i_item-plant      = 344_data-werks.        "Plant
    i_item-material   = 344_data-matnr.        "Material
    i_item-entry_qnt  = 344_data-clabs.        "Quantity
    i_item-batch      = 344_data-charg.        "Batch
    i_item-stge_loc   = 344_data-lgort.        "Storage Location
    append i_item.

*--- Transfer posting.
    call function 'BAPI_GOODSMVT_CREATE'
         EXPORTING
              goodsmvt_header  = i_header
              goodsmvt_code    = '04'          "MB1B Transaction
              testrun          = l_test
         IMPORTING
              goodsmvt_headret = i_headret
         TABLES
              goodsmvt_item    = i_item
              return           = i_return.

*--- End transaction.
    if i_return[] is initial.
      call function 'TRANSACTION_END'
           EXPORTING
                transaction_id = l_tid.

      call function 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
                wait = 'X'.
    else.
      call function 'TRANSACTION_ABORT'
           EXPORTING
                transaction_id = l_tid.

      add 1 to err_344.
      l_subrc = sy-subrc.
      read table i_return index 1.
      l_text = i_return-message.

      continue.

    endif.

    if sy-subrc = 0.
      add 1 to ok_344.
    else.
      add 1 to err_344.
      l_subrc = sy-subrc.
      read table i_return index 1.
      l_text = i_return-message.
    endif.

  endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Apr 2009 14:39:16 GMT</pubDate>
    <dc:creator>VenuAnumayam</dc:creator>
    <dc:date>2009-04-07T14:39:16Z</dc:date>
    <item>
      <title>BAPI_GOODSMVT_CREATE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-goodsmvt-create/m-p/5413049#M1242928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am using "BAPI_GOODSMVT_CREATE" to post 344 Movement Type. When I am running the program(foreground), sometimes it is running successfully and sometimes it is giving errors saying &lt;EM&gt;Material XXXXX is currently blocked&lt;/EM&gt;. When I run this program in debug mode to see what is happening, it is running successfully. Following is my code. Anybody please let me know if there is an issue. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at 344_data.

    refresh: i_item, i_return.
    clear: i_header, i_headret, i_item, i_return.

*--- Start Transaction
    CALL FUNCTION 'TRANSACTION_BEGIN'
         IMPORTING
              TRANSACTION_ID = l_tid.

*--- Set up document header data.
    i_header-pstng_date = sy-datum.
    i_header-doc_date   = sy-datum.
    i_header-pr_uname   = sy-uname.

*--- Set up document item data.
    i_item-move_type  = '344'.                 "Movement Type
    i_item-plant      = 344_data-werks.        "Plant
    i_item-material   = 344_data-matnr.        "Material
    i_item-entry_qnt  = 344_data-clabs.        "Quantity
    i_item-batch      = 344_data-charg.        "Batch
    i_item-stge_loc   = 344_data-lgort.        "Storage Location
    append i_item.

*--- Transfer posting.
    call function 'BAPI_GOODSMVT_CREATE'
         EXPORTING
              goodsmvt_header  = i_header
              goodsmvt_code    = '04'          "MB1B Transaction
              testrun          = l_test
         IMPORTING
              goodsmvt_headret = i_headret
         TABLES
              goodsmvt_item    = i_item
              return           = i_return.

*--- End transaction.
    if i_return[] is initial.
      call function 'TRANSACTION_END'
           EXPORTING
                transaction_id = l_tid.

      call function 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
                wait = 'X'.
    else.
      call function 'TRANSACTION_ABORT'
           EXPORTING
                transaction_id = l_tid.

      add 1 to err_344.
      l_subrc = sy-subrc.
      read table i_return index 1.
      l_text = i_return-message.

      continue.

    endif.

    if sy-subrc = 0.
      add 1 to ok_344.
    else.
      add 1 to err_344.
      l_subrc = sy-subrc.
      read table i_return index 1.
      l_text = i_return-message.
    endif.

  endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 14:39:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-goodsmvt-create/m-p/5413049#M1242928</guid>
      <dc:creator>VenuAnumayam</dc:creator>
      <dc:date>2009-04-07T14:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI_GOODSMVT_CREATE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-goodsmvt-create/m-p/5413050#M1242929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;well if someone is changing an material MM02 or MM42 he is blocking this material.&lt;/P&gt;&lt;P&gt;NOONE else can maintain it at the same time, even not the BAPI. Nothing wrong with your code so far.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 14:44:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-goodsmvt-create/m-p/5413050#M1242929</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-07T14:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI_GOODSMVT_CREATE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-goodsmvt-create/m-p/5413051#M1242930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If possible use WAIT statement in your code and try if it works for you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 15:11:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-goodsmvt-create/m-p/5413051#M1242930</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-07T15:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI_GOODSMVT_CREATE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-goodsmvt-create/m-p/5413052#M1242931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the responses. I have added "Commit Work and wait" statement. But I'm still seeing that error. Any idea?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 15:31:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-goodsmvt-create/m-p/5413052#M1242931</guid>
      <dc:creator>VenuAnumayam</dc:creator>
      <dc:date>2009-04-07T15:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI_GOODSMVT_CREATE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-goodsmvt-create/m-p/5413053#M1242932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have modified the program to post goods movement &lt;STRONG&gt;at end of material&lt;/STRONG&gt; and it worked.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Apr 2009 23:13:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-goodsmvt-create/m-p/5413053#M1242932</guid>
      <dc:creator>VenuAnumayam</dc:creator>
      <dc:date>2009-04-07T23:13:03Z</dc:date>
    </item>
  </channel>
</rss>

