BAPI_PO_CREATE to BAPI_PO_CREATE1; how to?

Hello gurus,
I'm working on an old custom interface FM (on a backend system) which substancially acts as a "wrapper" for the BAPI_PO_CREATE.
In details, the code processes an input, does some check on some conditions, then launch the BAPI_PO_CREATE fm in order to create a Purchase order. This is used to interface a third party system with SAP backends.
Now, the aim is to substitute the call to the BAPI_PO_CREATE (obsolete) with BAPI_PO_CREATE1. As far as I've seen, the latter allows to manage more data and also structures and types used are different from the older one.
So I wonder and ask if there's a sort of howto or standard FM to manage data conversion in order to successfully swap the call from BAPI_PO_CREATE with a newer call of BAPI_PO_CREATE1.
I searched a bit on the forum and web but didn't find anything related to this task
Thanks in advance for your help.

Hello there
sorry for the late, I had a previous task to work to so that I had the chance to test your purposed solution only on friday..
I have to say, Martin's suggestion goes quite fine; I used the standard EHSWA_112_PO_BAPI_CONVERT (curiosity: what are the EHSWA* FM for?) to convert some input structures from BAPI_PO_CREATE to BAPI_PO_CREATE1.
Some other structures use the same data type on both BAPI so they don't need - apparently - specific conversion.
And here comes the trouble: while older BAPI_PO_CREATE worked before, the newly interfaced BAPI_PO_CREATE1 doesn't work, as expected, because some little adjustments need to be done.
The one I'm facing now is how to adapt the EXTENSIONIN structure, which contains custom field values. I noticed in debug the routine that moves extensionin to the data structure of the bapi looks for the structure name BAPI_TE_MEPOHEADER, which is different from the structure used in the older bapi (BAPI_TE_PO_HEADER).
So, a preliminary task is to substitute in the EXTENSIONIN table the structure names, in order to adapt them to the new BAPI.
Tried in debug, but seems there are other problems and... since I don't know specifically how this extensionin structure works and what's the correct way of converting them for the new BAPI, is there any guide/document that could help me understanding how mapping is done ? Or the only way is to debug the stuff?
Thanks in advance for yout help

Similar Messages

  • Need help on BAPI_PO_CREATE and BAPI_PO_CREATE1

    Hi,
    Trying to create simple PO using BAPI_PO_CREATE.
    Filling up all necessary details about header , item and delivery schedule.
    In return message is shown as
    'In case of ERS procedure, please enter terms of payment'.
    I couldn't find what to do with ZTERM through bapi_po_create.
    Can any one give sample code to create PO using
    BAPI_PO_CREATE
    and BAPI_PO_CREATE1
    Madhura Nadgauda

    *& Report  ZBAPI_CREATE_PO                                             *
    *& Program demonstrates the BAPI call to create Purchase Order         *
    *& Minimum required parameters are used are as per the current         *
    *& system configuration                                                *
    REPORT  ZBAPI_CREATE_PO                         .
    *DATA DECLARATION
    CONSTANTS : C_X VALUE 'X'.
    *Structures to hold PO header data
    DATA : HEADER LIKE  BAPIMEPOHEADER   ,
           HEADERX LIKE  BAPIMEPOHEADERX .
    *Internal Tables to hold PO ITEM DATA
    DATA : ITEM   LIKE BAPIMEPOITEM  OCCURS 0 WITH HEADER LINE,
           ITEMX  LIKE BAPIMEPOITEMX OCCURS 0 WITH HEADER LINE,
    *Internal table to hold messages from BAPI call
           RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
    data : w_header(40) value 'PO Header'.
    data : ws_langu like sy-langu.
    *text-001 = 'PO Header' - define as text element
    selection-screen begin of block b1 with frame title text-001.
    parameters : company like header-comp_code  default '2700'      ,
                 doctyp  like HEADER-DOC_TYPE   default 'NB'        ,
                 cdate   like HEADER-CREAT_DATE default sy-datum    ,
                 vendor  like HEADER-VENDOR     default '0010000023',
                 pur_org like HEADER-PURCH_ORG  default '2700'      ,
                 pur_grp like HEADER-PUR_GROUP  default '001'       .
    selection-screen end of block b1.
    selection-screen begin of block b2 with frame title text-002.
    parameters : item_num like ITEM-PO_ITEM  default '00001',
                 material like ITEM-MATERIAL default 'CRANE'   ,
                 plant    like ITEM-PLANT    default '2700' ,
                 quantity like ITEM-QUANTITY default 100.
    selection-screen end of block b2.
    START-OF-SELECTION.
    *DATA POPULATION
    ws_langu = sy-langu.   "Language variable
    *POPULATE HEADER DATA FOR PO
    HEADER-COMP_CODE  = company    .
    HEADER-DOC_TYPE   = doctyp     .
    HEADER-CREAT_DATE = cdate      .
    HEADER-VENDOR     = vendor     .
    HEADER-LANGU      = ws_langu   .
    HEADER-PURCH_ORG  = pur_org    .
    HEADER-PUR_GROUP  = pur_grp    .
    *POPULATE HEADER FLAG.
    HEADERX-comp_code  = c_x.
    HEADERX-doc_type   = c_x.
    HEADERX-creat_date = c_x.
    HEADERX-vendor     = c_x.
    HEADERX-langu      = c_x.
    HEADERX-purch_org  = c_x.
    HEADERX-pur_group  = c_x.
    HEADERX-doc_date   = c_x.
    *POPULATE ITEM DATA.
    ITEM-PO_ITEM  = item_num.
    ITEM-MATERIAL = material.
    ITEM-PLANT    = plant.
    ITEM-QUANTITY = quantity.
    APPEND ITEM.
    *POPULATE ITEM FLAG TABLE
    ITEMX-PO_ITEM    = item_num.
    ITEMX-MATERIAL   = C_X.
    ITEMX-PLANT      = C_X .
    ITEMX-STGE_LOC   = C_X .
    ITEMX-QUANTITY   = C_X .
    ITEMX-TAX_CODE   = C_X .
    ITEMX-ITEM_CAT   = C_X .
    ITEMX-ACCTASSCAT = C_X .
    APPEND ITEMX.
    *BAPI CALL
    CALL FUNCTION 'BAPI_PO_CREATE1'
      EXPORTING
        POHEADER                     = HEADER
        POHEADERX                    = HEADERX
      POADDRVENDOR                 =
      TESTRUN                      =
    IMPORTING
      EXPPURCHASEORDER             =
      EXPHEADER                    =
      EXPPOEXPIMPHEADER            =
    TABLES
       RETURN                       = RETURN
       POITEM                       = ITEM
       POITEMX                      = ITEMX.
    *Confirm the document creation by calling database COMMIT
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
       WAIT          = 'X'
    IMPORTING
      RETURN        =
    end-of-selection.
    *Output the messages returned from BAPI call
    LOOP AT RETURN.
    WRITE / RETURN-MESSAGE.
    ENDLOOP.
    <b> Create a purchase order with configuration using the BAPI</b>
    This took some time to figure out how to setup. It may be useful.
    call function 'BAPI_CFG_CREATE'
      exporting
        object_id     = 'MYMATCODE'
        root_type     = 'MARA'
        root_name     = 'MYMATCODE'
        plant         = 'MYPLANT'
      importing
        cfg_handle    = l_handle
        root_instance = l_instance
      exceptions
        error         = 1
        others        = 2.
    l_characts_vals-atnam = 'WIDTH'.
    l_characts_vals-atwtb = '500'.
    append l_characts_vals to it_characts_vals.
    call function 'BAPI_CFGINST_CHARCS_VALS_SET'
      exporting
        object_id         = 'MYMATCODE'
        instance          = l_instance
      tables
        characts_vals     = it_characts_vals
        characts_vals_err = it_characts_vals_err.
    call function 'CE_C_SET_CBASE'.
    l_poitem-int_obj_no = l_handle.
    call function 'BAPI_PO_CREATE1'
       exporting
        poheader  = l_poheader
        poheaderx = l_poheaderx
       importing
        expheader = l_expheader
        exppurchaseorder = l_exppurchaseorder
       tables
        poitem      = lt_poitem
        poitemx     = lt_poitemx
                poschedule  = lt_poschedule
                poschedulex = lt_poschedulex
        return      = lt_return.
    call function 'BAPI_TRANSACTION_COMMIT'.
    also
    <a href="http://www.erpgenie.com/phpBB2/viewtopic.php?p=15525&sid=ea0812d14d0cbffb804e18d34040d521">refer</a>
    regards,
    srinivas
    <b>*reward for useful answers*</b>

  • A custom field added in BAPI_PO_CREATE and BAPI_PO_CREATE1

    Hi,
      I am trying to create a Service Purchase Order Single Account Assignment.
    A Custom field ZZEXPTYPE(Expense Type) is added in BAPI_PO_CREATE and passed the value '9015', The PO Is created Successfully but when I add same Custom Field ZZEXPTYPE(Expense Type) in BAPI_PO_CREATE1 whose value is '9015' ,It throws an Error Message as " Please enter a valid (SBU Specific) expense type!" . 
      The functional consultant says that Expense Type '9015' is correct. please Let me know what must be done.
    Regards,
    Deepthi.

    Extension to add Expense Type only
          IF NOT  w_src-zzexptype IS INITIAL.
            w_extensionin-structure = 'BAPI_TE_MEPOHEADER'.
            w_extensionin-valuepart1+10(4) = w_src-zzexptype.
            APPEND w_extensionin TO i_extensionin.
            CLEAR w_extensionin.
            w_extensionin-structure = 'BAPI_TE_MEPOHEADERX'.
            w_extensionin-valuepart1+10(4) = 'X'.
            APPEND w_extensionin TO i_extensionin.
            CLEAR w_extensionin.
          ENDIF.
    Call BAPI
          CALL FUNCTION 'BAPI_PO_CREATE1'
            EXPORTING
              poheader          = w_poheader
              poheaderx         = w_poheaderx
            IMPORTING
              exppurchaseorder  = gv_ebeln
            TABLES
             return            = i_return
             poitem            = i_poitem[]
             poitemx           = i_poitemx[]
             extensionin       = i_extensionin[].
    Commit the Transaction
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
             WAIT          = 'X'.

  • BAPI_PO_CREATE1 - How to get error PO item number

    All,
    I am using BAPI_PO_CREATE1. When PO is errored out, RETURN structure returns PO number with list of errors and warnings.
    It says, 'PO contains still faulty items'  but does not return specific item number.
    I need error PO item number too. Any help?
    Thanks,
    SKJ

    In the RETURN table which is of BAPIRET2 structure, there are 2 fields PARAMETER, ROW. Parameter gives the Table name which has the error and the ROW field gives the row number in that particular table. for eg: PARAMTER = 'POITEM'  and ROW = '2' means the error corresponds to line number 2 in the POITEM table.
    If these 2 fields are not populated, then it is an error in the header
    Hope this helps,
    Regards,
    Hari

  • HEADER TEXT in purchase orders using BAPI_PO_CREATE

    How to update HEADER TEXT in purchase orders using BAPI_PO_CREATE or BAPI_PO_CREATE1?Please advice for both types.

    Hi Srini ,
    IF you are using the BAPI_PO_CREATE , we are not having the parameter to pass Header Text.
    If you want to get Header Text  directly then Use  BAPI_PO_CREATE1 wiht a parameter POTEXTHEADER (I am not sure it is  there in 4.7).
    If  BAPI_PO_CREATE1 does not exist in  4.7 then  use create_text function module to update the the Header text
    Hope it helps
    Rgds
    Sree M
    Edited by: Sree  Merugu on Jun 13, 2008 5:10 PM

  • How to know which BAPi is being used for creation of PO in classic scenario

    Hello Experts,
    We are in SRM 7.0 classic scenario.
    How can we know which BAPI is being used in the calssic scenario i.e. How can we know if we are usind BAPI_PO_CREATE or BAPI_PO_CREATE1 for creation of PO?
    Any pointers will be highly appreciated.
    Thank you in advance,
    Thanks & Regards,
    RKS

    Hi RKS
    yesterday BLOG by our SUMMER WANG helps every SRM consultant to debug the PO error
    /people/summer.wang/blog/2010/05/11/trouble-shooting-of-srm-po-transfer-error
    Good work Summer wang !!
    Muthu

  • Pls help....BAPI_PO_CREATE1 text items filling...

    Hi experts,
    I need some help from you all.
    While doing program with BAPI_PO_CREATE1 , how to pass the parameters into these tables as inputs... wat are the mandatory fields for this..
    POTEXTHEADER
    POTEXTITEM
    how to assign values into this...???
    any useful inputs will be rewarded points.
    Rgds
    Lakshmiraj A

    Hi,
    Do you actually want to populate texts against your PO documents?  If you have no text data then these tables don't matter.
    Looking at SE37 to see the BAPI_PO_CREATE1 you can see that the two text tables are both optional so you don't have to populate them to create a PO.  You can also drill down on their structure definition to see the data required.  If this is where you are stuck, as you aren't sure what data you need to put into the text tables, I suggest the following to help you figure it out:-
    1. Read the documentation for BAPI_PO_CREATE1 as a good starter to explain about the BAPI.
    2. Look at the standard function module READ_TEXT and SAVE_TEXT - these are the basic module for reading and saving texts against objects in SAP and have some helpful documentation attached.  This might five you a clearer idea of what data goes where.
    3. Go to transaction ME23N and view an exisiting PO document that has texts assigned or go to ME22N and add texts to the header of a PO.  From the texts tab select the text and change "Continuous-text" in the drop down to "SAPScript editor".  This will show you the text in a more basic format and one that is very similar to how the lines of a text should be passed to the BAPI.
    Hope this helps.
    Gareth.

  • Express document "Updated was terminated" received from author in IW32

    Hi,
    I am creating PO in then method of IN_UPDATE or BEFORE_UPDATE of BADI  WORKORDER_UPDAT using BAPI_PO_CREATE or BAPI_PO_CREATE1, but it is not allowing commit transaction implicitly triggered by bapi so it is throwing the message Express document "Updated was terminated" received from author 'XXXX'.
    Please advice how to achieve creatING PO in the BADI.
    Regards,
    Krishna

    Hi,
    Then it would be really difficult because you will face an update termination every time incase something goes wrong in creating the PO.
    In this method even if you raise any messages it would lead to update termination.
    If you check the documentation it says that messages can be issued only in AT_SAVE method.
    Try creating your PO in this method.
    If you need the document number then what you can do is create a custom RFC FM and call it in background. In this FM call your BAPI and using the document number do the further processing.
    But if you want this document number to update something in the workorder then i feel that is not possible using this BADI.
    Regards,
    Ankur Parab

  • Automate receiving a fax and creation of PO thru SAP

    Hi SAP Gurus,
    I have a typical problem. I want to receive the Purchase Order thru fax into SAP. Convert it to text, read it and then automatically create a PO in SAP.
    The process of receiving the fax and converting it into text can be done using a 3rd party process. But then SAP should be able to retireve this text from a text file and create a PO by itself.
    A solution is desparately sought.
    Thanks & regards,
    Madhur

    You should see the text file and then check if logic can be built to read and understand the text file using ABAP program.
    e.g if the data is at a definite position in the text file or you can use pattern search to find the data.
    The idea is that your program should be able to read and differentiate the PO data of text file ..like material, qty , amount etc.
    You need to write an ABAP program which can be scheduled to run at regular intervals.
    This program will read the text data from the file and convert it into the data required in BAPI BAPI_PO_CREATE ( or BAPI_PO_CREATE1)...Then call the BAPI to create POs.
    Cheers,
    Ram

  • Pricing Condition for Serivce Line Item

    Hi Experts,
    I'm trying to create a service PO with 1 Service line item and this service line item actually contains more than 1 service number. Using BAPI_PO_CREATE1, how can I define the pricing condition for each of the service number?
    Currently, I'm able to define the pricing condition of the service item as a whole through this input parameter table POCOND.
    Thanks.
    Best Regards,
    Weishan

    Its really tricky requirement, when you are going for manual condition type.
    - the best alternative to cater your requirement is to go for maintenance of condition record, which you can upload at mass with the help of LSMW. Also, will be really helpful in having report for pricing. Finally, reduce time to create sales order. Thus, discuss & encourage your user to maintain pricing based condition record. Only header condition should be on manual bases.
    - If hard to convince your client on condition record. Then develop a routine with the help of ABAPer in your team. Where you can put logic. If the condition is manual enter and system is able find already entered value for material, then copy the price the slots where system don't find manually entered condition value.
    Regards
    JP

  • I need a BAPI or function that can create a PO without the purchase req.

    I need a BAPI or function that can create a PO without the reference to a purchase requisition. We are creating "direct POs" (with no reference to PR) manually. And we have a large amount of documents to create. I can't figure out if BAPI_PO_CREATE and BAPI_PO_CREATE1 can help us by doing this, because I've understood this BAPIs creates POs only with the reference to a purchase requisition.
    Thanks in advance!!
    Sebastian

    Sorry I'm late guys, I couldn't replay your posts because I was busy.
    Charlie,
    ...just because we have the data already in the SAP system.
    My client doesn't want purchase requisitions to be created from the PM orders. Instead he asked us to create the purchase workflow by generating direct purchase orders from the PM orders, basically taking the information from the purchase agreement within the order's tasks. Maybe you don't understand a bit what I'm saying, but let me get this straight: we can't use LSMW because data doesn't come from a legacy.
    Ian,
    ...after all, and like you've said, we're gonna use BAPI_PO_CREATE1 for creating the POs. Today I finally realized that, purchase requisitions aren't mandatory for the bapi to perform the process. If something goes wrong, I'll let you know.
    Thanks anyway for your attention.
    Sebastian

  • BAPI to Change MM Vendor Quotation (Simulate ME47)

    Hi everybody.
    I'm abap consultant and I'm trying to find a BAPI to change a Vendor Quotation.
    I've found two so far, but they are especific to Customer or Purchase Order (BAPI_CUSTOMERQUOTATION_CHANGE and bapi_po_change).
    I've seen that currently there isn't no BAPI for Vendor Quotation, but I can't belive it's true.
    Please anybody has any suggestion?
    Best regards

    Hello Vinicius,
    There is currently no BAPI for Transaction ME47 for RFQ and vendor quotation in the standard SAP system design.
    Please review Note 197958 BAPIs for purchase orders - Missing functionality
    In BAPI_PO_CREATE and BAPI_PO_CREATE1 the field bstyp is filled by program with 'F' (purchase order).
    Regards
    Amber

  • Regarding Business Objects and Methods

    Hi ,
    I need to create LSMW with BAPO for to create PO.
       Where shoud I found Business Objects and their method.
        Could you please suggest abt this.
    Regards,
    Sai.

    sai,
      "BAPI_PO_CREATE "  ( OR )  "BAPI_PO_CREATE1 "
    Goto SE37>Enter above bapi name>select where used list>it will show list>
    select prog RBUS2012
      or directly se38>RBUS2012>Press F7  or Display.
    Pls. reward if useful

  • Dialog progarm using BAPI

    Hi,
    I have to create a dialog program which can be called using the BAPI.As we have in the case of PO , it can be created using the transaction code ME21n and calling the BAPI(BAPI_PO_CREATE).Please suggest how to create the BAPI for the custom program.

    Hi,
    Call Bapi just like a function module.
    Below code will help you,
    CALL FUNCTION 'BAPI_PO_CREATE'
        EXPORTING
          po_header                        = WA_POHD
        PO_HEADER_ADD_DATA               =
        HEADER_ADD_DATA_RELEVANT         =
        PO_ADDRESS                       =
        SKIP_ITEMS_WITH_ERROR            = 'X'
        ITEM_ADD_DATA_RELEVANT           =
        HEADER_TECH_FIELDS               =
       IMPORTING
         PURCHASEORDER                    = g_prchord
        tables
          po_items                         = I_PO_ITM
        PO_ITEM_ADD_DATA                 =
          po_item_schedules                = I_PO_SCH
        PO_ITEM_ACCOUNT_ASSIGNMENT       =
        PO_ITEM_TEXT                     =
         RETURN                           = i_return
        PO_LIMITS                        =
        PO_CONTRACT_LIMITS               =
        PO_SERVICES                      =
        PO_SRV_ACCASS_VALUES             =
        PO_SERVICES_TEXT                 =
        PO_BUSINESS_PARTNER              =
        EXTENSIONIN                      =
        POADDRDELIVERY                   =
    you can use the above bapi in your dialog program.
    Rahul

  • How to pass sales office to BAPI_PO_CREATE1

    Hi,
    im using the 'BAPI_PO_CREATE1', im having a problem that it is showing error as 'pass the sales Office'.
    In ekko, sales office field is available. but in the structure BAPIMEPOHEADER, sales office field is not available.
    please help me how to pass the sales office to the Bapi.
    Thanks in advance,
    Regards,
    Elavarasu.

    Hi
    I think that it's an append in table EKKO as a ZZ-field (for instance, ZZVKBUR). If I am right, two possibilities:
    1. Populate with structure EXTENSIONIN. See SAP Note 582221 - FAQ: BAPIs for purchase orders, quesion 15.
    2. Try to populate it with badi 'ME_PROCESS_PO_CUST'.
    I hope this helps you
    Regards
    Eduardo

Maybe you are looking for

  • How to transfer a licence from old PC to new Mac?

    Hi I own photoshop elements & premier elements, each have 2 licence serial numbers however I bought the downloadable versions rather than from the shelf so when I access my adobe account in order to download onto the mac only windows versions are vis

  • KDE open file dialog does not honor the global double click setting

    I have checked both in system settings and in the file $HOME/.kde/share/config/kdeglobals to make sure the singleclick is set to false. Still in the open/save dialog the files are selected and opened in a single click. This bug is not seen in chakra

  • N97 Software update problem

    I'm trying to update the firmware on my phone, which vodaphone says is available to me. Firstly, I tried on my phone,but it states that there is no update available, so thought I'd try to do it using my laptop. I install the latest PC suite and SW up

  • To print two ' continuously

    Hi, I want to pass (' ' abcdef';3;5' )as an argument some function but when i am passing like this i am getting error quoted string not properly terminated. Can any one help me out. Regards, Guru.

  • Shared Blog / Wiki Capability :)

    I was just reviewing a BI blog that was on how to identify and solve some common load problems in the BW. Was wondering if there isn't some way to collect some of these types of blogs postings so that rather than being splattered across several autho