<?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: Looking for a BAPI in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-a-bapi/m-p/1202968#M131371</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try BAPI_PO_CREATE1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a sample FORM routine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

************************************************************************
*      Form  create_purchase_order
************************************************************************
form create_purchase_order.

  constants : c_x value 'X'.

  data: del_date type sy-datum.

  data: pohead  type bapimepoheader.
  data: poheadx type bapimepoheaderx.

  data: exp_head type bapimepoheader.

  data: return  type table of bapiret2 with header line.
  data: poitem  type table of bapimepoitem with header line.
  data: poitemx type table of bapimepoitemx with header line.

  data: posched  type table of bapimeposchedule with header line.
  data: poschedx type table of bapimeposchedulx with header line.

  data: ex_po_number type bapimepoheader-po_number.


* Header Level Data
 pohead-comp_code = '0010'.
  pohead-doc_type   = 'NB'     .
  pohead-creat_date = sy-datum   .

pohead-vendor = p_lifnr.
 pohead-purch_org = '0010'.
  pohead-pur_group = 'EMG'.

  pohead-langu      = sy-langu   .
  pohead-doc_date   = sy-datum.

  poheadx-comp_code  = c_x.
  poheadx-doc_type   = c_x.
  poheadx-creat_date = c_x.
  poheadx-vendor     = c_x.
  poheadx-langu      = c_x.
  poheadx-purch_org  = c_x.
  poheadx-pur_group  = c_x.
  poheadx-doc_date   = c_x.


* Item Level Data
  poitem-po_item  = 1.
  poitem-material = xresb-matnr.
  poitem-plant    = xresb-werks.
  poitem-stge_loc = xresb-lgort.
  poitem-quantity = p_bdmng.
  append poitem.

  poitemx-po_item    = 1.
  poitemx-po_itemx   = c_x.
  poitemx-material   = c_x.
  poitemx-plant      = c_x .
  poitemx-stge_loc   = c_x .
  poitemx-quantity   = c_x .
  poitemx-tax_code   = c_x .
  poitemx-item_cat   = c_x .
  poitemx-acctasscat = c_x .
  append poitemx.


* Schedule Line Level Data
  posched-po_item        = 1.
  posched-sched_line     = 1.
  posched-del_datcat_ext = 'D'.
  del_date = sy-datum + 1.
  write del_date to posched-delivery_date.
  posched-deliv_time     = '000001'.
  posched-quantity       = p_bdmng.
  append posched.

  poschedx-po_item        = 1.
  poschedx-sched_line     = 1.
  poschedx-po_itemx       = c_x.
  poschedx-sched_linex    = c_x.
  poschedx-del_datcat_ext = c_x.
  poschedx-delivery_date  = c_x.
  poschedx-quantity       = c_x.
  append poschedx.

  call function 'BAPI_PO_CREATE1'
       exporting
            poheader         = pohead
            poheaderx        = poheadx
            testrun          = ' '
       importing
            exppurchaseorder = ex_po_number
            expheader        = exp_head
       tables
            return           = return
            poitem           = poitem
            poitemx          = poitemx
            poschedule       = posched
            poschedulex      = poschedx.

  call function 'BAPI_TRANSACTION_COMMIT'
       exporting
            wait = 'X'.

  if not ex_po_number is initial.
    call function 'DEQUEUE_ALL'.
  else.
    call function 'DEQUEUE_ALL'.
    message i036.
  endif.

endform.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Mar 2006 17:27:52 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2006-03-17T17:27:52Z</dc:date>
    <item>
      <title>Looking for a BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-a-bapi/m-p/1202966#M131369</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;I'm a newbie in SAP, and I'm looking for a BAPI which able to create an order of purchase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Mar 2006 17:25:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-a-bapi/m-p/1202966#M131369</guid>
      <dc:creator>Joseph_BERTHE1</dc:creator>
      <dc:date>2006-03-17T17:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-a-bapi/m-p/1202967#M131370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  try Bapi BAPI_PO_CREATE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you look for bapis run transaction BAPI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, Manuel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Mar 2006 17:27:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-a-bapi/m-p/1202967#M131370</guid>
      <dc:creator>manuel_bassani</dc:creator>
      <dc:date>2006-03-17T17:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-a-bapi/m-p/1202968#M131371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try BAPI_PO_CREATE1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a sample FORM routine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

************************************************************************
*      Form  create_purchase_order
************************************************************************
form create_purchase_order.

  constants : c_x value 'X'.

  data: del_date type sy-datum.

  data: pohead  type bapimepoheader.
  data: poheadx type bapimepoheaderx.

  data: exp_head type bapimepoheader.

  data: return  type table of bapiret2 with header line.
  data: poitem  type table of bapimepoitem with header line.
  data: poitemx type table of bapimepoitemx with header line.

  data: posched  type table of bapimeposchedule with header line.
  data: poschedx type table of bapimeposchedulx with header line.

  data: ex_po_number type bapimepoheader-po_number.


* Header Level Data
 pohead-comp_code = '0010'.
  pohead-doc_type   = 'NB'     .
  pohead-creat_date = sy-datum   .

pohead-vendor = p_lifnr.
 pohead-purch_org = '0010'.
  pohead-pur_group = 'EMG'.

  pohead-langu      = sy-langu   .
  pohead-doc_date   = sy-datum.

  poheadx-comp_code  = c_x.
  poheadx-doc_type   = c_x.
  poheadx-creat_date = c_x.
  poheadx-vendor     = c_x.
  poheadx-langu      = c_x.
  poheadx-purch_org  = c_x.
  poheadx-pur_group  = c_x.
  poheadx-doc_date   = c_x.


* Item Level Data
  poitem-po_item  = 1.
  poitem-material = xresb-matnr.
  poitem-plant    = xresb-werks.
  poitem-stge_loc = xresb-lgort.
  poitem-quantity = p_bdmng.
  append poitem.

  poitemx-po_item    = 1.
  poitemx-po_itemx   = c_x.
  poitemx-material   = c_x.
  poitemx-plant      = c_x .
  poitemx-stge_loc   = c_x .
  poitemx-quantity   = c_x .
  poitemx-tax_code   = c_x .
  poitemx-item_cat   = c_x .
  poitemx-acctasscat = c_x .
  append poitemx.


* Schedule Line Level Data
  posched-po_item        = 1.
  posched-sched_line     = 1.
  posched-del_datcat_ext = 'D'.
  del_date = sy-datum + 1.
  write del_date to posched-delivery_date.
  posched-deliv_time     = '000001'.
  posched-quantity       = p_bdmng.
  append posched.

  poschedx-po_item        = 1.
  poschedx-sched_line     = 1.
  poschedx-po_itemx       = c_x.
  poschedx-sched_linex    = c_x.
  poschedx-del_datcat_ext = c_x.
  poschedx-delivery_date  = c_x.
  poschedx-quantity       = c_x.
  append poschedx.

  call function 'BAPI_PO_CREATE1'
       exporting
            poheader         = pohead
            poheaderx        = poheadx
            testrun          = ' '
       importing
            exppurchaseorder = ex_po_number
            expheader        = exp_head
       tables
            return           = return
            poitem           = poitem
            poitemx          = poitemx
            poschedule       = posched
            poschedulex      = poschedx.

  call function 'BAPI_TRANSACTION_COMMIT'
       exporting
            wait = 'X'.

  if not ex_po_number is initial.
    call function 'DEQUEUE_ALL'.
  else.
    call function 'DEQUEUE_ALL'.
    message i036.
  endif.

endform.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Mar 2006 17:27:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-a-bapi/m-p/1202968#M131371</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-03-17T17:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-a-bapi/m-p/1202969#M131372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi BERTHE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*****&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Calling function BAPI_PO_CREATE TO CREATE PURCHASE ORDER&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*****&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'BAPI_PO_CREATE'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        PO_HEADER                   = W_PO_HEADER&lt;/P&gt;&lt;P&gt;        SKIP_ITEMS_WITH_ERROR            = 'X'&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;       PURCHASEORDER                = W_PURCHASEORDER&lt;/P&gt;&lt;P&gt;      TABLES&lt;/P&gt;&lt;P&gt;        PO_ITEMS                    = W_PO_ITEMS&lt;/P&gt;&lt;P&gt;        PO_ITEM_SCHEDULES           = W_PO_ITEM_SCHEDULES&lt;/P&gt;&lt;P&gt;   RETURN                           =  W_RETURN&lt;/P&gt;&lt;P&gt;   PO_LIMITS                        =  W_PO_LIMITS&lt;/P&gt;&lt;P&gt;   PO_CONTRACT_LIMITS               =  W_PO_CONTRACT_LIMITS&lt;/P&gt;&lt;P&gt;   PO_SERVICES                      =  W_PO_SERVICES&lt;/P&gt;&lt;P&gt;   PO_SRV_ACCASS_VALUES             =  W_PO_SRV_ACCASS_VALUES&lt;/P&gt;&lt;P&gt;   PO_SERVICES_TEXT                 =  W_PO_SERVICES_TEXT&lt;/P&gt;&lt;P&gt;   PO_BUSINESS_PARTNER              = W_PO_BUSINESS_PARTNER&lt;/P&gt;&lt;P&gt;   EXTENSIONIN                      = W_EXTENSIONIN&lt;/P&gt;&lt;P&gt;   POADDRDELIVERY                   = W_POADDRDELIVERY&lt;/P&gt;&lt;P&gt;              .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Mar 2006 17:39:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-a-bapi/m-p/1202969#M131372</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-17T17:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a BAPI</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-a-bapi/m-p/1202970#M131373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You gave me lot of usefull tools.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I solved my problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Mar 2006 08:28:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looking-for-a-bapi/m-p/1202970#M131373</guid>
      <dc:creator>Joseph_BERTHE1</dc:creator>
      <dc:date>2006-03-20T08:28:40Z</dc:date>
    </item>
  </channel>
</rss>

