Step by step bapi for purchase order

hi friends,
i am very new to bapi i have requiremet to upload purchase order
using bapi can any one tell me how to use bapi_po_create
which parameter i hvae to pass .plz do the need ful.
regards
sonu

Hi Sir,
I am sending you the code in which i have implemented bapi pocreate.Please go through the FM ,you will easily understand it.
Plz do reward if useful.
Thankx.
method do_handle_event.
*CALL METHOD SUPER->DO_HANDLE_EVENT
EXPORTING
   EVENT           =
   HTMLB_EVENT     =
   HTMLB_EVENT_EX  =
   GLOBAL_MESSAGES =
RECEIVING
   GLOBAL_EVENT    =
  data: event_id type string.
  data zpr_num1 type banfn.
  data zreturn type zsn_bapiret2.
  data ret type bapireturn-type.
  data message type bapi_msg.
  data returnval type bapimepoheader-po_number.
  data: r_view type ref to if_bsp_page.
  data: crt_view type ref to if_bsp_page.
  data po_num_head type bapimepoheader.
  data zpoheader_it type zbapimepoheader_tab.
  data zpoheaderx_it type zbapimepoheaderx_tab.
to add a new item to list
  if htmlb_event is bound and htmlb_event->server_event = 'onadd'.
    zpr_num = request->get_form_field( 'PRNo' ) .
    data: zpr_num3 type banfn.
    call function 'ZCONVERT_ALPHA'
      exporting
        input  = zpr_num
      importing
        output = zpr_num3.
    zpr_num = zpr_num3.
    data: temp_tab1  type zrmheader.
    delete from zrmheader.
    zpoheader-vendor = request->get_form_field( 'Vendor' ) .
    zpoheader-purch_org = request->get_form_field( 'POrg' ).
    zpoheader-pur_group = request->get_form_field( 'PGrp' ).
    zpoheader-doc_type = 'NB'.
    zpoheader-item_intvl = request->get_form_field( 'Item' ).
    zpoheader-comp_code = request->get_form_field( 'CCode' ).
    zpoheader-doc_date = request->get_form_field( 'DocDate' ).
    delivdate_new = request->get_form_field( 'DelivDate' ).
    temp_tab1-vendor = request->get_form_field( 'Vendor' ) .
    temp_tab1-purch_org = request->get_form_field( 'POrg' ).
    temp_tab1-pur_group = request->get_form_field( 'PGrp' ).
    temp_tab1-doc_type = 'NB'.
    temp_tab1-item_intvl = request->get_form_field( 'Item' ).
    temp_tab1-comp_code = request->get_form_field( 'CCode' ).
    temp_tab1-doc_date = request->get_form_field( 'DocDate' ).
    data: temp_tabx1  type zrmheaderx.
    delete from zrmheaderx.
    temp_tabx1-vendor = 'x'.
    temp_tabx1-purch_org = 'x'.
    temp_tabx1-pur_group = 'x'.
    temp_tabx1-doc_type = 'x'.
    temp_tabx1-comp_code = 'x'.
    temp_tabx1-doc_date = 'x'.
    insert into zrmheader values temp_tab1.
    insert into zrmheaderx values temp_tabx1.
    data: temp_tab  type zrmitem .
    data: temp_tabx type zrmitemx.
    zitem1-acctasscat = request->get_form_field( 'A' ).
    temp_tab-acctasscat = request->get_form_field( 'A' ).
    zitem1-item_cat = request->get_form_field( 'I' ).
    temp_tab-item_cat = request->get_form_field( 'I' ).
    zitem1-material = request->get_form_field( 'Material' ).
    temp_tab-material = request->get_form_field( 'Material' ).
    zitem1-quantity = request->get_form_field( 'POQuantity' ).
    temp_tab-quantity = request->get_form_field( 'POQuantity' ).
    zitem1-po_unit = request->get_form_field( 'OUN' ).
    temp_tab-po_unit = request->get_form_field( 'OUN' ).
    zitem1-net_price = request->get_form_field( 'NetPrice' ).
    temp_tab-net_price = request->get_form_field( 'NetPrice' ).
    zitem1-plant = request->get_form_field( 'Plnt' ).
    temp_tab-plant = request->get_form_field( 'Plnt' ).
    zitem1-po_item = request->get_form_field( 'Item' ).
    temp_tab-po_item = request->get_form_field( 'Item' ).
    zitem1-stge_loc = request->get_form_field( 'Sloc' ).
    temp_tab-stge_loc = request->get_form_field( 'Sloc' ).
    zitem1-customer = request->get_form_field( 'Customer' ).
    temp_tab-customer = request->get_form_field( 'Customer' ).
    zitem1-incoterms2 = 'XDFGRT'.
    temp_tab-incoterms2 = 'XDFGRT'.
    append  zitem1 to zitem.
    insert into zrmitem values temp_tab.
    zitemx1-acctasscat = 'x'.
    zitemx1-item_cat = 'x'.
    zitemx1-material = 'x'.
    zitemx1-quantity = 'x'.
    zitemx1-net_price = 'x'.
    zitemx1-plant = 'x'.
    zitemx1-po_item = 00010.
    zitemx1-po_itemx = 'x'.
    zitemx1-stge_loc = 'x'.
    zitemx1-customer = 'x'.
    zitemx1-incoterms2 = 'x'.
   append  zitemx1 to zitemx.
    temp_tabx-acctasscat = 'x'.
    temp_tabx-item_cat = 'x'.
    temp_tabx-material = 'x'.
    temp_tabx-quantity = 'x'.
    temp_tabx-net_price = 'x'.
    temp_tabx-plant = 'x'.
    temp_tabx-po_item = 00010.
    temp_tabx-po_itemx = 'x'.
    temp_tabx-stge_loc = 'x'.
    temp_tabx-customer = 'x'.
    temp_tabx-incoterms2 = 'x'.
    insert into zrmitemx values temp_tabx.
    select * from zrmitem into corresponding fields of table zitem.
    zpr_num = request->get_form_field( 'PRNo' ) .
    call function 'ZCONVERT_ALPHA'
      exporting
        input  = zpr_num
      importing
        output = zpr_num1.
        LEN           =
    call function 'BAPI_REQUISITION_GETDETAIL'
      exporting
        number                               = zpr_num1
  ACCOUNT_ASSIGNMENT                   = ' '
  ITEM_TEXTS                           = ' '
  SERVICES                             = ' '
  SERVICE_TEXTS                        = ' '
      tables
        requisition_items                    = item_tab
  REQUISITION_ACCOUNT_ASSIGNMENT       =
  REQUISITION_TEXT                     =
  REQUISITION_LIMITS                   =
  REQUISITION_CONTRACT_LIMITS          =
  REQUISITION_SERVICES                 =
  REQUISITION_SERVICES_TEXTS           =
  REQUISITION_SRV_ACCASS_VALUES        =
  RETURN                               =
    call function 'BAPI_TRANSACTION_COMMIT'
      exporting
        wait = 'X'.
*IMPORTING
*RETURN = i_return
to save the item details and generate a PO number
  elseif htmlb_event is bound and htmlb_event->server_event = 'onsave'.
    zpr_num = request->get_form_field( 'PRNo' ) .
    data: zpr_num4 type banfn.
    call function 'ZCONVERT_ALPHA'
      exporting
        input  = zpr_num
      importing
        output = zpr_num4.
    zpr_num = zpr_num4.
    data: temp_t2 type zrmsched,
          count2 type n,
          a2 type n value 1.
    data:temp_t type zrmitem,
         count type n,
         a type n value 1.
    select * from zrmitem into corresponding fields of table data_tab.
    count = sy-dbcnt.
    do count times.
      read table data_tab into temp_t index a.
      a = a + 1.
      zitem1-po_item = temp_t-po_item.
      zitem1-acctasscat = temp_t-acctasscat.
      zitem1-item_cat = temp_t-item_cat.
      zitem1-material = temp_t-material.
      zitem1-quantity = temp_t-quantity.
      zitem1-po_unit = temp_t-po_unit.
      zitem1-net_price = temp_t-net_price.
      zitem1-plant = temp_t-plant.
      zitem1-stge_loc = temp_t-stge_loc.
      zitem1-customer = temp_t-customer.
      zitem1-incoterms2 = temp_t-incoterms2.
      append zitem1 to zitem.
      zitemx1-acctasscat = 'x'.
      zitemx1-item_cat = 'x'.
      zitemx1-material = 'x'.
      zitemx1-quantity = 'x'.
      zitemx1-net_price = 'x'.
      zitemx1-plant = 'x'.
      zitemx1-po_item = temp_t-po_item.
      zitemx1-po_itemx = 'x'.
      zitemx1-stge_loc = 'x'.
      zitemx1-customer = 'x'.
      zitemx1-incoterms2 = 'x'.
      append  zitemx1 to zitemx.
    enddo.
count2 = sy-dbcnt.
    zpoheader-vendor = request->get_form_field( 'Vendor' ) .
    zpoheader-purch_org = request->get_form_field( 'POrg' ).
    zpoheader-pur_group = request->get_form_field( 'PGrp' ).
    zpoheader-doc_type = 'NB'.
    zpoheader-item_intvl = request->get_form_field( 'Item' ).
    zpoheader-comp_code = request->get_form_field( 'CCode' ).
    zpoheader-doc_date = request->get_form_field( 'DocDate' ).
    delivdate_new = request->get_form_field( 'DelivDate' ).
    zpoheaderx-vendor = 'x'.
    zpoheaderx-purch_org = 'x'.
    zpoheaderx-pur_group = 'x'.
    zpoheaderx-doc_type = 'x'.
    zpoheaderx-comp_code = 'x'.
    zpoheaderx-doc_date = 'x'.
    data: zpovendor type elifn.
    call function 'ZCONVERT_ALPHA'
      exporting
        input  = zpoheader-vendor
      importing
        output = zpovendor.
    zpoheader-vendor = zpovendor.
    call function 'BAPI_PO_CREATE1'
      exporting
        poheader                     = zpoheader
        poheaderx                    = zpoheaderx
  POADDRVENDOR                 =
  TESTRUN                      =
  MEMORY_UNCOMPLETE            =
  MEMORY_COMPLETE              =
  POEXPIMPHEADER               =
  POEXPIMPHEADERX              =
  VERSIONS                     =
  NO_MESSAGING                 =
  NO_MESSAGE_REQ               =
  NO_AUTHORITY                 =
  NO_PRICE_FROM_PO             =
     importing
       exppurchaseorder             = po_num
         EXPHEADER                    = PO_NUM_HEAD
  EXPPOEXPIMPHEADER            =
     tables
        RETURN                       = zreturn
        poitem                       = zitem
        poitemx                      = zitemx
  POADDRDELIVERY               =
POSCHEDULE                   = zposched
POSCHEDULEX                  = zposchedx
  POACCOUNT                    =
  POACCOUNTPROFITSEGMENT       =
  POACCOUNTX                   =
  POCONDHEADER                 =
  POCONDHEADERX                =
  POCOND                       =
  POCONDX                      =
  POLIMITS                     =
  POCONTRACTLIMITS             =
  POSERVICES                   =
  POSRVACCESSVALUES            =
  POSERVICESTEXT               =
  EXTENSIONIN                  =
  EXTENSIONOUT                 =
  POEXPIMPITEM                 =
  POEXPIMPITEMX                =
  POTEXTHEADER                 =
  POTEXTITEM                   =
  ALLVERSIONS                  =
  POPARTNER                    =
  POCOMPONENTS                 =
  POCOMPONENTSX                =
  POSHIPPING                   =
  POSHIPPINGX                  =
  POSHIPPINGEXP                =
    call function 'BAPI_TRANSACTION_COMMIT'
      exporting
         wait = 'X'
     IMPORTING
     RETURN =
    delete from zrmitem.
    delete from zrmitemx.
    select * from zrmitem into corresponding fields of table zitem.
    if po_num = ' '.
      po_num = 'Try Again'.
    endif.
to store po_num and corresponding pr number
    data: temp_tt type zpo_pr_nums.
    temp_tt-pr_num = zpr_num.
    temp_tt-po_num = po_num.
    insert into zpo_pr_nums values temp_tt.
to store po num and corresponding delivery date
    data: wa11 type zpo_delivdate.
    wa11-po_number = po_num.
    wa11-deliv_date = delivdate_new.
    insert into zpo_delivdate values wa11.
    zpoheader-vendor = ' '.
    zpoheader-purch_org = ' '.
    zpoheader-pur_group = ' '.
    zpoheader-doc_type = ' '.
    zpoheader-item_intvl = ' '.
    zpoheader-comp_code = ' '.
    zpoheader-doc_date = ' '.
    delivdate_new = ' '.
to enter a PR Number
  elseif htmlb_event is bound and htmlb_event->server_event = 'onenter'.
    delete from zrmitem.
    delete from zrmitemx.
    select * from zrmitem into corresponding fields of table zitem.
    zpr_num = request->get_form_field( 'PRNo' ) .
    call function 'ZCONVERT_ALPHA'
      exporting
        input  = zpr_num
      importing
        output = zpr_num1.
        LEN           =
    call function 'BAPI_REQUISITION_GETDETAIL'
      exporting
        number                               = zpr_num1
  ACCOUNT_ASSIGNMENT                   = ' '
  ITEM_TEXTS                           = ' '
  SERVICES                             = ' '
  SERVICE_TEXTS                        = ' '
      tables
        requisition_items                    = item_tab
  REQUISITION_ACCOUNT_ASSIGNMENT       =
  REQUISITION_TEXT                     =
  REQUISITION_LIMITS                   =
  REQUISITION_CONTRACT_LIMITS          =
  REQUISITION_SERVICES                 =
  REQUISITION_SERVICES_TEXTS           =
  REQUISITION_SRV_ACCASS_VALUES        =
  RETURN                               =
    call function 'BAPI_TRANSACTION_COMMIT'
      exporting
        wait = 'X'.
*IMPORTING
*RETURN = i_return
to select an item from drop down item menu
  elseif htmlb_event is bound and htmlb_event->server_event = 'select'.
    data: zselection2 type bnfpo.
    data: data type ref to cl_htmlb_dropdownlistbox.
    zpr_num = request->get_form_field( 'PRNo' ) .
    data: zpr_num2 type banfn.
    call function 'ZCONVERT_ALPHA'
      exporting
        input  = zpr_num
      importing
        output = zpr_num2.
    data ?= cl_htmlb_manager=>get_data(
                                        request = runtime->server->request
                                        name    = 'dropdownlistbox'
                                        id      = 'ItemSel'
    if data is not initial.
      zselection2 = data->selection.
    endif.
    zpoheader-vendor = request->get_form_field( 'Vendor' ) .
    zpoheader-purch_org = request->get_form_field( 'POrg' ).
    zpoheader-pur_group = request->get_form_field( 'PGrp' ).
    zpoheader-doc_type = 'NB'.
    zpoheader-item_intvl = request->get_form_field( 'Item' ).
    zpoheader-comp_code = request->get_form_field( 'CCode' ).
    zpoheader-doc_date = request->get_form_field( 'DocDate' ).
    call function 'BAPI_REQUISITION_GETDETAIL'
      exporting
        number                               = zpr_num2
  ACCOUNT_ASSIGNMENT                   = ' '
  ITEM_TEXTS                           = ' '
  SERVICES                             = ' '
  SERVICE_TEXTS                        = ' '
      tables
        requisition_items                    = item_tab
  REQUISITION_ACCOUNT_ASSIGNMENT       =
  REQUISITION_TEXT                     =
  REQUISITION_LIMITS                   =
  REQUISITION_CONTRACT_LIMITS          =
  REQUISITION_SERVICES                 =
  REQUISITION_SERVICES_TEXTS           =
  REQUISITION_SRV_ACCASS_VALUES        =
  RETURN                               =
    data wa1 type bapieban.
    loop at item_tab into wa1.
      if wa1-preq_item = zselection2.
        item_new = wa1-preq_item.
        material_new = wa1-material.
        plant_new = wa1-plant.
        quantity_new = wa1-quantity.
        unit_new = wa1-unit.
        delivdate_new = wa1-deliv_date.
      endif.
    endloop.
  endif.

Similar Messages

  • BAPI for Purchase Order Confirmation and update EKES table

    Hi all,
    I have a requirement to update the PO confirmation soon after successful creation of PO in an IDOC.
    I have used BAPI_PO_CHANGE function module which didnt serve the purpose as it cannot update confirmations.
    I tried using ME_CONFIRMATION_UPDATE where I was able to add a confirmation entry in EKES table but that is not being reflected in ME23N transaction when I display the PO.
    Please help me out on this.
    Thanks & Regards
    Pavan

    NB: Never use a standard update FM (check attributes of ME_CONFIRMATION_UPDATE) its often only a SQL statement collector without any check, logging of changes or database consistency, if you perform a where-used you should find it is never called alone but with a bunch of other update FM after checks and other update preparation.
    Get back to the BAPI and table parameter POCONFIRMATION, also use BAPI_PO_GETDETAIL1 to get current data for the call of BAPI_PO_CHANGE.
    Regards,
    Raymond
    PS: If it is not in 197958 - BAPIs for purchase orders: Missing functions, you should be able to do it

  • BAPI for PURCHASE ORDER with OPEN QUANTITY field

    Hi All,
    I wanted to use the BAPI_PO_GETDETAIL to get the Purchase Order details upon triggering from Warehouse management system,
    But the details required contains a field called OPEN QUANTITY...which is not used in this BAPI.
    I request to let me know if any BAPI exits for PO details having the structure for this field:Open Quantity.
    Am using SAP version 4.0B.
    If not exists please advise how to customize the existing BAPI to meet the requirement.
    thanks
    mahi

    Hi,
    Open quantity is a calculated field. I guess the BAPI gives the details of the delivery, so take the ordered qty and substract the delivered qty from that.
    Delivery data is EKET table.
    Regards,
    Ravi

  • BAPI for Purchase Order Creation

    Hi All,
    Purchase Order creation through BAPI, Auto Po creation. Please advise program.
    The requirement is: when we delivery the goods from one plant to another plant,PO should create in second plant with goods what delivered from first plant.
    Pranitha
    Moderator message : Spec/requirements dumping is not allowed. Thread locked.
    Edited by: Vinod Kumar on Sep 30, 2011 3:37 PM

    Hi,
    As per  u r requirement
    you can use  : BAPI =>    BAPI_PO_CREATE  with suitable Document  Type ( Stock trasnfert : STO )
    IF  u want to auto po must be created after each delivry in this case you need to use BADI
    'MB_MIGO_BADI; In This BAPI  There is method : POST_DOCUMENT
    In this method u can write code for Auto PO Creation by using BAPI .
    Hope This will Resolve u r query.
    Thanks and Regads
    Santosh

  • BAPI for Purchase order change

    Hi experts,
      I just want to change PO quantity by BAPI function module: BAPI_PO_CHANGE, I fill in PO number, Item number, material number and PO quantity to parameters, but result is not well. it shows a message below and the purchase order is not changed.
    message:
    For the currency code  ALE communication is not allowed
    Message no. B1889
    Diagnosis
    The ISO code assigned to the current currency code is not unique and the primary flag is NOT set. This currency code can therefore not be used for external communication.
    I checked currency config in SPRO and the assignment of ISO code is unique and the primary flag is setted actually.
    so what else can I do to solve this problem.
    thanks in advance.
    jack

    The B1889 message has the following reasons:
      -> The primary flag of the found ISO code is assigned more than once.
      -> The ISO code is not unique and the primary flag is not assigned
         for associated SAP currency codes.
      -> The ISO code is not unique and the current SAP currency code has
         NOT assigned the primary flag.
    First case: CC   ISOCD  XPRIMARY
                CNY   CNY      X
                RMB   CNY
    Your ISO code is not unique, therefore you are using the primary flag.
    If a dataset wich currency code CNY is encountered, everything is ok
    because none of the 3 rules mentioned above can be applied.
    If a dataset contains currence code  RMB, rule (3) will be applied.
    Therefore, you get the following output in this case:
      "For curreny code  RMB  ALE Communication is not allowed"
    Second case: CC   ISOCD  XPRIMARY
                 CNY   CNY
                 RMB   CNY    X
    If a dataset contains currency code RMB, everything is ok because it is
    flagged as primary. Like in the first case, if CNY is encountered,
    rule (3) will be applied and you will get the output:
      "For curreny code CNY ALE Communication is not allowed"
    If you are using both CNY  and RMB together, it is not possible to avoi
    the B1889 message beause there will be always the case that your ISO
    code is not unique AND that one currency code is not flagged as primary,
    which is summed up in rule (3).
    Please see information in attached note  "144349 ALE: Problems with
    currency conve".

  • BAPI for purchase order

    Hi all,
    I have to retrieve the invoice verification due date given the following:
    •     Retrieve batch number from item level of billing (VBRP-CHARG)
    •     Pick up  purchase order number from batch master data MCH1
    •     Based on PO number, retrieve invoice verification number (EKBE-BELNR) where :
    1.     EKBE-EBELN = PO Number
    2.     EKBE-VGABE = ‘2’
    •     Based on Invoice receipt number, pick up due data on BSEG-FDTAG where BSEG-BLNR is equal with above invoice verification number.
    I've done the first bullet point but don't know how to proceed. How can i pick up the purchase order number, do we have any BAPI for that?
    Thanks!

    Used FM VB_BATCH_GET_DETAIL to get PO number

  • BAPI for purchase order .. to create and delete confirmation

    HI Gurus
    I need to create and delete PO(Purchase order) confirmation in SAP 4.7 R3 .
    Please let me know which BAPI i can use for .. in SAP 4.7
    1. Create PO confirmation
    2. Delete PO confirmation
    Many thanks and regards
    Sandeep Sharma

    Hi Sandeep,
    In SAP 4.7 R3 & ECC 5.0. we don't have BAPI to delete / create PO confirmatons.
    Use this FM for both : ME_CONFIRMATION_UPDATE
    In addition to above , we need to use this FM : ME_CONFIRMATION_REDISTR_ITEMS , for PO item update in MD04 transaction.
    In addtion to above 2 FM, you need to used Change doucment FM for write log data.
    Thanks.

  • BAPI for Purchase Order Vendor Confirmations

    Can any body suggest me the BAPI for the purchase order vendor confirmations transaction code me22n - Tab<b>-(Confirmations)</b> alone.
    regs,
    Raja

    Dear Asha,
    Pls find the below code, this handles only the BDC part of the program.Updates only the EKES table thru standard confirmation tab on ME22N.
    Kindly clarify any doubts in this reg.
    regs,
    Raja.
    FORM ins_stdtable .
      DATA:var TYPE c LENGTH 30,
      cstr(02) TYPE n value '01'.
      data istr(02) type n value '00'.
      DATA recno TYPE i.
      data: eblc type c length 5,
      ebli type i.
      DATA: kebeln LIKE utab-ebeln.
      DATA: BEGIN OF indx,
             ebelp type ekes-ebelp,
             eindx type i,
            END OF indx.
      DATA : CNT TYPE I value 1.
      DATA: COUNTER(2) TYPE N VALUE '01',
      ROWS TYPE P.
      DATA: w_textout            LIKE t100-text.
      DATA: gd_update TYPE i,
            gd_lines TYPE i.
      data :waek like indx,
      itabek LIKE TABLE OF waek.
    *Used to stores error information from CALL TRANSACTION Function Module
      DATA: BEGIN OF messtab OCCURS 0.
              INCLUDE STRUCTURE bdcmsgcoll.
      DATA: END OF messtab.
      SELECT MAX( ETENS ) FROM ekes INTO zetens WHERE ebeln =
      ekko-ebeln.
      recno = zetens.
      LOOP AT utab.
        SELECT distinct ebelp INTO CORRESPONDING FIELDS OF TABLE
        itabek  FROM eket  WHERE ebeln = ekko-ebeln.
        loop at itabek into waek.
          ebli =  ebli + 1.
          waek-eindx = ebli.
          modify itabek from waek.
        endloop.
        loop at itabek into waek where ebelp = utab-ebelp.
          eblc = waek-eindx.
          condense eblc.
        endloop.
        AT NEW ebeln.
          PERFORM bdc_dynpro      USING 'SAPLMEGUI' '0014'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=MECHOB'.
          PERFORM bdc_dynpro      USING 'SAPLMEGUI' '0002'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                        '=MEOK'.
          PERFORM bdc_field       USING 'BDC_CURSOR'
                                        'MEPO_SELECT-EBELN'.
          PERFORM bdc_field       USING 'MEPO_SELECT-EBELN'
                                         utab-ebeln.
          AT New EBELP.
            perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
            perform bdc_field       using 'BDC_CURSOR'
                                      'DYN_6000-LIST'.
            perform bdc_field       using 'DYN_6000-LIST'
                                     eblc.
            perform bdc_field       using 'BDC_OKCODE'
                                          '=DDOWN3200'.
            PERFORM bdc_dynpro      USING 'SAPLMEGUI' '0014'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          '=TABIDT15'.
            perform bdc_field       using 'DYN_6000-LIST'
                                    eblc.
            PERFORM bdc_dynpro      USING 'SAPLMEGUI' '0014'.
            PERFORM bdc_field       USING 'BDC_OKCODE'
                                          'PICK'.
          ENDAT.
        ENDAT.
        PERFORM bdc_field       USING 'DYN_6000-LIST'
                                          eblc.
        recno = recno + 1.
        cstr = recno.
        counter = cstr.
    *This is to check whether the scheduled line item exceeding 12 rows. if so, use *page up
        if counter >= 13.
          rows = counter MOD 13.
          istr = ( ( counter - rows ) / 13 ).
          do istr times.
            perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
            perform bdc_field       using 'BDC_OKCODE'
                                    '=EINB_CREATE'.
          enddo.
          DO 2 TIMES.
            perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
            perform bdc_field       using 'BDC_OKCODE'
                                    '=P+'.
          enddo.
          COUNTER = '03'.
          cstr = '03'.
        ENDIF.
        CONCATENATE 'EKES-EBTYP('  cstr  ')' INTO var.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                          var.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '/00'.
        PERFORM bdc_field       USING var
                                    utab-ebtyp.
        CONCATENATE 'RM06E-EEIND('  cstr  ')' INTO var.
        PERFORM bdc_field       USING var
                                       utab-eeind.
        CONCATENATE 'EKES-MENGE('  cstr  ')' INTO var.
        PERFORM bdc_field       USING var
                                       utab-menge.
        CONCATENATE 'J_3ASZDI-J_3ASIZED('  cstr  ')' INTO var.
        PERFORM bdc_field       USING var
                                       utab-j_3asize.
        AT END OF Ebelp.
          PERFORM bdc_dynpro      USING 'SAPLMEGUI' '0014'.
          PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=MESAVE'.
          perform bdc_dynpro      using 'SAPLMEGUI' '0014'.
          perform bdc_field       using 'BDC_OKCODE'
                                    '/00'.
          CALL TRANSACTION 'ME22N' USING bdcdata MODE 'E'.
          IF sy-subrc EQ 0.
            savedone = 'Y'.
            saveflag = 'Y'.
            initflag = 'N'.
            MESSAGE 'SAVED' TYPE 'I'.
          else.
            saveflag = 'N'.
            savedone = 'N'.
            initflag = 'Y'.
            MESSAGE 'Not Saved' Type 'I'.
          endif.
          CLEAR: bdcdata.
          REFRESH bdcdata.
        ENDAT.
      ENDLOOP.
    ENDFORM.
    Hope this will help u

  • BAPI for purchase order enhancement in DMS

    hi, guru,
    one of the client requirement is,
    Is there any BAPI s for enhance ment of DMS and Purchase order FUnctionalities?
    points!!!!!!!!!!1

    Hi,
    regarding the DMS BAPIs please see the transaction BAPI in your system or the SAP note 766277 which contains a complete documentation on all DMS BAPIs.
    Best regards,
    Christoph

  • Bapi for Purchase Order Text

    Hello...
    which Bapi should I use for enter to a material Purchase Order Text(MM01 or MM02)??
    Thanks ......

    Hi,
    i am not shure about the bapi
    but this FM solves u r problem.
    K_PURCHASE_ORDERS_READ_TEXTS
    Thanks

  • BAPI for purchase order TA Me27

    Hi,
    I´m looking for a BAPI to create purchase orders like in TA ME27. I don´t have the vendor...
    So I think, BAPI_PO_CREATE is not working because the vendor is mandatory...
    Thank You!

    Sorry, I mean creating a stock transport order and therefore using TA ME27.
    If you use order type 'UB' in TA ME27, you can create also stock transport orders...
    Do you know a BAPI for that?
    Thank You!

  • FM or BAPI for Purchase Order Creation.

    can ne1 help me to
    create purchase order reference to PReq(Requisition) thru ne FM or BAPI.

    Hi,
    We can create the PO Using the BAPI_PO_CREATE1 function module.
    in this function module fill up the all necessary Details.
    With details in Item Table we haveto give  the Fields PREQ_NO and PREQ_ITEM  for each item .
    then it will creates the PO with PREQ.
    Reward Points If useful.
    Thanks&Regards,
    Srinivas.

  • Bapi for "Purchase Order Return"

    Hi,
    Is there any BAPI for business process of
    "Purchase Return".
    Warm Regards
    Kuldeep K. Joshi

    Hi,
    Is there any BAPI for business process of
    "Purchase Return".
    Warm Regards
    Kuldeep K. Joshi

  • Need BAPI for Purchasing Order Reject through Workflow

    Hi All.
    I need a bapi to reject Purchase Order(PO) through Workflow. i've found some to release but not to reject, ('08' status Code). Can anybody hlp me please.
    Thanks & Regards,
    Mani.

    You can check standard Wflow Template WS65400030
    I think you can use Method ResetRelease of businress Object BUS2012

  • Please Tell  me the Standard Bapi for Purchase Order Creation

    Hi,
      Please tell me the standard BApi for the PO creation. How to excute the standard Bapi. Please help me.
    Regrads
    Mohan

    Hi Mohan,
    Use this BAPI BAPI_PO_CREATE1.
    Check this post, you have program aswell
    https://forums.sdn.sap.com/click.jspa?searchID=7294168&messageID=1172796
    Regards,
    Satish

Maybe you are looking for

  • What is the ideal RAID 5 logical drive configuration to use with editing 1080p on FCPX?

    Hello, I invested in one of the new Late 2013 Mac Pros (8-core 3GHz, dual Fire Pro D500 w/ 3GM VRAM each, 32GB RAM), along with a Promise Pegasus R6 Thunderbolt (ver 1) RAID because I wanted a fast and supremely smooth editing experience versus slow,

  • How to deliver parameter between applets

    Suppose that there is an applet named A, can it deliver some parameters to another applet B? Thanks in advance!

  • Scan for string

    HI erveryone, I am working with the Scan from String fuction, but I have a problem. The string that I have as input is "temp=32.2", so I am using the Scan function as follows: But as output 1 I have "temp=32.2" and 0 in the output 2. Does anyone have

  • Break a table

    I have a long table in Pages, that I want to break up and insert into an iBook Author doc. I don't see a way to break a table in pages. (Can be done in Word, actually, mayby I'll just use word.) But would still like to know if it's possible to do it

  • CCA9 DELTA STILL RUNNING

    Hi Gurus, we are loading cca9 delta on daily basis. Today delta is giving problem like. data has came to PSA, DATA selection has been ended at R/3. STATUS  :request still running. Current status The processing of the data was not finished. in extract