BAPI - BAPI*ACC*

hello,
i found list of function under BAPIACC in se37.
can we use this func. in zprg to get balance related with gl , vendor & customers.
performance wise bapi is better or our own code.
thanks & regards
raj

Hi
Performance wise and especially if it realated to accountings, BAPI's are always adivisable.

Similar Messages

  • Business Area in  BAPI _ ACC _ INVOICE _ RECEIPT _ POST & BAPI_INCOMINGINVO

    Dear Experts
    I am using this two BAPIs. for Invoice creation
    BAPI_INCOMINGINVOICE_CREATE for MIRO Invoice
    BAPI _ ACC _ INVOICE _ RECEIPT _ POST for FB60 invoice creation,
    In this I am facing Problem to Pass Business area, in BAPI _ ACC _ INVOICE _ RECEIPT _ POST no Business area field found (for vender line Item) this is required for us
    and in this bapi '' BAPI_INCOMINGINVOICE_CREATE '' business area field is available when I pass value in that it is asking Profit center in Header Data
    kindly help me to solve this  very urgent
    Regards
    Sathish J

    Hi Meridius
    I am having a similar problem to the one which you described in this thread. Tax is not calculated when I use BAPI_ACC_INVOICE_RECEIPT_POST for vendor invoice postings.
    If you want more details regarding my problem, please look at the following thread:
    VAT error when posting with BAPI_ACC_INVOICE_RECEIPT_POST
    Will you please help me?
    Sephiroth

  • BAPI: bapi or RFC for t-code f-28

    Hi all,
            can any one tell me bapi or rfc available for t-code f-28
           please help me...
    Regards,
    devika G.

    Hi,
    i dont think there is a BAPI for this Transaction...
    you can do  BDC on F-28
    FORM fill_bdc_data_f-28_9005 USING p_i_mult_doc TYPE c.
    **BDC from screen 9005
    DATA : l_amt_bdc(13), l_amt_bdc_remain(13), l_amt_bdc_mult(13),
    l_amt_bdc_mult_remain(13), l_assignment(14), l_period(2),
    l_amount(13).
    CLEAR t_bdcdata.
    REFRESH t_bdcdata.
    PERFORM bdc_dynpro USING 'SAPMF05A' '0103'.
    PERFORM bdc_field USING 'BDC_OKCODE' '=AB'. "OK CODE - doc overview
    **get user default date format and pass date in that format
    PERFORM convert_date_to_user_format USING bkpf-bldat.
    PERFORM bdc_field USING 'BKPF-BLDAT' w_date. "cheque date
    CLEAR w_date.
    PERFORM bdc_field USING 'BKPF-BLART' i_blart. "doc type
    PERFORM bdc_field USING 'BKPF-BUKRS' i_bukrs. "comp code
    **get user default date format and pass date in that format
    PERFORM convert_date_to_user_format USING bkpf-budat.
    PERFORM bdc_field USING 'BKPF-BUDAT' w_date. "posting date
    CLEAR w_date.
    l_period = sy-datum+4(2).
    PERFORM bdc_field USING 'BKPF-MONAT' l_period. "period
    PERFORM bdc_field USING 'BKPF-WAERS' 'INR'. "currency
    PERFORM bdc_field USING 'BKPF-BKTXT' i_bankl. "doc. hdr. text
    PERFORM bdc_field USING 'BKPF-XBLNR' i_xblnr. "Ref. Document No.
    PERFORM bdc_field USING 'BSEG-ZUONR' i_zuonr. "Assignment(Depot Code)
    PERFORM bdc_field USING 'RF05A-KONTO' i_bank_gl. "Bank GL acc
    PERFORM bdc_field USING 'BSEG-GSBER' i_gsber. "Business Area
    l_amount = bseg-wrbtr.
    PERFORM bdc_field USING 'BSEG-WRBTR' l_amount. "Amount
    PERFORM bdc_field USING 'BSEG-PRCTR' ''. "Profit Center
    **open items data
    PERFORM bdc_field USING 'RF05A-AGKOA' 'D'. "Acc type (D=customers)
    PERFORM bdc_field USING 'RF05A-XNOPS' 'X'. "Std OIs check box
    **end of first screen
    **document overview screen
    PERFORM bdc_dynpro USING 'SAPMF05A' '0700'. "Overview Screen
    PERFORM bdc_field USING 'BDC_CURSOR' 'RF05A-AZEI1(01)'. "cursor
    PERFORM bdc_field USING 'BDC_OKCODE' '/00'. "OK CODE
    PERFORM bdc_field USING 'RF05A-NEWBS' '19'. "posting key
    PERFORM bdc_field USING 'RF05A-NEWKO' i_kunnr. "customer
    PERFORM bdc_field USING 'RF05A-NEWUM' 'B'. "Spl GL Indicator
    **for single document selected
    CLEAR l_amt_bdc.
    IF p_i_mult_doc = ''.
    ***new screen - next line item
    PERFORM bdc_dynpro USING 'SAPMF05A' '0303'.
    PERFORM bdc_field USING 'BDC_OKCODE' '=BU'. "OK CODE
    **for single document, use the bouncing amount calculated earlier
    l_amt_bdc = w_amt_ant_bouncing.
    PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc. "amount
    **due date - same as posting date on screen
    **get user default date format and pass date in that format
    PERFORM convert_date_to_user_format USING bkpf-budat.
    PERFORM bdc_field USING 'BSEG-ZFBDT' w_date. "due date
    CLEAR w_date.
    **assignment
    CLEAR l_assignment.
    CONCATENATE t_seldoc_ant_bouncing-belnr
    t_seldoc_ant_bouncing-gjahr INTO l_assignment.
    PERFORM bdc_field USING 'BSEG-ZUONR' l_assignment. "assignment
    PERFORM bdc_field USING 'BSEG-GSBER' i_gsber.
    **if there is some remaining amount, then go for another line item
    IF w_rem_amt_ant_bouncing > 0.
    PERFORM bdc_field USING 'RF05A-NEWBS' '15'. "posting key
    PERFORM bdc_field USING 'RF05A-NEWKO' i_kunnr. "customer
    **new screen
    PERFORM bdc_dynpro USING 'SAPMF05A' '0301'.
    PERFORM bdc_field USING 'BDC_CURSOR' 'BSEG-ZTERM'. "CURSOR
    PERFORM bdc_field USING 'BDC_OKCODE' '=BU'. "OK CODE-ENTER
    l_amt_bdc_remain = w_rem_amt_ant_bouncing.
    PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc_remain.
    PERFORM bdc_field USING 'BSEG-ZTERM' '0001'.
    **AGAIN
    PERFORM bdc_dynpro USING 'SAPMF05A' '0301'.
    PERFORM bdc_field USING 'BDC_CURSOR' 'BSEG-WRBTR'. "CURSOR
    PERFORM bdc_field USING 'BDC_OKCODE' '=BU'. "OK CODE-SAVE
    PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc_remain.
    PERFORM bdc_field USING 'BSEG-ZTERM' '0001'. "pmt term -hardcoded
    PERFORM bdc_field USING 'BSEG-SKFBT' l_amt_bdc_remain.
    ENDIF.
    **multiple documents
    ELSE.
    **initialize remaining amount to amt entered on screen
    l_amt_bdc_mult_remain = bseg-wrbtr.
    LOOP AT t_seldoc_ant_bouncing.
    IF l_amt_bdc_mult_remain > 0.
    IF bseg-wrbtr > t_seldoc_ant_bouncing-rem_amt.
    l_amt_bdc_mult = t_seldoc_ant_bouncing-rem_amt.
    ELSE.
    l_amt_bdc_mult = bseg-wrbtr.
    ENDIF.
    **remaining amt = screen amt - amt calculated above.
    l_amt_bdc_mult_remain = l_amt_bdc_mult_remain - l_amt_bdc_mult.
    PERFORM bdc_dynpro USING 'SAPMF05A' '0303'.
    PERFORM bdc_field USING 'BDC_OKCODE' '=BU'. "OK CODE
    PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc_mult. "amount
    PERFORM bdc_field USING 'BSEG-GSBER' i_gsber. "Business Area
    **due date - same as posting date on screen
    **get user default date format and pass date in that format
    PERFORM convert_date_to_user_format USING bkpf-budat.
    PERFORM bdc_field USING 'BSEG-ZFBDT' w_date. "due date
    CLEAR w_date.
    **assignment
    CLEAR l_assignment.
    CONCATENATE t_seldoc_ant_bouncing-belnr
    t_seldoc_ant_bouncing-gjahr INTO l_assignment.
    PERFORM bdc_field USING 'BSEG-ZUONR' l_assignment. "assignment
    **posting key 19 for all but last document
    PERFORM bdc_field USING 'RF05A-NEWBS' '19'. "posting key
    PERFORM bdc_field USING 'RF05A-NEWKO' i_kunnr. "customer
    PERFORM bdc_field USING 'RF05A-NEWUM' 'B'. "Spl GL
    ENDIF.
    ENDLOOP.
    ENDIF.
    **post remaining amount
    IF p_i_mult_doc = 'X'.
    **new screen if there is some amount left
    IF l_amt_bdc_mult_remain > 0.
    **posting key 15 with remaining amount
    PERFORM bdc_field USING 'RF05A-NEWBS' '15'. "posting key
    PERFORM bdc_field USING 'RF05A-NEWKO' i_kunnr. "customer
    PERFORM bdc_field USING 'RF05A-NEWUM' ''. "Spl GL
    **new screen
    PERFORM bdc_dynpro USING 'SAPMF05A' '0301'.
    PERFORM bdc_field USING 'BDC_OKCODE' '=BU'. "OK CODE
    PERFORM bdc_field USING 'BSEG-WRBTR' l_amt_bdc_mult_remain.
    PERFORM bdc_field USING 'BSEG-ZTERM' '0001'. "pmt term - hardcoded
    ELSE.
    **if no amount is left, no need for a further line item
    PERFORM bdc_field USING 'RF05A-NEWBS' ''. "posting key
    PERFORM bdc_field USING 'RF05A-NEWKO' ''. "customer
    PERFORM bdc_field USING 'RF05A-NEWUM' ''. "Spl GL
    ENDIF.
    ENDIF.
    **clear variables
    CLEAR : l_amount, l_assignment, l_amt_bdc,
    l_amt_bdc_remain,l_amt_bdc_mult, l_amt_bdc_mult_remain.
    ENDFORM. " fill_bdc_data_F-28_9005
    Regards

  • Error with BAPI:'BAPI _MATERIAL_SAVEDATA'.

    Hi Guys,
    I am getting error when creating extended views for newly created materials.I am taking a new material number with Function module :BAPI_MATERIAL_GETINTNUMBER, and it has been created new material with Basi view.When i try to create extended views for the same material,its giving the following error: Field MATNR has been transferred inconsistently or is blank.
    Thanks in advance.
    Regards,
    Reddy

    The BAPI 'BAPI_MATERIAL_GETINTNUMBER' should not be used to assign internal numbers to material types.
    Documentation for 'BAPI_MATERIAL_GETINTNUMBER' says:
    In future, this method will no longer be supported for the object type Material (BUS1001).
    For standard materials you should use 'BAPI_STDMATERIAL_GETINTNUMBER' & for retail materials you should be using 'BAPI_MATERIAL_GETINTNUMBERRET'.
    BR,
    Suhas

  • Scenario File to RFC (BAPI): BAPI not executed successful

    Hi Dear Friends!
    At execution of asynchronous Scenario File to RFC (BAPI BAPI_ACC_DOCUMENT_POST)
    I have the following error in RWB Communication Channel (RFC receiver):
    - Error: 2007-07-25 11:08:25 EEST: Message processed for interface BAPI_ACC_DOCUMENT_POST:
    com.sap.aii.af.rfc.afcommunication.RfcAFWException: error while processing message
    to remote system:com.sap.aii.af.rfc.core.client.RfcClientBapiException:
    BAPI not executed successful
    Simultaniously <b>Test Configuration</b> was executed successfully. And mapping is good.
    But I don't any message in <b>target system</b> in <b>sxmb_moni</b> (formed by BAPI).
    In <b>XI system</b> I see in <b>sxmb_moni</b>:
    <Trace level="1" type="T">--start sender interface action determination</Trace>
      <Trace level="1" type="T">select interface mi_sender*</Trace>
      <Trace level="1" type="T">select interface namespace urn:file:to:bapi</Trace>
      <Trace level="1" type="T">no interface found</Trace>
      <Trace level="1" type="T">--start receiver interface action determination</Trace>
      <Trace level="1" type="T">Loop 0000000001</Trace>
      <Trace level="1" type="T">select interface *</Trace>
      <Trace level="1" type="T">select interface namespace</Trace>
      <Trace level="1" type="T">no interface found</Trace>
      <Trace level="1" type="T">--no sender or receiver interface definition found</Trace>
    Please help me understand my error.
    With the best regards,
    Natalia Maslova

    Hi, Dear Friends! Thanks for support!
    My settings of
    Connection between systems:
    DX7 01 (client 001) - XI Integration Server and DE2 13 (client 200) - target system.
    Phisically both systems are in one server: 10.20.30.24 (srv24)
    Business system DE2_200 has Communication Channel: cc_bapi_r, its settings (in Integration Builder Configuration):
    Adapter Type: RFC
    Receiver
    Transport Protocol: RFC
    Message Protocol: RFC (RFC XML)
    Adapter Engine: Integration Server
    RFC Client Parameter:
    RFC Server Type: SAP System
    Application Server: 10.20.30.24
    System Number: 13
    Authentication Mode: Use Logon Data for SAP System
    Logon User: n_maslova
    Logon Password: *******=*******
    Logon Language: EN
    Logon Client: 200
    Maximum Connections: 1
    x Advanced Mode
    x Send 'Confirm Transaction'
    x Commit Handling for Single BAPI Calls
    x BAPI Advances Mode
    Successful RETURN-TYPE Values: 0
    As I understand these settings are the settings of RFC-destination for target system DE2 13 (200) from XI (DX7 01 001).
    In SLD, Business system DE2_200 is defined as:
    Integration:
    Role: Application System
    Related Integration Server: DX7_001
    Technical System: DE2 on srv24
    Client: 200 of DE2
    Logical System Name: DE1CLNT200
    In target system DE2 13 (200) with the help of transaction sm59 I created
    RFC-destination DX7_001 of type H:
    Technical setting parameters:
    Target Host: 10.20.30.24
    Prefix Path: /sap/xi/engine/?type=entry
    Service Number: 8001
    Registration and Safe:
    SSL: Non active.
    SSL: client certificate: DFAULT SSL-client
    Enter to system:
    Language: EN
    Client: 001
    User: PIAPPLUSER
    Status PW: saved
    Password: ********
    After that in this system DE2 13 (200) with the help of transaction sxmb_adm I set in Integration Engine -> Configuration -> Configurate Integration Engine
    (Change Global Configuration Data):
    Role of Business System: Application System
    Related Integr. Server: dest://DX7_001
    Best regards,
    Natalia

  • Http == rfc (bapi) - bapi not created

    Hi
    I've got an http <==> rfc (bapi) scenario. QoS is Best Effort. I am using SAP's http test tool. After enabling the "synch-logging" I can see two successful rows. I am using the bapi "bapi_master_savedata".
    Some weird things:
    - no material master data is created.
    - The parts of the response message are only "Call Adapter" and "Request Message Mapping", nothing else.
    Thanks
    Go:khan

    Hi
    I think you pointed to the right problem.
    I haven't written something like that before, but I will try if there is no other solution.
    So I don't need any wrapper for a syn. rfc call with SP 14??
    But the following article doesn't use any wrapper "/people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit ??
    Thanks
    Go:khan

  • SAP PI Interface for Multiple Bapi

    hi,
    i need to expose 2 Bapi (Bapi A and Bapi B) using SAP PI 7.0 using single PI Interface / webservice.
    3rd party --> SAP PI -->SAP ECC6.
    for first option, i can create new Bapi C and include Bapi A & B new Bapi C.  then only expose BAPI C in SAP PI.
    for 2nd Option, i want to import BAPI A & B into SAP PI and used SAP PI capability to run BAPI A & B in sequence.
    if i want to go for 2nd option (just use existing BAPI A & B), how to implement the steps to make the bapi can execute in sequence? any link tutorial wil be help me a lot.

    Hi Hashim,
    try to implement Stefan approach or even you can try below appraoch,
    call BAPI A using SAP PI, then cal BAPI B within BAPI A logic, here you need to import only BAPI A in to PI system.
    better to take help from ABAPer, he will help you on the same.
    Regards,
    Raj

  • Error while defining BAPI method in the BOR

    Hi all,
    I am following a document and trying to learn BAPIs. Now, after an object type is created through SWO1, from Utilities -> API Methods -> Add Method, I am asked to enter a function module name. Shouldthis FM be already existing one? When I gave some name there and entered, it's giving an error
    BAPI : BAPI function module ZBAPI_GET_BILL_ITEMS has no return parameter
    Diagnosis
    The system checks that the RETURN parameter has been defined in both the BOR and in the function module. The parameter must refer to one of the BAPI return structures (all planned reference structures can be used for BAPIs up to and including Release 4.6B; but from Release 4.6C only BAPIRET2 can be used).
    The BOR parameter must be type EXPORT (one line or multi-line) and the function module parameter must be type EXPORT (if one line) or type TABLE (if multi-line).
    Procedure
    Create a RETURN parameter for the function module. Also define the reference of the BOR parameters to the function module parameter in the BOR ("Name in function module").
    Note that only incompatible changes can be made to BAPIs already released and delivered.
    Find out about enhancing or modifying BAPIs that have already been delivered by calling the BAPI Explorer (Tools -> BusinessFramework -> BAPI Explorer) and reading the project form "Project to change an existing BAPI".
    Can anybody help me out, please?

    Hi ,
    In the export of that fm u have to give this.
    parameter name typing   associated type
    RETURN        TYPE            BAPIRETURN      
    Regards

  • Error while doing PGI for Outbound delivery using BAPI BAPI_GOODSMVT_CREATE

    Hi All,
    I am getting an below error while doing PGI for outbound delivery using the BAPI BAPI BAPI_GOODSMVT_CREATE:
    Goods movement not possible with mvmt type 601
    Can anyone suggest me what will be the solution for it?
    Regards,
    Raghuraman.k

    I tried with the above BAPI but it is not working.
    In my case a delivery has one line item with batch split and other line item without batch split.
    Below is my code :
    DATA : gwa_header_data TYPE bapiobdlvhdrcon,
           gwa_header_ctrl TYPE bapiobdlvhdrctrlcon,
           lv_delivery     TYPE bapiobdlvhdrcon-deliv_numb,
           git_item_data TYPE STANDARD TABLE OF bapiobdlvitemcon,
           gwa_item_data TYPE bapiobdlvitemcon,
           git_item_ctrl TYPE STANDARD TABLE OF bapiobdlvitemctrlcon,
           gwa_item_ctrl TYPE bapiobdlvitemctrlcon,
           git_return    TYPE STANDARD TABLE OF bapiret2,
           gwa_return    TYPE bapiret2.
    *Header data
    gwa_header_data-deliv_numb = '0808000002'.
    *Header Control data
    gwa_header_ctrl-deliv_numb = '0808000002'.
    gwa_header_ctrl-post_gi_flg = 'X'.
    *Delivery Number
    lv_delivery = '0808000002'.
    *Item data and its corresponding control data
    gwa_item_data-deliv_numb      = '0808000002'.
    gwa_item_data-deliv_item      = '900002'.
    gwa_item_data-dlv_qty         = 4.
    gwa_item_data-dlv_qty_imunit  = 4.
    gwa_item_data-fact_unit_nom   = 1.
    gwa_item_data-fact_unit_denom = 1.
    APPEND gwa_item_data TO git_item_data.
    gwa_item_ctrl-deliv_numb      = '0808000002'.
    gwa_item_ctrl-deliv_item      = '900002'.
    gwa_item_ctrl-chg_delqty      = 'X'.
    APPEND gwa_item_ctrl TO git_item_ctrl.
    gwa_item_data-deliv_numb      = '0808000002'.
    gwa_item_data-deliv_item      = '900003'.
    gwa_item_data-dlv_qty         = 6.
    gwa_item_data-dlv_qty_imunit  = 6.
    gwa_item_data-fact_unit_nom   = 1.
    gwa_item_data-fact_unit_denom = 1.
    APPEND gwa_item_data TO git_item_data.
    gwa_item_ctrl-deliv_numb      = '0808000002'.
    gwa_item_ctrl-deliv_item      = '900003'.
    gwa_item_ctrl-chg_delqty      = 'X'.
    APPEND gwa_item_ctrl TO git_item_ctrl.
    gwa_item_data-deliv_numb      = '0808000002'.
    gwa_item_data-deliv_item      = '000020'.
    gwa_item_data-dlv_qty         = 10.
    gwa_item_data-dlv_qty_imunit  = 10.
    gwa_item_data-fact_unit_nom   = 1.
    gwa_item_data-fact_unit_denom = 1.
    APPEND gwa_item_data TO git_item_data.
    gwa_item_ctrl-deliv_numb      = '0808000002'.
    gwa_item_ctrl-deliv_item      = '000020'.
    gwa_item_ctrl-chg_delqty      = 'X'.
    APPEND gwa_item_ctrl TO git_item_ctrl.
    BREAK-POINT.
    CALL FUNCTION 'BAPI_OUTB_DELIVERY_CONFIRM_DEC'
      EXPORTING
        header_data    = gwa_header_data
        header_control = gwa_header_ctrl
        delivery       = lv_delivery
      TABLES
        item_data      = git_item_data
        item_control   = git_item_ctrl
        return         = git_return.
    BREAK-POINT.
    IF git_return IS INITIAL.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    ENDIF.

  • Error while creating own BAPI

    Hey,
    trying this step-by-step guide with own names
    http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
    Got two errors:
    1. In SWO1 while trying to add api methods he said:
    BAPI &1: The name of the function module &2 does not begin with 'BAPI'
    BAPI &1: BAPI function module &2 has no return parameter
    Searching in forum, I found that my structures have to begin with ZBAPI. But
    why the tutorial can do this? In tutorial the structure is named ZVEND. Why they
    can do this?
    2. The second error is telling me, that I have no return parameter. Thats not true.
    In my export tab of my function module, I have included a Parameter BAPIRET2 TYPE BAPIRET2.
    Trying to insert a table like this:
    RETURN TYPE BAPIRETURN
    He is telling me that "TABLES parameters are obsolete"
    In every tutorial they are using like, but I am not able to use LIKE, only TYPE is this something they changed in the SAP version > 4.7 ???
    Does every BAPI needs a return structure or table?
    If anyone have some good documents about how to create an own bapi let me know.
    But please no short description or 1000 links like this: how to create our own bapi?
    thanks
    chris
    thx
    chris

    Hi,
    Here are the answers for your queries.  (Version 4.7)
    1.  The function module name should start with "ZBAPI" the
         one we are creating our own.
         All the structures we refer for parameters in function moudle
         should also start with "ZBAPI"
         (eg., Import Params: VBELN LIKE ZVBAK-VBELN).
    2.  There must be a return parameter in Export List in the
         function module like the one below. Its a BAPI standard
         return variable.
         Export Params:RETURN LIKE ZBAPIRETURN.
         In BAPI Function modules we pass parameters as "pass
         by value". That's why Tables are not used as they are
         passed by reference.
    Hope it helps you
    Murthy.

  • BAPI FOR Deleting a Schedule Line Item from EKES and EKET tables

    Dear All,
    I would like to for deleting one of the line item from EKES (Po Confirmation ) and the respective line item from the EKET(PO Schedule Line Item Table).
    Assume that am allowing the user to select the lineitem from zprogram screen and collecting the PO and Its LIne Item details in an internal table.
    Can i Use
    <b>BAPI_PO_Change</b> , if so , can anybody tell me the steps to follow to use this bapi for deleting the PO lineItems, since i m going to try BAPI for First time.
    pls help me out
    Message was edited by: Raja K.P

    Hi raja ,
    loop at iekko1.
        w_index = sy-tabix.
        item-po_item   = itemx-po_item   = iekko1-ebelp.
        item-quantity  = iekko1-mng01.
        itemx-quantity = iekko1-mng01.
        if iekko1-wamng = iekko1-wemng.
        itemx-no_more_gr = item-no_more_gr = 'X'.
        else.
        itemx-no_more_gr = item-no_more_gr = ''.
        endif.
        append item.
        append itemx.
          clear return[].
          call function 'BAPI_PO_CHANGE'
               exporting
                    purchaseorder = iekko1-ebeln
               tables
                    return        = return
                    poitem        = item
                    poitemx       = itemx.
          if return[] is initial.
          commit work and wait.
          call function 'DEQUEUE_ALL'.
    search for deletion fields which u have to mark 'X'.
    before calling  this BAPi u have to lock the PO by using ENQUEUE.
    <b>
    FU BAPI_PO_CHANGE
    Text
    Change purchase order
    Functionality
    Function module BAPI_PO_CHANGE enables you to change purchase orders. The Change method uses the technology behind the online transaction ME22N.
    Alternatively, the IDoc type PORDCH1 is available. The data from this IDoc populates the interface parameters of the function module BAPI_PO_CHANGE.
    Functionality in Detail
    Authorization
    When you create (activity 02) an Enjoy purchase order, the following authorization objects are checked:
    M_BEST_BSA (document type in PO)
    M_BEST_EKG (purchasing group in PO)
    M_BEST_EKO (purchasing organization in PO)
    M_BEST_WRK (plant in PO)
    Controlling adoption of field values via X bar
    For most tables, you can use your own parameters in the associated X bar (e.g. PoItemX) to determine whether fields are to be set initial, values inserted via the interface, or default values adopted from Customizing or master records, etc. (for example, it is not mandatory to adopt the material group from an underlying requisition - you can change it with the BAPI).
    Transfer
    Purchase order number
    The PurchaseOrder field uniquely identifies a purchase order. This field must be populated in order to carry out the Change method.
    Header data
    The header data of the Enjoy purchase order is transferred in table PoHeader.
    Item data
    The item data of the Enjoy purchase order is stored in the tables PoItem (general item data). Changes regarding quantity and delivery date are to be made in the table PoSchedule.
    Use the table PoAccount to change the account assignment information.
    Services and limits
    Changes to existing items cannot be carried out with the Change method. It is only possible to create new items.
    Conditions
    Conditions are transferred in the table PoCond; header conditions in the table PoCondHeader. A new price determination process can be initiated via the parameter CALCTYPE in the table PoItem.
    Vendor and delivery address
    The vendor address in the table PoAddrVendor and the delivery address in the table PoAddrDelivery can only be replaced by another address number that already exists in the system (table ADRC). Changes to address details can only be made using the method BAPI_ADDRESSORG_CHANGE.
    Partner roles
    You can change all partners except the partner role "vendor" via the table PoPartner.
    Export/import data
    Export/import data can be specified per item in the table PoExpImpItem. Foreign trade data can only be transferred as default data for new items. Changes to the export/import data of existing items are not possible.
    Texts
    Header and item texts can be transferred in the tables PoTextHeader and PoTextItem. Texts for services are imported in the table PoServicesText. Texts can only be replaced completely.
    Version Management
    You can make use of the Version Management facility via the table AllVersions.
    Return
    If the PO was changed successfully, the header and item tables are populated with the information from the PO.
    Return messages
    Messages are returned in the parameter Return. This also contains information as to whether interface data has been wrongly or probably wrongly (heuristical interface check) populated. If a PO has been successfully created, the PO number is also placed in the return table with the appropriate message.
    Restrictions
    With this function module, it is not possible to:
    Create subcontracting components (you can only use existing ones)
    Create configurations (you can only use existing ones)
    Change message records (table NAST) and additional message data (this data can only be determined via the message determination facility (Customizing))
    Attach documents to the purchase order
    Change foreign trade data
    Change service data
    Change or reexplode BOMs
    A firewall prevents the manipulation of data that is not changeable in Purchasing according to the business logic of the purchase order (e.g. PO number, vendor, etc.).
    PO items with an invoicing plan cannot be created or changed using the BAPIs
    In this connection, please refer to current information in Note 197958.
    To change addresses with numbers from Business Address Services (cantral address management), please use the function module BAPI_ADDRESSORG_CHANGE.
    To change variant configurations, please use the function module BAPI_UI_CHANGE. More information is available in the BAPI Explorer under the Logistics General node.
    In the case of changes that are to be made via the BAPI_PO_CHANGE, a firewall first checks whether the relevant fields are changeable. This approach follows that of the online transaction. Here it is not possible to change the vendor or the document type, for example.
    Example
    Example of changes made to a purchase order with:
    1. Change in header data
    2. Change in item
    3. Change in delivery schedule
    4. Change in account assignment
    5. Change in conditions
    6. Change in partners
    Parameter: PURCHASEORDER 4500049596
    Parameter: POHEADER
    PMNTTRMS = 0002
    PUR_GROUP = 002
    Parameter: POHEADERX
    PMNTTRMS = X
    PUR_GROUP = X
    Parameter: POITEM
    PO_ITEM = 00001
    CONF_CTRL = 0001
    Parameter: POITEMX
    PO_ITEM = 00001
    PO_ITEMX = X
    CONF_CTRL =  X
    Parameter: POSCHEDULE
    PO_ITEM = 00001
    SCHED_LINE = 0001
    QUANTITY = 10.000
    PO_ITEM = 00001
    SCHED_LINE = 0003
    DELETE_IND =  X
    Parameter: POSCHEDULEX
    PO_ITEM =  00001
    SCHED_LINE =  0001
    PO_ITEMX =  X
    SCHED_LINEX =  X
    QUANTITY =  X
    PO_ITEM =  00001
    SCHED_LINE =  0003
    PO_ITEMX =  X
    SCHED_LINEX =  X
    DELETE_IND = X
    Parameter: POACCOUNT
    PO_ITEM = 00001
    SERIAL_NO = 01
    GL_ACCOUNT = 0000400020
    Parameter: POACCOUNTX
    PO_ITEM = 00001
    SERIAL_NO = 01
    PO_ITEMX = X
    SERIAL_NOX = X
    GL_ACCOUNT = X
    Parameter: POCOND
    ITM_NUMBER = 000001
    COND_TYPE = RA02
    COND_VALUE = 2.110000000
    CURRENCY = %
    CHANGE_ID = U
    Parameter: POCONDX
    ITM_NUMBER = 000001
    COND_ST_NO = 001
    ITM_NUMBERX = X
    COND_ST_NOX = X
    COND_TYPE = X
    COND_VALUE = X
    CURRENCY = X
    CHANGE_ID = X
    Parameter: POPARTNER
    PARTNERDESC =  GS
    LANGU =  EN
    BUSPARTNO = 0000001000
    Help in the Case of Problems
    1. Note 197958 lists answers to frequently asked questions (FAQs). (Note 499626 contains answers to FAQs relating to External Services Management.)
    2. If you have detected an error in the function of a BAPI, kindly create a reproducible example in the test data directory in the Function Builder (transaction code SE37). Note 375886 tells you how to do this.
    3. If the problem persists, please create a Customer Problem Message for the componente MM-PUR-PO-BAPI, and document the reproducible example where necessary.
    Customer Enhancements
    The following user exits (function modules) are available for the BAPI BAPI_PO_CREATE1:
    EXIT_SAPL2012_001 (at start of BAPI)
    EXIT_SAPL2012_003 (at end of BAPI)
    The following user exits (function modules) are available for the BAPI BAPI BAPI_PO_CHANGE:
    EXIT_SAPL2012_002 (at start of BAPI)
    EXIT_SAPL2012_004 (at end of BAPI)
    These exits belong to the enhancement SAPL2012 (see also transaction codes SMOD and CMOD).
    There is also the option of populating customer-specific fields for header, item, or account assignment data via the parameter EXTENSIONIN.
    Further Information
    1. Note 197958 contains up-to-date information on the purchase order BAPIs.
    2. If you test the BAPIs BAPI_PO_CREATE1 or BAPI_PO_CHANGE in the Function Builder (transaction code SE37), no database updates will be carried out. If you need this function, please take a look at Note 420646.
    3. The BAPI BAPI_PO_GETDETAIL serves to read the details of a purchase order. The BAPI cannot read all details (e.g. conditions). However, you can use the BAPI BAPI_PO_CHANGE for this purpose if only the document number is populated and the initiator has change authorizations for purchase orders.
    4. Frequently used BAPIs for purchase orders are BAPI_PO_CREATE, BAPI_PO_CREATE1, BAPI_PO_CHANGE, BAPI_PO_GETDETAIL, BAPI_PO_GETITEMS, BAPI_PO_GETITEMSREL, and BAPI_PO_GETRELINFO.
    5. For more information on purchase orders, refer to the SAP library (under MM Purchasing -> Purchase Orders) or the Help for the Enjoy Purchase Order, or choose the path Tools -> ABAP Workbench -> Overview -> BAPI Explorer from the SAP menu.
    Parameters
    PURCHASEORDER
    POHEADER
    POHEADERX
    POADDRVENDOR
    TESTRUN
    MEMORY_UNCOMPLETE
    MEMORY_COMPLETE
    POEXPIMPHEADER
    POEXPIMPHEADERX
    VERSIONS
    NO_MESSAGING
    NO_MESSAGE_REQ
    NO_AUTHORITY
    NO_PRICE_FROM_PO
    EXPHEADER
    EXPPOEXPIMPHEADER
    RETURN
    POITEM
    POITEMX
    POADDRDELIVERY
    POSCHEDULE
    POSCHEDULEX
    POACCOUNT
    POACCOUNTPROFITSEGMENT
    POACCOUNTX
    POCONDHEADER
    POCONDHEADERX
    POCOND
    POCONDX
    POLIMITS
    POCONTRACTLIMITS
    POSERVICES
    POSRVACCESSVALUES
    POSERVICESTEXT
    EXTENSIONIN
    EXTENSIONOUT
    POEXPIMPITEM
    POEXPIMPITEMX
    POTEXTHEADER
    POTEXTITEM
    ALLVERSIONS
    POPARTNER
    Exceptions
    Function Group
    2012
    </b>
    regards
    prabhu
    Message was edited by: Prabhu Peram

  • Freight vendor updation in GR document through BAPI

    Dear All
    In my system we are creating Goods Receipt in background through *BAPI BAPI_GOODSMVT_CREATE*. In my PO we have entered freight condition FRB1 for that PO line item and assigned a vendor code different from material vendor. For this freight condition FRB1 in the configuration we have maintained in Control Data 2 field Vendor in GR as 2 ( i.e. Entry always possible). This will help us to change freight vendor different from freight vendor maintained in PO line item.
    Now my query is that how can I achieve this through BAPI  BAPI BAPI_GOODSMVT_CREATE when I am creating GR in background. In which field of BAPI should we pass the freight vendor at the time of GR creation.
    Regards
    Satish Kumar

    Hi Satish,
    With standard SAP this is not Possible
    As indicated in the attached note 356665, the field SUPPL_VEND has no
    function. Please, have a look at this note for further information.
    In dialog (with MB01 or MIGO) you have the possibility to enter another
    freight vendor different than the vendor in your purchase order (or your
    scheduling agreement) as long as you have, in your purchasing condition
    type, "Vendor in GR" (V_T685A-BNKWE) maintained with the appropiate
    value. Then, by posting the Goods Receipt, you will update EKBZ with
    this new freight vendor.
    Unfortunately in the standard system this functionality is not available
    when working with the BAPI BAPI_GOODSMVT_CREATE or with the Idoc
    WMMBID02.
    There is no customizing setting or tool that you could use inside the
    standard system to change it.

  • In LSMW, what is diff between LSMW-BAPI and LSMW-IDOC

    hello all
    In LSMW, what is diff between LSMW-BAPI and LSMW-IDOC

    Hi Swamy,
    The differences between IDoc and BAPI are as follows: 
    IDOC
    IDocs are text encoded documents with a rigid structure that are used to exchange data between R/3 and a foreign system.
    Idocs are processed asynchronously and no information whatsoever is returned to the client.
    The target system need not be always online. The IDOC would be created and would send the IDOC once the target system is available (tRFC concept). Hence supports guaranteed delivery.
    With asynchronous links the sub-process on the client can be finished even if the communication line or the server is not available. In this case the message is stored in the database and the communication can be done later.
    The disadvantage of asynchronous links is that the sub-process on the server cannot return information to the calling sub-process on the client. A special way for sending information back to the client is required. In addition, a special error handling mechanism is required to handle errors on the receiving side.
    IDOCs may be more changeable from release to release.
    IDOCs  are poorly documented.
    BAPI
    BAPIs are a subset of the RFC-enabled function modules, especially designed as Application Programming Interface (API) to the SAP business object, or in other words: are function modules officially released by SAP to be called from external programs.
    BAPIs are called synchronously and (usually) return information.
    For BAPIs the client code needs to do the appropriate error handling.
    Problems with synchronous links occur if the communication line or the server is temporarily not available. If this happens, the sub-process on the client cannot be finished (otherwise there would be data inconsistencies).
    Synchronous links have the advantage that the sub-process on the server can return values to the sub-process on the client that has started the link.
    BAPIs are not totally immune to upgrades.
    BAPIs are reasonably well documented.
    Reward points if useful.
    Best Regards,
    Sekhar

  • Difference Between BAPI And RFC in ABAP

    Hi,
    i want to know difference between BAPI and RFC in SAP,
    can we call SAP GUI screen from NON SAP System Using BAPI.
    Reg,
    Hariharan

    Hi Ravishankar,
    The difference is not importat while you understand the concept.
    I think, RFC is the protocol for calling functions from external systems in R/3.
    I understand like BAPI a series of complet functions that SAP offers you for use and model a business use.
    But if I need program a function that can be called for external system i would call it RFC_NAME, because is a unique function that makes a single task.
    In other words, the difference i think is about work idea more than another thing.
    RFC
    A remote function call is a call to a function module running in a system different from the caller's. The remote function can also be called from within the same system (as a remote call).
    RFC consists of two interfaces : A calling interface for ABAP Programs and a calling interface for Non-SAP programs.
    The RFC Interface takes care of :-
    - Converting all parameter data to the representation needed in the remote system
    Calling the communication routines needed to talk to the remote system.
    Handling communications errors, and notifying the caller, if desired ( using EXCEPTIONS paramater of the CALL FUNCTION).
    BAPI
    BAPIs are standardized programming interfaces (methods) enabling external applications to access business processes and data in the R/3 System.
    BAPIs provide stable and standardized methods to achieve seamless integration between the R/3 System and external applications, legacy systems and add-ons.
    BAPIs are defined in the BOR(Business object repository) as methods of SAP business object types that carry out specific business functions.
    BAPIs are implemented as RFC-enabled function modules and are created in the Function Builder of the ABAP Workbench.
    The most critical difference btwn BAPI and FM is that BAPI can be wrapped in Business objects whereas RFC cant.
    BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA. in this case u only specify the business object and its method from external system in BAPI there is no direct system call. while RFC are direct system call Some BAPIs provide basic functions and can be used for most SAP business object types. These BAPIs should be implemented the same for all business object types. Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs. Whenever possible, a standardized BAPI must be used in preference to an individual BAPI.
    The following standardized BAPIs are provided:
    Reading instances of SAP business objects
    GetList ( ) With the BAPI GetList you can select a range of object key values, for example, company codes and material numbers.
    The BAPI GetList() is a class method.
    GetDetail() With the BAPI GetDetail() the details of an instance of a business object type are retrieved and returned to the calling program. The instance is identified via its key. The BAPI GetDetail() is an instance method. BAPIs that can create, change or delete instances of a business object type
    The following BAPIs of the same object type have to be programmed so that they can be called several times within one transaction. For example, if, after sales order 1 has been created, a second sales order 2 is created in the same transaction, the second BAPI call must not affect the consistency of the sales order 2. After completing the transaction with a COMMIT WORK, both the orders are saved consistently in the database.
    Create( ) and CreateFromData! ( )
    The BAPIs Create() and CreateFromData() create an instance of an SAP business object type, for example, a purchase order. These BAPIs are class methods.
    Change( )
    The BAPI Change() changes an existing instance of an SAP business object type, for example, a purchase order. The BAPI Change () is an instance method.
    Delete( ) and Undelete( ) The BAPI Delete() deletes an instance of an SAP business object type from the database or sets a deletion flag.
    The BAPI Undelete() removes a deletion flag. These BAPIs are instance methods.
    Cancel ( ) Unlike the BAPI Delete(), the BAPI Cancel() cancels an instance of a business object type. The instance to be cancelled remains in the database and an additional instance is created and this is the one that is actually canceled. The Cancel() BAPI is an instance method.
    Add<subobject> ( ) and Remove<subobject> ( ) The BAPI Add<subobject> adds a subobject to an existing object inst! ance and the BAPI and Remove<subobject> removes a subobject from an object instance. These BAPIs are instance methods.
    Check these Links out
    http://searchsap.techtarget.com/ateQuestionNResponse/0,289625,sid21_cid558752_tax293481,00.html
    http://www.sap-img.com/abap/interview-question-on-bapi-rfc-abap-objects-tables.htm
    http://www.sap-img.com/fu033.htm
    http://www.sap-img.com/abap/ale-bapi.htm
    Refer following SDN threads:
    Diff. Between BAPI and RFC
    Re: BAPI and RFC
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

  • BAPI for purchase requisition

    Hi all,
             I would like to know if there is any BAPI present to create purchase requisiton.
    The fileds that I would like to give are
    Item Category ,Material no,       
    Quantity      
    Delivery date
    Plant          
    Storage Location      
    Supplying plant           
    Requisitioner Name      
    I have seen the bapi BAPI_ACC_PURCHASE_REQUI_POST, but I dont think this has input field for item category and plant, storage location, supplying plant.
    If there is no bapi present for it, then I would have to go for BDC for creating purchase requisitions.
    Thanks
    Sachin

    Hi Sachin,
                   I think this thread has to be the best to explains you the issue you are facing at this moment so please have a look.
    Link:[BAPI|BAPI to create Purchase Requisition;
    Have a best day ahead.
    Edited by: Srivastava.G on Aug 28, 2009 8:48 AM

Maybe you are looking for