Bapi_Po_Create1_Input

Hi,
I am having a problem using Bapi_Po_Create1_Input from a Web Dynpro Application. I have the Cardinality of the Context Node set as 0..n and the selection as 0..1 with initialize lead selection as true. 
So far I have not been able to successfully use the BAPI to create a  Purchase Order.  Here is the execute method for example:
public void executeBapi_Po_Create1_Input( )
/@@begin executeBapi_Po_Create1_Input()
  try {
    wdContext.currentBapi_Po_Create1_InputElement().modelObject().execute();
    wdContext.nodeOutput().invalidate();
  } catch (Exception e) {
    msgMgr.reportException(e.getMessage(), false);
No exception is thrown, but the message from the BAPI is that it can not create a Purchase Order.  I have tested the SAP Backend ability to create a PO via transaction ME21N and am able to created a Purchase Order.    Any input or ideas about what could be wrong?  Thanks for your help..

I have a similar problem.
I am using BAPI_PO_CREATE1 to create purchase order.
I am getting an error that reads - No instance of object type PurchaseOrder has been created. External referen
I am using the following data to create a PO - do you see any attribute missing that may be causing the error.
//Header
poHeader.setDoc_Type("NB");
poHeader.setPurch_Org("XYZ");
poHeader.setVendor("610100");
poHeader.setComp_Code("PQR");
poHeader.setPur_Group("TN4");
poHeaderX.setDoc_Type(false);
poHeaderX.setPurch_Org(false);
poHeaderX.setVendor(false);
poHeaderX.setComp_Code(false);
poHeaderX.setPur_Group(false);
//Schedules
poItemSchedules.setQuantity(new BigDecimal(100));
poItemSchedules.setPo_Item("00001");
poItemSchedules.setSched_Line("0001");
poItemSchedules.setDelivery_Date("12/29/2007");
poItemSchedules.setDel_Datcat_Ext("1");
poItemScheduleX.setQuantity(false);
poItemScheduleX.setPo_Item("00001");
poItemScheduleX.setPo_Itemx(false);
poItemScheduleX.setSched_Line("0001");
poItemScheduleX.setSched_Linex(false);
poItemScheduleX.setDelivery_Date(false);
poItemScheduleX.setDel_Datcat_Ext(false);
//Line Items:
poItems.setTax_Code("I0");
poItems.setNet_Price(new BigDecimal(100.99));
poItems.setShort_Text("Test Description");
poItems.setMatl_Group("PI08");
poItems.setPlant("TOM");
poItems.setPo_Item("00001");
poItems.setAcctasscat("K");
poItems.setPrice_Unit(new BigDecimal(100));
poItems.setMaterial(String.valueOf(0));
poItems.setOver_Dlv_Tol(new BigDecimal(0));
poItems.setUnder_Dlv_Tol(new BigDecimal(0));
poItems.setGr_Ind(true);
poItems.setIr_Ind(true);
poItems.setGr_Basediv(true);
poItemX.setTax_Code(false);
poItemX.setNet_Price(false);
poItemX.setShort_Text(false);
poItemX.setMatl_Group(false);
poItemX.setPlant(false);
poItemX.setPo_Item("00001");
poItemX.setAcctasscat(false);
poItemX.setPrice_Unit(false);
poItemX.setOver_Dlv_Tol(false);
poItemX.setUnder_Dlv_Tol(false);
poItemX.setGr_Ind(false);
poItemX.setIr_Ind(false);
poItemX.setGr_Basediv(false);
poItemX.setDistrib(false);
poItemX.setStge_Loc(false);
poItemX.setItem_Cat(false);
//Account Assignments
itemAcctAssC.setPo_Item("00001");
itemAcctAssC.setSerial_No("01");
itemAcctAssC.setQuantity(new BigDecimal(2));
itemAcctAssC.setCostcenter("12345");
itemAcctAssC.setGl_Account("678901");
itemAcctAssC.setCo_Area("TRUY");
itemAcctAssCX.setPo_Item("00001");
itemAcctAssCX.setSerial_No("01");
itemAcctAssCX.setQuantity(false);
itemAcctAssCX.setCostcenter(false);
itemAcctAssCX.setGl_Account(false);
itemAcctAssCX.setCo_Area(false);
Thanks

Similar Messages

  • Creating a purchase order in web dynpro for java.........

    hello all,
    i am new to web dynpro for java.i have already done an application
    "Creating a Web Dynpro Application Accessing ABAP Functions" this application
    have good document on sdn.
    this application is working fine .
    Now i got an requiremnt for creating a purchase order in web dynpro for java.
    in normal report when i call  the bapi the parameter are the header, headerx,item, itemx is an internal table.
    CALL FUNCTION 'BAPI_PO_CREATE1'
      EXPORTING
        POHEADER                     = HEADER
        POHEADERX                    = HEADERX
      POADDRVENDOR                 =
      TESTRUN                      =
    IMPORTING
      EXPPURCHASEORDER             =
      EXPHEADER                    =
      EXPPOEXPIMPHEADER            =
    TABLES
       RETURN                       = RETURN
       POITEM                       = ITEM
       POITEMX                      = ITEMX.
    i just want to know how can i fill these internal table in web dynpro
    for java to create an application accessing "Bapi_po_create" .
    Thanks

    Hi Gopal,
    I'm not sure what is your issue, it seems you're not really understanding how the Model structure works in WDP.
    I'll assume few things here, like you know how to Import the Model into the WDP, and you know a little bit about what Java Classes will represent this Model in the Project.
    Try these steps:
    1. Import your Model into the Project;
    2. Open your Component Modeler, create a Data Link between your Model / Component (Or Custom Controller, as you prefer)
      - You can also use the "Apply Template -> Service Controler"
    3. Map the Input of your Model as the Main Node, check the Input Tables (you prob. will have two, POITEM = ITEM - POITEMX = ITEMX)
    4. Also, check the Return box, since this is BAPI return (You can use to display Backend messages)
    Now you have the Model mapped into your Controller, you need to develop the Java function to execute it.
    1. Create a new Input class, like
    BAPI_PO_CREATE1_Input purchaseOrderCreateInput = new BAPI_PO_CREATE1_Input();
    2. Bind your Input Node, in the Controller, with your Input Class;
    wdContext.nodeBAPI_PO_CREATE1().bind(purchaseOrderCreateInput);
    3. Set any Import parameters you need:
    purchaseOrderCreateInput.setEXPPURCHASEORDER(XXXX);
    4. To Add references to the Table, you will perform something like:
    First, you need to know what "Structure" you need to add (POItem Structure) - You have a Java class that represents that Structure..
    POITEM_Element poItemElement = new POITEM_Element();
    poItemElement.setPROPERTY();   /// Set your Properties
    purchaseOrderCreateInput.getPOITEM().add(poItemElement);
    5. Execute your Input,
    purchaseOrderCreateInput .execute();
    Hope it helps,
    Regards,
    Daniel

  • Error: No instance of object type PurchaseOrder has been created.

    Hi:
    I am using BAPI_PO_CREATE1 to create PO's using webdynpro. I get the following error message when I attempt to create a PO.
    No instance of object type PurchaseOrder has been created. External reference:
    Please help.
    Thanks
    Sriram

    Ramki:
    Yes, I did. The initialization code is as follows
    Bapi_Po_Create1_Input input = new Bapi_Po_Create1_Input();
    input.setPoheader(new Bapimepoheader());
    input.setPoheaderx(new Bapimepoheaderx());
    input.addPoitem(new Bapimepoitem());
    input.addPoitemx(new Bapimepoitemx());
    input.addPoaccount(new Bapimepoaccount());
    input.addPoaccountx(new Bapimepoaccountx());
    input.addPoschedule(new Bapimeposchedule());
    input.addPoschedulex(new Bapimeposchedulx());
    input.addPotextheader(new Bapimepotextheader());
    Thanks
    Sriram

Maybe you are looking for