Bapi_pr_create error

Hi,
     I am getting error
06                   243 Internal number assignment not defined (please enter number)                                  
BAPI                 001 No instance of object type PurchaseRequisition has been created. External reference: M201000002
KI                   113 Purchasing across company codes is not allowed                                                
ME                   083 Enter Valuation Price                 
when using bapi_pr_create,, iam pasing PREQ_NO ,PR_TYPE   in both prheader and prheaderx also  i am pasing, preq_price in pritem and pritemx too.
for this type of  prtype external number is to be given, even i am passing i am getting this error.

Check that the WBS element (PRACCOUNT-WBS_ELEMENT) is initial, if you do not use an account assignment with WBS element.
I had this problem because the WBS element value was '00000000' although I used account assignment category K and this created the error.

Similar Messages

  • BAPI_PR_CREATE - Error 'Enter G/L account'

    hi,
                   when i tried to create purchase requisition with bapi BAPI_PR_CREATE for VISA/BGC, i m getting error as 'Enter G/L account' even after passing that value. I tried with BAPI_REQUISITION_CREATE, here i can create requisition but i cant enter HEADER TEXT so im using BAPI_PR_CREATE. please help me in solving the error with BAPI_PR_CREATE.

    Hi,
      could you explain how you solved your issue?
    Thanks
    Fabio

  • BAPI_PR_CREATE  error enter GL account

    Hi All,
    I a using babi BAPI_PR_CREATE to create a PR with two line items. but I am getting error 'Enter GL account'.
    Please check below program and let me know if anything wrong in it.
    data: lv_prnum type BAPIEBANC-PREQ_NO.
    data: lv_prnumber type BAPIMEREQHEADER-PREQ_NO.
    data: it_req_item type table of BAPIEBANC,
          wa_req_item type BAPIEBANC.
    data: it_req_item_new type table of BAPIEBAN,
          wa_req_item_new type BAPIEBAN.
    data: it_acc_assig type table of BAPIEBKN,
          wa_acc_assig type BAPIEBKN.
    data: it_req_ser type table of BAPIESLLC,
          wa_req_ser type BAPIESLLC.
    data: it_ser_val type table of BAPIESKLC,
          wa_ser_val type BAPIESKLC.
    data: it_return type table of BAPIRETURN,
          lv_return type BAPIRET2.
    data: lv_msg type char50.
    data: it_change_return type table of BAPIRET2,
          wa_change_return type BAPIRET2.
    data: it_pritem type table of BAPIMEREQITEMIMP,
          wa_pritem type BAPIMEREQITEMIMP.
    data: it_pritemx type table of BAPIMEREQITEMX,
          wa_pritemx type BAPIMEREQITEMX.
    data: it_pritemexp type table of BAPIMEREQITEM,
          wa_pritemexp type BAPIMEREQITEM.
    data: it_praccount type table of BAPIMEREQACCOUNT,
          wa_praccount type BAPIMEREQACCOUNT.
    data: it_praccountx type table of BAPIMEREQACCOUNTX,
          wa_praccountx type BAPIMEREQACCOUNTX.
    data: it_ret type table of BAPIRET2,
          wa_ret type BAPIRET2.
    data: it_prheader type table of BAPIMEREQHEADER,
          wa_prheader type BAPIMEREQHEADER.
    data: it_prheaderx type table of BAPIMEREQHEADERX,
          wa_prheaderx type BAPIMEREQHEADERX.
    data: it_ser_acc type table of BAPI_SRV_ACC_DATA,
          wa_ser_acc type BAPI_SRV_ACC_DATA.
    data: it_ser_accx type table of BAPI_SRV_ACC_DATAX,
          wa_ser_accx type BAPI_SRV_ACC_DATAX.
    *first item - material
    wa_pritem-PREQ_ITEM = '00010'.
    wa_pritem-PUR_GROUP = 'ITD'.
    wa_pritem-preq_name = 'abcd'.
    wa_pritem-SHORT_TEXT = 'ABC'.
    wa_pritem-MATERIAL = 'NCAD100001'.
    wa_pritem-PLANT = '1100'.
    wa_pritem-TRACKINGNO = 'XXX'.
    wa_pritem-MATL_GROUP = 'Z111'.
    wa_pritem-QUANTITY = 1.
    *wa_pritem-UNIT = 'AU'.
    wa_pritem-PREQ_DATE = '20140430'.
    wa_pritem-DELIV_DATE = '20140505'.
    wa_pritem-PRICE_UNIT = 1.
    *wa_pritem-ITEM_CAT = ' '.
    wa_pritem-ACCTASSCAT = 'N'.
    *wa_pritem-des_vendor = '0050000793'.
    *wa_pritem-fixed_vend = '0050000793'.
    wa_pritem-PURCH_ORG = '1000'.
    append wa_pritem to it_pritem.
    *2nd item - service
    clear wa_pritem.
    wa_pritem-PREQ_ITEM = '00020'.
    wa_pritem-PUR_GROUP = 'ITD'.
    wa_pritem-preq_name = 'abc'.
    wa_pritem-SHORT_TEXT = 'ABC'.
    *wa_pritem-MATERIAL = 'NCAD100002'.
    wa_pritem-PLANT = '1100'.
    wa_pritem-TRACKINGNO = 'XXX'.
    wa_pritem-MATL_GROUP = 'S0010'.
    wa_pritem-QUANTITY = 1.
    *wa_pritem-UNIT = 'AU'.
    wa_pritem-PREQ_DATE = '20140430'.
    wa_pritem-DELIV_DATE = '20140505'.
    wa_pritem-PRICE_UNIT = 1.
    wa_pritem-ITEM_CAT = '9'.
    wa_pritem-ACCTASSCAT = 'N'.
    *wa_pritem-des_vendor = '0050000793'.
    *wa_pritem-fixed_vend = '0050000793'.
    wa_pritem-PURCH_ORG = '1000'.
    wa_pritem-pckg_no = '0000000001'.
    append wa_pritem to it_pritem.
    *fields for  1st item - material
    wa_pritemx-PREQ_ITEM = '00010'.
    wa_pritemx-PREQ_ITEMX = 'X'.
    wa_pritemx-PUR_GROUP = 'X'.
    wa_pritemx-preq_name = 'X'.
    wa_pritemx-SHORT_TEXT = 'X'.
    wa_pritemx-MATERIAL = 'X'.
    wa_pritemx-PLANT = 'X'.
    wa_pritemx-TRACKINGNO = 'X'.
    wa_pritemx-MATL_GROUP = 'X'.
    wa_pritemx-QUANTITY = 'X'.
    *wa_pritem-UNIT = 'AU'.
    wa_pritemx-PREQ_DATE = 'X'.
    wa_pritemx-DELIV_DATE = 'X'.
    wa_pritemx-PRICE_UNIT = 'X'.
    *wa_pritem-ITEM_CAT = ' '.
    wa_pritemx-ACCTASSCAT = 'X'.
    *wa_pritemx-des_vendor = 'X'.
    *wa_pritemx-fixed_vend = 'X'.
    wa_pritemx-PURCH_ORG = 'X'.
    append wa_pritemx to it_pritemx.
    *fields for  2nd item - service
    clear wa_pritemx.
    wa_pritemx-PREQ_ITEM = '00020'.
    wa_pritemx-PREQ_ITEMX = 'X'.
    wa_pritemx-PUR_GROUP = 'X'.
    wa_pritemx-preq_name = 'X'.
    wa_pritemx-SHORT_TEXT = 'X'.
    wa_pritemx-MATERIAL = 'X'.
    wa_pritemx-PLANT = 'X'.
    wa_pritemx-TRACKINGNO = 'X'.
    wa_pritemx-MATL_GROUP = 'X'.
    wa_pritemx-QUANTITY = 'X'.
    *wa_pritem-UNIT = 'X'.
    wa_pritemx-PREQ_DATE = 'X'.
    wa_pritemx-DELIV_DATE = 'X'.
    wa_pritemx-PRICE_UNIT = 'X'.
    wa_pritem-ITEM_CAT = 'X'.
    wa_pritemx-ACCTASSCAT = 'X'.
    *wa_pritemx-des_vendor = 'X'.
    *wa_pritemx-fixed_vend = 'X'.
    wa_pritemx-PURCH_ORG = 'X'.
    wa_pritem-pckg_no = 'X'.
    append wa_pritemx to it_pritemx.
    *Account assignment data for 1st item - material
    wa_praccount-PREQ_ITEM = '00010'.
    wa_praccount-SERIAL_NO = '01'.
    wa_praccount-QUANTITY = 1.
    wa_praccount-DISTR_PERC = '1.00'.
    wa_praccount-NET_VALUE = 1.
    wa_praccount-GL_ACCOUNT = '0040100801'.
    wa_praccount-UNLOAD_PT = 'ABC'.
    wa_praccount-CO_AREA = '1000'.
    wa_praccount-NETWORK = '000004011841'.
    append wa_praccount to it_praccount.
    *Account assignment data for 2nd item - service
    clear wa_praccount.
    wa_praccount-PREQ_ITEM = '00020'.
    wa_praccount-SERIAL_NO = '02'.
    *wa_praccount-QUANTITY = 1.
    *wa_praccount-DISTR_PERC = '1.00'.
    *wa_praccount-NET_VALUE = 1.
    wa_praccount-GL_ACCOUNT = '0040100801'.
    wa_praccount-UNLOAD_PT = 'ABC'.
    wa_praccount-CO_AREA = '1000'.
    wa_praccount-NETWORK = '000004011841'.
    append wa_praccount to it_praccount.
    *Account assignment fields for 1st item - material
    wa_praccountx-PREQ_ITEM = '00010'.
    wa_praccountx-SERIAL_NO = '01'.
    wa_praccountx-PREQ_ITEMX = 'X'.
    wa_praccountx-SERIAL_NOX = 'X'.
    wa_praccountx-QUANTITY = 'X'.
    wa_praccountx-DISTR_PERC = 'X'.
    wa_praccountx-NET_VALUE = 'X'.
    wa_praccountx-GL_ACCOUNT = 'X'.
    wa_praccountx-UNLOAD_PT = 'X'.
    wa_praccountx-CO_AREA = 'X'.
    wa_praccountx-NETWORK = 'X'.
    append wa_praccountx to it_praccountx.
    *Account assignment fields for 2nd item - service
    clear wa_praccountx.
    wa_praccountx-PREQ_ITEM = '00020'.
    wa_praccountx-SERIAL_NO = '02'.
    wa_praccountx-PREQ_ITEMX = 'X'.
    wa_praccountx-SERIAL_NOX = 'X'.
    *wa_praccountx-QUANTITY = 'X'.
    *wa_praccountx-DISTR_PERC = 'X'.
    *wa_praccountx-NET_VALUE = 'X'.
    wa_praccountx-GL_ACCOUNT = 'X'.
    wa_praccountx-UNLOAD_PT = 'X'.
    wa_praccountx-CO_AREA = 'X'.
    wa_praccountx-NETWORK = 'X'.
    append wa_praccountx to it_praccountx.
    *2nd item Service  details
    wa_ser_acc-doc_item = '00020'.
    wa_ser_acc-outline = '0000000001'.
    wa_ser_acc-srv_line = '0000000010'.
    wa_ser_acc-serial_no = '02'.
    wa_ser_acc-serial_no_item = '02'.
    wa_ser_acc-quantity = 10.
    append wa_ser_acc to it_ser_acc.
    *2nd item Service  fields
    wa_ser_accx-doc_item = '00020'.
    wa_ser_accx-outline = '0000000001'.
    wa_ser_accx-srv_line = '0000000010'.
    wa_ser_accx-serial_no = '02'.
    wa_ser_accx-serial_no_item = 'X'.
    wa_ser_accx-quantity = 'X'.
    append wa_ser_accx to it_ser_accx.
    *Header details
    wa_prheader-pr_type = 'PURE'.
    wa_prheaderx-pr_type = 'X'.
    CALL FUNCTION 'BAPI_PR_CREATE'
      EXPORTING
        PRHEADER                     = wa_prheader
        PRHEADERX                    = wa_prheaderx
    *   TESTRUN                      =
      IMPORTING
        NUMBER                       = lv_prnumber
    *   PRHEADEREXP                  =
      TABLES
        RETURN                       = it_ret
        PRITEM                       = it_pritem
        PRITEMX                      = it_pritemx
    *    PRITEMEXP                    = it_pritemexp
    *   PRITEMSOURCE                 =
        PRACCOUNT                    = it_praccount
    *   PRACCOUNTPROITSEGMENT        =
        PRACCOUNTX                   = it_praccountx
    *   PRADDRDELIVERY               =
    *   PRITEMTEXT                   =
    *   PRHEADERTEXT                 =
    *   EXTENSIONIN                  =
    *   EXTENSIONOUT                 =
    *   PRVERSION                    =
    *   PRVERSIONX                   =
    *   ALLVERSIONS                  =
    *   PRCOMPONENTS                 =
    *   PRCOMPONENTSX                =
    *   SERVICEOUTLINE               =
    *   SERVICEOUTLINEX              =
    *   SERVICELINES                 =
    *   SERVICELINESX                =
    *   SERVICELIMIT                 =
    *   SERVICELIMITX                =
    *   SERVICECONTRACTLIMITS        =
    *   SERVICECONTRACTLIMITSX       =
        SERVICEACCOUNT               = it_ser_acc
        SERVICEACCOUNTX              = it_ser_accx
    *   SERVICELONGTEXTS             =
    *   SERIALNUMBER                 =
    *   SERIALNUMBERX                =
    IF sy-subrc eq 0.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
       EXPORTING
         WAIT          = 'X'
       IMPORTING
         RETURN        = lv_return.
    endif.

    Hi
    If you want to specify the G/L account for PR you have to transfer
    it in field GL_ACCOUNT in PRACCOUNT and PRACCOUNTX structures.
    This errornormally could occur because the SERIAL_NO in PRACCOUNT and PRACCOUNTX
    was set to "00". It should be setto a value > 0, e.g. "01"
    Kind regards,
    Lorraine

  • Bapi_pr_create,,  error - convt_no_number

    Hi   expert !
    i was trying to post pr docu by  using bapi_pr_create, but i got  dump error /;convt_no_number
    searched notes , but didn't find related notes.
    i did deleted some source not needed in the whole source, because convt_no_number comes up.
    i hoped that  return table from bapi_pr_create, but  dump error came up with convt_no_number,
    humm,,,  very strange issue,   please get back to me with good advise.
    my source code is not complete to post docu ,, just hope not dump error comes up, but dump error as convt_no number.....
    someone can execute this source whether dump error or return bapi return table with some error message ?
    System environment
        SAP-Release 700
        SAP kernel....... 700
        created (date)... "Aug 24 2008 21:47:28"
         Patch level. 175
        Database............. "ORACLE
        SAP database version. 700
        APPL  SP 18
      data : g_mereqheader  like bapimereqheader,
             g_mereqheaderx like bapimereqheaderx,
             g_mereqitem    like bapimereqitemimp occurs 0 with header line,
             g_mereqitemx   like bapimereqitemx occurs 0 with header line,
             g_mereqacc     like bapimereqaccount occurs 0 with header line,
             g_mereqaccx    like bapimereqaccountx occurs 0 with header line,
             g_te_meqitem   type bapi_te_mereqitem,
             g_te_meqitemx  type bapi_te_mereqitemx,
             g_ext_in       like bapiparex occurs 0 with header line,
             g_ext_out      like bapiparex occurs 0 with header line,
             g_prnumber     like bapimereqheader-preq_no,
             gt_return      like bapiret2 occurs 0 with header line,
             wa_valuepart(960),
             wa_valuepartx(960).
      data :  ex_value type me_max_container.
      data : lv_item like eban-bnfpo,
                lv_sn like bapimereqaccount-serial_no.
      g_mereqheader-pr_type = 'NB'.
      g_mereqheaderx-pr_type = 'X'.
      lv_sn = '01'.
      loop at gt_itab where check = 'X'.
        clear : g_mereqitem, g_mereqitemx.
        lv_item = lv_item + 10.
        g_mereqitem-preq_item = lv_item.
        g_mereqitem-acctasscat = '1'.                " 1 is used for stock material 
        g_mereqitem-material = gt_itab-matnr.    " valuse 00000123   or 123  both tried ,,
        g_mereqitemx-preq_item = lv_item.
        g_mereqitemx-preq_itemx = 'X'.
        g_mereqitemx-acctasscat = 'X'.
        g_mereqitemx-material = 'X'.
        g_mereqacc-preq_item = lv_item.
        g_mereqacc-serial_no = lv_sn.
        g_mereqaccx-preq_item = lv_item.
        g_mereqaccx-serial_no = lv_sn.
        g_mereqaccx-serial_nox = 'X'.
        append g_mereqacc.   append g_mereqaccx.
        append g_mereqitem.  append g_mereqitemx.
    endloop.
      call function 'BAPI_PR_CREATE'
         exporting
          prheader                    = g_mereqheader
          prheaderx                   = g_mereqheaderx
      TESTRUN                     =
         importing
          number                      = g_prnumber
      PRHEADEREXP                 =
        tables
          return                      = gt_return
          pritem                      = g_mereqitem
          pritemx                     = g_mereqitemx
      PRITEMEXP                   =
      PRITEMSOURCE                =
          praccount                   = g_mereqacc
      PRACCOUNTPROITSEGMENT       =
          praccountx                  = g_mereqaccx
      PRADDRDELIVERY              =
      PRITEMTEXT                  =
      PRHEADERTEXT                =
          extensionin                 =  g_ext_in
         extensionout                =  g_ext_in
      PRVERSION                   =
      PRVERSIONX                  =
      ALLVERSIONS                 =
    Edited by: venjamin on Sep 10, 2010 10:15 AM
    Edited by: venjamin on Sep 10, 2010 10:18 AM

    Hi there
    as you see the above source,  there is no one you worry about.
    could you test the above source if  dump error comes up or get return table included error message without dump error?
    Best & Regards;
    venjamin

  • Error on creation of PR using BAPI_PR_CREATE

    Hello All,
    while creating a PR using BAPI_PR_CREATE getting an error simultaneously a PR is creating
    The error is Enter a G/L Account. Even when I am providing with the G/L Account number.
    There is one input field as SERIAL_NO in tables PRACCOUNT and PRACCOUNTX. If I give SERIAL_NO as 00 in tables PRACCOUNT and PRACCOUNTX, then  it gives the same error but and no PR is created but if i give 01 it gives the same error but and now PR is created simultaneouly .
    Using the same details if I execute BAPI_REQUISITION_CREATE and SERIAL_NO as 00, the PR is successfully created.
    Please let me know if anybody worked on it.
    Thanks & Regards,
    Ruchi Tiwari

    Hi,
    you just need to populate the following fields:
    praccount-preq_item = '10'. <--- this depends on how many items you have in your PR.
    praccount-serial_no = '1'. <--- this one is required, in case you split the qty of the item by G/L or Cost Center.
    dont forget to populate the ff. fields in the Purchase Requisition Change Parameter - Account Assignment table.
    praccountx-preq_item = '10'.
    praccountx-serial_no = '1'.
    Thanks & regards,
    ShreeMohan

  • Capture an error while creating a purchase requisition (BAPI_PR_CREATE)

    Hi All,
        I am using FM BAPI_PR_CREATE to create purchase requesition, Now my problem is that i have various items for single material now i wan to capture the error if any item has ?
    Please let me know how to do so?
    Thanks & Regards,
    Ruchi Tiwari

    Hi,
    To get the error messages after the BAPI_PR_CREATE is called,
    loop at the return table which will contain the system messages and call the following FM
    CALL FUNCTION 'FORMAT_MESSAGE'
            EXPORTING
              ID        = LS_MESSAGES-MSGID
              LANG      = '-D'
              NO        = LS_MESSAGES-MSGNR
              V1        = LS_MESSAGES-MSGV1
              V2        = LS_MESSAGES-MSGV2
              V3        = LS_MESSAGES-MSGV3
              V4        = LS_MESSAGES-MSGV4
            IMPORTING
              MSG       = LV_MESSAGE
            EXCEPTIONS
              NOT_FOUND = 1
              OTHERS    = 2.
          IF SY-SUBRC  0.
            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.

  • Error Message: Enter Plant, ME 083 in BAPI_PR_CREATE in Batch Log of batch

    Hi Experts,
    Am creating the Purc Requisations of EBAN table, by using BAPI_PR_CREATE from my " Z " prog.
    They are creating fine, but, in JOB LOG(when scheduled as BATCH JOB), am getting an error as
    " ENTER PLANT" of ID is ME # is 083.
    I tried all combinations, like populated a value into Procuring plant, Supplying plant, in the folllowing structures of BAPI,(passing follwoing tables)
             pritem    = it_bapimereqitemimp
             pritemx   = it_bapimereqitemx
             pritemexp = it_bapimereqitem
             PRITEMSOURCE = it_BAPIMEREQSOURCE
    still getiitng the same error!!!
    I debugged, but, culd not able figure it out??
    let me know that, Why its so?
    How to fix it?
    Any SAP NOTE?
    thanq

    Hi,
    I have the same issue.
    Did you ever figure this out ?

  • GL account error for BAPI_PR_CREATE

    Hi Experts,
    I am getting error while using function moule  BAPI_PR_CREATE for creating PR.
    Enter G/L Account
    No instance of object type PurchaseRequisition has been created. External reference: # 1
    here I have provided data like PREQ_ITEM, SERIAL_NO, CREAT_DATE, QUANTITY, GL_ACCOUNT and COSTCENTER for PRACCOUNT table.
    Please can you suggest solution for this.
    Thanks & Regards,
    BBC

    Hi,
    I have maintained indicators for PRITEMX then I got error maintain services or limits.
    here I am passing values for SERVICELIMIT table like DOC_ITEM, OVERALL_LIMIT & EXP_VALUE.
    here I have doubt , have to maintain indicators for PRACCOUNTX & SERVICELIMITX ?
    please suggest me.
    Regards,
    BBC

  • BAPI_PR_CREATE (Enter G/L account) error

    Hi
    I am using <b>BAPI_PR_CREATE</b> to create Open PR , I passed all the fields  and entered  G/L account . But i am getting error as <b>'Enter G/L account'</b>. If I am not entering G/L account it is giving <b>error two times </b> as 'Enter G/L account'. What more I need pass to the BAPI .please help

    I've tried regarding Helmut's advise and it works.
    10 points (if i was a thread owner)

  • Error whil creating Service Line item in ME51N using BAPI_PR_CREATE

    Hi Experts,
                Am able to create PR number using BAPI_PR_CREATE, but when am trying to create Service line item am getting acc assignment error please check my code and solve my issue. ..its very adj  please help me .
    DATA : t_bapimereqitemimp TYPE TABLE OF bapimereqitemimp ,
          t_bapimereqaccount TYPE TABLE OF bapimereqaccount,
          t_bapimereqaccountx TYPE TABLE OF bapimereqaccountx,
          t_pritemx    TYPE TABLE OF bapimereqitemx,
          wa_bapimereqitemimp        TYPE bapimereqitemimp,
          pr_number  TYPE bapimereqheader-preq_no,
          wa_prheader  TYPE   bapimereqheader,
          wa_prheaderx TYPE  bapimereqheaderx,
          wa_pritemx   TYPE  bapimereqitemx,
          wa_bapimereqaccountx TYPE bapimereqaccountx,
          wa_bapimereqaccount TYPE bapimereqaccount,
          t_return     TYPE TABLE OF bapiret2,
          wa_return    TYPE bapiret2.
    DATA : t_bapi_srv_limit_data TYPE TABLE OF bapi_srv_limit_data,
            wa_bapi_srv_limit_data TYPE bapi_srv_limit_data.
    DATA servicelimitx  TYPE TABLE OF bapi_srv_limit_datax.
    DATA w_servicelimitx  TYPE bapi_srv_limit_datax.
    DATA : t_servicelines TYPE TABLE OF bapi_srv_service_line,
            w_servicelines TYPE bapi_srv_service_line,
            t_servicelinesx TYPE TABLE OF bapi_srv_service_linex,
            w_servicelinesx TYPE bapi_srv_service_linex,
            t_bapi_srv_acc_data TYPE TABLE OF bapi_srv_acc_data,
            w_bapi_srv_acc_data TYPE bapi_srv_acc_data,
            t_bapi_srv_acc_datax TYPE TABLE OF bapi_srv_acc_datax,
            w_bapi_srv_acc_datax TYPE bapi_srv_acc_datax.
    DATA : t_bapimereqitem TYPE TABLE OF bapimereqitem,
            w_bapimereqitem TYPE bapimereqitem.
    DATA :  t_bapimereqitemx TYPE TABLE OF bapimereqitemx,
            w_bapimereqitemx TYPE bapimereqitemx.
    wa_prheader-pr_type  = 'RV'."lv_doc_type.
    wa_prheaderx-pr_type = 'X'.
    wa_bapimereqitemimp-preq_item  = '1'."wa_eban-item.
    wa_bapimereqitemimp-pur_group  = '100'."wa_eban-ekgrp.
    wa_bapimereqitemimp-preq_name  = 'E.R. TITTO'."wa_eban-afnam.
    wa_bapimereqitemimp-short_text = 'AC Fitting'."wa_eban-txz01.
    wa_bapimereqitemimp-material   = ' '."wa_eban-matnr.
    wa_bapimereqitemimp-plant      = '1000'."wa_eban-werks.
    wa_bapimereqitemimp-store_loc  = 'ST00'."wa_eban-lgort.
    wa_bapimereqitemimp-matl_group = 'Z13'."wa_eban-matkl.
    wa_bapimereqitemimp-quantity   = '1'."wa_eban-menge.
    wa_bapimereqitemimp-unit       = 'AU'."wa_eban-meins.
    wa_bapimereqitemimp-deliv_date =  '20140604'."wa_eban-lfdat.
    wa_bapimereqitemimp-preq_price = '100'."wa_eban-preis.
    wa_bapimereqitemimp-item_cat   = 'D'."wa_eban-pstyp.
    wa_bapimereqitemimp-acctasscat =  'K'."wa_eban-knttp.
    wa_bapimereqitemimp-fixed_vend = ' '."wa_eban-flief.
    wa_bapimereqitemimp-purch_org  = '1000'."wa_eban-ekorg.
    wa_bapimereqitemimp-currency   = 'INR'."wa_eban-waers.
    wa_bapimereqitemimp-pckg_no = '00000001'.
    wa_bapimereqaccount-preq_item  = '1'."wa_eban-item.
    *wa_bapimereqaccount-serial_no  = '01'.
    wa_bapimereqaccount-gl_account = '0000002244'."wa_eban-sakto.
    wa_bapimereqaccount-costcenter = 'OPSD'."wa_eban-kostl.
    APPEND wa_bapimereqitemimp TO t_bapimereqitemimp.
    APPEND wa_bapimereqaccount TO t_bapimereqaccount.
    wa_pritemx-preq_item  = '1'."wa_eban-item.
    wa_pritemx-pur_group  = 'X'.
    wa_pritemx-preq_name  = 'X'.
    wa_pritemx-short_text = 'X'.
    wa_pritemx-material   = 'X'.
    wa_pritemx-plant      = 'X'.
    wa_pritemx-store_loc  = 'X'.
    wa_pritemx-matl_group = 'X'.
    wa_pritemx-quantity   = 'X'.
    wa_pritemx-unit       = 'X'.
    wa_pritemx-deliv_date = 'X'.
    wa_pritemx-preq_price = 'X'.
    wa_pritemx-item_cat   = 'X'.
    wa_pritemx-acctasscat = 'X'.
    wa_pritemx-fixed_vend = 'X'.
    wa_pritemx-purch_org  = 'X'.
    wa_pritemx-currency   = 'X'.
    wa_pritemx-pckg_no   = 'X'.
    wa_bapimereqaccountx-preq_item  = '1'."wa_eban-item.
    *wa_bapimereqaccountx-serial_no  = '01'.
    wa_bapimereqaccountx-preq_itemx = 'X'.
    wa_bapimereqaccountx-serial_nox = 'X'.
    wa_bapimereqaccountx-gl_account = 'X'.
    wa_bapimereqaccountx-costcenter = 'X'.
    APPEND wa_pritemx TO t_pritemx.
    APPEND wa_bapimereqaccountx TO t_bapimereqaccountx.
    **Service item limit
    *wa_bapi_srv_limit_data-doc_item = '10'.
    wa_bapi_srv_limit_data-overall_limit = '1000'.
    wa_bapi_srv_limit_data-exp_value = '800'.
    APPEND wa_bapi_srv_limit_data TO  t_bapi_srv_limit_data.
    *w_servicelimitx-doc_item = '10'.
    w_servicelimitx-overall_limit = 'X'.
    w_servicelimitx-exp_value = 'X'.
    APPEND w_servicelimitx TO servicelimitx.
    w_bapimereqitem-preq_item = '10'.
    ***w_bapimereqitem-preq_name = 'E.R. TITTO'.
    ***w_bapimereqitem-plant = '1000'.
    ***w_bapimereqitem-store_loc = 'ST00'.
    ***w_bapimereqitem-matl_group = 'Z03'.
    ***w_bapimereqitem-quantity = '1'.
    ***w_bapimereqitem-unit = 'AU'.
    w_bapimereqitem-item_cat = 'D'.
    w_bapimereqitem-deliv_time = '20140604'.
    w_bapimereqitem-acctasscat = 'K'.
    **w_bapimereqitem-consumpt = 'U'.
    APPEND w_bapimereqitem TO t_bapimereqitem.
    **w_bapi_srv_acc_data-doc_item = '1'.
    **w_bapi_srv_acc_data-outline = '0000000001'.
    *w_bapi_srv_acc_data-srv_line = '20'.
    w_bapi_srv_acc_data-serial_no = '10'.
    w_bapi_srv_acc_data-serial_no_item = 'D'.
    *w_bapi_srv_acc_data-quantity = '1'.
    *APPEND w_bapi_srv_acc_data TO t_bapi_srv_acc_data.
    **w_bapi_srv_acc_datax-doc_item = '1'.
    **w_bapi_srv_acc_datax-outline = '0000000001'.
    *w_bapi_srv_acc_datax-srv_line = '20'.
    **w_bapi_srv_acc_datax-serial_no = '01'.
    **w_bapi_srv_acc_datax-serial_no_item = '01'.
    *w_bapi_srv_acc_datax-quantity = '1'.
    *APPEND w_bapi_srv_acc_datax TO t_bapi_srv_acc_datax.
    w_servicelines-service = '00000001'.
    APPEND w_servicelines TO t_servicelines.
    w_servicelinesx-service = 'X'.
    APPEND w_servicelinesx TO t_servicelinesx.
    CALL FUNCTION 'BAPI_PR_CREATE'
       EXPORTING
         prheader        = wa_prheader
         prheaderx       = wa_prheaderx
       IMPORTING
         number          = pr_number
       TABLES
         return          = t_return
         pritem          = t_bapimereqitemimp
         pritemx         = t_pritemx
         pritemexp       = t_bapimereqitem
         praccount       = t_bapimereqaccount
         praccountx      = t_bapimereqaccountx
         servicelimit    = t_bapi_srv_limit_data
         servicelimitx   = servicelimitx
         servicelines    = t_servicelines
         servicelinesx   = t_servicelinesx
         serviceaccount  = t_bapi_srv_acc_data
         serviceaccountx = t_bapi_srv_acc_datax.

    Hi,
    Check this Thread , Thread1 . It might help you to resolve the issue.
    Thanks
    KH

  • Error bapi_pr_create

    Hello Experts,
    I am trying to create a service purchase requisition with bapi_pr_create while creating i am getting an error "In case of account assignment please enter account assignment data for item"
    account data i am passing is
    PRACCOUNT structure
    SERIAL_NO 01
    GL_ACCOUNT 400000
    COSTCENTER 6_1200
    PRACCOUNTX structure
    SERIAL_NO 01
    GL_ACCOUNT X
    COSTCENTER X
    SERVICEACCOUNT structure
    Line 1:
    SERIAL_NO 01
    SERIAL_NO_ITEM 01
    SERVICEACCOUNTX structure
    Line 1:
    SERIAL_NO 01
    SERIAL_NO_ITEM X
    Can any one suggest me where i am going wrong
    BR,
    praveen

    Hello Manohar,
    Thanks for your response.
    I am able to create purchase requisition through me51n but if pass the same data into the FM bapi_pr_create it is showing the error like "In case of account assignment, please enter acc. assignment data for item". in debugging i found that my accounting info is not getting filled.
    METHOD get_exkn.
        LOOP AT me->my_state->acct_items INTO l_acct_item.
          CHECK l_acct_item->is_funds_mgt_wrapper( ) EQ mmpur_no.
          l_exkn = l_acct_item->if_accounting_model_mm~get_exkn( ).
          INSERT l_exkn INTO TABLE ex_exkn.
        ENDLOOP.
    Could you please guide me where its going wrong.
    BR,
    Praveen

  • Enter GL account error in BAPI_PR_CREATE

    Hi Experts,
    I a using babi BAPI_PR_CREATE to create a PR with two line items. but I am getting error 'Enter GL account'.
    Please check below program and let me know if anything wrong in it.
    data: lv_prnum type BAPIEBANC-PREQ_NO.
    data: lv_prnumber type BAPIMEREQHEADER-PREQ_NO.
    data: it_req_item type table of BAPIEBANC,
          wa_req_item type BAPIEBANC.
    data: it_req_item_new type table of BAPIEBAN,
          wa_req_item_new type BAPIEBAN.
    data: it_acc_assig type table of BAPIEBKN,
          wa_acc_assig type BAPIEBKN.
    data: it_req_ser type table of BAPIESLLC,
          wa_req_ser type BAPIESLLC.
    data: it_ser_val type table of BAPIESKLC,
          wa_ser_val type BAPIESKLC.
    data: it_return type table of BAPIRETURN,
          lv_return type BAPIRET2.
    data: lv_msg type char50.
    data: it_change_return type table of BAPIRET2,
          wa_change_return type BAPIRET2.
    data: it_pritem type table of BAPIMEREQITEMIMP,
          wa_pritem type BAPIMEREQITEMIMP.
    data: it_pritemx type table of BAPIMEREQITEMX,
          wa_pritemx type BAPIMEREQITEMX.
    data: it_pritemexp type table of BAPIMEREQITEM,
          wa_pritemexp type BAPIMEREQITEM.
    data: it_praccount type table of BAPIMEREQACCOUNT,
          wa_praccount type BAPIMEREQACCOUNT.
    data: it_praccountx type table of BAPIMEREQACCOUNTX,
          wa_praccountx type BAPIMEREQACCOUNTX.
    data: it_ret type table of BAPIRET2,
          wa_ret type BAPIRET2.
    data: it_prheader type table of BAPIMEREQHEADER,
          wa_prheader type BAPIMEREQHEADER.
    data: it_prheaderx type table of BAPIMEREQHEADERX,
          wa_prheaderx type BAPIMEREQHEADERX.
    data: it_ser_acc type table of BAPI_SRV_ACC_DATA,
          wa_ser_acc type BAPI_SRV_ACC_DATA.
    data: it_ser_accx type table of BAPI_SRV_ACC_DATAX,
          wa_ser_accx type BAPI_SRV_ACC_DATAX.
    *first item - material
    wa_pritem-PREQ_ITEM = '00010'.
    wa_pritem-PUR_GROUP = 'ITD'.
    wa_pritem-preq_name = 'abcd'.
    wa_pritem-SHORT_TEXT = 'ABC'.
    wa_pritem-MATERIAL = 'NCAD100001'.
    wa_pritem-PLANT = '1100'.
    wa_pritem-TRACKINGNO = 'XXX'.
    wa_pritem-MATL_GROUP = 'Z111'.
    wa_pritem-QUANTITY = 1.
    *wa_pritem-UNIT = 'AU'.
    wa_pritem-PREQ_DATE = '20140430'.
    wa_pritem-DELIV_DATE = '20140505'.
    wa_pritem-PRICE_UNIT = 1.
    *wa_pritem-ITEM_CAT = ' '.
    wa_pritem-ACCTASSCAT = 'N'.
    *wa_pritem-des_vendor = '0050000793'.
    *wa_pritem-fixed_vend = '0050000793'.
    wa_pritem-PURCH_ORG = '1000'.
    append wa_pritem to it_pritem.
    *2nd item - service
    clear wa_pritem.
    wa_pritem-PREQ_ITEM = '00020'.
    wa_pritem-PUR_GROUP = 'ITD'.
    wa_pritem-preq_name = 'abc'.
    wa_pritem-SHORT_TEXT = 'ABC'.
    *wa_pritem-MATERIAL = 'NCAD100002'.
    wa_pritem-PLANT = '1100'.
    wa_pritem-TRACKINGNO = 'XXX'.
    wa_pritem-MATL_GROUP = 'S0010'.
    wa_pritem-QUANTITY = 1.
    *wa_pritem-UNIT = 'AU'.
    wa_pritem-PREQ_DATE = '20140430'.
    wa_pritem-DELIV_DATE = '20140505'.
    wa_pritem-PRICE_UNIT = 1.
    wa_pritem-ITEM_CAT = '9'.
    wa_pritem-ACCTASSCAT = 'N'.
    *wa_pritem-des_vendor = '0050000793'.
    *wa_pritem-fixed_vend = '0050000793'.
    wa_pritem-PURCH_ORG = '1000'.
    wa_pritem-pckg_no = '0000000001'.
    append wa_pritem to it_pritem.
    *fields for  1st item - material
    wa_pritemx-PREQ_ITEM = '00010'.
    wa_pritemx-PREQ_ITEMX = 'X'.
    wa_pritemx-PUR_GROUP = 'X'.
    wa_pritemx-preq_name = 'X'.
    wa_pritemx-SHORT_TEXT = 'X'.
    wa_pritemx-MATERIAL = 'X'.
    wa_pritemx-PLANT = 'X'.
    wa_pritemx-TRACKINGNO = 'X'.
    wa_pritemx-MATL_GROUP = 'X'.
    wa_pritemx-QUANTITY = 'X'.
    *wa_pritem-UNIT = 'AU'.
    wa_pritemx-PREQ_DATE = 'X'.
    wa_pritemx-DELIV_DATE = 'X'.
    wa_pritemx-PRICE_UNIT = 'X'.
    *wa_pritem-ITEM_CAT = ' '.
    wa_pritemx-ACCTASSCAT = 'X'.
    *wa_pritemx-des_vendor = 'X'.
    *wa_pritemx-fixed_vend = 'X'.
    wa_pritemx-PURCH_ORG = 'X'.
    append wa_pritemx to it_pritemx.
    *fields for  2nd item - service
    clear wa_pritemx.
    wa_pritemx-PREQ_ITEM = '00020'.
    wa_pritemx-PREQ_ITEMX = 'X'.
    wa_pritemx-PUR_GROUP = 'X'.
    wa_pritemx-preq_name = 'X'.
    wa_pritemx-SHORT_TEXT = 'X'.
    wa_pritemx-MATERIAL = 'X'.
    wa_pritemx-PLANT = 'X'.
    wa_pritemx-TRACKINGNO = 'X'.
    wa_pritemx-MATL_GROUP = 'X'.
    wa_pritemx-QUANTITY = 'X'.
    *wa_pritem-UNIT = 'X'.
    wa_pritemx-PREQ_DATE = 'X'.
    wa_pritemx-DELIV_DATE = 'X'.
    wa_pritemx-PRICE_UNIT = 'X'.
    wa_pritem-ITEM_CAT = 'X'.
    wa_pritemx-ACCTASSCAT = 'X'.
    *wa_pritemx-des_vendor = 'X'.
    *wa_pritemx-fixed_vend = 'X'.
    wa_pritemx-PURCH_ORG = 'X'.
    wa_pritem-pckg_no = 'X'.
    append wa_pritemx to it_pritemx.
    *Account assignment data for 1st item - material
    wa_praccount-PREQ_ITEM = '00010'.
    wa_praccount-SERIAL_NO = '01'.
    wa_praccount-QUANTITY = 1.
    wa_praccount-DISTR_PERC = '1.00'.
    wa_praccount-NET_VALUE = 1.
    wa_praccount-GL_ACCOUNT = '0040100801'.
    wa_praccount-UNLOAD_PT = 'ABC'.
    wa_praccount-CO_AREA = '1000'.
    wa_praccount-NETWORK = '000004011841'.
    append wa_praccount to it_praccount.
    *Account assignment data for 2nd item - service
    clear wa_praccount.
    wa_praccount-PREQ_ITEM = '00020'.
    wa_praccount-SERIAL_NO = '02'.
    *wa_praccount-QUANTITY = 1.
    *wa_praccount-DISTR_PERC = '1.00'.
    *wa_praccount-NET_VALUE = 1.
    wa_praccount-GL_ACCOUNT = '0040100801'.
    wa_praccount-UNLOAD_PT = 'ABC'.
    wa_praccount-CO_AREA = '1000'.
    wa_praccount-NETWORK = '000004011841'.
    append wa_praccount to it_praccount.
    *Account assignment fields for 1st item - material
    wa_praccountx-PREQ_ITEM = '00010'.
    wa_praccountx-SERIAL_NO = '01'.
    wa_praccountx-PREQ_ITEMX = 'X'.
    wa_praccountx-SERIAL_NOX = 'X'.
    wa_praccountx-QUANTITY = 'X'.
    wa_praccountx-DISTR_PERC = 'X'.
    wa_praccountx-NET_VALUE = 'X'.
    wa_praccountx-GL_ACCOUNT = 'X'.
    wa_praccountx-UNLOAD_PT = 'X'.
    wa_praccountx-CO_AREA = 'X'.
    wa_praccountx-NETWORK = 'X'.
    append wa_praccountx to it_praccountx.
    *Account assignment fields for 2nd item - service
    clear wa_praccountx.
    wa_praccountx-PREQ_ITEM = '00020'.
    wa_praccountx-SERIAL_NO = '02'.
    wa_praccountx-PREQ_ITEMX = 'X'.
    wa_praccountx-SERIAL_NOX = 'X'.
    *wa_praccountx-QUANTITY = 'X'.
    *wa_praccountx-DISTR_PERC = 'X'.
    *wa_praccountx-NET_VALUE = 'X'.
    wa_praccountx-GL_ACCOUNT = 'X'.
    wa_praccountx-UNLOAD_PT = 'X'.
    wa_praccountx-CO_AREA = 'X'.
    wa_praccountx-NETWORK = 'X'.
    append wa_praccountx to it_praccountx.
    *2nd item Service  details
    wa_ser_acc-doc_item = '00020'.
    wa_ser_acc-outline = '0000000001'.
    wa_ser_acc-srv_line = '0000000010'.
    wa_ser_acc-serial_no = '02'.
    wa_ser_acc-serial_no_item = '02'.
    wa_ser_acc-quantity = 10.
    append wa_ser_acc to it_ser_acc.
    *2nd item Service  fields
    wa_ser_accx-doc_item = '00020'.
    wa_ser_accx-outline = '0000000001'.
    wa_ser_accx-srv_line = '0000000010'.
    wa_ser_accx-serial_no = '02'.
    wa_ser_accx-serial_no_item = 'X'.
    wa_ser_accx-quantity = 'X'.
    append wa_ser_accx to it_ser_accx.
    *Header details
    wa_prheader-pr_type = 'PURE'.
    wa_prheaderx-pr_type = 'X'.
    CALL FUNCTION 'BAPI_PR_CREATE'
      EXPORTING
        PRHEADER                     = wa_prheader
        PRHEADERX                    = wa_prheaderx
    *   TESTRUN                      =
      IMPORTING
        NUMBER                       = lv_prnumber
    *   PRHEADEREXP                  =
      TABLES
        RETURN                       = it_ret
        PRITEM                       = it_pritem
        PRITEMX                      = it_pritemx
    *    PRITEMEXP                    = it_pritemexp
    *   PRITEMSOURCE                 =
        PRACCOUNT                    = it_praccount
    *   PRACCOUNTPROITSEGMENT        =
        PRACCOUNTX                   = it_praccountx
    *   PRADDRDELIVERY               =
    *   PRITEMTEXT                   =
    *   PRHEADERTEXT                 =
    *   EXTENSIONIN                  =
    *   EXTENSIONOUT                 =
    *   PRVERSION                    =
    *   PRVERSIONX                   =
    *   ALLVERSIONS                  =
    *   PRCOMPONENTS                 =
    *   PRCOMPONENTSX                =
    *   SERVICEOUTLINE               =
    *   SERVICEOUTLINEX              =
    *   SERVICELINES                 =
    *   SERVICELINESX                =
    *   SERVICELIMIT                 =
    *   SERVICELIMITX                =
    *   SERVICECONTRACTLIMITS        =
    *   SERVICECONTRACTLIMITSX       =
        SERVICEACCOUNT               = it_ser_acc
        SERVICEACCOUNTX              = it_ser_accx
    *   SERVICELONGTEXTS             =
    *   SERIALNUMBER                 =
    *   SERIALNUMBERX                =
    IF sy-subrc eq 0.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
       EXPORTING
         WAIT          = 'X'
       IMPORTING
         RETURN        = lv_return.
    endif.

    Hi ,
    read the BAPI documentation where they have provided example for PR creation with and  without account assignment with example.
    check that.
    regards,

  • Found error in BAPI_PR_CREATE

    Dear All,
    I am facing problem while i am using BAPI_PR_CREATE to add purchase req. automatically.Can anybody help me
    error is ME 083  Enter Document Type
    BAPI  001 No instance of object type PurchaseRequisition has been created. External reference: # 1.
    My Code is
    TABLES:eban.
    DATA: BEGIN OF itab OCCURS 0,
          NO(5),
          bnfpo LIKE eban-bnfpo,
          bsart LIKE eban-bsart,
          matnr LIKE eban-matnr,
          lgort LIKE eban-lgort,
          menge LIKE eban-menge,
          bednr LIKE eban-bednr,
          lfdat LIKE eban-lfdat,
          TX(132),
          END OF itab.
    DATA :
    prheader LIKE TABLE OF bapimereqheader WITH HEADER LINE,
    prheader1 LIKE TABLE OF bapimereqheader WITH HEADER LINE,
    prheaderx LIKE TABLE OF bapimereqheaderx WITH HEADER LINE,
    PRITEMEXP LIKE TABLE OF BAPIMEREQITEM WITH HEADER LINE,
    WA_PRITEMEXP LIKE BAPIMEREQITEM ,
    return LIKE TABLE OF bapiret2 WITH HEADER LINE,
    WA_return LIKE  bapiret2 ,
    pritem LIKE TABLE OF bapimereqitemimp WITH HEADER LINE,
    pritemx LIKE TABLE OF bapimereqitemx WITH HEADER LINE,
    PRITEMTEXT LIKE TABLE OF BAPIMEREQITEMTEXT WITH HEADER LINE,
    pw_pr_number  TYPE bapimereqheader-preq_no.
    DATA auxfilename LIKE rlgrap-filename.
    prheader-PR_TYPE = 'ZRAW'.
    prheader-GENERAL_RELEASE  = 'X'.
    APPEND prheader.
    CLEAR prheader.
    prheaderx-PR_TYPE = 'X'.
    prheaderx-GENERAL_RELEASE  = 'X'.
    *prheaderx-CREATE_IND  = ''.
    *prheaderx-CTRL_IND = 'X'.
    *prheaderx-ITEM_INTVL = 'X'.
    *prheaderx-LAST_ITEM = 'X'.
    *prheaderx-MEMORY = 'X'.
    APPEND prheaderx.
    CLEAR prheaderx.
    pritem-preq_item = 00010.
    pritem-material = 'R8101140006-0000'.
    pritem-plant = 2210.
    pritem-store_loc = 2001.
    pritem-pur_group = 104.
    pritem-quantity = 101.
    pritem-trackingno = 'HR'.
    pritem-deliv_date = '20140930'.
    APPEND pritem.
    CLEAR pritem.
    pritemx-PREQ_ITEM = 00010.
    pritemx-preq_itemX = 'X'.
    pritemx-material = 'X'.
    pritemx-plant = 'X'.
    pritemx-store_loc = 'X'.
    pritem-pur_group = 'X'.
    pritemx-quantity = 'X'.
    pritemx-trackingno = 'X'.
    pritemx-deliv_date = 'X'.
    *pritemx-SHORT_TEXT = 'X'.
    APPEND pritemx.
    CLEAR pritemx.
    CALL FUNCTION 'BAPI_PR_CREATE'                            "#EC *
         EXPORTING
           prheader     = prheader
           prheaderx    = prheaderx
    *      TESTRUN      = TESTRUN
         IMPORTING
           number       = pw_pr_number
         TABLES
           return       = return
           pritem       = pritem
           pritemx      = pritemx
    *      pritemexp    = pritemexp
    *      pritemsource = t_itemsource
    *      pritemtext   = t_itext
         EXCEPTIONS
           OTHERS       = 1.
    ****** Check whether any error exist. If not commit the changes else rollback the changes.
       READ TABLE return
    *             TRANSPORTING NO FIELDS                         dar013009
                  INTO wa_return .                                "dar013009
    *             WITH KEY type = c_msgty_e.
       IF sy-subrc = 0.
    *    pw_flag = c_error.
    *    pw_msg  = wa_return-message.                            "dar013009
       ELSE.
    *    pw_flag = c_success.
       ENDIF.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    REFRESH PRITEM.
    REFRESH prheader.
    REFRESH prheaderx.
    REFRESH PRITEMX.
    REFRESH PRITEMTEXT.
    data : str type string.
    CONCATENATE 'purchase req no is : ' pw_pr_number into str SEPARATED BY space.
    message str type 'S'.

    i add this code and use same in Bapi_pr_create
    pritemexp-DOC_TYPE = 'ZRAW'.
    APPEND pritemexp.
    CLEAR pritemexp.
    i am checking in debug mode actually before call of bapi_pr_create it is showing doc_type value in table pritemexp = 'ZRAW'
    but after call of bapi_pr_create it is making blank doc_type  and throwing error.

  • Error in bapi BAPI_PR_CREATE while uploading

    HI Gurus,
            I have program for uploading PR with BAPI. BAPI_PR_CREATE.
    while uploading without account assignment category  it is working fine.
    while enter account assignment category  v need to enter sales order no and item no. that is mandatory field for account assignment category..
    if using program its showing error.
    No instance of object type Purchase Requisition has been created. External reference: # 1
    Enter sales order
    Sd document XXXXXXX is not in the database or has been archived.
    but  I tried to create manually it is working fine.
    I tried to upload with bapi directly with out z program.
    tht time also it showing error
    No instance of object type Purchase Requisition has been created. External reference: # 1
    Enter sales order
    If any one give solution
    it is very helpful for me.

    Hi
    Thnaks for the Reply,
    in normal scenario it ll upload base on header.
    if header change it ll generate automatically requisition no.  So in program v used AT END OF pr_type. 
    so if pr_type is diff it will work.
    in my case only one header it will not change. v hav only one pr type.
    it should generate based on Item.
    If item 10 it should generate new requisition No.
    my flat file is ,
    pr type -  material  - pur org - plant - storage loc  - qty -  traking no - ....  pr item
    xxx          abc           pqr        1000       xyz             100         11111               10
    xxx          abc           pqr        1000       xyz              200        11111                20        
    xxx          abc           pqr        1000       xyz              300       11111                 30
    xxx          abc           pqr        1000       xyz              400        11111                10
    xxx          abc           pqr        1000       xyz              500        11111                20
    here header is same.. if pr item 10 it should generate new requisition No, means it should commit before value 10.
    so before commit v hav to give the logic if item 10 it should generate for before value.
    hope u got my requirement.

  • Error in Bapi_pr_create

    Hi,
    I am trying to call Bapi_PR_Create in a report.
    But it gives me an error saying "Plant I001 not defined.Please check your input."
    The Bapi creates a PR successfully with the same data when called executed separately.
    What could be wrong?
    Please help.

    LOOP AT gt_line INTO wa_line.
    gt_item_bapi-PLANT = wa_line-werks.
    APPEND gt_item_bapi.
    CALL FUNCTION 'BAPI_PR_CREATE'
           EXPORTING
            PRHEADER                    = gt_header_bapi
            PRHEADERX                   = gt_headerx_bapi
         IMPORTING
            NUMBER                      = PREQ_NO
          TABLES
            RETURN                      = gt_return
            PRITEM                      = gt_item_bapi
            PRITEMX                     = gt_itemx_bapi
            PRITEMEXP                   = gt_item_exp_bapi
            PRACCOUNT                   = GT_ITEM_ACC_BAPI
            PRACCOUNTX                  = gt_item_accx_bapi
            EXTENSIONIN                 = gt_extensionin
    The value passed is I001.

Maybe you are looking for