10 Replies Latest reply: Mar 2, 2011 8:19 AM by suresh kumar RSS

No instance of object type PurchaseOrder has been created. External referen

suresh kumar
Currently Being Moderated

Hi Gurus,

 

We are using  ECC 6.0.

 

When we try to create a PO from excel using bapi_po_create1 FM  doesnot get created, but we get this error message  "No instance of object type PurchaseOrder has been created. External reference: "

 

 

any help on this ???

 

Regards,

Sureshkumar.s

  • Re: No instance of object type PurchaseOrder has been created. External referen
    Currently Being Moderated

    Hi,

     

    You are not passing the correct values in the BAPI for PO Creation.

    There are lots of post/blogs in SDN about the data to be passed for PO creation .

    You can go through that.

     

    Corect the data once.

     

    Thanks

    Arbind

    • Re: No instance of object type PurchaseOrder has been created. External referen
      suresh kumar
      Currently Being Moderated

      Hi Arbind

       

       

      Thanks for your quick responce

       

      This is our code

       

       

      REPORT  ZME21N.

      constants : c_x value 'X'.

       

        data: del_date type sy-datum.

       

        data: pohead  type bapimepoheader.

        data: poheadx type bapimepoheaderx.

       

        data: exp_head type bapimepoheader.

       

        data: return  type table of bapiret2 with header line.

        data: poitem  type table of bapimepoitem with header line.

        data: poitemx type table of bapimepoitemx with header line.

       

        data: posched  type table of bapimeposchedule with header line.

        data: poschedx type table of bapimeposchedulx with header line.

       

        data: ex_po_number type bapimepoheader-po_number.

       

       

      • Header Level Data

       

        pohead-comp_code = 'NCCP'.

        pohead-doc_type   = 'NB'     .

        pohead-creat_date = sy-datum   .

       

        pohead-vendor = 'ITT'.

        pohead-purch_org = 'NCPO'.

        pohead-pur_group = 'P53'.

       

        pohead-GR_MESSAGE = 'X'.

        pohead-langu      = sy-langu   .

        pohead-doc_date   = sy-datum.

       

        poheadx-comp_code  = c_x.

        poheadx-doc_type   = c_x.

        poheadx-creat_date = c_x.

        poheadx-vendor     = c_x.

        poheadx-langu      = c_x.

        poheadx-purch_org  = c_x.

        poheadx-pur_group  = c_x.

        poheadx-doc_date   = c_x.

       

       

      • Item Level Data

        poitem-po_item  = 1.

        poitem-material = 'YD1801581X1R00SB-N'.

        poitem-plant    = '1002'.

        poitem-stge_loc = 'ST01'.

        poitem-quantity = 1.

        append poitem.

       

        poitemx-po_item    = 1.

        poitemx-po_itemx   = c_x.

        poitemx-material   = c_x.

        poitemx-plant      = c_x .

        poitemx-stge_loc   = c_x .

        poitemx-quantity   = c_x .

        poitemx-tax_code   = c_x .

        poitemx-item_cat   = c_x .

        poitemx-acctasscat = c_x .

        append poitemx.

       

       

      • Schedule Line Level Data

        posched-po_item        = 1.

        posched-sched_line     = 1.

        posched-del_datcat_ext = 'D'.

        del_date = sy-datum + 1.

        write del_date to posched-delivery_date.

        posched-deliv_time     = '000001'.

        posched-quantity       = 1.

        append posched.

       

        poschedx-po_item        = 1.

        poschedx-sched_line     = 1.

        poschedx-po_itemx       = c_x.

        poschedx-sched_linex    = c_x.

        poschedx-del_datcat_ext = c_x.

        poschedx-delivery_date  = c_x.

        poschedx-quantity       = c_x.

        append poschedx.

       

        call function 'BAPI_PO_CREATE1'

             EXPORTING

                  poheader         = pohead

                  poheaderx        = poheadx

                  testrun          = ' '

             IMPORTING

                  exppurchaseorder = ex_po_number

                  expheader        = exp_head

             TABLES

                  return           = return

                  poitem           = poitem

                  poitemx          = poitemx

                  poschedule       = posched

                  poschedulex      = poschedx.

       

        call function 'BAPI_TRANSACTION_COMMIT'

             EXPORTING

                  wait = 'X'.

       

        if not ex_po_number is initial.

          call function 'DEQUEUE_ALL'.

        else.

          call function 'DEQUEUE_ALL'.

      •    message i036.

        endif.

       

       

      Can you tell me what is the wrong value

       

      Regards

      Suresh

      • Re: No instance of object type PurchaseOrder has been created. External referen
        Mehwish Haq
        Currently Being Moderated

        Is number range for this document type external or internal.If its external,pass PO number otherwise leave it blank.

      • Re: No instance of object type PurchaseOrder has been created. External referen
        Currently Being Moderated

        Hi,

         

        In th import parameter POHEADER pass the Purchase Order Number  and POHEADER-PO_NUMBER = 'X'.

        Check it out once whther PO Number is external or Internal.

         

         

        Thanks

        Arbind

        • Re: No instance of object type PurchaseOrder has been created. External referen
          suresh kumar
          Currently Being Moderated

          Hi Arbind

           

           

          My Requirement is PO was automatically create and PO number is internal

           

          please advise

           

           

          Regards

          Suresh

          • Re: No instance of object type PurchaseOrder has been created. External referen
            Currently Being Moderated

            Hi,

             

            Please check once that internal number range has been created in SNRO for that particular Docyment type and it is activated.

            May be the problem with the internal number range.

            Anywayz plz go through the sample code...

            REPORT ZPURCHASEORDER.
            data:
            header like BAPIMEPOHEADER,
            headerx like BAPIMEPOHEADERX,
            it_item like standard table of BAPIMEPOITEM,
            it_itemx like standard table of BAPIMEPOITEMX,
            return like standard table of BAPIRET2,
            wa_item like BAPIMEPOITEM,
            wa_itemx like BAPIMEPOITEMX,
            p_int type i,
            p_matnr like mara-matnr,
            p_pono like ekko-ebeln.
            DATA: BEGIN OF BAPIRETURN OCCURS 0.
            INCLUDE STRUCTURE BAPIRET2.
            DATA: END OF BAPIRETURN.
            constants:
            c_x type c value 'X'.
            header-comp_code = '3000'.
            header-doc_type = 'DP25'.
            header-creat_date = sy-datum.
            header-item_intvl = '10'.
            header-vendor = 'ARAMI-00'.
            header-langu = sy-langu.
            header-pmnttrms = '0001'.
            header-purch_org = '3000'.
            header-pur_group = '010'.
            header-currency = 'USD'.
            headerx-comp_code = c_x.
            headerx-doc_type = c_x.
            headerx-creat_date = c_x.
            headerx-item_intvl = c_x .
            headerx-vendor = c_x.
            headerx-langu = c_x.
            headerx-pmnttrms = c_x .
            headerx-purch_org = c_x.
            headerx-pur_group = c_x.
            p_int = p_int + 10.
            wa_item-po_item = p_int.
            p_matnr = 'T-SRM01'.
            CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
            EXPORTING
            input = p_matnr
            IMPORTING
            output = p_matnr
            EXCEPTIONS
            length_error = 1
            OTHERS = 2.
            wa_item-material = p_matnr.
            wa_item-plant = '3200'.
            wa_item-quantity = 100.
            wa_item-conf_ctrl = 'Z01'.
            wa_item-ACKN_REQD = 'X'.
            WA_ITEM-ERS = ''.
            APPEND wa_item TO it_item.
            wa_itemx-po_item = p_int.
            wa_itemx-material = c_x.
            wa_itemx-plant = c_x .
            wa_itemx-stge_loc = c_x .
            wa_itemx-quantity = c_x .
            wa_itemx-item_cat = c_x .
            wa_itemx-acctasscat = c_x .
            wa_itemx-conf_ctrl = 'X'.
            wa_itemx-ACKN_REQD = 'X'.
            WA_ITEMX-ERS = 'X'.
            APPEND wa_itemx TO it_itemx.
            CALL FUNCTION 'BAPI_PO_CREATE1'
            EXPORTING
            poheader = header
            poheaderx = headerx
            IMPORTING
            exppurchaseorder = p_pono
            TABLES
            return = return
            poitem = it_item
            poitemx = it_itemx.
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
            WAIT = 'X'
            IMPORTING
            RETURN = BAPIRETURN.
            write:/ p_pon

            .

             

            Thanks

            Arbind

  • Re: No instance of object type PurchaseOrder has been created. External referen
    Birendra Chatterjee
    Currently Being Moderated

    Hi Suresh,

     

    You can debug the BAPI, and check why this error is coming. Sometimes, if the BAPI is unable to generate a suitable error message, it gives a generic message in return which is 'No instance of object type PurchaseOrder has been created'.

     

    Rgds,

    Birendra

Actions