BAPI_PO_CREATE1 for ME21

Hi people! Please help me.
I want to use the bapi_po_create to create a PO like in ME21. In ME21 i'm creating an PO with service like this SHDB:
'X'  'SAPLMLSP'               '0200',
    ' '  'RM11P-HEADTEXT'         t_zpsdcom001-txz01,
    ' '  'ESLL-SRVPOS(01)'        t_zpsdcom001-asnum,
    ' '  'ESLL-MENGE(01)'         '1',
    ' '  'ESLL-MWSKZ(01)'         t_zpsdcom001-mwskz,
    ' '  'ESLL-KTEXT1(01)'        t_zpsdcom001-txz01,
    ' '  'ESLL-TBTWR(01)'         v_valor,
    ' '  'RM11P-KOSTL(01)'        t_zpsdcom001-kostl,
    ' '  'BDC_OKCODE'             '/00',
It's possible use this bapi for this PO?
Thanks.

Hi,
You can use the Fowwlowing BAPI..
'BAPI_PO_CREATE1'.
Refer
https://forums.sdn.sap.com/click.jspa?searchID=5092542&messageID=2848339
Re: PGI in vl01n
Regards
Kiran Sure

Similar Messages

  • User Exit for ME21 PO Creation at the time of saving--Urgent

    Hi,
    Can some one help me out in finding the user exit for PO creation at the time of saving.
    The Requirement is:
    I need to create a custom field in EKKO table.
    After appending the structure with the field to the EKKO table, i need to create a PO.
    Now i need to update the field which has been created at the time of pressing the SAVE button.
    I need to update the EKKO table it self.
    I could find the user exits but none of them have the EKKO table either in Changing or in Tables.
    Thanks,

    Hi,
              You may want to check this user exits.
    EXIT_SAPMM06E_012 - Check Customer-Specific Data Before Saving
    EXIT_SAPMM06E_013 - Update Customer-Specific Data in Purchasing Document
    Here is the list of available user exits for ME21.
    EXIT_SAPMM06E_001 - Other Number Range or Own Document Number
    EXIT_SAPMM06E_004 - User Exit for Cust.-Specific Control of Import Data Screens in Purchasing
    EXIT_SAPMM06E_005 - Field Selection Control: Vendor Address Screen
    EXIT_SAPMM06E_006 - Export Data to Customer Subscreen for Purchasing Document Header (PBO)
    EXIT_SAPMM06E_007 - Export Data to Customer Subscreen for Purchasing Document Header (PAI)
    EXIT_SAPMM06E_008 - Import Data from Customer Subscreen for Purchasing Document Header
    EXIT_SAPMM06E_009 - Reset Customer Data at Beginning of New Document (Without Dialog)
    EXIT_SAPMM06E_012 - Check Customer-Specific Data Before Saving
    EXIT_SAPMM06E_013 - Update Customer-Specific Data in Purchasing Document
    EXIT_SAPMM06E_014 - Read Customer-Specific Data when Importing Purchasing Document
    EXIT_SAPMM06E_016 - Export Data to Customer Subscreen for Purchasing Document Item (PBO)
    EXIT_SAPMM06E_017 - Export Data to Customer Subscreen for Purchasing Document Item (PAI)
    EXIT_SAPMM06E_018 - Import Data from Customer Subscreen for Purchasing Document Item
    EXIT_SAPMM06E_020 - User Exit: Change Document for Requisitions (Conversion into PO)
    EXIT_SAPMM06E_021 - Fulfillment of Target Value: Release Orders Against a Contract
    <b>Reward points</b>
    Regards

  • Getting errors when iam using  BAPI_PO_CREATE1 for Purchase Order creation

    Hi sap Gurus,
      I am getting Errors when iam using  BAPI_PO_CREATE1 for Purchase Order creation that Material (144) does not exist but it is alreardy maintained in MM01.
    I dont get how it is coming.and what are the mandatory fields in bapi BAPI_PO_CREATE1 in item level .that is too material only.
    pls let me know .
    thanks in advance.

    Hi,
    Check the sample code..
    report  zpo_test             .
    *DATA DECLARATION
    constants : c_x value 'X'.
    *Structures to hold PO header data
    data : header like bapimepoheader ,
    headerx like bapimepoheaderx .
    *Structures to hold PO account data
    data : account like bapimepoaccount occurs 0 with header line ,
    accountx like bapimepoaccountx occurs 0 with header line .
    *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,
    *Internal table to hold messages from BAPI call
    pocontractlimits like bapiesucc occurs 0 with header line.
    data : w_header(40) value 'PO Header',
    purchaseorder like bapimepoheader-po_number,
    delivery_date like bapimeposchedule-delivery_date.
    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 '122' ,
    doctyp like header-doc_type default 'NB' ,
    cdate like header-creat_date default sy-datum ,
    vendor like header-vendor default '2000000012' ,
    pur_org like header-purch_org default 'PU01' ,
    pur_grp like header-pur_group default '005' .
    *sociedad like HEADER-COMP_CODE default '122' ,
    *vendedor like HEADER-SALES_PERS default 'sale person'.
    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 '00010',
    material like item-material default '12000000' ,
    tipo_imp like item-acctasscat default 'K' ,
    *pos_doc like ITEM-ITEM_CAT default 'F' ,
    shorttxt like item-short_text default 'PRUEBA BAPI' ,
    grup_art like item-matl_group default '817230000' ,
    plant like item-plant default '3001' ,
    mpe like item-trackingno default '9999' ,
    *contrato like ITEM-AGREEMENT default '4904000003' ,
    *quantity like ITEM-QUANTITY default 1 .
    po_unit like item-po_unit default 'EA'.
    selection-screen end of block b2.
    Par?mnetros de imputaci?n
    selection-screen begin of block b3 with frame title text-004.
    parameters : centro like account-costcenter default '1220813150',
    cuenta like account-gl_account default '6631400' ,
    num_pos like account-po_item default '10' ,
    serial like account-serial_no default '01' ,
    ind_imp like account-tax_code default 'I2' .
    selection-screen end of block b3.
    start-of-selection.
    *DATA POPULATION
      ws_langu = sy-langu. "Language variable
    *POPULATE HEADER DATA FOR PO
    *HEADER-COMP_CODE = sociedad .
      header-doc_type = doctyp .
      header-vendor = vendor .
      header-creat_date = cdate .
      header-created_by = 'TD17191' .
      header-purch_org = pur_org .
      header-pur_group = pur_grp .
      header-comp_code = company .
      header-langu = ws_langu .
    *HEADER-SALES_PERS = vendedor .
    *HEADER-CURRENCY = 'DOP' .
    *HEADER-ITEM_INTVL = 10 .
    *HEADER-PMNTTRMS = 'N30' .
    *HEADER-EXCH_RATE = 1 .
    *POPULATE HEADER FLAG.
      headerx-comp_code = c_x.
      headerx-doc_type = c_x.
      headerx-vendor = c_x.
      headerx-creat_date = c_x.
      headerx-created_by = c_x.
      headerx-purch_org = c_x.
      headerx-pur_group = c_x.
      headerx-langu = c_x.
    *HEADERX-sales_pers = c_x.
    *HEADERX-CURRENCY = c_x.
    *HEADER-ITEM_INTVL = c_x.
    *HEADER-PMNTTRMS = c_x.
    *HEADER-EXCH_RATE = c_x.
    *HEADER-EXCH_RATE = c_x.
    *POPULATE ITEM DATA.
      item-po_item = item_num.
      item-quantity = '1'.
    *ITEM-MATERIAL = material .
      item-short_text = 'prueba bapi_po_create1'.
    *ITEM-TAX_CODE = ''.
      item-acctasscat = 'K' .
    *ITEM-ITEM_CAT = 'D' .
      item-matl_group = '817230000' .
      item-plant = '3001' .
      item-trackingno = '99999'.
      item-preq_name = 'test'.
    *ITEM-AGREEMENT = '' .
    *ITEM-AGMT_ITEM = ''.
      item-quantity = '1' .
      item-po_unit = 'EA'.
    *ITEM-ORDERPR_UN = 'EA'.
      item-conv_num1 = '1'.
      item-conv_den1 = '1'.
      item-net_price = '1000000' .
      item-price_unit = '1'.
      item-gr_pr_time = '0'.
      item-prnt_price = 'X'.
      item-unlimited_dlv = 'X'.
      item-gr_ind = 'X' .
      item-ir_ind = 'X' .
      item-gr_basediv = 'X'.
    *ITEM-PCKG_NO = '' .
      append item. clear item.
    *POPULATE ITEM FLAG TABLE
      itemx-po_item = item_num.
      itemx-po_itemx = c_x.
    *ITEMX-MATERIAL = C_X.
      itemx-short_text = c_x.
      itemx-quantity = c_x.
    *ITEMX-TAX_CODE = C_X.
      itemx-acctasscat = c_x.
    *ITEMX-ITEM_CAT = c_x.
      itemx-matl_group = c_x.
      itemx-plant = c_x.
      itemx-trackingno = c_x.
      itemx-preq_name = c_x.
    *ITEMX-AGREEMENT = C_X.
    *ITEMX-AGMT_ITEM = c_x.
      itemx-stge_loc = c_x.
      itemx-quantity = c_x.
      itemx-po_unit = c_x.
    *ITEMX-ORDERPR_UN = C_X.
      itemx-conv_num1 = c_x.
      itemx-conv_den1 = c_x.
      itemx-net_price = c_x.
      itemx-price_unit = c_x.
      itemx-gr_pr_time = c_x.
      itemx-prnt_price = c_x.
      itemx-unlimited_dlv = c_x.
      itemx-gr_ind = c_x .
      itemx-ir_ind = c_x .
      itemx-gr_basediv = c_x .
      append itemx. clear itemx.
    *POPULATE ACCOUNT DATA.
      account-po_item = item_num.
      account-serial_no = serial .
      account-creat_date = sy-datum .
      account-costcenter = centro .
      account-gl_account = cuenta .
      account-gr_rcpt = 'tester'.
      append account. clear account.
    *POPULATE ACCOUNT FLAG TABLE.
      accountx-po_item = item_num .
      accountx-po_itemx = c_x .
      accountx-serial_no = serial .
      accountx-serial_nox = c_x .
      accountx-creat_date = c_x .
      accountx-costcenter = c_x .
      accountx-gl_account = c_x .
      account-gr_rcpt = c_x.
      append accountx. clear accountx.
    *BAPI CALL
      call function 'DIALOG_SET_NO_DIALOG'.
      call function 'BAPI_PO_CREATE1'
        exporting
          poheader         = header
          poheaderx        = headerx
        importing
          exppurchaseorder = purchaseorder
        tables
          return           = return
          poitem           = item
          poitemx          = itemx
          poaccount        = account
          poaccountx       = accountx.
    *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.
    Regards
    Sudheer

  • Net Price showing zero while using BAPI_PO_CREATE1 for me21n

    Dear All,
    I am using BAPI_PO_CREATE1 for ME21N. The problem is, after execution of the program the error msg it shows-
    No instance of object type PurchaseOrder has been created. External reference:
    Purchase order still contains faulty items
    Net price must be greater than 0
    The values are coming from excel file.
    Please tell me where I am doing wrong.
    With regards,
    Rosaline.

    Hi,
    Symptom
    You create a purchase order with BAPI_PO_CREATE1 or you add an item to an existing purchase order with BAPI_PO_CHANGE. You assign a value in field POITEM-NET_PRICE. However, this value is not transferred. If it was not possible for you to determine any conditions, the system generated the error message 06218 'Net price must be greater than 0'.
    Other terms
    BAPI_PO_CREATE1, BAPI_PO_CHANGE, price, net price, gross price, conditions, price determination, condition type, 06218, EKPO-NETPR, NETPR, POITEM-NET_PRICE, NET_PRICE, PO_PRICE, BAPI_PO_PRICE, BUS2012, PurchaseOrder.CreateFromData1, CreateFromData1, PurchaeOrder.Change
    Reason and Prerequisites
    This function has not been available up to now. You could also assign conditions via the condition tables.
    Read also Notes 399791, 428621, 529287, 578253 and 539950 for this.
    Solution
    The present note adds field PO_PRICE to table POITEM. PO_PRICE can have the values ' ', '1' or '2' with the following meaning:
        PO_PRICE = ' ': The price determination is carried out as before.
        PO_PRICE = '1': The value assigned in field NET_PRICE is transferred as a gross price, that is it is set in the condition type that is defined as a base price in the calculation schema. All other condition types remain unchanged. No conditions are copied from the last document.
        PO_PRICE = '2': The value assigned in field NET_PRICE is transferred as a net price, that is it is set in the condition type that is defined as base price in the calculation scheme. All other condition types are deleted.
    Note the following
    The following restrictions apply to field PO_PRICE:
        If you assign conditions via the BAPI interface, these are always transferred. This is carried out independently of the value that you assign in field PO_PRICE.
        If you add a new item to a purchase order with BAPI_PO_CHANGE, it does not suffice to fill field POITEM-NET_PRICE on item level. The corresponding currency must be specified explicitly on header level.
        You can only use field PO_PRICE during the creation of a purchase order item. If you want to change the price of an already existing item, you can only do this via the conditions.
        If you fill field POITEM-PO_PRICE, you must enter an 'X' in POITEMX-PO_PRICE so that the value is transferred.
    Correction
    The correction is made available via R/3 support package. If you want to implement the note manually, proceed as follows:
        1. Make sure that your system contains Notes 494759, 552189 and 578253.
        2. Create data type BAPI_PO_PRICE with the following attributes:
                        Short text:
                           Price transfer indicator: 1  = gross, 2 = net
                        Package: ME
                        Domain: BPUEB
        3. Extend structure BAPIMEPOITEM (directly after NO_ROUNDING):
                        Component: PO_PRICE
                        Component type: BAPI_PO_PRICE
        4. Extend structure BAPIMEPOITEMX (directly after NO_ROUNDING):
                        Component: PO_PRICE
                        Component type: BAPIUPDATE
        5. Extend structure MEPOITEM_DATA (directly after NO_ROUNDING):
                        Component: PO_PRICE
                        Component type: BAPI_PO_PRICE
        6. Extend structure MEPOITEM_DATAX (directly after NO_ROUNDING):
                        Component: PO_PRICE
                        Component type: BAPIUPDATE
        7. Implement the correction instructions in your system.
    regards,
    Ravi
    Edited by: Parupelly on Dec 14, 2011 1:30 PM

  • Exit or enhancement for ME21, ME22, ME21N, ME22N and ME27

    Can anyone tell me an exit which can be used for ME21, ME22, ME21N, ME22N and ME27.
    I tried using EXIT_SAPMM06E_006, it did not work as the values get cleared from the internal table once out of the Exit.
    Requirement:
    Need an user exit which is common to transactions ME21, ME22, ME21N, ME22N and ME27 to block the line item of a purchase order based on following conditions:
    u2022     Document type is u2018xxu2019 or u2018yyu2019
    u2022     IF Condition type u2018aau2019 or u2018bbu2019 exist in the PO line item
    Please advice

    USe export to database indx..
    check this wiki for more info
    http://wiki.sdn.sap.com/wiki/display/Snippets/ImportandExporttoCluster+Databases

  • Error using BAPI_PO_CREATE1 for creating PO with services

    Hi,
    I'm getting an error saying 'EnTER account assignment data for item' when I use BAPI_PO_CREATE1 and try to create POs with Service Items. I have filled all the required details, even then the system throws up this error message. Thanks for any help.
    Regards,
    Vijay

    what have you passed to the table POACCOUNT? and POACCOUNTX?
    Regards,
    Ravi

  • Bapi_po_create1 for service

    I am trying to create a PO with reference to PR for service.
    Getting error saying “In case of account assignment, please enter acc. assignment data for item” at POITEM level
    Normal PO and PO with ref to PR are working fine.
    Any clue what might be wrong?
    CALL FUNCTION 'BAPI_PO_CREATE1'
        EXPORTING
         poheader                     = wa_header
       poheaderx                    = wa_headerx
       poaddrvendor                 = tb_address
         testrun                      = co_space
    *   MEMORY_UNCOMPLETE            =
    *   MEMORY_COMPLETE              =
    *   NO_MESSAGING                 =
    *   NO_MESSAGE_REQ               =
    *   NO_AUTHORITY                 =
       no_price_from_po             = 'X'
    * IMPORTING
    *   EXPPURCHASEORDER             =
    *   EXPHEADER                    =
    TABLES
       return                       = tb_return
       poitem                       = tb_item
       poitemx                      = tb_itemx
    *   POADDRDELIVERY               =
       poschedule                   = tb_sch
       poschedulex                  = tb_schx
       poaccount                    = tb_acc
    *   POACCOUNTPROFITSEGMENT       =
       poaccountx                   = tb_accx
    *   pocondheader                 = tb_condheader
    *   pocondheaderx                = tb_condheaderx
       pocond                       = tb_cond
       pocondx                      = tb_condx
       polimits                     = tb_e1bpesuhc
       pocontractlimits             = tb_e1bpesucc
       poservices                   = tb_service
       posrvaccessvalues            = tb_e1bpesklc
       poservicestext               = tb_e1bpeslltx
    *   EXTENSIONIN                  =
    *   EXTENSIONOUT                 =
       potextheader                 = tb_htext
       potextitem                   = tb_itext
       popartner                    = tb_e1bpekkop
    * Following line added for testing purpose
      READ TABLE tb_ze1bpekkotx INDEX 1.
      IF sy-subrc EQ 0.
        st_e1bpekkoc-po_number = tb_ze1bpekkotx-po_number.
      ENDIF.
    * End of Insertion.
    * Fill the PO Header
      wa_header-doc_date   = st_e1bpekkoc-doc_date.
      wa_header-doc_type   = st_e1bpekkoc-doc_type.
      wa_header-comp_code  = st_e1bpekkoc-co_code.
      wa_header-purch_org  = st_e1bpekkoc-purch_org.
      wa_header-pur_group  = st_e1bpekkoc-pur_group.
      wa_header-vendor     = st_e1bpekkoc-vendor.
      wa_header-po_number  = st_e1bpekkoc-po_number.
      wa_header-pmnttrms   = st_e1bpekkoa-pmnttrms.
      wa_header-dscnt1_to  = st_e1bpekkoa-dscnt1_to.
      wa_header-dscnt2_to  = st_e1bpekkoa-dscnt2_to.
      wa_header-dscnt3_to  = st_e1bpekkoa-dscnt3_to.
      wa_header-dsct_pct1  = st_e1bpekkoa-cash_disc1.
      wa_header-dsct_pct2  = st_e1bpekkoa-cash_disc2.
      wa_header-created_by = st_e1bpekkoa-created_by.
      wa_header-currency   = st_e1bpekkoa-currency.
      wa_header-exch_rate  = st_e1bpekkoa-exch_rate.
      wa_header-ex_rate_fx = st_e1bpekkoa-ex_rate_fx.
      wa_header-incoterms1 = st_e1bpekkoa-incoterms1.
      wa_header-incoterms2 = st_e1bpekkoa-incoterms2.
      wa_header-ref_1      = st_e1bpekkoa-ref_1.
      wa_header-sales_pers = st_e1bpekkoa-sales_pers.
      wa_header-telephone  = st_e1bpekkoa-telephone.
    * Fill the PO Header Change Toolbar
      wa_headerx-doc_date   = co_x.
      wa_headerx-doc_type   = co_x.
      wa_headerx-comp_code  = co_x.
      wa_headerx-purch_org  = co_x.
      wa_headerx-pur_group  = co_x.
      wa_headerx-vendor     = co_x.
      wa_headerx-po_number  = co_x.
      wa_headerx-pmnttrms   = co_x.
      wa_headerx-dscnt1_to  = co_x.
      wa_headerx-dscnt2_to  = co_x.
      wa_headerx-dscnt3_to  = co_x.
      wa_headerx-dsct_pct1  = co_x.
      wa_headerx-dsct_pct2  = co_x.
      wa_headerx-created_by = co_x.
      wa_headerx-currency   = co_x.
      wa_headerx-exch_rate  = co_x.
      wa_headerx-ex_rate_fx = co_x.
      wa_headerx-incoterms1 = co_x.
      wa_headerx-incoterms2 = co_x.
      wa_headerx-ref_1      = co_x.
      wa_headerx-sales_pers = co_x.
      wa_headerx-telephone  = co_x.
    * Fill the Address Table
      tb_address-po_number  = st_e1bpekkoc-po_number.
      tb_address-addr_no    = st_e1bpaddress-addrnumber.
      tb_address-name       = st_e1bpaddress-name1.
      tb_address-name_2     = st_e1bpaddress-name2.
      tb_address-name_3     = st_e1bpaddress-name3.
      tb_address-name_4     = st_e1bpaddress-name4.
      tb_address-city       = st_e1bpaddress-city1.
      tb_address-district   = st_e1bpaddress-city2.
      tb_address-city_no    = st_e1bpaddress-city_code.
      tb_address-postl_cod1 = st_e1bpaddress-post_code1.
      tb_address-postl_cod2 = st_e1bpaddress-post_code2.
      tb_address-postl_cod3 = st_e1bpaddress-post_code3.
      tb_address-po_box     = st_e1bpaddress-po_box.
      tb_address-po_box_cit = st_e1bpaddress-po_box_loc.
      tb_address-street     = st_e1bpaddress-street.
      APPEND tb_address.
    * Fill the POItem Table
      LOOP AT tb_e1bpekpoc.
        tb_item-po_item            = tb_e1bpekpoc-po_item.
    * Process the material based on the value.
        IF tb_e1bpekpoc-material+0(2) EQ co_b9.
          tb_item-material         = co_space.
        ELSE.
          tb_item-material         =  tb_e1bpekpoc-material.
        ENDIF.
        tb_item-item_cat           =  tb_e1bpekpoc-item_cat.
        tb_item-acctasscat         =  tb_e1bpekpoc-acctasscat.
        tb_item-agreement          =  tb_e1bpekpoc-agreement.
        tb_item-agmt_item          =  tb_e1bpekpoc-agmt_item.
        tb_item-matl_group         =  tb_e1bpekpoc-mat_grp.
        tb_item-short_text         =  tb_e1bpekpoc-short_text.
        tb_item-distrib            =  tb_e1bpekpoc-distrib.
        tb_item-part_inv           =  tb_e1bpekpoc-part_inv.
        tb_item-kanban_ind         =  tb_e1bpekpoc-kanban_ind.
        tb_item-plant              =  tb_e1bpekpoc-plant.
        tb_item-po_unit            =  tb_e1bpekpoc-unit.
        tb_item-po_unit_iso        =  tb_e1bpekpoc-po_unit_iso.
        tb_item-net_price          =  tb_e1bpekpoc-net_price.
        tb_item-conv_num1          =  tb_e1bpekpoc-conv_num1.
        tb_item-conv_den1          =  tb_e1bpekpoc-conv_den1.
        tb_item-orderpr_un         =  tb_e1bpekpoc-orderpr_un.
        tb_item-pckg_no            =  tb_e1bpekpoc-pckg_no.
        tb_item-trackingno         =  tb_e1bpekpoc-trackingno.
        tb_item-at_relev           =  tb_e1bpekpoc-at_relev.
        tb_item-po_price           =  tb_e1bpekpoc-po_price.
        tb_item-tax_code           =  tb_e1bpekpoc-tax_code.
        tb_item-preq_name          =  tb_e1bpekpoc-preq_name.
        tb_item-delete_ind         =  tb_e1bpekpoc-delete_ind.
        tb_item-free_item          =  co_space.
        tb_item-material_external  = tb_e1bpekpoc-material_external.
    *Populate the table from the other segments.
        READ TABLE tb_e1bpekpoa WITH KEY po_item = tb_e1bpekpoc-po_item.
        IF sy-subrc EQ 0.
          tb_item-info_upd         =  tb_e1bpekpoa-info_upd.
          tb_item-gr_ind           =  tb_e1bpekpoa-gr_ind.
          tb_item-ir_ind           =  tb_e1bpekpoa-ir_ind.
          wf_ind_check = co_x.
        ENDIF.
        READ TABLE tb_e1bpeket WITH KEY po_item = tb_e1bpeket.
        IF sy-subrc EQ 0.
          tb_item-preq_no          =  tb_e1bpeket-preq_no.
          tb_item-preq_item        =  tb_e1bpeket-preq_item.
    *      tb_item-ref_doc          =  tb_e1bpeket-preq_no.
          tb_item-quantity         =  tb_e1bpeket-quantity.
          wf_qty_check = co_x.
        ENDIF.
        APPEND tb_item.
    * Fill the POItemx Table
        tb_itemx-po_item           = tb_e1bpekpoc-po_item.
        tb_itemx-material          = co_x.
        tb_itemx-item_cat          = co_x.
        tb_itemx-acctasscat        = co_x.
        tb_itemx-agreement         = co_x.
        tb_itemx-agmt_item         = co_x.
        tb_itemx-matl_group        = co_x.
        tb_itemx-short_text        = co_x.
        tb_itemx-distrib           = co_x.
        tb_itemx-part_inv          = co_x.
        tb_itemx-kanban_ind        = co_x.
        tb_itemx-plant             = co_x.
        tb_itemx-po_unit           = co_x.
        tb_itemx-po_unit_iso       = co_x.
        tb_itemx-net_price         = co_x.
        tb_itemx-conv_num1         = co_x.
        tb_itemx-conv_den1         = co_x.
        tb_itemx-orderpr_un        = co_x.
        tb_itemx-pckg_no           = co_x.
        tb_itemx-trackingno        = co_x.
        tb_itemx-at_relev          = co_x.
        tb_itemx-po_price          = co_x.
        tb_itemx-tax_code          = co_x.
        tb_itemx-preq_name         = co_x.
        tb_itemx-delete_ind        = co_x.
        tb_itemx-free_item         = co_x.
        tb_itemx-material_external = co_x.
        IF NOT wf_ind_check IS INITIAL.
          tb_itemx-info_upd        = co_x.
          tb_itemx-gr_ind          = co_x.
          tb_itemx-ir_ind          = co_x.
        ENDIF.
        IF NOT wf_qty_check IS INITIAL.
          tb_itemx-preq_no         = co_x.
          tb_itemx-preq_item       = co_x.
    *      tb_itemx-ref_doc          = co_x.
          tb_itemx-quantity        = co_x.
        ENDIF.
        APPEND tb_itemx.
      ENDLOOP.
    * Fill the POSCHEDULE Table.
      LOOP AT tb_e1bpeket.
        tb_sch-po_item        = tb_e1bpeket-po_item.
        tb_sch-delivery_date  = tb_e1bpeket-deliv_date.
        tb_sch-quantity       = tb_e1bpeket-quantity.
        tb_sch-preq_no        = tb_e1bpeket-preq_no.
        tb_sch-preq_item      = tb_e1bpeket-preq_item.
        tb_sch-del_datcat_ext = tb_e1bpeket-del_datcat_ext.
        APPEND tb_sch.
    * Fill the POSCHEDULEX Table
        tb_schx-po_item       = tb_e1bpeket-po_item.
        tb_schx-delivery_date = co_x.
        tb_schx-quantity      = co_x.
        tb_schx-preq_no       = co_x.
        tb_schx-preq_item     = co_x.
        tb_sch-del_datcat_ext = co_x.
        APPEND tb_schx.
      ENDLOOP.
    * Fill the POTEXTITEM Table.
      LOOP AT tb_e1bpekpotx.
        tb_itext-po_number = tb_e1bpekpotx-po_number.
        tb_itext-po_item   = tb_e1bpekpotx-po_item.
        tb_itext-text_id   = tb_e1bpekpotx-text_id.
        tb_itext-text_form = tb_e1bpekpotx-text_form.
        tb_itext-text_line = tb_e1bpekpotx-text_line.
        APPEND tb_itext.
      ENDLOOP.
    * Fill the POTEXTHEADER Table.
      LOOP AT tb_ze1bpekkotx.
        tb_htext-po_number = tb_ze1bpekkotx-po_number.
        tb_htext-text_id   = tb_ze1bpekkotx-text_id.
        tb_htext-text_form = tb_ze1bpekkotx-text_form.
        tb_htext-text_line = tb_ze1bpekkotx-text_line.
        APPEND tb_htext.
      ENDLOOP.
      LOOP AT tb_item.
    * Fill the Condition Table.
        tb_cond-cond_value = tb_item-net_price.
        tb_cond-itm_number = 10. "tb_item-po_item.
        tb_cond-currency = st_e1bpekkoa-currency.
        tb_cond-change_id = 'I'.      "co_i.
        tb_cond-condchaman = co_x.
        APPEND tb_cond.
        tb_condheader-cond_value = tb_item-net_price.
        tb_condheader-cond_type = 'PB00'.
        tb_condheader-currency = st_e1bpekkoa-currency.
        tb_condheader-change_id = 'I'.
        tb_condheader-condchaman = co_x.
        APPEND tb_condheader.
    * Fill the Condition header Table
        tb_condx-itm_number = tb_item-po_item.
        tb_condx-cond_value = co_x.
        tb_condx-cond_type  = co_x.
        tb_condx-currency = co_x.
        tb_condx-change_id = co_x.
        tb_condx-condchaman = co_x.
        APPEND tb_condx.
        tb_condheaderx-cond_type = co_x.
        tb_condheaderx-cond_value = co_x.
        tb_condheaderx-currency = co_x.
        tb_condheaderx-change_id = co_x.
        tb_condheaderx-condchaman = co_x.
        APPEND tb_condheaderx.
      ENDLOOP.
    * Testing for PR and Services
      IF NOT wf_qty_check IS INITIAL.
        SELECT *
          FROM eban
        INTO TABLE tb_eban_po
        FOR ALL ENTRIES IN tb_item
        WHERE banfn = tb_item-preq_no
         AND  bnfpo = tb_item-preq_item.
        IF NOT tb_eban_po[] IS INITIAL.
          CLEAR lv_tabix.
          LOOP AT tb_item.
            lv_tabix = sy-tabix.
            READ TABLE tb_eban_po WITH KEY banfn = tb_item-preq_no
                                           bnfpo = tb_item-preq_item.
            IF sy-subrc EQ 0.
              tb_item-item_cat = tb_eban_po-pstyp.
              tb_item-acctasscat = tb_eban_po-knttp.
              tb_item-gr_basediv = co_x.
    * Populate the Service Table
              tb_service-pckg_no = tb_eban_po-packno.
              tb_service-matl_group = tb_eban_po-matkl.
              tb_service-quantity = tb_eban_po-menge.
              tb_service-base_uom = tb_eban_po-meins.
              tb_service-short_text = tb_eban_po-txz01.
              tb_service-base_uom   = tb_eban_po-meins.
              tb_service-ext_line   = '10'.
              tb_service-gr_price   = tb_eban_po-preis.
              APPEND tb_service.
              tb_srv_acc-pckg_no = tb_eban_po-packno.
              APPEND tb_srv_acc.
              READ TABLE tb_itemx INDEX lv_tabix.
              IF sy-subrc EQ 0.
                tb_itemx-item_cat = co_x.
                tb_itemx-acctasscat = co_x.
                tb_itemx-gr_basediv = co_x.
                MODIFY tb_item INDEX lv_tabix.
                MODIFY tb_itemx INDEX lv_tabix.
              ENDIF.
              tb_item-item_cat = tb_eban_po-pstyp.
              tb_item-acctasscat = tb_eban_po-knttp.
            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDIF.
    * Fill the POACCOUNT Table.
      SELECT *
          FROM ebkn
      INTO TABLE tb_ebkn_po
      FOR ALL ENTRIES IN tb_sch
      WHERE banfn = tb_sch-preq_no.
      IF NOT tb_ebkn_po[] IS INITIAL.
        LOOP AT tb_ebkn_po.
          tb_acc-po_item     = tb_ebkn_po-bnfpo.
          tb_acc-serial_no   = tb_ebkn_po-zebkn.
          tb_acc-quantity    = tb_ebkn_po-menge.
          tb_acc-gl_account  = tb_ebkn_po-sakto.
          tb_acc-costcenter  = tb_ebkn_po-kostl.
          tb_acc-profit_ctr  = tb_ebkn_po-prctr.
          tb_acc-co_area     = tb_ebkn_po-kokrs.
          tb_acc-net_value   = tb_ebkn_po-netwr.
          APPEND tb_acc.
    * Fill the POACCOUNTX Table
          tb_accx-po_item    = tb_ebkn_po-bnfpo.
          tb_accx-po_itemx   = co_x.
          tb_accx-serial_no  = tb_ebkn_po-zebkn.
          tb_accx-serial_nox = co_x.
          tb_accx-quantity   = co_x.
          tb_accx-gl_account = co_x.
          tb_accx-costcenter = co_x.
          tb_accx-profit_ctr = co_x.
          tb_accx-co_area    = co_x.
          tb_accx-net_value  = co_x.
          APPEND tb_accx.
        ENDLOOP.
      ENDIF.
    ENDFORM.
    Edited by: Archish RS on Feb 7, 2008 9:34 AM

    Hello,
    The same problem is discussed before two days.
    Please have a look at this thread:
    https://www.sdn.sap.com/irj/sdn/profile?userid=3461421
    solved the issue by debugging.
    Don't get too worried, there is an easy way to solve this if you get issues like this. See I was able to create a service PO from ME21N transaction. As you know service PO needs Service lines to be created it's mandatory. Here were my error is.
    SAP from front end is using a hierarchical method of creating service lines. Not sure this is always like this!!!
    The way you can figure out is ..go and create a PO from front end. use that PO number in BAPI_PO_GETDETAIL.
    See the values it returns in the associated tables. Compare these values with your mapping in data load program. Then make the necessary changes. Of course there are things needs to be changed in Both Service line structure and Account structure. good luck
    Hope this will solve ur problem
    Cheers,
    Vasanth

  • BAPI_PO_CREATE1: For Service Items

    Dear All,
    I am trying to create an upload program for all the POs which include service items using BAPI_PO_CREATE1.
    However, i am facing problems: Systems throws up an error message
    <b>"In case of account assignment, please enter acc. assignment data for item"</b>
    i have provided all the relavent fields, still could not found the reasons. (we are using services (with service master data in SAP) as line items).
    Please find the code:
    Fill PO Header Data
      wa_poheader-ref_1      = '1'.
      wa_poheader-doc_date   = '20070730'.
      wa_poheader-doc_type   = 'ZMN'.
      wa_poheader-vendor     = '0000100001'.
      wa_poheader-purch_org  = 'CPO'.
      wa_poheader-pur_group  = 'P01'.
      wa_poheader-currency   = 'MYR'.
      wa_poheader-incoterms1 = 'CIF'.
      wa_poheader-incoterms2 = 'MITV'.
      wa_poheaderx-ref_1      = 'X'.
      wa_poheaderx-doc_date   = 'X'.
      wa_poheaderx-doc_type   = 'X'.
      wa_poheaderx-vendor     = 'X'.
      wa_poheaderx-purch_org  = 'X'.
      wa_poheaderx-pur_group  = 'X'.
      wa_poheaderx-currency   = 'X'.
      wa_poheaderx-incoterms1 = 'X'.
      wa_poheaderx-incoterms2 = 'X'.
    Fill PO Line Item Data
      wa_poitem-po_item    = '00010'.
      wa_poitem-quantity   = '1'.
      wa_poitem-short_text = 'service material'.
      wa_poitem-acctasscat = 'K'.
      wa_poitem-item_cat   = '9'.
      wa_poitem-matl_group = 'SERVICE'.
      wa_poitem-plant      = '1000'.
      wa_poitem-net_price  = '100'.
      wa_poitem-price_unit = '1'.
      wa_poitem-pckg_no    = '0000000001'.
      APPEND wa_poitem TO it_poitem.
    PO Line item values to be updated
      wa_poitemx-po_item    = '00010'.
      wa_poitemx-po_itemx   = 'X'.
      wa_poitemx-quantity   = 'X'.
      wa_poitemx-short_text = 'X'.
      wa_poitemx-acctasscat = 'X'.
      wa_poitemx-item_cat   = 'X'.
      wa_poitemx-matl_group  = 'X'.
      wa_poitemx-plant      = 'X'.
      wa_poitemx-net_price  = 'X'.
      APPEND wa_poitemx TO it_poitemx.
      CLEAR: wa_poitem,
             wa_poitemx.
    Fill Accounting Data
      wa_poaccount-po_item    = '00010'.
      wa_poaccount-serial_no  = '01'.
      wa_poaccount-creat_date = sy-datum.
      wa_poaccount-quantity   = '1'.
      wa_poaccount-net_value  = '100'.
      wa_poaccount-costcenter = 'MNCOE0201'.
      wa_poaccount-gl_account = '0000505203'.
      wa_poaccount-co_area    = 'MITV'.
      APPEND wa_poaccount TO it_poaccount.
    Accounting line item values to be updated
      wa_poaccountx-po_item    = '00010'.
      wa_poaccountx-po_itemx  = 'X'.
      wa_poaccountx-serial_no = '01'.
      wa_poaccountx-serial_no   = 'X'.
      wa_poaccountx-creat_date = 'X'.
      wa_poaccountx-quantity   = 'X'.
      wa_poaccountx-net_value  = 'X'.
      wa_poaccountx-costcenter = 'X'.
      wa_poaccountx-gl_account = 'X'.
      wa_poaccountx-co_area     = 'X'.
      APPEND wa_poaccountx TO it_poaccountx.
    Fill Service Details servicio 1
      wa_poservices-pckg_no = '0000000001'.
      wa_poservices-line_no = '00010' .
      wa_poservices-ext_line = '00010' .
      wa_poservices-outl_level = '0'.
      wa_poservices-subpckg_no = '0000000000'.
      wa_poservices-service = '000000000003000025'.
      wa_poservices-edition = '0000' .
      wa_poservices-base_uom = 'EA' .
    *SERVICES-UOM_ISO = 'C62' .
      wa_poservices-quantity = '1' .
      wa_poservices-price_unit = '1' .
      wa_poservices-ovf_tol = '0' .
    wa_poSERVICES-FROM_LINE = '1' .
      wa_poservices-short_text = 'Electrical System'.
      wa_poservices-pers_no = '00000000' .
      wa_poservices-pln_pckg = '0000000000' .
      wa_poservices-pln_line = '0000000000' .
      wa_poservices-con_pckg = '0000000000' .
      wa_poservices-con_line = '0000000000' .
      wa_poservices-tmp_pckg = '0000000000' .
      wa_poservices-tmp_line = '0000000000' .
      wa_poservices-limit_line = '0000000000' .
    *SERVICES-TAX_CODE = 'I2' .
      wa_poservices-gr_price = '100' .
      wa_poservices-matl_group = 'SERVICE'.
      APPEND wa_poservices TO it_poservices.
      CLEAR wa_poservices.
    FIRST ENTRY
      posrvaccessvalues-pckg_no = '0000000001'.
      posrvaccessvalues-serno_line = '00010'.
      posrvaccessvalues-percentage = '100'.
      posrvaccessvalues-serial_no = '01'.
      posrvaccessvalues-quantity = '1'.
      posrvaccessvalues-net_value = '100'.
      APPEND posrvaccessvalues .
      CLEAR posrvaccessvalues.
      CALL FUNCTION 'BAPI_PO_CREATE1'
        EXPORTING
          poheader          = wa_poheader
          poheaderx         = wa_poheaderx
        IMPORTING
          exppurchaseorder  = w_ponumber
        TABLES
          return            = it_return
          poitem            = it_poitem
          poitemx           = it_poitemx
          poaccount         = it_poaccount
          poaccountx        = it_poaccountx
          polimits          = po_limits
          poservices        = it_poservices
          posrvaccessvalues = posrvaccessvalues.
      IF NOT w_ponumber IS INITIAL.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
        WRITE:/ w_ponumber.
      ELSE.
        LOOP AT it_return INTO wa_return.
          WRITE:/ wa_return-message_v1, wa_return-message_v2, wa_return-message.
        ENDLOOP.
      ENDIF.
    Please suggest me where i am going wrong.

    Hi,
    To commit BAPI or to run it properly , you need to fulfill all required data for BAPI.
    You can go to BAPI documentation to check for mandetory parameters and also check with Function consultant for more data and confifuration/
    Reward if useful!

  • Multiple Account Assignment issue with BAPI_PO_CREATE1 for service POs

    Whle creating service PO through BAPI_PO_CREATE1, The account assignments at the service line items were not being added correctly at the item level, instead they are getting split further wrt tax jurisdiction. This is occuring when an item have multiple service line items with mutltiple account assignments.
    The sample code is below, and the all the internal tables and structure were related to BAPI_PO_CREATE1. Tried with BADI ME_TAX_FROM_ADDRESS and User Exit enhancement SAPL2012, which were not helpful for this particular scenario.
    Item Details
    W_BAPI_ITEM-PO_ITEM = 1.
    W_BAPI_ITEMX-PO_ITEM = 1.
    W_BAPI_ITEM-ITEM_CAT = D.
    W_BAPI_ITEMX-ITEM_CAT = 'X'.
    W_BAPI_ITEM-ACCTASSCAT = K.
    W_BAPI_ITEMX-ACCTASSCAT = 'X'.
    W_BAPI_ITEM-PLANT = USMP. Tax Jurisdiction code 3604931001
    W_BAPI_ITEMX-PLANT = 'X'.
    W_BAPI_ITEM-MATL_GROUP = IT37.
    W_BAPI_ITEMX-MATL_GROUP = 'X'.
    W_BAPI_ITEM-QUANTITY = 1.
    W_BAPI_ITEMX-QUANTITY = 'X'.
    W_BAPI_ITEM-PRICE_UNIT = 1.
    W_BAPI_ITEMX-PRICE_UNIT = 'X'.
    W_BAPI_ITEM-PO_UNIT = LE.
    W_BAPI_ITEMX-PO_UNIT = 'X'.
    W_BAPI_ITEM-NET_PRICE = 100.
    W_BAPI_ITEMX-NET_PRICE = 'X'.
    W_BAPI_ITEM-PCKG_NO = 3456.
    W_BAPI_ITEMX-PCKG_NO = 'X'.
    W_BAPI_ITEM-PREQ_NAME = RTPTS02.
    W_BAPI_ITEMX-PREQ_NAME = 'X'.
    APPEND W_BAPI_ITEM TO IT_BAPI_ITEM.
    APPEND W_BAPI_ITEMX TO IT_BAPI_ITEMX.
    Delivery address details - Tax Jurisdiction 3305923401
    W_BAPI_ADDRDEL-PO_ITEM = 1.
    W_BAPI_ADDRDEL-NAME = COR.
    W_BAPI_ADDRDEL-NAME_2 = Chairman.
    W_BAPI_ADDRDEL-BUILD_LONG = 1001R
    W_BAPI_ADDRDEL-CITY = plainview.
    W_BAPI_ADDRDEL-STREET = old country road.
    W_BAPI_ADDRDEL-POSTL_COD1 = 11803.
    W_BAPI_ADDRDEL-COUNTRY = US.
    W_BAPI_ADDRDEL-REGION = NY.
    APPEND W_BAPI_ADDRDEL TO IT_BAPI_ADDRDEL.
    First Account Assignment - 3310300441
    W_BAPI_POACNT-SERIAL_NO = 1.
    W_BAPI_POACNTX-SERIAL_NO = 1.
    W_BAPI_POACNTX-SERIAL_NOX = 'X'.
    W_BAPI_POACNT-CREAT_DATE  = 11/03/2010.
    W_BAPI_POACNTX-CREAT_DATE  = 'X'.
    W_BAPI_POACNT-QUANTITY = 0.75.
    W_BAPI_POACNTX-QUANTITY  = 'X'.
    W_BAPI_POACNT-DISTR_PERC = 75.
    W_BAPI_POACNTX-DISTR_PERC  = 'X'.
    W_BAPI_POACNT-NET_VALUE = 75 .
    W_BAPI_POACNTX-NET_VALUE  = 'X'.
    W_BAPI_POACNT-PO_ITEM = 1.
    W_BAPI_POACNTX-PO_ITEM = 1.
    W_BAPI_POACNTX-PO_ITEMX = 'X'.
    W_BAPI_POACNT-GL_ACCOUNT = 641099.
    W_BAPI_POACNTX-GL_ACCOUNT  = 'X'.
    W_BAPI_POACNT-COSTCENTER =  10010394.
    W_BAPI_POACNTX-COSTCENTER = 'X'.
    W_BAPI_POACNT-CO_AREA = 1234.
    W_BAPI_POACNTX-CO_AREA = 'X'.
    APPEND W_BAPI_POACNT TO IT_BAPI_POACNT.
    APPEND W_BAPI_POACNTX TO IT_BAPI_POACNTX.
    Second Account Assignment
    W_BAPI_POACNT-SERIAL_NO = 2.
    W_BAPI_POACNTX-SERIAL_NO = 2.
    W_BAPI_POACNTX-SERIAL_NOX = 'X'.
    W_BAPI_POACNT-CREAT_DATE  = 11/03/2010.
    W_BAPI_POACNTX-CREAT_DATE  = 'X'.
    W_BAPI_POACNT-QUANTITY = 0.25.
    W_BAPI_POACNTX-QUANTITY  = 'X'.
    W_BAPI_POACNT-DISTR_PERC = 25.
    W_BAPI_POACNTX-DISTR_PERC  = 'X'.
    W_BAPI_POACNT-NET_VALUE = 25 .
    W_BAPI_POACNTX-NET_VALUE  = 'X'.
    W_BAPI_POACNT-PO_ITEM = 1.
    W_BAPI_POACNTX-PO_ITEM = 1.
    W_BAPI_POACNTX-PO_ITEMX = 'X'.
    W_BAPI_POACNT-GL_ACCOUNT = 641099.
    W_BAPI_POACNTX-GL_ACCOUNT  = 'X'.
    W_BAPI_POACNT-COSTCENTER =  10010393.
    W_BAPI_POACNTX-COSTCENTER = 'X'.
    W_BAPI_POACNT-CO_AREA = 1234.
    W_BAPI_POACNTX-CO_AREA = 'X'.
    APPEND W_BAPI_POACNT TO IT_BAPI_POACNT.
    APPEND W_BAPI_POACNTX TO IT_BAPI_POACNTX.
    Service Item detials
    W_BAPI_SERVICE-OUTL_IND = 'X'.
    W_BAPI_SERVICE-SUBPCKG_NO =  3457.
    W_BAPI_SERVICE-LINE_NO = 1.
    W_BAPI_SERVICE-PCKG_NO = 3456.
    W_BAPI_SERVICE-EXT_LINE = 0000000000.
    W_BAPI_SERVICE-QUANTITY = 0.
    W_BAPI_SERVICE-BASE_UOM = 0.
    W_BAPI_SERVICE-PRICE_UNIT = 0.
    W_BAPI_SERVICE-GR_PRICE = 0.
    W_BAPI_SERVICE-SHORT_TEXT = 0.
    W_BAPI_SERVICE-MATL_GROUP = 0.
    W_BAPI_SERVICE-DISTRIB = 0.
    APPEND W_BAPI_SERVICE TO IT_BAPI_SERVICE.
    W_BAPI_SERVICE-OUTL_IND = 'X'.
    W_BAPI_SERVICE-LINE_NO = 2.
    W_BAPI_SERVICE-PCKG_NO = 3457.
    W_BAPI_SERVICE-EXT_LINE = 0000000010.
    W_BAPI_SERVICE-QUANTITY = 10.
    W_BAPI_SERVICE-BASE_UOM = STD.
    W_BAPI_SERVICE-PRICE_UNIT = 0.
    W_BAPI_SERVICE-GR_PRICE = 5.
    W_BAPI_SERVICE-SHORT_TEXT = Cabling Services1.
    W_BAPI_SERVICE-MATL_GROUP = IT37.
    W_BAPI_SERVICE-DISTRIB = 2.
    APPEND W_BAPI_SERVICE TO IT_BAPI_SERVICE.
    W_BAPI_SERVICE-OUTL_IND = 'X'.
    W_BAPI_SERVICE-LINE_NO = 3.
    W_BAPI_SERVICE-PCKG_NO = 3457.
    W_BAPI_SERVICE-EXT_LINE = 0000000020.
    W_BAPI_SERVICE-QUANTITY = 10.
    W_BAPI_SERVICE-BASE_UOM = STD.
    W_BAPI_SERVICE-PRICE_UNIT = 0.
    W_BAPI_SERVICE-GR_PRICE = 5.
    W_BAPI_SERVICE-SHORT_TEXT = Cabling Services2.
    W_BAPI_SERVICE-MATL_GROUP = IT37.
    W_BAPI_SERVICE-DISTRIB = 2.
    APPEND W_BAPI_SERVICE TO IT_BAPI_SERVICE.
    Service Account assignment details
    W_ACC_SERVICE-PCKG_NO = 3457.
    W_ACC_SERVICE-LINE_NO = 2.
    W_ACC_SERVICE-SERNO_LINE = 1.
    W_ACC_SERVICE-SERIAL_NO = 1.   "Account Assignment Link
    W_ACC_SERVICE-NET_VALUE = .
    W_ACC_SERVICE-QUANTITY = 50 .
    W_ACC_SERVICE-PERCENTAGE = 100 .
    APPEND W_ACC_SERVICE TO IT_ACC_SERVICE.
    W_ACC_SERVICE-PCKG_NO = 3457.
    W_ACC_SERVICE-LINE_NO = 3.
    W_ACC_SERVICE-SERNO_LINE = 1.
    W_ACC_SERVICE-SERIAL_NO = 1.   "Account Assignment Link
    W_ACC_SERVICE-NET_VALUE = .
    W_ACC_SERVICE-QUANTITY = 50 .
    W_ACC_SERVICE-PERCENTAGE = 50 .
    APPEND W_ACC_SERVICE TO IT_ACC_SERVICE.
    W_ACC_SERVICE-PCKG_NO = 3457.
    W_ACC_SERVICE-LINE_NO = 3.
    W_ACC_SERVICE-SERNO_LINE = 1.
    W_ACC_SERVICE-SERIAL_NO = 2.   "Account Assignment Link
    W_ACC_SERVICE-NET_VALUE = .
    W_ACC_SERVICE-QUANTITY = 50 .
    W_ACC_SERVICE-PERCENTAGE = 50 .
    APPEND W_ACC_SERVICE TO IT_ACC_SERVICE.
    EKKN table entries:
    When created thru ME21N with the same set of data,which is expected
    ZEKKN            MENGE            NETWR  SAKTO        KOSTL
    01               0.750            75.00  0000641099   0010010394
    02               0.250            25.00  0000641099   0010010393
    But through BAPI_PO_CREATE1, the below split is being done with respect to Tax Jurisdiction code.
    01               0.500            50.00  0000641099   0010010394
    02               0.250            25.00  0000641099   0010010394
    03               0.250            25.00  0000641099   0010010393
    Please advice the solution.
    PS: there were different tax jurisdiction codes were being determined.
    Plant, Cost Center and Delivery Address.

    Hi,
    To commit BAPI or to run it properly , you need to fulfill all required data for BAPI.
    You can go to BAPI documentation to check for mandetory parameters and also check with Function consultant for more data and confifuration/
    Reward if useful!

  • Query with BAPI_PO_CREATE1 for Partial Service PO.

    Dear Experts,
    I am unable to create a Partial Service PO with BAPI_PO_CREATE1. No matter the Qty specified, in the field POSERVICES-QUANTITY; the Service PO gets created with the Qty specified in the RFQ.
    For your ref, the sample ABAP code is as below:
    "The PR has 2 line items, a coded Service and another uncoded service.
    "The internal table service_data is filled by us for testing.
    LOOP AT service_data.
    MOVE service_data-introw TO poservices-line_no.
    MOVE service_data-extrow TO poservices-ext_line.
    MOVE service_data-srvpos TO poservices-service.
    MOVE service_data-order_qty TO poservices-quantity.
    APPEND poservices.
    ENDLOOP.
    The BAPI executes successfully and a Transaction Commit is also used for PO creation.
    Kindly, let us know for any specific fields that needs to be passed to POITEM, POSERVICES or any other BAPI parameters that I have missed out.
    Regards,
    Yogesh.

    Dear Yogesh,
    The moment you give the reference of a quotation for Service PO Creation, the Service PO created will always be of the quantity of the quotation. That's because in Service PO Quotation maintenance, the gross price of the service is calculated as rate*quantity. Now, the addition of this Service Gross Price of all the sub-line items of the Service becomes the Basic Price for the corresponding line item.
    Hence, any change in quantity in the quotation and the PO created through BAPI with quotation as reference will be in contradiction.
    The only option is to create a PO and then amend it.
    Regards,
    Pranav.

  • BDC for ME21 Po create

    Hi ALL,
    Iam Creating BDC Program bu using ME21 for Uploading PO.
    Iam getting error at Income term2 in the Second Screen of ME21. Iam Passing this value through Excel Sheet But event then it is not picking. When i check in debugging the value of income term2 is populating.
    Let me know what are the mandotory fields for creating PO using Me21.
    Here iam also attaching the code, Please help us because it is very urgent.
    report ZPOUPLOADME21
    no standard page heading line-size 255.
    *include bdcrecx1.
    INCLUDE YMM_BDCRECX1.
    •     Internal Table T_BDCDATA to store BDC data
    •     Batchinputdata of single transaction
    DATA: T_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
    •     Internal Table T_BDC_MSG to store BDC messages
    DATA: T_BDC_MSG LIKE STANDARD TABLE OF BDCMSGCOLL INITIAL
    SIZE 0 WITH HEADER LINE.
    DATA: V_FILE LIKE RLGRAP-FILENAME ,
    V_COUNT(5) TYPE C,
    V_MESSAGE_CNT(5) TYPE C .
    DATA : BEGIN OF IT_DATA OCCURS 0,
    LIFNR LIKE EKKO-LIFNR, " Vendor
    BSART LIKE RM06E-BSART, " Order Type
    BEDAT(10) TYPE C, " Date
    EKORG LIKE EKKO-EKORG, " Purchasing Organization
    EKGRP LIKE EKKO-EKGRP, " Purchasing Group
    WERKS LIKE RM06E-WERKS, " Plant
    INCO2 LIKE EKKO-INCO2, " Inco Terms
    KNTTP LIKE EKPO-KNTTP, " A/C Assignment Category
    EMATN LIKE EKPO-EMATN, " Material Number
    MENGE LIKE EKPO-MENGE, " Purchase Order Quantity
    NETPR LIKE EKPO-NETPR, " Net Price
    MWSKZ LIKE EKPO-MWSKZ, " Tax Code
    NPLNR LIKE MSEG-NPLNR, " Network
    VORNR LIKE PSORDER-VORNR, " Operation
    END OF IT_DATA.
    START-OF-SELECTION.
    PERFORM OPEN_GROUP.
    PERFORM DATA_UPLOAD.
    PERFORM CALL_TRANSACTION.
    PERFORM CLOSE_GROUP.
    PERFORM WRITE_ERROR.
    *& Form DATA_UPLOAD
    •     text
    •     --> p1 text
    •     <-- p2 text
    FORM DATA_UPLOAD.
    *call function ws_upload to retrieve data from a flat file in the
    *presentation server into an internal table
    CALL FUNCTION 'UPLOAD'
    EXPORTING
    FILENAME = V_FILE
    FILETYPE = 'DAT'
    TABLES
    DATA_TAB = IT_DATA
    EXCEPTIONS
    CONVERSION_ERROR = 1
    INVALID_TABLE_WIDTH = 2
    INVALID_TYPE = 3
    NO_BATCH = 4
    UNKNOWN_ERROR = 5
    GUI_REFUSE_FILETRANSFER = 6
    OTHERS = 7.
    •     if ws_upload fails then display appropriate message
    IF SY-SUBRC 0.
    •     MESSAGE E000 WITH 'Data not Uploaded into internal table'.
    ENDIF.
    ENDFORM. " DATA_UPLOAD
    *& Form CALL_TRANSACTION
    •     text
    •     --> p1 text
    •     <-- p2 text
    FORM CALL_TRANSACTION.
    DATA : V_IVDAT(10) TYPE C,
    V_AKTIV(10) TYPE C,
    V_MESSAGE(404) TYPE C.
    REFRESH T_BDCDATA.
    CLEAR T_BDCDATA.
    V_COUNT = 0.
    V_MESSAGE_CNT = 0.
    LOOP AT IT_DATA .
    V_COUNT = V_COUNT + 1.
    *perform open_group.
    perform bdc_dynpro using 'SAPMM06E' '0100'.
    perform bdc_field using 'BDC_CURSOR'
    'RM06E-WERKS'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'EKKO-LIFNR'
    IT_DATA-LIFNR.
    perform bdc_field using 'RM06E-BSART'
    IT_DATA-BSART.
    *perform bdc_field using 'RM06E-BEDAT'
    •     '24.01.2008'.
    perform bdc_field using 'RM06E-BEDAT'
    IT_DATA-BEDAT.
    perform bdc_field using 'EKKO-EKORG'
    IT_DATA-EKORG.
    perform bdc_field using 'EKKO-EKGRP'
    IT_DATA-EKGRP.
    *perform bdc_field using 'RM06E-LPEIN'
    •     'T'.
    perform bdc_field using 'RM06E-WERKS'
    IT_DATA-WERKS.
    perform bdc_dynpro using 'SAPMM06E' '0101'.
    perform bdc_field using 'BDC_CURSOR'
    'EKKO-INCO2'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    *perform bdc_field using 'EKKO-EKGRP'
    •     IT_DATA-EKGRP1. "'SP3'.
    *perform bdc_field using 'EKKO-PINCR'
    •     IT_DATA-PINCR. "'10'.
    *perform bdc_field using 'EKKO-SPRAS'
    •     IT_DATA-SPRAS. "'EN'.
    *perform bdc_field using 'EKKO-UPINC'
    •     IT_DATA-UPINC. "'1'.
    *perform bdc_field using 'EKKO-ZTERM'
    •     IT_DATA-ZTERM.
    *perform bdc_field using 'EKKO-WAERS'
    •     IT_DATA-WAERS. "'INR'.
    *perform bdc_field using 'EKKO-ZBD1T'
    •     IT_DATA-ZBD1T. "'44'.
    *perform bdc_field using 'EKKO-WKURS'
    •     IT_DATA-WKURS. "' 1.00000'.
    *perform bdc_field using 'EKKO-INCO1'
    •     IT_DATA-INCO1.
    perform bdc_field using 'EKKO-INCO2'
    IT_DATA-INCO2.
    perform bdc_dynpro using 'SAPMM06E' '0120'.
    perform bdc_field using 'BDC_CURSOR'
    'EKPO-NETPR(01)'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    *perform bdc_field using 'EKPO-KNTTP(01)'
    •     'N'.
    perform bdc_field using 'EKPO-KNTTP(01)'
    IT_DATA-KNTTP.
    perform bdc_field using 'EKPO-EMATN(01)'
    IT_DATA-EMATN.
    perform bdc_field using 'EKPO-MENGE(01)'
    IT_DATA-MENGE.
    perform bdc_field using 'EKPO-NETPR(01)'
    IT_DATA-NETPR.
    perform bdc_dynpro using 'SAPMM06E' '0111'.
    perform bdc_field using 'BDC_CURSOR'
    'EKPO-MWSKZ'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    *perform bdc_field using 'EKPO-KNTTP'
    •     'N'.
    *perform bdc_field using 'EKPO-TXZ01'
    •     'Clamps & Connector'.
    *perform bdc_field using 'EKPO-MENGE'
    •     '4'.
    *perform bdc_field using 'EKPO-SPINF'
    •     'A'.
    *perform bdc_field using 'EKPO-NETPR'
    •     '100.00'.
    *perform bdc_field using 'EKPO-PEINH'
    •     '1'.
    *perform bdc_field using 'EKPO-BPRME'
    •     'NO'.
    *perform bdc_field using 'EKPO-BPUMN'
    •     '1'.
    *perform bdc_field using 'EKPO-BPUMZ'
    •     '1'.
    *perform bdc_field using 'EKPO-PRSDR'
    •     'X'.
    *perform bdc_field using 'RM06E-EEIND'
    •     '24.01.2008'.
    *perform bdc_field using 'RM06E-LPEIN'
    •     'D'.
    *perform bdc_field using 'EKPO-WEPOS'
    •     'X'.
    perform bdc_field using 'EKPO-MWSKZ'
    IT_DATA-MWSKZ.
    *perform bdc_field using 'EKPO-REPOS'
    •     'X'.
    perform bdc_dynpro using 'SAPMM06E' '0511'.
    perform bdc_field using 'BDC_CURSOR'
    'EKKN-SAKTO'.
    perform bdc_field using 'BDC_OKCODE'
    '=ENTE'.
    *perform bdc_field using 'EKKN-SAKTO'
    •     '6034025'.
    *perform bdc_field using 'DKACB-FMORE'
    •     'X'.
    perform bdc_dynpro using 'SAPLKACB' '0002'.
    *perform bdc_field using 'BDC_CURSOR'
    •     'COBL-VORNR'.
    perform bdc_field using 'BDC_OKCODE'
    '=ENTE'.
    perform bdc_field using 'COBL-NPLNR'
    IT_DATA-NPLNR.
    perform bdc_field using 'COBL-VORNR'
    IT_DATA-VORNR.
    perform bdc_dynpro using 'SAPMM06E' '0111'.
    perform bdc_dynpro using 'SAPMM06E' '0120'.
    perform bdc_field using 'BDC_CURSOR'
    'RM06E-EBELP'.
    perform bdc_field using 'BDC_OKCODE'
    '=BU'.
    *perform bdc_field using 'RM06E-EBELP'
    •     '10'.
    perform bdc_dynpro using 'SAPLSPO1' '0300'.
    perform bdc_field using 'BDC_OKCODE'
    '=YES'.
    perform bdc_transaction using 'ME21'.
    perform close_group.
    LOOP AT T_MESSTAB WHERE REC_NO IS INITIAL.
    AT FIRST.
    V_MESSAGE_CNT = V_MESSAGE_CNT + 1.
    T_MESSTAB-REC_NO = V_COUNT.
    ENDAT.
    MODIFY T_MESSTAB TRANSPORTING REC_NO.
    ENDLOOP.
    REFRESH T_BDCDATA.
    CLEAR T_BDCDATA.
    ENDLOOP.
    SKIP.
    WRITE : /10 'Record Number ', 30 'Error Message'.
    SKIP.
    endform.
    *& Form WRITE_ERROR
    •     text
    •     --> p1 text
    •     <-- p2 text
    FORM WRITE_ERROR.
    LOOP AT T_MESSTAB.
    WRITE : /10 T_MESSTAB-REC_NO , 30 T_MESSTAB-MESSAGE.
    ENDLOOP.
    ULINE /10(100).
    WRITE : /10 'No of Records : ' , V_COUNT.
    WRITE : /10 'No of Erroneous Records : ' , V_MESSAGE_CNT.
    ULINE /10(100).
    ENDFORM. " WRITE_ERROR
    *& Form CHECK_BDC
    •     text
    •     --> p1 text
    •     <-- p2 text
    FORM CHECK_BDC.
    DATA: L_CHECK LIKE YMMT_CHECK_BDC-YCHECK.
    SELECT SINGLE YCHECK INTO L_CHECK FROM YMMT_CHECK_BDC
    WHERE PROGRAMM EQ SY-REPID
    AND YCHECK EQ 'X'.
    IF SY-SUBRC NE 0.
    MESSAGE S000(YM) WITH 'Execution not possible'.
    STOP.
    ENDIF.
    ENDFORM. " CHECK_BDC
    <REMOVED BY MODERATOR>
    Thanks
    Rahul
    Edited by: Alvaro Tejada Galindo on Jan 24, 2008 9:38 AM

    it depends on your release whether you can use ME21N and/or the bapi.
    but why throw away what you have already achieved? ME21 still works also in later releases. to find out the mandatory fields in your system, check the customzing settings in tx. OLME -> Purchase Order -> Define Screen Layout at Document Level -> click on ME21 -> Terms of delivery and payment. Here are the incoterm-settings.
    Edited by: Mylene Euridice Dorias on Jan 24, 2008 5:19 PM

  • BDC FOR ME21

    Hi ALL,
    Iam Creating BDC Program bu using ME21 for Uploading PO.
    Iam getting error at Income term2 in the Second Screen of ME21. Iam Passing this value through Excel Sheet But event then it is not picking. When i check in debugging the value of income term2 is populating.
    Let me know what are the mandotory fields for creating PO using Me21.
    Here iam also attaching the code, Please help us because it is very urgent.
    report ZPOUPLOADME21
           no standard page heading line-size 255.
    *include bdcrecx1.
    INCLUDE YMM_BDCRECX1.
    Internal Table T_BDCDATA to store BDC data
           Batchinputdata of single transaction
    DATA:   T_BDCDATA LIKE BDCDATA  OCCURS 0 WITH HEADER LINE.
    Internal Table T_BDC_MSG to store BDC messages
    DATA:   T_BDC_MSG LIKE STANDARD TABLE OF BDCMSGCOLL INITIAL
            SIZE 0 WITH HEADER LINE.
    DATA:   V_FILE LIKE RLGRAP-FILENAME ,
            V_COUNT(5) TYPE C,
            V_MESSAGE_CNT(5) TYPE C .
    DATA : BEGIN OF IT_DATA OCCURS 0,
           LIFNR LIKE EKKO-LIFNR,      " Vendor
           BSART LIKE RM06E-BSART,     " Order Type
           BEDAT(10) TYPE C,           " Date
           EKORG LIKE EKKO-EKORG,      " Purchasing Organization
           EKGRP LIKE EKKO-EKGRP,      " Purchasing Group
           WERKS LIKE RM06E-WERKS,     " Plant
           INCO2 LIKE EKKO-INCO2,      " Inco Terms
           KNTTP LIKE EKPO-KNTTP,      " A/C Assignment Category
           EMATN LIKE EKPO-EMATN,      " Material Number
           MENGE LIKE EKPO-MENGE,      " Purchase Order Quantity
           NETPR LIKE EKPO-NETPR,      " Net Price
           MWSKZ LIKE EKPO-MWSKZ,      " Tax Code
           NPLNR LIKE MSEG-NPLNR,      " Network
           VORNR LIKE PSORDER-VORNR,   " Operation
           END OF IT_DATA.
    START-OF-SELECTION.
         PERFORM OPEN_GROUP.
         PERFORM DATA_UPLOAD.
         PERFORM CALL_TRANSACTION.
         PERFORM CLOSE_GROUP.
         PERFORM WRITE_ERROR.
    *&      Form  DATA_UPLOAD
          text
    -->  p1        text
    <--  p2        text
    FORM DATA_UPLOAD.
    *call function ws_upload to retrieve data from a flat file in the
    *presentation server into an internal table
      CALL FUNCTION 'UPLOAD'
           EXPORTING
                FILENAME                = V_FILE
                FILETYPE                = 'DAT'
           TABLES
                DATA_TAB                = IT_DATA
           EXCEPTIONS
                CONVERSION_ERROR        = 1
                INVALID_TABLE_WIDTH     = 2
                INVALID_TYPE            = 3
                NO_BATCH                = 4
                UNKNOWN_ERROR           = 5
                GUI_REFUSE_FILETRANSFER = 6
                OTHERS                  = 7.
    if ws_upload fails then display appropriate message
      IF SY-SUBRC <> 0.
       MESSAGE E000  WITH 'Data not Uploaded into internal table'.
      ENDIF.
    ENDFORM.                    " DATA_UPLOAD
    *&      Form  CALL_TRANSACTION
          text
    -->  p1        text
    <--  p2        text
    FORM CALL_TRANSACTION.
      DATA : V_IVDAT(10) TYPE C,
             V_AKTIV(10) TYPE  C,
             V_MESSAGE(404) TYPE C.
      REFRESH T_BDCDATA.
      CLEAR T_BDCDATA.
      V_COUNT = 0.
      V_MESSAGE_CNT = 0.
      LOOP AT IT_DATA .
        V_COUNT = V_COUNT + 1.
    *perform open_group.
    perform bdc_dynpro      using 'SAPMM06E' '0100'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RM06E-WERKS'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'EKKO-LIFNR'
                                  IT_DATA-LIFNR.
    perform bdc_field       using 'RM06E-BSART'
                                  IT_DATA-BSART.
    *perform bdc_field       using 'RM06E-BEDAT'
                                 '24.01.2008'.
    perform bdc_field       using 'RM06E-BEDAT'
                                  IT_DATA-BEDAT.
    perform bdc_field       using 'EKKO-EKORG'
                                  IT_DATA-EKORG.
    perform bdc_field       using 'EKKO-EKGRP'
                                  IT_DATA-EKGRP.
    *perform bdc_field       using 'RM06E-LPEIN'
                                 'T'.
    perform bdc_field       using 'RM06E-WERKS'
                                  IT_DATA-WERKS.
    perform bdc_dynpro      using 'SAPMM06E' '0101'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'EKKO-INCO2'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    *perform bdc_field       using 'EKKO-EKGRP'
                                 IT_DATA-EKGRP1. "'SP3'.
    *perform bdc_field       using 'EKKO-PINCR'
                                 IT_DATA-PINCR. "'10'.
    *perform bdc_field       using 'EKKO-SPRAS'
                                 IT_DATA-SPRAS. "'EN'.
    *perform bdc_field       using 'EKKO-UPINC'
                                 IT_DATA-UPINC. "'1'.
    *perform bdc_field       using 'EKKO-ZTERM'
                                 IT_DATA-ZTERM.
    *perform bdc_field       using 'EKKO-WAERS'
                                 IT_DATA-WAERS. "'INR'.
    *perform bdc_field       using 'EKKO-ZBD1T'
                                 IT_DATA-ZBD1T. "'44'.
    *perform bdc_field       using 'EKKO-WKURS'
                                 IT_DATA-WKURS. "' 1.00000'.
    *perform bdc_field       using 'EKKO-INCO1'
                                 IT_DATA-INCO1.
    perform bdc_field       using 'EKKO-INCO2'
                                  IT_DATA-INCO2.
    perform bdc_dynpro      using 'SAPMM06E' '0120'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'EKPO-NETPR(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    *perform bdc_field       using 'EKPO-KNTTP(01)'
                                 'N'.
    perform bdc_field       using 'EKPO-KNTTP(01)'
                                  IT_DATA-KNTTP.
    perform bdc_field       using 'EKPO-EMATN(01)'
                                  IT_DATA-EMATN.
    perform bdc_field       using 'EKPO-MENGE(01)'
                                  IT_DATA-MENGE.
    perform bdc_field       using 'EKPO-NETPR(01)'
                                  IT_DATA-NETPR.
    perform bdc_dynpro      using 'SAPMM06E' '0111'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'EKPO-MWSKZ'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    *perform bdc_field       using 'EKPO-KNTTP'
                                 'N'.
    *perform bdc_field       using 'EKPO-TXZ01'
                                 'Clamps & Connector'.
    *perform bdc_field       using 'EKPO-MENGE'
                                 '4'.
    *perform bdc_field       using 'EKPO-SPINF'
                                 'A'.
    *perform bdc_field       using 'EKPO-NETPR'
                                 '100.00'.
    *perform bdc_field       using 'EKPO-PEINH'
                                 '1'.
    *perform bdc_field       using 'EKPO-BPRME'
                                 'NO'.
    *perform bdc_field       using 'EKPO-BPUMN'
                                 '1'.
    *perform bdc_field       using 'EKPO-BPUMZ'
                                 '1'.
    *perform bdc_field       using 'EKPO-PRSDR'
                                 'X'.
    *perform bdc_field       using 'RM06E-EEIND'
                                 '24.01.2008'.
    *perform bdc_field       using 'RM06E-LPEIN'
                                 'D'.
    *perform bdc_field       using 'EKPO-WEPOS'
                                 'X'.
    perform bdc_field       using 'EKPO-MWSKZ'
                                  IT_DATA-MWSKZ.
    *perform bdc_field       using 'EKPO-REPOS'
                                 'X'.
    perform bdc_dynpro      using 'SAPMM06E' '0511'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'EKKN-SAKTO'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTE'.
    *perform bdc_field       using 'EKKN-SAKTO'
                                 '6034025'.
    *perform bdc_field       using 'DKACB-FMORE'
                                 'X'.
    perform bdc_dynpro      using 'SAPLKACB' '0002'.
    *perform bdc_field       using 'BDC_CURSOR'
                                 'COBL-VORNR'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTE'.
    perform bdc_field       using 'COBL-NPLNR'
                                  IT_DATA-NPLNR.
    perform bdc_field       using 'COBL-VORNR'
                                  IT_DATA-VORNR.
    perform bdc_dynpro      using 'SAPMM06E' '0111'.
    perform bdc_dynpro      using 'SAPMM06E' '0120'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RM06E-EBELP'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BU'.
    *perform bdc_field       using 'RM06E-EBELP'
                                 '10'.
    perform bdc_dynpro      using 'SAPLSPO1' '0300'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=YES'.
    perform bdc_transaction using 'ME21'.
    perform close_group.
    LOOP AT T_MESSTAB WHERE REC_NO IS INITIAL.
        AT FIRST.
          V_MESSAGE_CNT = V_MESSAGE_CNT + 1.
          T_MESSTAB-REC_NO = V_COUNT.
        ENDAT.
          MODIFY T_MESSTAB TRANSPORTING REC_NO.
        ENDLOOP.
        REFRESH T_BDCDATA.
        CLEAR T_BDCDATA.
    ENDLOOP.
      SKIP.
      WRITE : /10 'Record Number ', 30 'Error Message'.
      SKIP.
    endform.
    *&      Form  WRITE_ERROR
          text
    -->  p1        text
    <--  p2        text
    FORM WRITE_ERROR.
      LOOP AT T_MESSTAB.
        WRITE : /10 T_MESSTAB-REC_NO , 30 T_MESSTAB-MESSAGE.
      ENDLOOP.
      ULINE /10(100).
      WRITE : /10 'No of Records : ' , V_COUNT.
      WRITE : /10 'No of Erroneous Records : ' , V_MESSAGE_CNT.
      ULINE /10(100).
    ENDFORM.                    " WRITE_ERROR
    *&      Form  CHECK_BDC
          text
    -->  p1        text
    <--  p2        text
    FORM CHECK_BDC.
    DATA: L_CHECK LIKE YMMT_CHECK_BDC-YCHECK.
      SELECT SINGLE YCHECK INTO L_CHECK FROM YMMT_CHECK_BDC
                                         WHERE PROGRAMM EQ SY-REPID
                                           AND YCHECK EQ 'X'.
      IF SY-SUBRC NE 0.
        MESSAGE S000(YM) WITH 'Execution not possible'.
        STOP.
      ENDIF.
    ENDFORM.                    " CHECK_BDC
    Answers will be awarded
    Thanks
    Rahul

    It is going into the second screen but whatever the value iam passing to incoterms2 it sis not populating when i run program, but in debugging value is coming.
    Is there any possibility of user exits attached to this ME21 transaction
    please advice
    thanks
    Madhukar Reddy

  • How to pass the condition vallues in bapi BAPI_PO_CREATE1 for items as well

    HI,
    where to pass the condition value table in bapi BAPI_PO_CREATE1 item level as well as header level
    Like Frieght charges,discounts, basic price ,VAT,CST etc.
    Is there any BAPI for GR tcode MIGO.
    Pl send along with simple examples .
    Your answeres will be rewarded.

    Pass the condition value to the following parameters.
      POCONDHEADER                 =
      POCONDHEADERX                =
      POCOND                       =
      POCONDX                      =
    For GR u case use the following BAPI.
    GMCODE Table T158G - 01 - MB01 - Goods Receipts for Purchase Order
                         02 - MB31 - Goods Receipts for Prod Order
                         03 - MB1A - Goods Issue
                         04 - MB1B - Transfer Posting
                         05 - MB1C - Enter Other Goods Receipt
                         06 - MB11
    Domain: KZBEW - Movement Indicator
         Goods movement w/o reference
    B - Goods movement for purchase order
    F - Goods movement for production order
    L - Goods movement for delivery note
    K - Goods movement for kanban requirement (WM - internal only)
    O - Subsequent adjustment of "material-provided" consumption
    W - Subsequent adjustment of proportion/product unit material
             call function 'BAPI_GOODSMVT_CREATE'
               exporting
                   goodsmvt_header             = gmhead
                   goodsmvt_code               = gmcode
                 *   TESTRUN                     = ' '
              IMPORTING
                  goodsmvt_headret            = mthead
             *   MATERIALDOCUMENT            =
      MATDOCUMENTYEAR             =
               tables
                 goodsmvt_item               = itab
      GOODSMVT_SERIALNUMBER       =
                return                      = errmsg.

  • Transaction Variant For Me21.

    Can i create a transaction variant for transaction me21.
    if yes, please tell me the procedure.
    please help.
    its urgent.

    hi
    good
    i think you can do it , because Transaction Variants to make fields Mandatory, Hidden or Display. Also applicable to screens and tabstrips.
    You can hide unwanted screens and fields in any of the standard SAP programs without changing any of the standard programs.  Additional features such as making the variant as default on the standard SAP transaction code is only available as of 4.6x.
    In 4.6c, you can default your transaction variant as the standard variant. (SHD0 - Edit -> Activate/Deactivate as standard variant)
    thanks
    mrutyun^

  • Screen exit (for newTabstrip) for ME21 TRANSACTION CODE AT ITEM LEVEL

    Hi All ABAPERS,
    I had a urgent requirement that I need to provide new tabstrip in ME21 tcode at ITEM level.
    note: not in Item overview.
    So, friends could you please tell me what is the screen exit for it and if you have steps for it please give me the solution as early as possible and good points will be rewarded.

    use this enhamcement MM06E005
    go to se51 give program name SAPLXM06 and create 0111 screen and mention subscreen under attributes of screen.
    and go to layout define ur fields in the layout..
    use exit_sapmm06e_013 for getting data .
    also create ci_ekpo structrure and write the req logic to update that strucutre so that values will go and sit in stadard ekpo table.
    after creating that structure dont forget to activate ekpo thr se14.
    and go to se80 and give function group of exit_sapmm06e_013(this fm) and u will find under includes some z*top where u can declare all ur screen fields .

Maybe you are looking for

  • When I be able to play my iTunes on my Android ?

    When will I be able to listen to My iTunes on Android ?

  • Dell Ultrasharp 2007WPF Banding Problem?

    I have set my sights on getting this model for a widescreen monitor (sorry Apple, 700 bucks is too much). The only thing I have heard about it is this "banding" issue. Do anyone of you know what I am talking about? What exactly is it? Does anyone her

  • Brightness, Gamma, Blacklevel on 4444's from DaVinci?

    Hi, Guys! I graded a sequence in DaVinci Resolve 9. As a client-monitor I use a panasonic plasma connected to the BlackMagic DeckLink card in my MacPro. I do know that it's not a calibrated monitor, but what I see is a relative problem rather than a

  • Very urgent - Usage of IsError function in HFR

    Hi All, Its very urgent requirement for us. How can we use the is error function in HFR.bcoz if the both values in formula ex: a/b ; a=0,b=0; then it shows some garbage value.i came to know we can achieve that by using iserror function.but i dnt know

  • Conditional increment in XSLT

    In a Shipment the number of orders is present. For each order there is a number of order line Items. Order Line Items contain item. For each iteration we are maintaining the hierarchy levels. In the orderLine Items section, if the previous item is eq