Error : Creating PO's using BAPI_PO_CREATE1

Hi Friends ,
I have created a program to create PO's using  a  load program . This program is set up to have POs created for each Company Code Vendor, Purchase Org, Plant, Buyer combination. The input fields for the load program are:
LIFNR       Vendor Number         
EKORG       Purchasing Organization       
EKGRP       Purchasing Group              
BUKRS       Company Code          
WERKS       Plant         
EMATN       Material Number       
MENGE       PO Quantity  
The input file i have has 3 material nos. 2material nos belong to the same vendor and create 1 PO . The third material no belongs to different vendor and creates a 2nd PO .
The problem i have is that when i run the progam it creates 2 PO's . The PO which contains 2 material Nos gives me the 2nd line with quantity 1000 instead of 1 .
The first line and the second line in the PO should have the quantity 1 .
The first line correctly shows the Po quantity 1  EA.
The second one shows the PO quantity 1000 LB .
The error in the return BAPI t_return is :
"Order quantity violates rounding rules (See long text)"
Please advise .
Thank you

Hi Prabhu ,
The rounding value for one of the material is 1000.000 and the unit is LB in /NMM03 .
When i try to upload this material with order quantity 1 . It creates a PO with order quantity 1000.000 and order unit LB . It gives me a warning when creating the PO that
"Order quantity violates rounding rules (See long text)"
Please advise .

Similar Messages

  • Creation of invoicing plan while creating the PO using BAPI_PO_CREATE1

    Hi, basically I'm creating a PO using BAPI_PO_CREATE1 and then creating Invoicing plan thru ME22 using BDC.
    Could anyone please help me if there is any possibility of creation of invoicing plan while creating the PO itself using BAPI_PO_CREATE1.
    thanks in advance.

    Hi,
    Have you tried filling up the invoicing plan related tables of the bapi ?
    *"      INVPLANHEADER STRUCTURE  BAPI_INVOICE_PLAN_HEADER OPTIONAL
    *"      INVPLANHEADERX STRUCTURE  BAPI_INVOICE_PLAN_HEADERX OPTIONAL
    *"      INVPLANITEM STRUCTURE  BAPI_INVOICE_PLAN_ITEM OPTIONAL
    *"      INVPLANITEMX STRUCTURE  BAPI_INVOICE_PLAN_ITEMX OPTIONAL
    Regards.

  • Creating Service PO using BAPI_PO_CREATE1

    Hi gurus,
    I am trying to create a PO with service lines using BAPI_PO_CREATE1 but am getting the following errror even though i have passed values to the structures POSERVICES POSRVACCESSVALUES and POACCOUNT along with item and header details:
    Please maintain services or limits
    Please suggest what are the basic details that need to be passed to the structures for creating a PO with service lines.

    Hi,
    You need to use Package Number to link the services with the item. Check the tables like ESKN to know how the linking works with your existing data.
    There are lot of posts related to this. Please do a search to get detailed answers. Thanks for your patience!!
    Regards,
    Yogesh

  • Probelm with Creating purchase order using BAPI_PO_CREATE1

    Hi Experts,
    I am trying to create a PO using the "BAPI_PO_CREATE1".
    The BAPI is returning a PO number but when I am checking for the same in ME23 its saying that the number doesnot exsists.
    In BAPI retrun I am gettig an info message as "Stock transport ord. Created number 4500016833". What does this indicate and what do I need do for the PO to get created?
    Thanks & Regards,
    Suma

    If so how can we make use of the PO create BAPI from an Integration like XI?
    I need to create a PO using BAPI from XI, and the returned PO number has to taken reference and create a Goods receipt using BAPI_GOODSMVT_CREATE. I am testing the data before using the same for XI.
    So what do i need to do for creating a PO from XI?
    Thanks,
    Suma

  • Error creating request when using CUP in GRC 5.3

    Hello guru's
    when user is trying to create request in CUP , he is facing an error message at top indicating Error Creating Request ,
    The error message is " * Exception in getting the results from the web service : Service call exception; nested exception is:  java.lang.Exception: Incorrect content-type found 'text/html' * "
    can anyone help me how to trace the problem.
    thanks and regards,
    keerthi

    HI all
    I am also gettting same error like this..We created CUP Requests one hour before ..But we are not able to create CUP Requests now.. I got below error message in system log.
    Risk analysis failed: Exception in getting the results from the web service : Service call exception; nested exception is: com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized. The requested URL was:"http://c700u121.com:50000/SAPGRC_CCRiskAnalysis_V01/Config1?wsdl&style=document"
    2012-03-08 13:05:25,558 [SAPEngine_Application_Threadimpl:3]_23 ERROR com.virsa.ae.core.BOException: Exception in getting the results from the web service : Service call exception; nested exception is:
    com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized. The requested URL was:"http://c700u121.com:50000/SAPGRC_CCRiskAnalysis_V01/Config1?wsdl&style=document"
    com.virsa.ae.core.BOException: Exception in getting the results from the web service : Service call exception; nested exception is:
    com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized. The requested URL was:"http://c700u121.com:50000/SAPGRC_CCRiskAnalysis_V01/Config1?wsdl&style=document"
    at com.virsa.ae.accessrequests.bo.RiskAnalysisBO.findViolations(RiskAnalysisBO.java:199)
    at com.virsa.ae.accessrequests.bo.RiskAnalysisBO.findViolations(RiskAnalysisBO.java:80)
    at com.virsa.ae.accessrequests.bo.RequestBO.saveRiskAnalysis(RequestBO.java:4087)
    at com.virsa.ae.accessrequests.bo.RequestBO.saveNewRequest(RequestBO.java:408)
    at com.virsa.ae.accessrequests.actions.CreateRequestAction.createRequest(CreateRequestAction.java:381)

  • Error while Creating a PO using BAPI_PO_CREATE1

    Hi Friends,
         The following issue that I have observed and as explained below is one of the weirdest scenarios that I have seen while working with SAP. Hence, kindly help me with possible errors from my end. I am working on ECC 6.0.
    Requirement: To automatically create a PO.
    Option used: I have used a BAPI: u2018BAPI_PO_CREATE1u2019
    Scenario: When I execute the BAPI u2018BAPI_PO_CREATE1u2019 directly in sequence with u2018BAPI_TRANSACTION_COMMITu2019, the PO gets created successfully. The data entered as input is:
    POHEADER-COMP_CODE
    POHEADER-DOC_TYPE
    POHEADER-PMNTTRMS
    POITEM-PO_ITEM
    POITEM-QUANTITY
    POITEM-TAX_CODE
    POITEM-TAXJURCODE
    POITEM-RFQ_NO
    POITEM-RFQ_ITEM
    POITEM-PREQ_NO
    POITEM-PREQ_ITEM
    POITEM-PREQ_NAME
    POSCHEDULE-PO_ITEM
    POSCHEDULE-SCHED_LINE
    POSCHEDULE-QUANTITY
    POSCHEDULE-PREQ_NO
    POSCHEDULE-PREQ_ITEM
    Problem: I need to pass data to the BAPI through code, so I called the BAPI u2018BAPI_PO_CREATE1u2019 and u2018BAPI_TRANSACTION_COMMITu2019 in a test function module as well as report. I passed the same data as mentioned above i.e. while creating the PO by passing data to the BAPI directly.
    But the BAPI returns an error BAPI header data still faulty, enter plant, Pur. Org., Pur. Grp., etc.
    I tried by passing all the available data for the header and then for the items, but finally, I still get an error that the item is from a different order account and just cannot create a PO.
    The Test FM code is as shown below:
      DATA : PYMNT_TERMS    TYPE YOAF_SEC_MASTER-TER_PYMNT.
      DATA : ITEM_NO(4) .
      DATA : CURRENCY TYPE LFM1-WAERS.
      DATA : POHEAD         TYPE BAPIMEPOHEADER.
      DATA : POHEADX        TYPE BAPIMEPOHEADERX.
      DATA : EXP_HEAD       TYPE BAPIMEPOHEADER.
      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.
      CONSTANTS : C_X VALUE 'X'.
      POHEAD-COMP_CODE  = 'P110'.
      POHEAD-DOC_TYPE   = DOC_TYPE.
      POHEAD-PMNTTRMS   = 'P10'.
      POHEADX-COMP_CODE  = C_X.
      POHEADX-DOC_TYPE   = C_X.
      POHEADX-PMNTTRMS   = C_X.
      POITEM-PO_ITEM    = '00001'.
      POITEM-QUANTITY   = '1.000'.
      POITEM-TAX_CODE   = 'D2'.
      POITEM-TAXJURCODE = 'MH01'.
      POITEM-RFQ_NO     = '2300009491'.
      POITEM-RFQ_ITEM   = '00001'.
      POITEM-PREQ_NO    = '200003583'.
      POITEM-PREQ_ITEM   = '00001'.
      POITEM-PREQ_NAME  = 'SACHIN'.
      APPEND POITEM.
      POITEMX-PO_ITEM    = '00001'.
      POITEMX-PO_ITEMX   = C_X.
      POITEMX-QUANTITY   = C_X .
      POITEMX-TAX_CODE   = C_X .
      POITEMX-TAXJURCODE = C_X .
      POITEM-RFQ_NO      = C_X.
      POITEM-RFQ_ITEM    = C_X.
      POITEM-PREQ_NO     = C_X.
      POITEM-PREQ_ITEM   = C_X.
      POITEMX-PREQ_NAME  = C_X.
      APPEND POITEMX.
      POSCHED-PO_ITEM        = '00001'.
      POSCHED-SCHED_LINE     = '0001'.
      POSCHED-QUANTITY       = '1.000'.
      POSCHED-PREQ_NO        = '1200003583'.
      POSCHED-PREQ_ITEM      = '00001'.
      APPEND POSCHED.
      POSCHEDX-PO_ITEM        = '1'.
      POSCHEDX-SCHED_LINE     = '0001'.
      POSCHEDX-PO_ITEMX       = C_X.
      POSCHEDX-SCHED_LINEX    = C_X.
      POSCHEDX-QUANTITY       = C_X.
      POSCHEDX-PREQ_NO        = C_X.
      POSCHEDX-PREQ_ITEM      = C_X.
      APPEND POSCHEDX.
      CALL FUNCTION 'BAPI_PO_CREATE1'
          EXPORTING
            POHEADER                     = POHEAD
            POHEADERX                    = POHEADX
          IMPORTING
            EXPPURCHASEORDER             = EX_PO_NUMBER
            EXPHEADER                    = EXP_HEAD
               EXPPOEXPIMPHEADER             =
          TABLES
            RETURN                       = RETURN_ERROR
            POITEM                       = POITEM
            POITEMX                      = POITEMX
               POADDRDELIVERY               =
            POSCHEDULE                   = POSCHED
            POSCHEDULEX                  = POSCHEDX
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          WAIT   = 'X'
        IMPORTING
          RETURN = RETURN_ERROR.

    Hi,
    As mentioned that this error was one of the wierdest SAP issues I have faced, it was due to the silliest copy paste errors on my behalf. I completely overlooked the POITEMX naming.
    For 4 values of RFQ_NO, RFQ_ITEM, PREQ_NO, PREQ_ITEM, I didnt have the 'X' for POITEMX and kept on looking for errors for days.
    BAPI_PO_CREATE1 works with min. possible inputs successfully.
    Thanks to all!

  • Problem while creating service PO using bapi_po_create1

    hi all,
        i am getting error :
    In case of account assignment, please enter acc. assignment data for item
    what does this mean?
    please help,,
    thanks,
    Siddhartha Prakash

    Hi Sid.
    I'm having this same problems on creating PO Service. Did you solve it? How did you do that?
    I'm using a PR and the Category is 'Y', and I cant find where is the problem.
    The tables that I'm passing to the BAPI_PO_CREATE1 are:
    POITEM/ POITEMX
    POACCOUNT/ POACCOUNTX
    POSERVICES
    POSRVACCESSVALUES
    Please, if you have any idea, let me know!
    Tks a lot!
    Renata

  • Error creating document from using list using Document Template

    Hi All,
    I am trying to create a document from sharepoint list and upload it to a document library using item added and item updated event receiver methods. I can create metadata from list update in document library but unable to open the document. The error message
    I get is "we're sorry. we can't open "Filename" because we found a problem with its contents. no error detail available". Please see the below code.
    SPSecurity.RunWithElevatedPrivileges(delegate()
                       try
                           string TemplateUrl = string.Empty;
                           SPWeb web = properties.OpenWeb();
                           web.AllowUnsafeUpdates = true;
                           SPDocumentLibrary olist = web.Lists["NewLibList"] as SPDocumentLibrary;
                           String url = olist.RootFolder.ServerRelativeUrl.ToString();
                           SPFile file = null;
                           file = web.GetFile(olist.DocumentTemplateUrl);
                           if (file != null)
                               SPListItem oItems = properties.ListItem;
                               web.AllowUnsafeUpdates = true;
                               byte[] readStream = file.OpenBinary();
                               SPFile uploadedFile = olist.RootFolder.Files.Add("http://site/subsite/Libraryname/" + properties.ListItemId.ToString() + ".docx", readStream,
    true);
                               SPListItem listitem = uploadedFile.Item;
                               listitem["Firstname"] = oItems["Firstname"];
                               listitem["Lastname"] = oItems["Lastname"];
                               if (uploadedFile.CheckOutType != SPFile.SPCheckOutType.None)
                                   uploadedFile.CheckIn(string.Empty);
                               listitem.Update();
                               uploadedFile.Update();
                               web.AllowUnsafeUpdates = false;
                       catch (Exception ex)
                           EventLog.WriteEntry(EventLogName, ex.Message, EventLogEntryType.Error);

    Hi,
    Please try to use the code below:
    SPSecurity.RunWithElevatedPrivileges(delegate()
    try
    string TemplateUrl = string.Empty;
    SPWeb web = properties.OpenWeb();
    web.AllowUnsafeUpdates = true;
    SPDocumentLibrary olist = web.Lists["NewLibList"] as SPDocumentLibrary;
    String url = olist.RootFolder.ServerRelativeUrl.ToString();
    SPFile file = null;
    file = web.GetFile(olist.DocumentTemplateUrl);
    if (file != null)
    SPListItem oItems = properties.ListItem;
    web.AllowUnsafeUpdates = true;
    Stream readStream = file.OpenBinaryStream(); //file is SPFile type
    SPFile uploadedFile = olist.RootFolder.Files.Add("http://site/subsite/Libraryname/" + properties.ListItemId.ToString() + ".docx", readStream, true);
    uploadedFile.CheckOut();
    SPListItem listitem = uploadedFile.Item;
    listitem["Firstname"] = oItems["Firstname"];
    listitem["Lastname"] = oItems["Lastname"];
    listitem.Update();
    uploadedFile.Update();
    uploadedFile.CheckIn(string.Empty);
    web.AllowUnsafeUpdates = false;
    catch (Exception ex)
    EventLog.WriteEntry(EventLogName, ex.Message, EventLogEntryType.Error);
    If the issue still exists, I suggest you dubug your code and check whether line of code error.
    Thanks,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Dennis Guo
    TechNet Community Support

  • Error creating Crystal Report using Stored Proc Universe

    Hi,
    I have created a stored procedure Universe, using the new feature available in XI R3.
    This connects to an Oracle database, executing a PL/SQL procedure returning ref cursor.
    I have created a WebI report using this Universe, which works fine and functions as expected.
    So there are no problems with either my Oracle stored proc or the Universe.
    However, I would like to create a Crystal report (2008) using the same Universe.
    I can create the report ok - using the SP Universe.
    When I attempt to refresh the data I get an error:
    Failed to retrieve data from the database.
    Details: ORA-06550: line 1, column 7:
    PLS-00103: Encountered the symbol "." when expecting one of the following:
    begin case declare etc etc
    .................................My Procedure ...................
    CREATE OR REPLACE PROCEDURE BIADM.Bo_Test_Report_R
    (Deposit_Cursor IN OUT SYS_REFCURSOR)
    IS
    BEGIN
    OPEN Deposit_Cursor FOR
    SELECT DISTINCT foracid "A/C"
    , acct_name "A/C Name", acct_opn_date "OP/Date", schm_code "SchmCode"
    FROM gam@finrpt
    WHERE acct_cls_flg ='N'
    AND foracid ='2252020145001';
    --AND cust_id ='CB2020145'
    END Bo_Test_Report_R;
    Please Give me solution as early as possible.
    Masud Iqubal

    Moved to Universe Design forum.

  • ORA-29855 - Error creating Spatial Index using a Stored Procedure

    Hi
    I am using Oracle 10gR2 database and I have written a stored procedure to create spatial index. But when i execute this function i get the following error message.
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13249: internal error in Spatial index: [mdidxrbd]
    ORA-13249: Error in Spatial index: index build failed
    ORA-13249: Error in R-tree: [mdrcrtscrt]
    ORA-13231: failed to create index table [MDRT_217C1$] during R-tree creation
    ORA-13249: Stmt-Execute Failure: CREATE TABLE FGDABZ40.MDRT_217C1$ (NODE_ID NUMBER, NODE_LEVEL NUMBER, INFO BLOB) LOB (INFO) STORE AS (CACHE) NOLOGGING PCTFREE 2
    ORA-29400: data cartridge error
    ORA-01031: insufficient privileges
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 10
    ORA-06512: at line 1
    ORA-06512: at "FGDABZ40.PKG_PSSDBE_APPLICATION", line 298
    ORA-06512: at line 17
    The tables that i am passing are registered in metadata and I am able to create indexes directly in sql plus. But when i try to create using this stored procedure, it fails.
    it should be possible to create indexes using a generic function. Has any faced a similar problem?
    regards
    sam

    Hi,
    I am having a same error on Oracle 10gR2 database. When I execute the same statement in sqlplus, it works. But it gives this error when I call the procedure which has this create spatial index statement.
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13249: internal error in Spatial index: [mdidxrbd]
    ORA-13249: Error in Spatial index: index build failed
    ORA-13249: Error in R-tree: [mdrcrtscrt]
    ORA-13231: failed to create index table [MDRT_20CDA$] during R-tree creation
    ORA-13249: Stmt-Execute Failure: CREATE TABLE "SDOMGR".MDRT_20CDA$ (NODE_ID NUMBER, NODE_LEVEL NUMBER, INFO BLOB) LOB (INFO) STORE AS (CACHE) NOLOGGING PCTFREE 2
    ORA-29400: data cartridge error
    ORA-01031: i
    Any help will be appreciated.
    Thanks,
    Sri

  • Error creating a function using the O2A Cartridges

    Hi, I am using the O2A Cartridges and I have created a new function in the next cartridge OracleComms_OSM_O2A_COM_Billing. Then I have included the function as a order component in the BaseProductSpec.
    At this point when I build all the workspace the next problem is generated:
    Order Model Error - The node /ControlData/Functions [COM_SalesOrderFulfillment] has multiple contributors with different significance set.  Please see the log for further details COM_SalesOrderFulfillment.order /OracleComms_OSM_O2A_COM_Base/model/ORDER Unknown Problem
    The function created has the same significance as the other functions like SyncCustomerFunction.
    I don't know how to solve this problem.  Tell me, if you need more information about it.
    Thanks,
    Juan

    in the TOP Include the statement
    FUNCTION-POOL (<b>Name of function Group</b>).
    is missing.
    to Reach to th eexact point.
    to to attibutes tab of your FM
    double click on Program Name.
    double click on include ending with TOP.
    Declare the statement in the TOP include.
    amandeep.

  • Error creating stored procedure using Apex

    Hello,
    I have worked with Access, SQL Server, and Firebird before, but am new to Oracle. I am trying to create a stored procedure to return the count of multiple hash values in a table. I want to know the number of rows that contain hash values that are duplicates somewhere else in the table. So if my table has 10 rows containing hash values: a, b, a, b, c, d, e, a, b, a, my return value should be 7. Here is my create procedure statement:
    CREATE OR REPLACE PROCEDURE CommonHashValuesCount (dupThreshold in number, totalCount out number)
    IS
    BEGIN
    totalCount := 0;
    FOR h IN
    (SELECT DISTINCT xf.MD5_HASH, COUNT(xf.MD5_HASH) as "HashCount"
    FROM XFILE xf
    GROUP BY xf.MD5_HASH)
    LOOP
    IF h.HashCount > dupThreshold THEN
    totalCount := totalCount + h.HashCount;
    END IF;
    END LOOP;
    END;
    I get the following error when I try and run it:
    ERROR at line 12: PL/SQL: Statement ignored
    1. CREATE OR REPLACE PROCEDURE CommonHashValuesCount (dupThreshold in number, totalCount out number)
    2. IS
    3. BEGIN
    Can anyone tell me what is wrong with my create statement? Or if anyone knows how to accomplish what I want in a single sql statement, I'd love to hear it!
    TIA,
    Theresa

    Why not do it in a SQL statement so you can test it in the APEX SQL command window?
    SELECT Sum(HashCount)
      FROM (SELECT DISTINCT xf.MD5_HASH
                 , COUNT(xf.MD5_HASH) HashCount
              FROM XFILE xf
             GROUP BY xf.MD5_HASH
    WHERE HashCount > <testvalue>
    not tested
    and then simply put that into your stored procedure/package:
    SELECT Sum(HashCount)
      INTO totalCount
      FROM (SELECT DISTINCT xf.MD5_HASH
                 , COUNT(xf.MD5_HASH) HashCount
              FROM XFILE xf
             GROUP BY xf.MD5_HASH
    WHERE HashCount > dubThreshold
    also not tested
    C.

  • Error creating partner profiles using we20

    hi friends,
    I am trying to create a new partner profile from an existing one..but it giving me an error  <b>"Please enter a permitted partner number"...</b> but when i give another number its accepting....
    can someone help me understand  what am i missing?
    cheers
    charlie

    Hi
    assign the partner profile number in fi12 and save then click on the partner profile button and copy the partner profile u want and create a new one and save.
    Regards
    genie

  • Error creating an Appliction using JDeveloper

    Hello,
    I'm trying to create a new application on JDeveloper 11.1.2.3.0 (running on Windows 7) but it's not working. After I click on Finish, the configuration bar shows and then the following error message is thrown "An error occurred while trying to create the Fusion Web Application (ADF)". If I try to do anything on the IDE it doesn't work. Taking a look at the messages pane, I see the following:
    Mar 27, 2013 12:42:43 PM oracle.security.jps.util.JpsUtil disableAudit
    INFO: JpsUtil: isAuditDisabled set to true
    Mar 27, 2013 12:42:46 PM oracle.jdeveloper.rescat2.model.registry.RescatContextRegistry getWorkspaceContext()
    SEVERE: oracle.adf.rc.exception.MissingParameterException
    oracle.adf.rc.exception.MissingParameterException: required parameter [sessionProvider] is missing or null
         at oracle.adf.rc.util.CatalogUtils.checkNotNull(CatalogUtils.java:503)
         at oracle.adf.rc.config.BasicCatalogConfig.setMDSSessionProvider(BasicCatalogConfig.java:237)
         at oracle.adf.rc.config.BasicCatalogConfig.initialize(BasicCatalogConfig.java:86)
         at oracle.jdeveloper.rescat2.model.registry.RescatContext.initFromContextProvider(RescatContext.java:309)
         at oracle.jdeveloper.rescat2.model.registry.RescatContext.<init>(RescatContext.java:162)
         at oracle.jdeveloper.rescat2.model.registry.RescatContextRegistry.getWorkspaceContext(RescatContextRegistry.java:382)
         at oracle.adf.share.dt.AppConnContext.getRescatContext(AppConnContext.java:266)
         at oracle.adf.share.dt.ADFConnectionAddin$1.applicationChanged(ADFConnectionAddin.java:95)
         at oracle.ide.navigator.ApplicationNavigatorWindow.fireApplicationChangeEventImpl(ApplicationNavigatorWindow.java:1125)
         at oracle.ide.navigator.ApplicationNavigatorWindow.fireApplicationChangeEvent(ApplicationNavigatorWindow.java:1110)
         at oracle.ide.navigator.ApplicationNavigatorWindow.access$200(ApplicationNavigatorWindow.java:104)
         at oracle.ide.navigator.ApplicationNavigatorWindow$1L.itemStateChanged(ApplicationNavigatorWindow.java:269)
         at javax.swing.JComboBox.fireItemStateChanged(JComboBox.java:1205)
         at javax.swing.JComboBox.selectedItemChanged(JComboBox.java:1262)
         at javax.swing.JComboBox.contentsChanged(JComboBox.java:1309)
         at javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:100)
         at javax.swing.DefaultComboBoxModel.setSelectedItem(DefaultComboBoxModel.java:88)
         at javax.swing.JComboBox.setSelectedItem(JComboBox.java:557)
         at oracle.ide.navigator.ApplicationNavigatorWindow$8.update(ApplicationNavigatorWindow.java:749)
         at oracle.ide.model.IdeSubject.notifyObservers(IdeSubject.java:98)
         at oracle.ide.model.ObservableFolder.notifyObservers(ObservableFolder.java:86)
         at oracle.ide.model.UpdateMessage.fireChildAdded(UpdateMessage.java:460)
         at oracle.ide.cmd.NewWorkspaceCommand.createEmptyWorkspace(NewWorkspaceCommand.java:191)
         at oracle.ide.cmd.NewWorkspaceCommand.createEmptyWorkspace(NewWorkspaceCommand.java:138)
         at oracle.jdeveloper.template.wizard.NewApplicationFromTemplateWizard.getOrCreateWorkspace(NewApplicationFromTemplateWizard.java:160)
         at oracle.jdeveloper.template.wizard.NewObjectFromTemplateWizard$CreateObjectFromTemplateWorker.doInBackground(NewObjectFromTemplateWizard.java:717)
         at oracle.jdeveloper.template.wizard.NewObjectFromTemplateWizard$CreateObjectFromTemplateWorker.doInBackground(NewObjectFromTemplateWizard.java:699)
         at javax.swing.SwingWorker$1.call(SwingWorker.java:277)
         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
         at javax.swing.SwingWorker.run(SwingWorker.java:316)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
         at java.lang.Thread.run(Thread.java:662)
    Mar 27, 2013 12:42:46 PM oracle.adf.share.common.rc.util.LibraryUtils filterNonADFItems
    INFO: [jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.adf.model_11.1.1/adfm.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.adf.model_11.1.1/adftransactionsdt.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.adf.view_11.1.1/adf-dt-at-rt.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.adf.model_11.1.1/adfdt_common.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.adf.model_11.1.1/adflibrary.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.adf.model_11.1.1/db-ca.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.adf.model_11.1.1/jdev-cm.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.adf.share_11.1.1/commons-el.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.adf.share_11.1.1/jsp-el-api.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.adf.share_11.1.1/oracle-el.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.adf.security_11.1.1/adf-share-security.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.adf.security_11.1.1/adf-controller-security.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.adf.share_11.1.1/adf-share-support.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.adf.share.ca_11.1.1/adf-share-ca.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.adf.share.ca_11.1.1/adf-share-base.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.adf.share_11.1.1/adflogginghandler.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.adf.share_11.1.1/adfsharembean.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.adf.model_11.1.1/bc4j-mbeans.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/jlib/commons-cli-1.0.jar!/, jar:file:/D:/Oracle/Middleware/oracle_common/modules/oracle.javacache_11.1.1/cache.jar!/]
    java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
         at oracle.adf.share.common.rc.util.impl.LoaderUtilImpl.newJRLClassLoader(LoaderUtilImpl.java:37)
         at oracle.adf.share.common.rc.util.LoaderUtil.newJRLClassLoader(LoaderUtil.java:200)
         at oracle.adf.share.common.rc.util.LoaderUtil.justGetLoader(LoaderUtil.java:82)
         at oracle.adf.share.common.rc.util.LoaderUtil.getLoader(LoaderUtil.java:54)
         at oracle.adf.share.common.rc.util.LibraryUtils.filterNonADFItems(LibraryUtils.java:146)
         at oracle.adfdtinternal.library.util.ResourceLibraryListener.projectClasspathChanged(ResourceLibraryListener.java:80)
         at oracle.adfdt.library.event.LibraryListener$1.projectClasspathChanged(LibraryListener.java:22)
         at oracle.jdevimpl.library.LibraryChangeListenerHandler.fireLibraryChangeEvent(LibraryChangeListenerHandler.java:43)
         at oracle.jdevimpl.library.ProjectChangeSink.projectPropertiesChanged(ProjectChangeSink.java:191)
         at oracle.ide.model.Project$StorageListener.structureValuesChanged(Project.java:1134)
         at oracle.javatools.data.Structure.fireStructureChangeEvent(Structure.java:533)
         at oracle.javatools.data.Structure.fireBatchEvent(Structure.java:504)
         at oracle.javatools.data.Structure.applyBatchChanges(Structure.java:257)
         at oracle.ide.model.HashStructureNode$1.run(HashStructureNode.java:327)
         at oracle.javatools.data.Structure.applyBatchChanges(Structure.java:231)
         at oracle.ide.model.HashStructureNode.applyBatchChanges(HashStructureNode.java:323)
         at oracle.jdeveloper.model.JProjectUtil._updateLibraries(JProjectUtil.java:131)
         at oracle.jdeveloper.model.JProjectUtil.addLibraries(JProjectUtil.java:61)
         at oracle.jbo.dt.jdevx.util.TechScopeUtil.addLibraries(TechScopeUtil.java:46)
         at oracle.jbo.dt.jdevx.ui.JdxJboAddin$1.technologyAdded(JdxJboAddin.java:308)
         at oracle.jdeveloper.model.JProjectTechnologyNotifier.fireTechnologyAdded(JProjectTechnologyNotifier.java:132)
         at oracle.jdeveloper.model.JProjectTechnologyNotifier.access$100(JProjectTechnologyNotifier.java:30)
         at oracle.jdeveloper.model.JProjectTechnologyNotifier$1.projectPropertiesChanged(JProjectTechnologyNotifier.java:58)
         at oracle.ide.model.Project$StorageListener.structureValuesChanged(Project.java:1134)
         at oracle.javatools.data.Structure.fireStructureChangeEvent(Structure.java:533)
         at oracle.javatools.data.Structure.fireBatchEvent(Structure.java:504)
         at oracle.javatools.data.Structure.fireBatchEvent(Structure.java:510)
         at oracle.javatools.data.Structure.applyBatchChanges(Structure.java:257)
         at oracle.ide.model.TechnologyScopeConfiguration.setTechnologyScope(TechnologyScopeConfiguration.java:221)
         at oracle.jdeveloper.template.wizard.NewProjectFromTemplatePanel.commitWizardChanges(NewProjectFromTemplatePanel.java:256)
         at oracle.jdeveloper.template.wizard.TemplateWizardPage.wizardFinished(TemplateWizardPage.java:96)
         at oracle.jdeveloper.template.wizard.NewObjectFromTemplateWizard.commitProjectChanges(NewObjectFromTemplateWizard.java:325)
         at oracle.jdeveloper.template.wizard.NewObjectFromTemplateWizard$CreateObjectFromTemplateWorker.doInBackground(NewObjectFromTemplateWizard.java:727)
         at oracle.jdeveloper.template.wizard.NewObjectFromTemplateWizard$CreateObjectFromTemplateWorker.doInBackground(NewObjectFromTemplateWizard.java:699)
         at javax.swing.SwingWorker$1.call(SwingWorker.java:277)
         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
         at javax.swing.SwingWorker.run(SwingWorker.java:316)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
         at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at oracle.adf.share.common.rc.util.impl.LoaderUtilImpl.newJRLClassLoader(LoaderUtilImpl.java:28)
         ... 40 more
    Caused by: java.lang.NoClassDefFoundError: oracle/ide/net/JarIndex$19
         at oracle.ide.net.JarIndex.getManifestMainAttribute(JarIndex.java:953)
         at oracle.ide.net.JarUtil.getManifestMainAttribute(JarUtil.java:412)
         at oracle.ide.net.JarUtil.getClassPathImpl(JarUtil.java:382)
         at oracle.ide.net.JarUtil.getClassPath(JarUtil.java:182)
         at oracle.ide.net.URLPath.expandToIncludeManifestClassPathImpl(URLPath.java:401)
         at oracle.ide.net.URLPath.expandToIncludeManifestClassPaths(URLPath.java:349)
         at oracle.jdeveloper.java.locator.ClassLocatorFactory.getClassLocator(ClassLocatorFactory.java:262)
         ... 45 more
    Caused by: java.lang.ClassNotFoundException: oracle.ide.net.JarIndex$19
         at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
         at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
         at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
         at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
         ... 52 more
    I read some posts about similar errors that suggested to manually set the "JDEV_USER_DIR" variable. I tried this but then JDeveloper doesn't even start (freezes at start screen).
    Thanks in advance.

    Looks like your installation is corrupted. Try removing (uninstall) jdev and install it again. Make sure that the folder you choose is empty befoer installing again.
    Timo

  • Error  while creating a Service PO using BAPI_PO_CREATE1

    Hi,
    Im facing Error as "In case of account assignment, please enter acc. assignment data for item" while creating Service PO using BAPI_PO_CREATE1.
    Header Data
          w_poheader-comp_code = w_src-bukrs.  "Company Code
          w_poheader-doc_type = w_src-bsart.   "Document type
         w_poheader-delete_ind = w_src-vrtkz. "Deletion Indicator
          CLEAR: lv_date.
          CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
            EXPORTING
              date_external            = w_src-aedat
            IMPORTING
              date_internal            = lv_date
            EXCEPTIONS
              date_external_is_invalid = 1
              OTHERS                   = 2.
          w_poheader-creat_date = lv_date.    "Creation Date
          w_poheader-created_by = sy-uname.    "Creator Name
          w_poheader-vendor = w_src-lifnr.     "Vendor
          w_poheader-pmnttrms = w_src-zterm.   "Payment Terms
          w_poheader-purch_org = w_src-ekorg.  "Purchase Organization
          w_poheader-pur_group = w_src-ekgrp.  "Purchase Group
          w_poheader-ref_1    = w_src-ihrez.   "OLD PO
          w_poheaderx-comp_code = 'X'.  "Company Code
          w_poheaderx-doc_type = 'X'.   "Document type
         w_poheaderx-delete_ind = 'X'.      "Deletion Indicator
          w_poheaderx-creat_date = 'X'.    "Creation Date
          w_poheaderx-created_by = 'X'.
          w_poheaderx-vendor = 'X'.
          w_poheaderx-pmnttrms = 'X'.   "Payment Terms
          w_poheaderx-purch_org = 'X'.  "Purchase Organization
          w_poheaderx-pur_group = 'X'.  "Purchase Group
          w_poheaderx-ref_1 = 'X'.
    Item Data
          w_poitem-po_item = w_src-ebelp.
          IF NOT w_src-elikz IS INITIAL.
            w_poitem-delete_ind = w_src-elikz.
          ENDIF.
          IF NOT w_src-txz01 IS INITIAL.
            w_poitem-short_text = w_src-txz01.
          ENDIF.
          IF NOT w_src-werks IS INITIAL.
            w_poitem-plant = w_src-werks.
          ENDIF.
    Material group
          IF NOT w_src-matkl IS INITIAL.
            w_poitem-matl_group = w_src-matkl.
          ENDIF.
    Open or Partial Qty
          IF w_src-opqty IS  NOT INITIAL.
            w_poitem-quantity = w_src-opqty.
          ELSEIF NOT w_src-paqty IS INITIAL.
            w_poitem-quantity = w_src-paqty.
          ENDIF.
          IF NOT w_src-meins IS INITIAL.
            w_poitem-po_unit = w_src-meins. "Base Unit of Measure
          ENDIF.
          IF NOT w_src-netpr IS INITIAL.
            w_poitem-net_price = w_src-netpr.  "Net Price
          ENDIF.
          IF NOT w_src-mwskz IS INITIAL.
            w_poitem-tax_code = w_src-mwskz.
          ENDIF.
          IF NOT w_src-pstyp IS INITIAL.
            w_poitem-item_cat = w_src-pstyp.
          ENDIF.
          IF NOT w_src-knttp IS INITIAL.
            w_poitem-acctasscat = w_src-knttp.
          ENDIF.
          IF NOT w_src-vrtkz IS INITIAL.
            w_poitem-distrib = w_src-vrtkz.
          ENDIF.
    Package No
          IF NOT w_src-packno IS INITIAL.
            w_poitem-pckg_no = w_src-packno.  "Package no
          ENDIF.
          IF w_poitem-delete_ind IS INITIAL AND
             w_poitem-short_text IS INITIAL AND
             w_poitem-plant IS INITIAL AND
             w_poitem-matl_group IS INITIAL AND
             w_poitem-quantity IS INITIAL AND
             w_poitem-po_unit IS INITIAL AND
             w_poitem-net_price IS INITIAL AND
             w_poitem-tax_code IS INITIAL.
            CLEAR lv_item.
          ELSE.
            APPEND w_poitem TO i_poitem.
            CLEAR: w_poitem.
            lv_item = 'X'.
          ENDIF.
          w_poitemx-po_item = w_src-ebelp.
          w_poitemx-delete_ind = 'X'.
          w_poitemx-short_text = 'X'.
          w_poitemx-plant = 'X'.
          w_poitemx-matl_group = 'X'.
          w_poitemx-quantity = 'X'.
          w_poitemx-po_unit = 'X'.
          w_poitemx-net_price = 'X'.
          w_poitemx-tax_code = 'X'.
          w_poitemx-item_cat = 'X'.
          w_poitemx-acctasscat = 'X'.
          w_poitemx-distrib = 'X'.
          IF NOT w_src-packno IS INITIAL.
            w_poitemx-pckg_no = 'X'.
          ENDIF.
          IF lv_item = 'X'.
            APPEND w_poitemx TO i_poitemx.
            CLEAR: w_poitemx,
                   lv_item.
          ENDIF.
    PO Deliery Address
          w_poaddrdelivery-po_item = w_src-ebelp.
          IF NOT w_src-adrn2 IS INITIAL.
            w_poaddrdelivery-addr_no = w_src-adrn2.
            APPEND w_poaddrdelivery TO i_poaddrdelivery.
            CLEAR w_poaddrdelivery.
          ENDIF.
    POschedule
          w_poschedule-po_item = w_src-ebelp.
          CLEAR: lv_date.
          CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
            EXPORTING
              date_external            = w_src-eindt
            IMPORTING
              date_internal            = lv_date
            EXCEPTIONS
              date_external_is_invalid = 1
              OTHERS                   = 2.
          IF NOT lv_date IS INITIAL.
            w_poschedule-del_datcat_ext = 'D'. "Delivery Date in Day Format
            w_poschedule-delivery_date = lv_date.
            w_poschedule-quantity = w_src-menge.
            APPEND w_poschedule TO i_poschedule.
            CLEAR w_poschedule.
            lv_schd = 'X'.
          ENDIF.
          w_poschedulex-po_item = w_src-ebelp.
          w_poschedulex-del_datcat_ext = 'X'.
          w_poschedulex-delivery_date = 'X'.
          w_poschedulex-quantity = 'X'.
          IF lv_schd = 'X'.
            APPEND w_poschedulex TO i_poschedulex.
            CLEAR : w_poschedulex,
                    lv_schd.
          ENDIF.
    PO Account Assignment
          w_poaccount-po_item = w_src-ebelp.
          w_poaccount-serial_no = w_src-zekkn.
    Distribution Indicator is 1
          IF w_src-vrtkz EQ '1'.
            w_poaccount-distr_perc = w_src-vproz.
            IF NOT w_src-menge IS INITIAL.
              CLEAR lv_menge.
              lv_menge = w_src-menge.
            ENDIF.
            lv_acct_qty = lv_menge * w_src-vproz / 100.
    Get Round value of Quanity
            frac = FRAC( lv_acct_qty ).
            IF frac EQ 0.
              lv_acct_qty = FLOOR( lv_acct_qty ).
            ELSE.
              lv_acct_qty = CEIL( lv_acct_qty ).
            ENDIF.
            w_poaccount-quantity = lv_acct_qty.
          ELSEIF w_src-vrtkz IS INITIAL.
            w_poaccount-quantity = w_src-menge.
          ENDIF.
          w_poaccount-gl_account = w_src-saknr.
          w_poaccount-costcenter = w_src-kostl.
          w_poaccount-asset_no = w_src-anln1.
          w_poaccount-wbs_element = w_src-wbs.
          w_poaccount-network = w_src-nplnr.
          w_poaccount-tax_code = w_src-mwskz.
          w_poaccount-activity = w_src-vornr.
          APPEND w_poaccount TO i_poaccount.
          CLEAR w_poaccount.
          w_poaccountx-po_item = w_src-ebelp.
          w_poaccountx-serial_no = w_src-zekkn.
          IF w_src-vrtkz EQ '1'.
            w_poaccountx-distr_perc =  'X'.
          ENDIF.
          w_poaccountx-quantity = 'X'.
          w_poaccountx-gl_account = 'X'.
          w_poaccountx-costcenter = 'X'.
          w_poaccountx-wbs_element = 'X'.
          w_poaccountx-network = 'X'.
          w_poaccountx-tax_code = 'X'.
          w_poaccountx-activity = 'X'.
          APPEND w_poaccountx TO i_poaccountx.
          CLEAR w_poaccountx.
    PO Services
          w_poservices-pckg_no = w_src-packno.  "Package no
          w_poservices-line_no = w_src-srv_line_no.    "Line item
          w_poservices-ext_line = w_src-extrow.    "External line
         w_poservices-outl_level = 0.
         w_poservices-outl_ind = 'X'.
          w_poservices-subpckg_no = w_src-sub_packno.  "Sub package no
          w_poservices-quantity = w_src-srqty.  "Service Quantity
          w_poservices-base_uom = w_src-srmeins.  "Service Basic unit of Measure
          w_poservices-price_unit = '1'.
         w_poservices-from_line = '1'.
          w_poservices-gr_price  = w_src-brtwr.  "GR Price
          w_poservices-short_text = w_src-sh_text1.    "Service Short Text
         w_poservices-matl_group = w_src-matkl.  "Material Group
          APPEND w_poservices TO i_poservices.
          CLEAR w_poservices.
    PO Service Access values
          w_posrvacc-pckg_no = w_src-packno.  "Package no
          w_posrvacc-line_no = w_src-srv_line_no. "Line item
          w_posrvacc-serno_line = w_src-zekkn.                  "'01'..
          IF w_src-vproz IS INITIAL.
            w_posrvacc-percentage = '100.0'.
          ENDIF.
          w_posrvacc-serial_no = w_src-zekkn.                   "'01'.
          w_posrvacc-quantity = w_src-srqty.  "Service Quantity
          w_posrvacc-net_value = w_src-srqty.  "Net value
          APPEND w_posrvacc TO i_posrvacc.
          CLEAR w_posrvacc.
        ENDIF.
    ***Create a NEW PO
        AT END OF ihrez.
    Call BAPI
          CALL FUNCTION 'BAPI_PO_CREATE1'
            EXPORTING
              poheader          = w_poheader
              poheaderx         = w_poheaderx
            IMPORTING
              exppurchaseorder  = gv_ebeln
            TABLES
              return            = i_return
              poitem            = i_poitem[]
              poitemx           = i_poitemx[]
              poaddrdelivery    = i_poaddrdelivery[]
              poschedule        = i_poschedule[]
              poschedulex       = i_poschedulex[]
              poaccount         = i_poaccount[]
              poaccountx        = i_poaccountx[]
              poservices        = i_poservices[]
              posrvaccessvalues = i_posrvacc[]
              extensionin       = i_extensionin[].
    Commit the Transaction
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
             WAIT          = 'X'.
    Regards,
    Deepthi.

    1. If we get error as  "In case of account assignment, please enter acc. assignment data for item" than First cehck whetaher u have authorization to Tcode ME23n or not. In my case, I din't had authorization to Me23n tcode.
    2. If we get Error as "Please Mainatain Services or Limits". Please create a Service PO in the following Order.
    *& Internal Table Declaration
    DATA : i_intern         TYPE STANDARD TABLE OF alsmex_tabline WITH HEADER LINE,
           i_poitem         TYPE STANDARD TABLE OF bapimepoitem,
           i_poitemx        TYPE STANDARD TABLE OF bapimepoitemx,
           i_poaddrdelivery TYPE STANDARD TABLE OF bapimepoaddrdelivery,
           i_poschedule     TYPE STANDARD TABLE OF bapimeposchedule,
           i_poschedulex    TYPE STANDARD TABLE OF bapimeposchedulx,
           i_poaccount      TYPE STANDARD TABLE OF bapimepoaccount,
           i_poaccountx     TYPE STANDARD TABLE OF bapimepoaccountx,
           i_poservices     TYPE STANDARD TABLE OF bapiesllc,
           i_posrvacc       TYPE STANDARD TABLE OF bapiesklc,
           i_extensionin    TYPE STANDARD TABLE OF bapiparex,
           i_return         TYPE STANDARD TABLE OF bapiret2.
    *& Work Area Declaration
    DATA:
          w_poheader       TYPE bapimepoheader,
          w_poheaderx      TYPE bapimepoheaderx,
          w_poitem         TYPE bapimepoitem,
          w_poitemx        TYPE bapimepoitemx,
          w_poaddrdelivery TYPE bapimepoaddrdelivery,
          w_poschedule     TYPE bapimeposchedule,
          w_poschedulex    TYPE bapimeposchedulx,
          w_poaccount      TYPE bapimepoaccount,
          w_poaccountx     TYPE bapimepoaccountx,
          w_poservices     TYPE bapiesllc,
          w_posrvacc       TYPE bapiesklc,
          w_extensionin    TYPE bapiparex,
          w_return         TYPE bapiret2.
    START-OF-SELECTION.
    Header Data
      w_poheader-comp_code = '5791'.  "Company Code
      w_poheader-doc_type = 'Z0CM'.   "Document type
      w_poheader-creat_date = sy-datum.  "lv_date.    "Creation Date
      w_poheader-created_by = sy-uname.    "Creator Name
      w_poheader-vendor = '0005012343'.     "Vendor
      w_poheader-pmnttrms = 'Z004'.   "Payment Terms
      w_poheader-purch_org = 'P000'.  "Purchase Organization
      w_poheader-pur_group = '001'.  "Purchase Group
      w_poheader-ref_1    = '004500007671'.   "OLD PO
      w_poheaderx-comp_code = 'X'.  "Company Code
      w_poheaderx-doc_type = 'X'.   "Document type
      w_poheaderx-creat_date = 'X'.    "Creation Date
      w_poheaderx-created_by = 'X'.
      w_poheaderx-vendor = 'X'.
      w_poheaderx-pmnttrms = 'X'.   "Payment Terms
      w_poheaderx-purch_org = 'X'.  "Purchase Organization
      w_poheaderx-pur_group = 'X'.  "Purchase Group
      w_poheaderx-ref_1 = 'X'.
    Item Data
      w_poitem-po_item = '000010'.
      w_poitem-short_text = 'Z0CM - Default Appr. Test  '.
      w_poitem-plant = '5368'.
      Trackign no
      w_poitem-trackingno = ''.
    Material group
      w_poitem-matl_group = '119'.
      w_poitem-po_unit = 'EA'. "Base Unit of Measure
      w_poitem-net_price = '17500.00'.  "Net Price
      w_poitem-tax_code = 'I0'.
      w_poitem-item_cat = '9'.
      w_poitem-acctasscat = 'K'.
      w_poitem-distrib = space.
    Package must be given in item to create Service PO
      w_poitem-pckg_no = 0000000001.
      APPEND w_poitem TO i_poitem.
      CLEAR: w_poitem.
      w_poitemx-po_item = '000010'.
      w_poitemx-delete_ind = 'X'.
      w_poitemx-short_text = 'X'.
      w_poitemx-plant = 'X'.
      w_poitemx-trackingno = 'X'.
      w_poitemx-matl_group = 'X'.
      w_poitemx-quantity = 'X'.
      w_poitemx-po_unit = 'X'.
      w_poitemx-net_price = 'X'.
      w_poitemx-tax_code = 'X'.
      w_poitemx-item_cat = 'X'.
      w_poitemx-acctasscat = 'X'.
      w_poitemx-distrib = 'X'.
      w_poitemx-pckg_no = 'X'.
      APPEND w_poitemx TO i_poitemx.
      CLEAR: w_poitemx.
    PO Deliery Address
          w_poaddrdelivery-po_item = '000010'.
            w_poaddrdelivery-addr_no = '0000061208'.
            APPEND w_poaddrdelivery TO i_poaddrdelivery.
            CLEAR w_poaddrdelivery.
    POschedule
          w_poschedule-po_item = '000010'..
    DATA : LV_DATE TYPE SY-DATUM,
           lv_schd.
          CLEAR: lv_date.
          CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
            EXPORTING
              date_external            = '12/2/2009'
            IMPORTING
              date_internal            = lv_date
            EXCEPTIONS
              date_external_is_invalid = 1
              OTHERS                   = 2.
          IF NOT lv_date IS INITIAL.
            w_poschedule-del_datcat_ext = 'D'. "Delivery Date in Day Format
            w_poschedule-delivery_date = lv_date.
            w_poschedule-quantity = '1.000'.
            APPEND w_poschedule TO i_poschedule.
            CLEAR w_poschedule.
            lv_schd = 'X'.
          ENDIF.
          w_poschedulex-po_item = '000010'.
          w_poschedulex-del_datcat_ext = 'X'.
          w_poschedulex-delivery_date = 'X'.
          w_poschedulex-quantity = 'X'.
          IF lv_schd = 'X'.
            APPEND w_poschedulex TO i_poschedulex.
            CLEAR : w_poschedulex,
                    lv_schd.
          ENDIF.
    PO Account Assignment
      w_poaccount-po_item = '000010'.
      w_poaccount-serial_no = '01'.
      w_poaccount-distr_perc = ''.
      w_poaccount-quantity = '1.000'.
      w_poaccount-gl_account = '0000603064'.
      w_poaccount-costcenter = '0053680100'.
      w_poaccount-asset_no = ''.
      w_poaccount-wbs_element = ''.
      w_poaccount-network = ''.
      w_poaccount-tax_code = 'I0'.
      w_poaccount-activity = ''.
      APPEND w_poaccount TO i_poaccount.
      CLEAR w_poaccount.
      w_poaccountx-po_item = '000010'.
      w_poaccountx-serial_no = '01'.
      w_poaccountx-distr_perc =  'X'.
      w_poaccountx-quantity = 'X'.
      w_poaccountx-gl_account = 'X'.
      w_poaccountx-costcenter = 'X'.
      w_poaccountx-wbs_element = 'X'.
      w_poaccountx-network = 'X'.
      w_poaccountx-tax_code = 'X'.
      w_poaccountx-activity = 'X'.
      w_poaccountx-cmmt_item = 'X'.
      APPEND w_poaccountx TO i_poaccountx.
      CLEAR w_poaccountx.
    Extension for ZZSub
      w_extensionin-structure = 'BAPI_TE_MEPOACCOUNTING'.
      w_extensionin-valuepart1+0(5) = '00010'..
      w_extensionin-valuepart1+5(2) = '01'.
      w_extensionin-valuepart1+28(5) = ''.
      APPEND w_extensionin TO i_extensionin.
      CLEAR w_extensionin.
      w_extensionin-structure = 'BAPI_TE_MEPOACCOUNTINGX'.
      w_extensionin-valuepart1+0(5) = '00010'.
      w_extensionin-valuepart1+5(2) = '01'.
      w_extensionin-valuepart1+11(1) = 'X'.
      APPEND w_extensionin TO i_extensionin.
      CLEAR w_extensionin.
    Extension to add Expense Type only
      w_extensionin-structure = 'BAPI_TE_MEPOHEADER'.
      w_extensionin-valuepart1+10(4) = '0131'.
      APPEND w_extensionin TO i_extensionin.
      CLEAR w_extensionin.
      w_extensionin-structure = 'BAPI_TE_MEPOHEADERX'.
      w_extensionin-valuepart1+10(4) = 'X'.
      APPEND w_extensionin TO i_extensionin.
      CLEAR w_extensionin.
      EXPORT i_extensionin[] TO MEMORY ID 'SUB'.
    PO Services
    PO Services( One Line Iem)
    Assign the dummy no as Pacakage no
      w_poservices-pckg_no = 0000000001.  "(assign package no as a dummy number)
      w_poservices-line_no = 0000000001.      "Line item
      w_poservices-outl_ind = 'X'.
    Assign Dummy no as sub package no
      w_poservices-subpckg_no = 0000000003.   "(Dummy No.) "Sub package no
      w_poservices-from_line = '1'.
      APPEND w_poservices TO i_poservices.
      CLEAR w_poservices.
    PO Services(Second Line Item )
    Assign the same sub package dummy no which is mentioned above
      w_poservices-pckg_no = 0000000003.   "(Dummy No.) "Sub package no
      w_poservices-line_no = 0000000002.
      w_poservices-ext_line = '0000000010'.     "External line
      w_poservices-quantity = '17500.0'.    "Service Quantity
      w_poservices-base_uom = 'EA'.    "Service Basic unit of Measure
      w_poservices-price_unit = '1'.
      w_poservices-gr_price  = '1'.    "GR Price
      w_poservices-short_text = 'Z0CM - Default Appr. T'.      "Service Short Text
    w_poservices-matl_group = '119'.  "w_src-matkl.  "Material Group
      APPEND w_poservices TO i_poservices.
      CLEAR w_poservices.
    PO Service Access values
      w_posrvacc-pckg_no = 0000000003.  "w_src-sub_packno.  "Sub package no
      w_posrvacc-line_no = 0000000002.  "w_src-srv_line_no. "Line item
      w_posrvacc-serno_line = '01'.
      w_posrvacc-percentage = '100.0'.
      w_posrvacc-serial_no = '01'.
      w_posrvacc-quantity = '17500.0'.  "w_src-srqty.  "Service Quantity
      APPEND w_posrvacc TO i_posrvacc.
      CLEAR w_posrvacc.
      DATA : gv_ebeln TYPE ebeln.
    Call BAPI
      CALL FUNCTION 'BAPI_PO_CREATE1'
        EXPORTING
          poheader          = w_poheader
          poheaderx         = w_poheaderx
        IMPORTING
          exppurchaseorder  = gv_ebeln
        TABLES
          return            = i_return
          poitem            = i_poitem[]
          poitemx           = i_poitemx[]
          poaddrdelivery    = i_poaddrdelivery[]
          poschedule        = i_poschedule[]
          poschedulex       = i_poschedulex[]
          poaccount         = i_poaccount[]
          poaccountx        = i_poaccountx[]
          poservices        = i_poservices[]
          posrvaccessvalues = i_posrvacc[]
          extensionin       = i_extensionin[].
    Commit the Transaction
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
      WRITE:/5 gv_ebeln COLOR 5.
      SKIP 2.
      DATA : lv_msg TYPE string.
      LOOP AT i_return INTO w_return WHERE type = 'E'.
        CALL FUNCTION 'FORMAT_MESSAGE'
          EXPORTING
            id        = w_return-id
            lang      = 'EN'
            no        = w_return-number
            v1        = w_return-message_v1
            v2        = w_return-message_v2
            v3        = w_return-message_v3
            v4        = w_return-message_v4
          IMPORTING
            msg       = lv_msg
          EXCEPTIONS
            not_found = 1
            OTHERS    = 2.
        WRITE:/10 lv_msg.
      ENDLOOP.

Maybe you are looking for