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.

Similar Messages

  • 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

  • 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.

  • 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

  • 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 ?

  • 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

  • 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.

  • Bapi_PR_Create - Enter valuation price error

    Hi all,
    I'm using the BAPI_PR_CREATE and it's giving me the "Enter Valuation Price" Error.
    Does any one can tell me what is the fields for passing the Valuation Price?
    I'm not really sure.
    I'm Using the PRITEM-PREQ_PRICE (and I'm not forgeting the PRITEMX ).
    Thanks in advanced.
    Miguel

    Hi
    The valuation price of the material is not picked up from the field PRITEM-PREQ_PRICE in the BAPI.
    Please maintain the Price in the material master in the accounting view , then only the price will be picked up.
    If you are not able to do so please maintain the price of the material using MR21.
    Even though you fill the field the valuation price in BAPI this will always be over written by the Material price.
    Thanks & Regards
    Kishore
    Edited by: Kishore Kumar Chiluka on May 15, 2008 2:53 PM

  • BAPI_PR_CREATE  enter GL account error

    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
    Now i able to post PR. I DID BELOW CHANGE. I ADDED serrial no.
    Ls_acct-SERIAL_NO = '01'.
    Ls_acct-COSTCENTER = gs_psdata-kostl.
    Ls_acct-WBS_ELEMENT =  gs_psdata-wbs_element.
    append ls_acct to lt_acct.
    Ls_acctx-SERIAL_NO = '01'.
    Ls_acctx-COSTCENTER = GC_X.
    Ls_acctX-WBS_ELEMENT = GC_X.
    append ls_acctx to lt_acctx.
    But second issue i am facing
    i am using item category 'L' subcontracting
    i am trying to replace existing BOM with new material USING BELOW LOGIC.
    LS_COMP-MATERIAL =  gs_psdata-COMP_MATNR.  " Ne material act as component of product
    LS_COMP-PLANT = gs_psdata-werks.
    LS_COMP-CHANGE_ID = 'I'. "gc_value_r.
    LS_COMP-ENTRY_QUANTITY =  gs_psdata-QUANTITY.
    APPEND LS_COMP TO LT_COMP.
    CLEAR LS_COMP.
    *LS_COMPx-PREQ_ITEM = '00010'.
    LS_COMPX-MATERIAL = GC_X.
    LS_COMPx-PLANT = gc_x.
    LS_COMPX-CHANGE_ID = GC_X.
    LS_COMPX-ENTRY_QUANTITY = GC_X.
    APPEND LS_COMPX TO LT_COMPX.
    CLEAR LS_COMPX.
    But i observed that  old BOM is pulled into PR. and not appeared my material added in above logic.
    Any advise.
    Regards
    Ramakrishnaiah Y

  • 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

Maybe you are looking for

  • JDev 11.1.2.4.0 Can't Open Unbounded Task Flow

    I just created a new Fusion application. When I click on the unbounded task flow adfc-config.xml I get an error dialog box An unexpected severe error has occured in JDeveloper. It seems that same issue as in that discussion https://forums.oracle.com/

  • Hard drive crash, need to get ipod songs back onto itunes

    i'm a bit computer illiterate and need step by step instructions for how to connect my ipod without losing everything. if you've done this before and you can help, it would be greatly appreciated. i downloaded senuti but i don't know what to do from

  • Sleep Light Most Annoying thing ever.

    I was wondering if t here is a way to turn off the sleep light or if Apple could programm a way in the future to turn off this sleep light. I have my mac in my bedroom and cannot turn it against the wall or throw something over it. I have taped stuff

  • How to call module pool  from Bussiness event.

    Hi SDN, I have a reqd where ....through a business transaction event..I need to call a module pool screen. I will also need to pass few internal tables present in the business event to the module pool screen. Please tell me the steps or a code segmen

  • BPEL and JMS/AQ Request

    Hello everybody, It would be great if I could get some information on the following from BPEL Developers/ Experts. In our Project we are planning to have 1. BPEL Server in Server 1 2. JMS/ AQ in Server 2 I want the BPEL Process to interact with the J