BAPI for creation of PO

Hi All,
This is the first time that i have got to work with BAPI .
Can some 1 tell me the BAPI to create a purchase order.
And also is bapi same as using a function module in calling .
How do we pass the parameters and get back the result.
I got 1 bapi 'Z_CREATE_PURCHASE_ORDER_BAPI ' but im not able to make out how to pass the parameters and get back the result.
Thanks
Mustameer

Please find the code below to change purchase order using bapi, in the same program replace BAPI_PO_CHANGE with BAPI_PO_CREATE1 and do your required coding it will work.
Hope This Info Helps YOU.
Reward Points If It Helps YOU.
Regards,
Raghav
report zmm_po_year_end_mass_change
      no standard page heading
      message-id zh.
*                  Database Table Declarations
tables : ekko,      " Purchase order header
         ekpo,      " purchase order Line item
         t001w,     " Plant master table
         t024e.     " Purchasing organzation.
*                  Type Pools Declarations
type-pools: slis.       " GLOBALE TYPEN FÜR GENERISCHE LISTBAUSTEINE
*                  Structure table declaration
* For Prod order header data to be pass to BAPI funtion
data : t_poheader like     bapimepoheader.
* For Prod order header X data to be pass to BAPI funtion
data:  t_poheaderx like    bapimepoheaderx.
*                 BAPI INTERNAL TABLES
* Internal table for Return table inported by BAPI FM
data : i_return  like bapiret2 occurs 0 with header line.
* Internal table for PO item return table inported by BAPI FM
data : i_poitem  like bapimepoitem occurs 0 with header line.
* Internal table for changing shceduled qty by BAPI FM
data : i_schedule like bapimeposchedule occurs 0 with header line.
* Internal table for changing shceduled qty by BAPI FM
data : i_poschedulex like bapimeposchedulx occurs 0 with header line.
* Internal table for PO item 'x' return table inported by BAPI FM
data : i_poitemx like bapimepoitemx occurs 0 with header line.
*                  Internal Table Declaration
* Internal table for PO orders to be processed.
data : begin of i_orders occurs 0,
           chk(1),
           ebeln like ekko-ebeln,      " Purchase order
           ebelp like ekpo-ebelp,      " Item No of Purchasing Document
           aedat like ekko-aedat,      " Creation Date
           erekz like ekpo-erekz,      " Final Invoice Indicator
           twrkz like ekpo-twrkz,      " partial Invoice indicator
           etenr like eket-etenr,      " Delivery schedule line counter
           menge like eket-menge,      " Scheduled quantity
           wemng like eket-wemng,      " Delivered quantity
           loekz like ekpo-loekz,      " Deletion Indicator
           inqty like ekbe-menge,      " Invoice quantity  (From i_ekbe)
           knttp like ekpo-knttp.      " Account assignemnt DEVK907644
data : end of i_orders.
* Internal table for EKBE data " DEVK907004
data : begin of i_ekbe occurs 0,
           ebeln like ekko-ebeln,      " Purchase order
           ebelp like ekpo-ebelp,      " Item No of Purchasing Document
           zekkn like ekbe-zekkn,      "
           vgabe like ekbe-vgabe,      " Transaction/event type
           belnr like ekbe-belnr,
           buzei like ekbe-buzei,
           bewtp like ekbe-bewtp,      " PO history category
           menge like ekbe-menge,      " Invoicing quantity
           shkzg like ekbe-shkzg.      " DR / Cr Indicator
data : end of i_ekbe.
* Internal table for successful records
data : begin of i_suc_req occurs 0.
        include structure i_orders.
data : end of i_suc_req.
* Internal table for Error records
data : begin of i_err occurs 0.
        include structure i_orders.
data : end of i_err.
*                   Variables Declarations
data :
       v_lines type i,              " For checking line items
       v_lines_2 type i,            " For checking line items
       v_index like sy-tabix,       " For internal table counter
       v_chk_color(2) type n,       " For color coding
       v_header(2)    type n,       " For top-of-page
       v_flag.
*                   Constants Declaration
*                  Selection - Screen
selection-screen begin of block blk1 with frame.
select-options :
  s_ebeln for ekko-ebeln ,    " Purchase order
  s_aedat for ekko-aedat obligatory,    " Creation date
  s_werks for ekpo-werks,               " Plant
  s_ekorg for ekko-ekorg.               " Purchasing org
selection-screen end of block blk1.
selection-screen begin of block prs with frame.
parameters: p_report as checkbox default 'X'.
selection-screen end of block prs.
*                  Ranges Declaration
ranges : s_knttp for ekpo-knttp. " Account assignment " DEVK907628
*&********  E N D   O F   D A T A    D E C L A R A T I O N S  **********
*&****  B E G I N N I N G    O F     P R O G R A M    L O G I C  *******
*                  INITILIZATION
initialization.
*                  At selection Screen
at selection-screen.
  perform check_inputs.
*&                TOP OF PAGE
top-of-page.
  if p_report eq 'X'.
    perform display_header.   " To display the header
  endif.
*                  Start of selection
start-of-selection.
*  Extract orders
  perform extract_orders.
* Extract EKBE Invoice qty
  perform extract_ekbe_inv_qty.
* Extract Inv qty and make checkbox for each record
  perform po_to_be_changed.
  if p_report eq 'X'.
    set pf-status 'PROCESS'.
    perform display_orders_with_checkbox.
  else.
    perform bapi_process.              " BAPI Process
    perform display_success_records.   " Succesfull Records
    perform display_error_records.     " Error Records
  endif.
*                  At User Command
at user-command.
  case sy-ucomm.
    when 'PROC'.
      perform delete_orders.
      perform bapi_process.                " BAPI Process
      clear v_lines.
      describe table i_suc_req lines v_lines.
      clear v_lines_2.
      describe table i_err lines v_lines_2.
      if v_lines > 0 and v_lines_2 > 0.
        perform display_success_records.   " Succesfull Records
        perform display_error_records.     " Error Records
      elseif v_lines > 0 and v_lines_2 = 0.
        perform display_success_records.   " Succesfull Records
        message s007 with 'No error records found'.
      elseif v_lines = 0 and v_lines_2 > 0.
        perform display_error_records.   " Error Records
        message s007 with 'No Success records found'.
      elseif v_lines = 0 and v_lines_2 = 0.
        message i007 with 'No Records have been processed'.
        stop.
      endif.
    when 'EXIT'.
      leave to screen 0.
  endcase.
*                  end of selection
end-of-selection.
*&      Form  check_inputs
*       text
*  -->  p1        text
*  <--  p2        text
form check_inputs.
*  Purchase order validation
*If PO is entered only then continue    "DEVK907080
  if not s_ebeln is  initial.
    select single ebeln from ekko
            into ekko-ebeln
            where ebeln in s_ebeln.
    if sy-subrc ne 0.
      message e007 with 'Please select valid Purchase order'.
    endif.
  endif.                                                    "DEVK907080
* Plant Validation
  if not s_werks is initial.
    select single werks from t001w
           into t001w-werks
           where werks in s_werks.
    if sy-subrc ne 0.
      message e007 with 'Please select valid Plant'.
    endif.
  endif.
* Purchasing Organization Validation
  if not s_ekorg is initial.
    select single ekorg from t024e
           into t024e-ekorg
           where ekorg in s_ekorg.
    if sy-subrc ne 0.
      message e007 with 'Please select valid Purchasing organization'.
    endif.
  endif.
endform.                    " check_inputs
*&      Form  extract_orders
*       text
*  -->  p1        text
*  <--  p2        text
form extract_orders.
* Get Purchase order data from EKKO , EKPO and Scheduled Quantities
* from EKET validating user input those orders which are having
*          Account assignment = 'P'
*     and  Purchasing group   = 'CON'
*     and  Deletion Indicator NE 'X'.
*these orders should not get extracted from these tables
*" DEVK907628
* the account assignment cat "Z" needs to be excluded
  refresh s_knttp[].
  s_knttp-sign    = 'I'.
  s_knttp-option  = 'EQ'.
  s_knttp-low     = 'P'.
  append s_knttp.
  clear s_knttp. " DEVK907644
  s_knttp-sign    = 'I'.
  s_knttp-option  = 'EQ'.
  s_knttp-low     = 'Z'.
  append s_knttp.
  clear s_knttp. " DEVK907644
  clear i_orders.
  refresh i_orders.
  select p~ebeln p~aedat                          " EKKO Data
         f~ebelp f~werks f~erekz f~twrkz f~knttp  " EKPO Data
         b~menge b~wemng b~etenr                  " EKET Data
  into   corresponding fields of table i_orders
  from   ( ( ekko as p
             inner join ekpo  as f on p~ebeln = f~ebeln     )
             inner join eket as  b on b~ebeln = f~ebeln  and
                                      b~ebelp = f~ebelp     )
  where p~ebeln  in  s_ebeln  and                " Purchase order
        p~aedat  in  s_aedat  and                " Creation Date
        p~ekorg  in  s_ekorg  and                " Purchasing Org
        p~ekgrp  ne  'CON'    and                " Purchasing group
        f~loekz  ne  'X'      and                " Deletion ind
        f~werks  in  s_werks  .                  " Plant
*" DEVK907628 Start
*        f~elikz  EQ 'X'       AND                " Delivery com indi
*        f~erekz  EQ 'X'."     and                " Final Invoice indi
* DEVK907644 Delete the reqs which are are having "P" and "Z".
  sort i_orders by ebeln ebelp knttp.
  delete i_orders where knttp in s_knttp.
  clear v_lines.
  describe table i_orders lines v_lines.
  if v_lines = 0.
    message i007 with 'No records found'.
    stop.
  endif.
endform.                    " extract_orders
*&      Form  PO_to_be_changed
*       text
*  -->  p1        text
*  <--  p2        text
form po_to_be_changed.
* Calculate Invoiced quantity and create check box entries.
  clear v_index.
  sort i_orders by ebeln ebelp.
  loop at i_orders.
    v_index = v_index + 1.                                                     " WHY?????
*    MOVE : 'X' TO i_orders-chk.                                               "CHECKS EACH RECORD,SO NOT REQD.
    loop at i_ekbe where ebeln = i_orders-ebeln
                   and   ebelp = i_orders-ebelp.
      if i_ekbe-shkzg = 'H'.                                                  "IF DEBIT,THEN MAKE QTY. NEGATIVE
        i_ekbe-menge = i_ekbe-menge * - 1.
      endif.
      i_orders-inqty = i_orders-inqty + i_ekbe-menge.
    endloop.
    modify i_orders index v_index transporting chk inqty.
  endloop.
endform.                    " PO_to_be_changed
*&      Form  bapi_process
*       text
*  -->  p1        text
*  <--  p2        text
form bapi_process.
  clear i_poitem. clear i_poitemx.
  refresh i_poitem. refresh i_poitemx.
  loop at i_orders where chk = 'X'.
* Refreshing  and clearing all the the tables used in Bapi.DEVK907080
    clear:  i_return,i_poitem, i_poitemx,i_schedule,i_poschedulex.
    refresh:  i_return,i_poitem, i_poitemx,i_schedule,i_poschedulex.
* End of Refreshing and clearing    DEVK907080
* If Ordered qty for PO = 0 then delete the invoice no
    if  i_orders-wemng = 0.
      move : 'X'  to i_poitem-delete_ind.       " Deletion Ind
      move : 'X'  to i_poitemx-delete_ind.      " Deletion Ind
*   !! start
      move : 'X'  to i_poitem-final_inv.        " Final invoice
      move : 'X' to i_poitem-no_more_gr.       " Delivery com ind
      move : 'X' to i_poitemx-final_inv.        " Final invoice
      move : 'X' to i_poitemx-no_more_gr.       " Delivery com ind
*   !! end
* If Ordered QTY more than 0
*      and it is less than Scheduled qty
*          then change the scheduled QTY = ordered qty
    elseif i_orders-wemng > 0 and i_orders-wemng < i_orders-menge.
      i_schedule-po_item = i_orders-ebelp.      " PO order
      i_poschedulex-po_item = i_orders-ebelp.   " PO order
      i_schedule-sched_line = i_orders-etenr.    " sched line item
      i_poschedulex-sched_line = i_orders-etenr. " sched line item
      i_schedule-quantity = i_orders-wemng.      " Changing sched qty
      i_poschedulex-quantity = i_orders-wemng.   " sched line item
      clear v_flag.
      v_flag = 'X'.
      i_orders-menge = i_schedule-quantity.
      append i_schedule. append i_poschedulex.
*-------------------  Invoice qty calc -------------------*
* Checks where Scheduled QTY = Deliverd QTY ----
*-------------------  Invoice qty calc -------------------*
*      in this case use invoiced QTY and Final invoice indicator
*      to delete the item
    elseif i_orders-wemng = i_orders-menge.
* if final invoice indicator is checked
*      and Scheduled QTY = Invoice QTY then delete item
      if i_orders-erekz eq 'X'
            and i_orders-inqty = i_orders-menge.
        move : 'X'  to i_poitem-delete_ind.   " Deletion Ind
        move : 'X'  to i_poitemx-delete_ind.  " Deletion Ind
*   !! start
      move : 'X'  to i_poitem-final_inv.        " Final invoice
      move : 'X' to i_poitem-no_more_gr.       " Delivery com ind
      move : 'X' to i_poitemx-final_inv.        " Final invoice
      move : 'X' to i_poitemx-no_more_gr.       " Delivery com ind
*   !! end
* If final invoice unchecked
*        and scheduled = invoice qty, Do not delete item
      elseif i_orders-erekz eq ' '
             and i_orders-inqty = i_orders-menge.
        continue.
* if final partial invoice indicator checked then dont delete item
      elseif i_orders-twrkz = 'X'.
        move : ' '  to i_poitem-delete_ind.   " Deletion Ind
        move : ' '  to i_poitemx-delete_ind.  " Deletion Ind
*   !! start
        move : ' '  to i_poitem-final_inv.        " Final invoice
        move : ' ' to i_poitem-no_more_gr.       " Delivery com ind
        move : ' ' to i_poitemx-final_inv.        " Final invoice
        move : ' ' to i_poitemx-no_more_gr.       " Delivery com ind
*   !! end
* if invoiced quantity = 0
*        and final invoice indicator checked
      elseif i_orders-inqty = 0
            and i_orders-erekz = 'X'.
        move : 'X'  to i_poitem-delete_ind.   " Deletion Ind
        move : 'X'  to i_poitemx-delete_ind.  " Deletion Ind
*   !! start
      move : 'X'  to i_poitem-final_inv.        " Final invoice
      move : 'X' to i_poitem-no_more_gr.       " Delivery com ind
      move : 'X' to i_poitemx-final_inv.        " Final invoice
      move : 'X' to i_poitemx-no_more_gr.       " Delivery com ind
*   !! end
      else.
        continue.
      endif.
    endif.
* BAPI will run for every Purchase order
    on change of i_orders-ebeln.
      move: i_orders-ebeln to t_poheader-po_number,    " Purchase number
                 'X'           to  t_poheaderx-po_number.  " Indicator
    endon.
    move : i_orders-ebelp    to i_poitem-po_item,     " Purchase order
           i_orders-ebelp    to i_poitemx-po_item.    " Line Item
    append i_poitem. append i_poitemx.
    clear i_return.
    refresh i_return.
    call function 'BAPI_PO_CHANGE'
         exporting
              purchaseorder = i_orders-ebeln
              poheader      = t_poheader
              poheaderx     = t_poheaderx
         tables
              return        = i_return
              poitem        = i_poitem
              poschedule    = i_schedule
              poschedulex   = i_poschedulex
              poitemx       = i_poitemx.
* Save the deletion mark
    commit work." and wait.
    loop at i_return.
      if i_return-type eq 'S' or i_return-type eq 'I'
          or i_return-type eq 'W'.
        if v_flag ne 'X'.
        move : 'X'  to i_orders-loekz.            " Dele ind for disp it
        endif.
        move-corresponding i_orders to i_suc_req.
        append i_suc_req. clear i_suc_req.
      elseif i_return-type eq 'E'.
*   Move error record into i_err for processing those manually
        move-corresponding i_orders to i_err.
        append i_err. clear i_err.
      endif.
    endloop.
  endloop.
* Delete Duplicate Entries from Internal tables
  delete adjacent duplicates from i_suc_req comparing ebeln ebelp.
  delete adjacent duplicates from i_err comparing ebeln ebelp.
endform.                    " bapi_process
*&      Form  display_success_records
*       text
*  -->  p1        text
*  <--  p2        text
form display_success_records.
  write:/001 sy-uline(89).
  format intensified on.
  write:/001 sy-vline.
  format color col_heading.
  write:029 'Purchase Order Success Records'.
  write:089 sy-vline.
  format color col_background.
  write:/001 sy-uline(089).
  write:/001 sy-vline.
  format color col_heading.
*  Display the field headings
  write: 001 sy-vline,
         003 'Pur Order',
         018 sy-vline,
         020 'Item No',
         027 sy-vline,
         029 'Creation Date',
         043  sy-vline,
         045 'Scheduled Qty',
         061  sy-vline,
         063 'Delivered Qty',
         079 sy-vline,
         081 'Dele Ind',      " Deletion Indicator
         089 sy-vline.
  format color off.
  loop at i_suc_req.
*      To provide color codings.
    v_chk_color = sy-tabix mod 2.
    if v_chk_color = 0.
      format color col_normal.
    else.
      format color col_background.
    endif.
    write:/001 sy-vline,
           003 i_suc_req-ebeln ," Purchase order
           018 sy-vline,
           020 i_suc_req-ebelp ," Creation Date
           027 sy-vline,
           029 i_suc_req-aedat ," Item No of Purchasing Document
           043 sy-vline,
           045 i_suc_req-menge ," Scheduled quantity
           061 sy-vline,
           063 i_suc_req-wemng ," Delivered quantity
           079 sy-vline,
           081 i_suc_req-loekz, " Deletion Indicator
           089 sy-vline.
  endloop.
  write :/1 sy-uline(89).
endform.                    " display_success_records
*&      Form  display_error_records
*       text
*  -->  p1        text
*  <--  p2        text
form display_error_records.
  if v_lines > 0.
    skip 2.
  endif.
  write:/001 sy-uline(89).
  format intensified on.
  write:/001 sy-vline.
  format color col_heading.
  write:029 'Purchase Order Error Records'.
  write:089 sy-vline.
  format color col_background.
  write:/001 sy-uline(089).
  write:/001 sy-vline.
  format color col_heading.
*  Display the field headings
  write: 001 sy-vline,
         003 'Pur Order',
         018 sy-vline,
         020 'Item No',
         027 sy-vline,
         029 'Creation Date',
         043  sy-vline,
         045 'Scheduled Qty',
         061  sy-vline,
         063 'Delivered Qty',
         079 sy-vline,
         081 'Del Ind',      " Deletion Indicator
         089 sy-vline.
  format color off.
  loop at i_err.
*      To provide color codings.
    v_chk_color = sy-tabix mod 2.
    if v_chk_color = 0.
      format color col_normal.
    else.
      format color col_negative.
    endif.
    write:/001 sy-vline,
           003 i_err-ebeln ," Purchase order
           018 sy-vline,
           020 i_err-ebelp ," Creation Date
           027 sy-vline,
           029 i_err-aedat ," Item No of Purchasing Document
           043 sy-vline,
           045 i_err-menge ," Scheduled quantity
           061 sy-vline,
           063 i_err-wemng ," Delivered quantity
           079 sy-vline,
           081 i_err-loekz, " Deletion Indicator
           089 sy-vline.
  endloop.
  write :/1 sy-uline(89).
endform.                    " display_error_records
*&      Form  delete_orders
*       text
*  -->  p1        text
*  <--  p2        text
form delete_orders.
  clear v_index.
  loop at i_orders.
    v_index = sy-tabix + 5.
    read line v_index field value i_orders-chk.
    if i_orders-chk eq space.
      modify i_orders transporting chk.
    endif.
  endloop.
  delete i_orders where chk eq ' '.
  set pf-status 'PROCESS' excluding 'PROC'.
endform.                    " delete_orders
*&      Form  extract_ekbe_inv_qty
*       text
*  -->  p1        text
*  <--  p2        text
form extract_ekbe_inv_qty.
* Get the invoicing qty.
  clear i_ekbe.
  refresh i_ekbe.
  if v_lines > 0.
*    SELECT ebeln ebelp vgabe bewtp menge shkzg    " DEVK907004
    select * from ekbe              " DEVK907004
          into corresponding fields of table i_ekbe
          for all entries in i_orders
          where  ebeln = i_orders-ebeln      " Purchase order
          and    ebelp = i_orders-ebelp      " Purchase order Line item
          and    vgabe = '2'.                " Transaction/event type
    sort i_ekbe by ebeln ebelp.
  endif.
endform.                    " extract_ekbe_inv_qty
*&      Form  display_orders_with_checkbox
*       text
*  -->  p1        text
*  <--  p2        text
form display_orders_with_checkbox.
  loop at i_orders.
*      To provide color codings.
    v_chk_color = sy-tabix mod 2.
    if v_chk_color = 0.
      format color col_normal.
    else.
      format color col_background.
    endif.
    write:/001 sy-vline,
           002 i_orders-chk as checkbox,
           005 sy-vline,
           007 i_orders-ebeln ," Purchase order
           018 sy-vline,
           020 i_orders-ebelp ," Creation Date
           027 sy-vline,
           029 i_orders-aedat ," Item No of Purchasing Document
           043 sy-vline,
           045 i_orders-menge ," Scheduled quantity
           061 sy-vline,
           063 i_orders-wemng ," Delivered quantity
           079 sy-vline.
  endloop.
  write :/1 sy-uline(79).
endform.                    " display_orders_with_checkbox
*&      Form  display_header
*       text
*  -->  p1        text
*  <--  p2        text
form display_header.
  write:/001 sy-uline(79).
  format intensified on.
  write:/001 sy-vline.
  format color col_heading.
  write:024 'Purchase Orders to be Processed'.
*  text-011.       " 'Master Data Information' .
  write:079 sy-vline.
  format color col_background.
  write:/001 sy-uline(079).
  write:/001 sy-vline.
  format color col_heading.
*  write:004 sy-vline.
*  Display the field headings
  write: 001 sy-vline,
         002  'Chk',
         005 sy-vline,
         007 'PO Order',
         018 sy-vline,
         020 'Item No',
         027 sy-vline,
         029 'Creation Date',
         043  sy-vline,
         045 'Scheduled Qty',
         061  sy-vline,
         063 'Delivered Qty',
         079 sy-vline.
*  WRITE:079 sy-vline.
  format color col_background.
  write:/001 sy-uline(079).
endform.                    " display_header

Similar Messages

  • BAPI for Creation of inspection lot

    I have two scenario:-
    1.Can any body help to find BAPI for creation of Inspection lot for the material under PO envisaged for PDI.
    2. Can any body find me a BAPI or FM which can creates inspection lot in QALS table without inspection lot origin under 01 i.e. 0101 or Z01SI01.
    My objective is to creation inspection lot without assigning Inspection type of Z01SI01 or Z01SI02 and so on in the material code under a respective Plant 1004 or 1005 0r 1006 so on.
    In my Z Development for creation of inspection lot BDC is run for QA01 as this code created inspection lot on when material code has inspection type Z01SI01 i.e. location of source inspection and vendr code particular classification under 010 vendor class inspection type Z01SI01. System search both the inspection type for both material and vendor then create inspection lot in QALS table by assiging inspection matching inspection on the lot.
    I want to get rid of assignment of inspection on the materilal. If any BAPI or FM is avalable for creation of inspection without assigning inspection type on material code. I want to create inspection lot in which Inpsection type assignment can be done based on vendor class only.
    YPB

    2. Can any body find me a BAPI or FM which can creates inspection lot in QALS table without inspection lot origin under 01 i.e. 0101 or Z01SI01.
    I am very sure that this is not possible.You can not create inspection lot without inspection lot origin or inspection type.
    Regards
    Sujit

  • BAPI for creation of subcontract PO

    Hi all,
       Currently iam doing a BAPI for creation of subcontract Purchase Order using the BAPI_PO_CREATE1. But in this BAPI iam unable to find the table for entering Components.
    Regards,
    Sun.

    Hi,
    I wil give you how to fill the components of PO items, it is a sample code;
    *zPoHeader
      if kna1-kunnr eq 'BOR020'.
        zpoheader-comp_code   = '0040'.
      endif.
      if  kna1-kunnr eq 'BOR040'.
        zpoheader-comp_code   = '0048'.
      endif.
      zpoheader-doc_type    = 'ZSA'.
      zpoheader-doc_date    = mkpf-budat.
      zpoheader-vendor      = 'BOR050'. "&#351;imdilik
      zpoheader-pmnttrms    = 'Z030'.
      zpoheader-purch_org   = '1100'.
      zpoheader-pur_group   = '101'. "malzeme ÜZERINDEKI marc-ekgrp
      zpoheader-currency    = zsaleshead-waers.
      zpoheader-item_intvl  = 10.
      zpoheaderx-comp_code  = 'X'.
      zpoheaderx-doc_type   = 'X'.
      zpoheaderx-vendor     = 'X'.
      zpoheaderx-purch_org  = 'X'.
      zpoheaderx-pur_group  = 'X'.
      zpoheaderx-currency   = 'X'.
      zpoheaderx-doc_date   = 'X'.
      zpoheaderx-pmnttrms   = 'X'.
      zpoheaderx-item_intvl = 'X'.
    *zPoitem
      loop at i_posnr.
        lv_ebelp = lv_ebelp + 10.
        zpoitem-po_item    =  lv_ebelp.
        zpoitem-material   = i_posnr-matnr.
        if kna1-kunnr eq 'BOR020'.
          zpoitem-plant      = '0040'.
          zpoitem-stge_loc   = '4001'.
        endif.
        if kna1-kunnr eq 'BOR040'.
          zpoitem-plant      = '0048'.
          zpoitem-stge_loc   = '4801'.
        endif.
        zpoitem-quantity   = i_posnr-menge.
        zpoitem-po_unit    = i_posnr-meins.
        zpoitem-net_price  = i_posnr-bfiyat.
        zpoitem-price_unit = 1.
        zpoitem-tax_code   = 'V0'.
        zpoitemx-po_item    = lv_ebelp.
        zpoitemx-po_itemx   = 'X'.
        zpoitemx-material   = 'X'.
        zpoitemx-plant      = 'X'.
        zpoitemx-stge_loc   = 'X'.
        zpoitemx-quantity   = 'X'.
        zpoitemx-po_unit    = 'X'.
        zpoitemx-net_price  = 'X'.
        zpoitemx-price_unit = 'X'.
        zpoitemx-tax_code   = 'X'.
        append: zpoitem, zpoitemx.
        clear : zpoitem, zpoitemx.
      endloop.
      call function 'BAPI_PO_CREATE1'
        exporting
        poheader                     = zpoheader
        poheaderx                    = zpoheaderx
    tables
       return                       = zreturn3
       poitem                       = zpoitem
       poitemx                      = zpoitemx.
    Send me your results,
    Kenan.

  • Bapi for creation of a contract against services.

    Hi.
    i just want to know the correct bapi for creation of contracts against services..here i was tried with BAPI_CONTRACT_CREATE but the documentation says that it is not supported for exxternal or internal services.
    so iam not sure if this bapi is the one for contract creation for services.
    any way i was tried to test this function module but i havent got  Contract created.
    wil be waiting for an excellent answer.
    bye.
    reegards.
    seetaram.

    Hi Ram,
    Try the function module
    BAPI_CONTRACT_CREATEFROMDATA.
    Once you create the contract, update the technical objects for the contracts
    using two function modules called one after another.
    IWOL_WV_ADD_OBJECTS
    IWOL_WV_POST_OBJECT_LIST
    Regards,
    Chandra Sekhar

  • BAPI for Creation of Maintenance Plan (TCode - IP01)

    Hello
    Kindly help me with the BAPI for Creation of Maintenance Plan (TCode - IP01)
    Thanks and Regards
    Avishek

    Hi
       Check Tcode: IBIP. and LSMW method and below link it may be helpful.
    [link|Re: LSMW for uploading equipment.]
    Thanks,
    Asit Purbey.

  • BAPI for Creation of the Project in ECC using Standard Templates

    Hi,
    I want BAPI for Creation of the Project in ECC using project id and project standard template ID
    and BAPI for Updating of project and WBS element  using  project id and WBS element ID

    One idea is to write a wrapper FM that is remote enabled and internally call BBP_PD_CTR_CREATE for your own use.

  • BAPI for creation of material documents/movements

    Hi Everebody:
    I need some help regarding to bapis for the creation of mateial documents and/or movements. I have been trying to implement bapi BAPI_GOODSMVT_CREATE, but this bapi does not have (import) the posting time in document, which is very important for my porpuse.
    So, I would appretiate a lot any information anybody could give about any bapi I could use to create material documents or material movements but incluidng the posting time in document (field MKPF-OIB_BLTIME).
    Regards

    You can check MB_CREATE_GOODS_MOVEMENT which has mkpf as inporting parameter.

  • Bapi for creation of equipment master

    hi friends ,
    I have to made a BDC program for creation of equipment master .
    for that  I am using bapi i.e. ' BAPI_EQUI_CREATE '.
    I had matched the fields of transaction IE01 but in the additinal data part i could not able to map 'Partner' fields .
    pls some body can guide what should i do for it.

    Hi Das,
    If u r going to create equipment no against this Bapi BAPI_EQUI_CREATE"
    then u need to pass material no, Equipment type, Serial No. there is no need to give partner no .
    If its good, then plz give point.

  • BAPI for creation of Authorization Objects in BI 7.0

    Hi BW Gurus,
    Greetings!!!
    Is there any BAPI Available for creation of Authorization Objects in BI 7.0.
    The data will be transferred through flatfiles.
    Kindly provide me the info as earliest as possible.
    Best Regards,
    Priya

    Got the Workaround...
    Priya

  • BAPI for Creation of Stock

    Hi Freinds,
    I need to trigger the creation of a stock from a BAPI.
    So in MIGO i am using movement type 501 and type as Others.
    I could see a bapi BAPI_GOODSMVT_CREATE for that .But in the checktable for the tcodes t158g , i could not find MIGO.So i doubt if i can use this BAPI for the creation of a stock.
    Please let me know if there is a BAPI for the creation of stocks.
    Thanks and Regards,
    Anoop

    Hello,
    Use the belwo bapi.
    BAPI_WHSE_TO_CREATE_STOCK
    Reward if helps.
    Thanks,
    Krishna

  • Standard remote enabled bapi for creation of purchaser contract in srm

    Hello Friends
    Plz tell me is there any standard,remote enabled FM/BAPI in SRM system for creation of purchaser contract.
    I found BBP_PD_CTR_CREATE. But this is normal FM.
    I need BAPI like BAPI_CONTRACT_CREATE which there in ECC system.
    Plz help.
    Thanks & regards,

    One idea is to write a wrapper FM that is remote enabled and internally call BBP_PD_CTR_CREATE for your own use.

  • BAPI  for  creation of Equipment BOM

    Which BAPI is used for creation of Equipment BOM?

    Hi,
    Check this Code, it works:
    DATA ecsin  TYPE csin.
    DATA estkob TYPE stkob .
    DATA estzub TYPE stzub .
    DATA astlnr TYPE stzub-stlnr .
    DATA t_stpob TYPE STANDARD TABLE OF stpob WITH HEADER LINE .
    PARAMETERS: pa_equnr TYPE equnr DEFAULT '1500037'. "Your Equipment.
    START-OF-SELECTION.
       ecsin-equnr = pa_equnr.
       ecsin-stlty = 'E' .
       ecsin-stlan = '4' .
       ecsin-werks = 'C002'. "Your Plant.   
       ecsin-datuv = '20130101'.
       estkob-bmein =  'ST'.
       estkob-bmeng = 1.
       estkob-stktx = 'TEST'.
       t_stpob-stlty = 'M' .
       t_stpob-postp = 'L' .
       t_stpob-idnrk = '000000000040002882'. "Your Component.
       t_stpob-meins = 'ST' .
       t_stpob-menge = 1 .
       t_stpob-rvrel = 'X' .
       APPEND t_stpob .
       t_stpob-menge = 2.
       t_stpob-idnrk = '000000000040002877'. "Your Component.
       APPEND t_stpob.
       CALL FUNCTION 'CSAI_BOM_CREATE'
         EXPORTING
           ecsin                    = ecsin
           estkob                   = estkob
           estzub                   = estzub
    *   FL_NO_CHANGE_DOC         = ' '
    *   FL_COMMIT_AND_WAIT       = ' '
    *   FL_NO_COMMIT_WORK        = ' '
    *   FL_ALE                   = ' '
         IMPORTING
    *   FL_WARNING               =
           astlnr                   = astlnr
         TABLES
           t_stpob                  = t_stpob
         EXCEPTIONS
           error                    = 1
           OTHERS                   = 2.
       IF astlnr IS INITIAL.
    ****ERROR.
       ENDIF.
       IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       ENDIF.
    Regards,
    Sergio.

  • Bapi for creation media product family

    hi friends ,
    Is there any bapi exist for  creation of media product family.

    Hi sandipan,
    for creation of media product family there is no bapi.acually how bapi's are nothing but api methods or transactions.
    the business object for productcatalog is BUS1071.
    go to SWO1(its not zero) and check this .
    they assigned a transaction WWM1 to create productcatalog.
    reward points if helpful.

  • BAPI for creation of Purchasing info record

    Hi SAPians,
    Greetings......
    Can you help me out in giving the BAPI for the creation of Purchasing Info record (ME11) .
    Thanks in advance,
    Lekha.

    Hi ,
    You people have suggested me to use RM06IBI0 this program.
    I want to know in what way it can help me.
    Thankyou in advance,
    Lekha.

  • BAPI for creation of batch MCHB

    HIi
    There is a FM BAPI_BATCH_CREATE for creation of batch i though it was updating the batch in table MCHB but it was updatin MCHA table.
    Please advise if anyone know of a BAPI which update the MCHB table

    Hi,
    Try doing  BAPIBATCH* in SE37 instead of posting here. Please search on SCN before posting.
    Regards
    Abhii
    Edited by: Abhii on Dec 11, 2009 2:49 PM

  • Help Rgd. BAPI for Creation of Inbound delivery Document

    Hi all,
    I need a Bapi to create inbound delivery document without using PO reference. I have seen the below BAPIs. i) BAPI_IBDLV_CREATE_FROM_OBDLV, 
    ii) BAPI_GOODSMVT_CREATE. I am not sure whether they are for creating inbound delivery document without using PO reference.
    It will be of great use if anyone can give me the BAPI for the purpose and the mandatory parameters or sample test data for the BAPI.
    Thanks in Advance,
    Rakesh.

    If you create the inbound delivery->check the purchase order in the tabstrip "Confirmations" on item level. There are three fields: "Confirmation control key", "Order acknowl." and "acknowl. required".
    Ckeck if there is a value in "confirmation control key".
    You should get the same error if you try to create VL31N in dialog mode, not only by using the bapi.
    Rgds,
    JP

Maybe you are looking for

  • HT204380 Can I use same apple ID on both my ipad2s and do FaceTime

    I have 2 iPads and same iTunes ID. Can I login in with this but use 2 different emails to do FaceTime? E.g I have [email protected] as ID on both iPad 2s. But my kid is in school and want to FaceTime with me. Can he use his email ID and connect to my

  • Just bought ipod nano.  Just bought 2 songs in istore however did not sync to my ipod.  how do i tell if ipod is active with istore

    Just bought ipod and went to istore and bought 2 songs.  However does not seem to have synced to my ipod.  How do i make sure device is recognized by istore.  Should istore page be indicating its presence.  First experience with ipod or istore and am

  • Desktop display help needed

    my son was playing with the computer and accidentally did something to change the display of the desktop screen and now everything is re-sized.  The dock on the bottom of the screen and the bar on top no longer fit on the page together and all the ic

  • After Effects crash to open

    Faulting application name: AfterFX.exe, version: 11.0.4.2, time stamp: 0x52886341 Faulting module name: AfterFXLib.dll, version: 0.0.0.0, time stamp: 0x52888ba6 Exception code: 0xc0000005 Fault offset: 0x000000000072e40f Faulting process id: 0x492c F

  • User not receiving Email

    I have a user that can not receive email the emails just sit in the queue. The error I see is DBERROR: error fetching user.user: cyrusdb error I have ran mailbfr -m twice and restarted the server with no success. What is the next step.