<?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 for MIGO in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-for-migo/m-p/1221984#M136714</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;Is there a BAPI for selecting multiple line items in a Purchase Order (based on the material number), updating each one and posting a Goods receipt with one single material document number?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Apr 2006 13:51:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-04-05T13:51:03Z</dc:date>
    <item>
      <title>BAPI for MIGO</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-for-migo/m-p/1221984#M136714</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;Is there a BAPI for selecting multiple line items in a Purchase Order (based on the material number), updating each one and posting a Goods receipt with one single material document number?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Apr 2006 13:51:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-for-migo/m-p/1221984#M136714</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-05T13:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI for MIGO</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-for-migo/m-p/1221985#M136715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try with BAPI_GOODSMVT_CREATE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Apr 2006 13:53:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-for-migo/m-p/1221985#M136715</guid>
      <dc:creator>LucianoBentiveg</dc:creator>
      <dc:date>2006-04-05T13:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: BAPI for MIGO</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-for-migo/m-p/1221986#M136716</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;check this code..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  Z_BAPI_GM                                  .
*
* BAPI TO Upload Inventory Data
*
* GMCODE Table T158G - 01 - MB01 - Goods Receipts for Purchase Order
*                      02 - MB31 - Goods Receipts for Prod Order
*                      03 - MB1A - Goods Issue
*                      04 - MB1B - Transfer Posting
*                      05 - MB1C - Enter Other Goods Receipt
*                      06 - MB11
*
* Domain: KZBEW - Movement Indicator
*      Goods movement w/o reference
*  B - Goods movement for purchase order
*  F - Goods movement for production order
*  L - Goods movement for delivery note
*  K - Goods movement for kanban requirement (WM - internal only)
*  O - Subsequent adjustment of "material-provided" consumption
*  W - Subsequent adjustment of proportion/product unit material


parameters: p-file like rlgrap-filename default
                         'c:Norandex-ReynoldsIbcstrans_demo3.txt'.
parameters: xpost like sy-datum default sy-datum.

TABLES : EKKO, EKPO.

data: begin of gmhead.
        include structure bapi2017_gm_head_01.
data: end of gmhead.

data: begin of gmcode.
        include structure bapi2017_gm_code.
data: end of gmcode.

data: begin of mthead.
        include structure bapi2017_gm_head_ret.
data: end of mthead.

data: begin of itab occurs 100.
        include structure bapi2017_gm_item_create.
data: end of itab.

data: begin of errmsg occurs 10.
        include structure bapiret2.
data: end of errmsg.

data: wmenge like iseg-menge,
      errflag.

data: begin of pcitab occurs 100,
        code(10),              "I code
        branch(3),             "Branch #
        pur_doc(6),            "Purchase Document No
        po_item(3),            "Purchase Document Item No
        material(10),          "Material Number
        qty(7),               "Quantity
        post_date(6),          "Posting Date
        date_rec(6),           "Receiving date
        vendor(6),             "Vendor Number
        filler(1),              "Filler
        prog_code(1),          "Program Code
        action_cd(1),          "Action code
        unit_cost(6),          "Cost
        descr(20),             "Descr
        filler3(5),              "Filler
        invoice(5),            "Invoice Number
        codis_part(10),        "Codis Part
        flag(1),               "Flag
        filler1(54),            "Filler
        region(3),             "region
        branch1(3),             "Branch
        filler2(10),            "Filler
        end of pcitab.

call function 'WS_UPLOAD'
  exporting
    filename                      = p-file
    filetype                      = 'DAT'
* IMPORTING
*   FILELENGTH                    =
  tables
    data_tab                      = pcitab
* EXCEPTIONS
*   FILE_OPEN_ERROR               = 1
*   FILE_READ_ERROR               = 2
*   NO_BATCH                      = 3
*   GUI_REFUSE_FILETRANSFER       = 4
*   INVALID_TYPE                  = 5
*   OTHERS                        = 6
          .
if sy-subrc &amp;lt;&amp;gt; 0.
  message id sy-msgid type sy-msgty number sy-msgno
          with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  exit.
endif.

gmhead-pstng_date = xpost.
gmhead-doc_date = xpost.
gmhead-pr_uname = sy-uname.
gmcode-gm_code = '01'.   "01 - MB01 - Goods Receipts for Purchase Order

loop at pcitab.
  select single ekko~ebeln ekpo~ebelp ekpo~matnr ekpo~werks
  INTO (itab-po_number,itab-po_item,itab-material,itab-plant)
    from ekko inner join ekpo on  ekko~ebeln = ekpo~ebeln
     where IHREZ EQ pcitab+1(9).
CHECK SY-SUBRC  EQ 0.
  itab-move_type  = '101'.
  itab-mvt_ind    = 'B'.
  itab-entry_qnt  = '1.000'.
  itab-stge_loc   = '0001'.
  append itab.

 call function 'BAPI_GOODSMVT_CREATE'
  exporting
    goodsmvt_header             = gmhead
    goodsmvt_code               = gmcode
*    TESTRUN                     = 'X'
  IMPORTING
    goodsmvt_headret            = mthead
*   MATERIALDOCUMENT            =
*   MATDOCUMENTYEAR             =
  tables
    goodsmvt_item               = itab
*   GOODSMVT_SERIALNUMBER       =
    return                      = errmsg
          .
clear errflag.
loop at errmsg.
  if errmsg-type eq 'E'.
    write:/'Error in function', errmsg-message.
    errflag = 'X'.
  else.
    write:/ errmsg-message.
  endif.
endloop.
if errflag is initial.
  commit work and wait.
  if sy-subrc ne 0.
    write:/ 'Error in updating'.
    exit.
  else.
    write:/ mthead-mat_doc, mthead-doc_year.
*    perform upd_sta.
  endif.
endif.
refresh ITAB.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Apr 2006 14:00:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-for-migo/m-p/1221986#M136716</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-04-05T14:00:07Z</dc:date>
    </item>
  </channel>
</rss>

