ITPub博客

首页 > Linux操作系统 > Linux操作系统 > BAPI_PO_CREATE

BAPI_PO_CREATE

原创 Linux操作系统 作者:ytfsrs2008 时间:2010-05-06 13:30:37 0 删除 编辑
report zrpptest05 .
tables: marc,mara,ekko,ekpo.
  data : p_error type c,
         po_num like ekko-ebeln.
data : g_return like table of bapireturn with header line.
  selection-screen begin of block blk1 with frame.
      parameters: t_werks like marc-werks.
  selection-screen end of block blk1.
 start-of-selection.
   perform. create_po_form.

*&---------------------------------------------------------------------*
*&      Form  create_po_form
*&---------------------------------------------------------------------*
form. create_po_form.
  data : pohd like bapiekkoc.
  data : poit like table of bapiekpoc with header line.
  data : posl like table of bapieket with header line.
  data : marc type marc.

    pohd-doc_date = sy-datum.
    pohd-doc_type = 'NB'.
    pohd-doc_cat = 'L'.
    pohd-co_code = 'TWHH'.
    pohd-purch_org = 'TWHH'.
    pohd-pur_group = 'HB1'.
    pohd-vendor = 'JEI006'.
 
      poit-po_item = '00010'.
      poit-material = 'TEST-9999'.
      poit-pur_mat = 'TEST-9999'.
      poit-plant = t_werks.
      poit-store_loc = '005G'.
      poit-net_price = '1.56'.
      poit-price_unit = '10' .
      poit-po_price = 'X'.
      poit-disp_quan = '59'.
      poit-qual_insp = ''.
      append poit.
    posl-po_item = '00010'.
    posl-deliv_date = sy-datum.
    posl-quantity = '59'.
    append posl.
  if p_error = 'E' .
    exit .
  else.
    call function 'BAPI_PO_CREATE'
         exporting
              po_header         = pohd
         importing
              purchaseorder     = po_num
         tables
              po_items          = poit
              po_item_schedules = posl
              return            = g_return.
    commit work.
  endif.

 loop at g_return.
    if g_return-type = 'S'.
       write:/ 'Purchase order number is:',po_num.
    endif.
    if g_return-type = 'E'.
       write:/ 'Purchase order number fail,',g_return-message.
    endif.
endloop.
endform.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15117617/viewspace-662035/,如需转载,请注明出处,否则将追究法律责任。

上一篇: VL01N BDC
下一篇: BDC CO40
请登录后发表评论 登录
全部评论

注册时间:2008-10-31

  • 博文量
    52
  • 访问量
    49842