Skip to Content
author's profile photo Former Member
Former Member

Problem With BAPI_PO_CREATE1

Hi Friends.

I got some problems using BAPI_PO_CREATE1 for create a PO.

I need use the number of contract(Outline agreement) and number of contract item (Contract Item). After it I just need associate a Service for contract, only this.

But, when I run it on se37, BAPI return a error message "In case of account assignment, please enter acc. assignment data for item".

I did a shearch on forum before post and read anything about put the cost center data, but it's into the BAPI all time.

Need a help plz.

Cheers.

Thiago.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 29, 2006 at 05:59 PM

    Hi,

    I believe you have to pass the account assignment details in the following parameter..

    POACCOUNT STRUCTURE BAPIMEPOACCOUNT OPTIONAL

    Thanks,

    Naren

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Yeah I did it, that's the following parameters.

      PO_ITEM 00001

      SERIAL_NO 01

      DELETE_IND

      CREAT_DATE

      QUANTITY 1,000

      DISTR_PERC 0,0

      NET_VALUE 0,000000000

      GL_ACCOUNT 6150010308

      BUS_AREA

      COSTCENTER 1448336

      SD_DOC

      ITM_NUMBER 000000

      SCHED_LINE 0000

      ASSET_NO

      SUB_NUMBER

      ORDERID

      GR_RCPT

      UNLOAD_PT

      CO_AREA BAND

      COSTOBJECT

      PROFIT_CTR

      WBS_ELEMENT

      NETWORK

      RL_EST_KEY

      PART_ACCT

      CMMT_ITEM

      REC_IND

      FUNDS_CTR

      FUND

      FUNC_AREA

      REF_DATE

      TAX_CODE

      TAXJURCODE

      NOND_ITAX 0,000000000

      ACTTYPE

      CO_BUSPROC

      RES_DOC

      RES_ITEM 000

      ACTIVITY

      GRANT_NBR

      CMMT_ITEM_LONG

      FUNC_AREA_LONG

  • author's profile photo Former Member
    Former Member
    Posted on Nov 29, 2006 at 06:12 PM

    Hi,

    Did you pass the X internal table..

    *" POACCOUNTX STRUCTURE BAPIMEPOACCOUNTX OPTIONAL

    Thanks,

    Naren

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 29, 2006 at 06:17 PM

    Hi,

    Have a look at this code, you will get the Parameters to pass to the BAPI

    *&---------------------------------------------------------------------*
    *& Report ZCHARLI *
    *& *
    *&---------------------------------------------------------------------*
    *& *
    *& *
    *&---------------------------------------------------------------------*
    
    *& *
    *&---------------------------------------------------------------------*
    *& 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 .
    
    *Structures to hold PO account data
    DATA : ACCOUNT LIKE BAPIMEPOACCOUNT OCCURS 0 WITH HEADER LINE ,
    ACCOUNTX LIKE BAPIMEPOACCOUNTX OCCURS 0 WITH HEADER LINE .
    
    *Structures to hold PO schedule data
    DATA : ITEMSCHEDULE LIKE BAPIMEPOSCHEDULE OCCURS 0 WITH HEADER LINE ,
    ITEMSCHEDULEX LIKE BAPIMEPOSCHEDULX OCCURS 0 WITH HEADER LINE .
    
    *Structures to hold PO (distrib.imputac.lín.servicios) data
    DATA : POSRVACCESSVALUES LIKE BAPIESKLC OCCURS 0 WITH HEADER LINE .
    
    *Structures to hold PO services data
    DATA : SERVICES LIKE BAPIESLLC 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 '1000' ,
    doctyp like HEADER-DOC_TYPE default 'PM' ,
    cdate like HEADER-CREAT_DATE default sy-datum ,
    vendor like HEADER-VENDOR default '100006' ,
    pur_org like HEADER-PURCH_ORG default '1000' ,
    pur_grp like HEADER-PUR_GROUP default '850' ,
    sociedad like HEADER-COMP_CODE default '1000' ,
    vendedor like HEADER-SALES_PERS default 'Wilda Messina'.
    
    
    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 'CRANE' ,
    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 '350001' ,
    plant like ITEM-PLANT default '1000' ,
    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 'UP'.
    
    selection-screen end of block b2.
    
    * Parámnetros para los servicios
    selection-screen begin of block b3 with frame title text-003.
    parameters : paquete like SERVICES-PCKG_NO default '956',
    numlinin like SERVICES-LINE_NO default '9' ,
    numlinea like SERVICES-EXT_LINE default '80',
    service like SERVICES-SERVICE default '8010',
    srv_cant like SERVICES-quantity default '5' ,
    precio like SERVICES-GR_PRICE default '300' ,
    impuesto like SERVICES-TAX_CODE default 'I2' .
    
    selection-screen end of block b3.
    
    * Parámnetros de imputación
    selection-screen begin of block b4 with frame title text-004.
    parameters : centro like ACCOUNT-COSTCENTER default '120100',
    cuenta like ACCOUNT-GL_ACCOUNT default '6501002000' ,
    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 b4.
    
    
    *&---------------------------------------------------------------------*
    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 = '10'.
    ITEM-QUANTITY = '1'.
    *ITEM-MATERIAL = material .
    ITEM-SHORT_TEXT = 'prueba bapi_po_create1'.
    ITEM-TAX_CODE = 'I2'.
    ITEM-ACCTASSCAT = 'K' .
    ITEM-ITEM_CAT = 'F' .
    ITEM-MATL_GROUP = '350001' .
    ITEM-PLANT = '1000' .
    ITEM-TRACKINGNO = '99999'.
    ITEM-AGREEMENT = '4904000004' .
    ITEM-AGMT_ITEM = '0010'.
    ITEM-QUANTITY = '1' .
    ITEM-PO_UNIT = 'UP'.
    *ITEM-ORDERPR_UN = 'UP'.
    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 = '2748' .
    
    
    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-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 .
    ITEMX-PCKG_NO = C_X.
    
    APPEND ITEMX. CLEAR ITEMX.
    
    *&---------------------------------------------------------------------*
    *POPULATE ITEM SCHEDULE DATA.
    *&---------------------------------------------------------------------*
    ITEMSCHEDULE-PO_ITEM = '00010'.
    ITEMSCHEDULE-DEL_DATCAT_EXT = 'T'.
    ITEMSCHEDULE-DELIVERY_DATE = '21.04.2005'. "sy-datum + 2 dias.
    *ITEM_SCHEDULE-QUANTITY = '1'. "ITDETALLE-CANTIDAD.
    APPEND ITEMSCHEDULE.
    CLEAR ITEMSCHEDULE.
    
    *&---------------------------------------------------------------------*
    *POPULATE ITEM FLAG FOR SCHEDULE TABLE.
    *&---------------------------------------------------------------------*
    ITEMSCHEDULEX-PO_ITEM = '10'.
    ITEMSCHEDULEX-PO_ITEMX = c_x .
    ITEMSCHEDULEX-DEL_DATCAT_EXT = c_x.
    ITEMSCHEDULEX-DELIVERY_DATE = c_x .
    *ITEMSCHEDULEX-QUANTITY = '1' . "ITDETALLE-CANTIDAD.
    APPEND ITEMSCHEDULEX.
    CLEAR ITEMSCHEDULEX.
    
    
    *&---------------------------------------------------------------------*
    *POPULATE ACCOUNT DATA.
    *&---------------------------------------------------------------------*
    ACCOUNT-PO_ITEM = '10' .
    ACCOUNT-SERIAL_NO = serial .
    ACCOUNT-CREAT_DATE = sy-datum .
    ACCOUNT-COSTCENTER = centro .
    ACCOUNT-GL_ACCOUNT = cuenta .
    ACCOUNT-CO_AREA = 'CD01' .
    ACCOUNT-TAX_CODE = 'I2' .
    APPEND ACCOUNT. CLEAR ACCOUNT.
    
    *&---------------------------------------------------------------------*
    *POPULATE ACCOUNT FLAG TABLE.
    *&---------------------------------------------------------------------*
    ACCOUNTX-PO_ITEM = '10' .
    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 .
    ACCOUNTX-CO_AREA = c_x .
    ACCOUNTX-TAX_CODE = c_x .
    APPEND ACCOUNTX. CLEAR ACCOUNTX.
    
    
    *&---------------------------------------------------------------------*
    *POPULATE POSRVACCESSVALUES TABLE DATA.
    *&---------------------------------------------------------------------*
    
    * FIRST ENTRY
    POSRVACCESSVALUES-PCKG_NO = '0000002749' .
    POSRVACCESSVALUES-LINE_NO = '0000000002' .
    POSRVACCESSVALUES-SERNO_LINE = '01'.
    POSRVACCESSVALUES-PERCENTAGE = '100'.
    POSRVACCESSVALUES-SERIAL_NO = '01'.
    *POSRVACCESSVALUES-QUANTITY = '1'.
    POSRVACCESSVALUES-NET_VALUE = '850'.
    APPEND POSRVACCESSVALUES . CLEAR POSRVACCESSVALUES.
    
    * SECOND ENTRY
    POSRVACCESSVALUES-PCKG_NO = '0000002749' .
    POSRVACCESSVALUES-LINE_NO = '0000000003' .
    POSRVACCESSVALUES-SERNO_LINE = '01'.
    POSRVACCESSVALUES-PERCENTAGE = '100'.
    POSRVACCESSVALUES-SERIAL_NO = '01'.
    *POSRVACCESSVALUES-QUANTITY =
    POSRVACCESSVALUES-NET_VALUE = '150'.
    APPEND POSRVACCESSVALUES . CLEAR POSRVACCESSVALUES.
    
    
    
    *&---------------------------------------------------------------------*
    *POPULATE SERVICES DATA.
    *&---------------------------------------------------------------------*
    
    * servicio JERARQUIA SUPERIOR
    
    SERVICES-PCKG_NO = '2748'.
    SERVICES-LINE_NO = '0000000001' .
    SERVICES-EXT_LINE = '0000000000' .
    SERVICES-OUTL_LEVEL = '0'.
    SERVICES-OUTL_NO = ' '.
    SERVICES-OUTL_IND = 'X'.
    SERVICES-SUBPCKG_NO = '2749'.
    *SERVICES-SERVICE = ' ' .
    SERVICES-EDITION = '0000' .
    *SERVICES-BASE_UOM = '
    SERVICES-QUANTITY = '0' .
    SERVICES-OVF_TOL = '0' .
    SERVICES-GR_PRICE = '0' .
    SERVICES-FROM_LINE = '1' .
    SERVICES-PERS_NO = '00000000' .
    SERVICES-PLN_PCKG = '0000000000' .
    SERVICES-PLN_LINE = '0000000000' .
    SERVICES-CON_PCKG = '0000000000' .
    SERVICES-CON_LINE = '0000000000' .
    SERVICES-TMP_PCKG = '0000000000' .
    SERVICES-TMP_LINE = '0000000000' .
    SERVICES-LIMIT_LINE = '0000000000' .
    SERVICES-TAX_CODE = impuesto .
    *SERVICES-SHORT_TEXT = 'prueba creacion BAPI'.
    *SERVICES-MATL_GROUP = '350001'.
    
    APPEND SERVICES. CLEAR SERVICES .
    
    
    * servicio 1
    
    SERVICES-PCKG_NO = '2749'.
    SERVICES-LINE_NO = '2' .
    SERVICES-EXT_LINE = '10' .
    SERVICES-OUTL_LEVEL = '0'.
    *SERVICES-OUTL_NO = ' '.
    *SERVICES-OUTL_IND = 'X'.
    SERVICES-SUBPCKG_NO = '0000000000'.
    SERVICES-SERVICE = '000000000000008010'.
    SERVICES-EDITION = '0000' .
    SERVICES-BASE_UOM = 'UNO' .
    SERVICES-UOM_ISO = 'C62' .
    SERVICES-QUANTITY = '1' .
    SERVICES-PRICE_UNIT = '1' .
    SERVICES-OVF_TOL = '0' .
    *SERVICES-FROM_LINE = '1' .
    SERVICES-SHORT_TEXT = 'prueba creacion BAPI'.
    SERVICES-PERS_NO = '00000000' .
    SERVICES-PLN_PCKG = '0000001980' .
    SERVICES-PLN_LINE = '0000000002' .
    SERVICES-CON_PCKG = '0000001980' .
    SERVICES-CON_LINE = '0000000002' .
    SERVICES-TMP_PCKG = '0000000000' .
    SERVICES-TMP_LINE = '0000000000' .
    SERVICES-LIMIT_LINE = '0000000000' .
    SERVICES-TAX_CODE = 'I2' .
    SERVICES-GR_PRICE = '850' .
    SERVICES-MATL_GROUP = '350001'.
    
    APPEND SERVICES. CLEAR SERVICES .
    
    
    *&---------------------------------------------------------------------*
    *POPULATE CONTRACT LIMITS DATA.
    *&---------------------------------------------------------------------*
    POCONTRACTLIMITS-PCKG_NO = '956'.
    POCONTRACTLIMITS-CON_NUMBER = '4903000004'.
    POCONTRACTLIMITS-CON_ITEM = '10'.
    POCONTRACTLIMITS-NO_LIMIT = c_x.
    POCONTRACTLIMITS-PRICE_CHG = c_x.
    APPEND POCONTRACTLIMITS. CLEAR POCONTRACTLIMITS .
    
    
    *&---------------------------------------------------------------------*
    *BAPI CALL
    *&---------------------------------------------------------------------*
    CALL FUNCTION 'BAPI_PO_CREATE1'
    EXPORTING
    POHEADER = HEADER
    POHEADERX = HEADERX
    * POADDRVENDOR =
    * TESTRUN =
    IMPORTING
    EXPPURCHASEORDER = PURCHASEORDER
    * EXPHEADER =
    * EXPPOEXPIMPHEADER =
    TABLES
    RETURN = RETURN
    POITEM = ITEM
    POITEMX = ITEMX
    POSCHEDULE = ITEMSCHEDULE
    POSCHEDULEX = ITEMSCHEDULEX
    POACCOUNT = ACCOUNT
    POACCOUNTX = ACCOUNTX
    POSERVICES = SERVICES.
    
    *&---------------------------------------------------------------------*
    *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.
    

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 05, 2006 at 03:52 AM

    Hi Moya,

    Enter acc. assignment data for item as 'F'. Then you will come out of this error.

    Thanks,

    Rani.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 22, 2007 at 06:47 PM

    Maybe your contract line has a cost center. If so, you have to set fields POSERVICES-PLN_PCKG and POSERVICES-PLN_LINE with contract's package and line number. You will find it at ESLL table.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.