Error in BAPI_PO_CHANGE Function Module

Hi Experts,
I have two purchase orders in my ALV internal table. One is received from MIGO and the other is received from ML81 transactions. I want to check the FINAL INVOICE INDICATOR box using FM BAPI_PO_CHANGE for these PO's. PO which is received thru MIGO is working fine. But the PO which is received thru ML81 is giving me error in my BAPIRET2 table.
Below is my code.
    MOVE:  WA_EKPO-EBELP  TO  I_BAPIMEPOITEM-PO_ITEM,
           WA_EKPO-WERKS  TO  I_BAPIMEPOITEM-PLANT,
           'X'            TO  I_BAPIMEPOITEM-FINAL_INV.
    APPEND I_BAPIMEPOITEM.
    MOVE:  WA_EKPO-EBELP  TO  I_BAPIMEPOITEMX-PO_ITEM,
           'X'            TO  I_BAPIMEPOITEMX-PO_ITEMX,
           'X'            TO  I_BAPIMEPOITEMX-PLANT,
           'X'            TO  I_BAPIMEPOITEMX-FINAL_INV.
    APPEND I_BAPIMEPOITEMX.
CALL FUNCTION 'BAPI_PO_CHANGE'
        EXPORTING
          PURCHASEORDER = L_PO            "Here I am passing PO Number(10020633)
        TABLES
          RETURN        = I_BAPIRET2      "Errors
          POITEM        = I_BAPIMEPOITEM
          POITEMX       = I_BAPIMEPOITEMX.
IF SY_SUBRC = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            WAIT = 'X'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.
The Errors are:
MEPO  000   Purchase order still contains faulty items
BAPI  003   Instance 10020633 of object type PurchaseOrder could not be changed
06    436   In case of Account Assignment, please enter acc. assignment data for item
I am totally stuck over here. Am I missing any parameters to pass in the BAPI. Please help me.
Thanks.

hi use this to get your values
     CALL FUNCTION 'BAPI_PO_GETDETAIL1'
                   EXPORTING
                     PURCHASEORDER            = P_EBELN
                   ACCOUNT_ASSIGNMENT       = ' '
                   ITEM_TEXT                = ' '
                   HEADER_TEXT              = ' '
                   DELIVERY_ADDRESS         = ' '
                   VERSION                  = ' '
                   SERVICES                 = ' '
                   SERIALNUMBERS            = ' '
                   INVOICEPLAN              = ' '
                  IMPORTING
                    POHEADER                 = POHEADER
                   POEXPIMPHEADER           =
                  TABLES
                    RETURN                   = RETURN3
                    POITEM                   = I_BAPIMEPOITEM
                   POADDRDELIVERY           =
                   POSCHEDULE               =
                   POACCOUNT                =
                   POCONDHEADER             =
                   POCOND                   =
                   POLIMITS                 =
                   POCONTRACTLIMITS         =
                   POSERVICES               =
                   POSRVACCESSVALUES        =
                   POTEXTHEADER             =
                   POTEXTITEM               =
                   POEXPIMPITEM             =
                   POCOMPONENTS             =
                   POSHIPPINGEXP            =
                   POHISTORY                =
                   POHISTORY_TOTALS         =
                   POCONFIRMATION           =
                   ALLVERSIONS              =
                   POPARTNER                =
                   EXTENSIONOUT             =
                   SERIALNUMBER             =
                   INVPLANHEADER            =
                   INVPLANITEM              =
                   POHISTORY_MA             =

Similar Messages

  • Getting error in the function module

    Hi everybody.
    I have created one function module in se37 and i am calling that function module in the se38 report, when i am executing the report it is throwing me an error.
    here in my report i am having the select option fields ex matnr, in the function module importing i have given the parameter matnr over there and when i am running the report it is through an error that 
    "The function module interface allows you to specify only 
    fields of a particular type under "MATNR".               
    The field "S_MATNR" specified here is a different        
    field type                                                "
    IF i am giving the parameter instead of select-options in the report and executing, then the function module is getting triggered and receiving the data what ever the code is available in the source code.
    can anyone help me out in this issue so that i can get the data while using the select-option instead of parameter.
    Thanks in advance

    Hi,
    Actually, I wouldn't recommend the use of that tables parameter...
    From sap help:
    Table parameters are obsolete CHANGING parameters that are typed as standard tables with a header line. If an internal table without a header line or a table body is passed as an actual parameter to a formal parameter of this type, an empty local header line is generated in the function module. If an internal table with a header line is used as an actual parameter, both the table body and the header line are passed to the function module. Pass by value is not possible in formal parameters defined using TABLES. Formal parameters defined with TABLES can be replaced by formal parameters defined with CHANGING. A local work area can be created for the internal table in the function module by using the addition LIKE LINE OF itab of the DATA statement.
    Exceptions
    So i definitely would go with either importing or changing parameter...
    Cheers,
    m.

  • Type error while calling function module with in FOX formula

    Hi,
    I am getting following error while calling function module from FOX Formula:
    "Types of parameter DAY_IN () and variable J_CALDAY(D) are inconsistent"
    Following is the code:
    DATA    I_CALDAY       TYPE  0CALDAY.
    DATA    N_CALDAY       TYPE  0CALDAY.
    DATA    KYF              TYPE KEYFIGURE_NAME.
    FOREACH   I_CALDAY, KYF.
       CALL FUNCTION SLS_MISC_GET_LAST_DAY_OF_MONTH
          EXPORTING
             DAY_IN  =  I_CALDAY
          IMPORTING
             LAST_DAY_OF_MONTH = N_CALDAY.
        {KYF, N_CALDAY}  =  {KYF, L_CALDAY}.
    ENDFOR.
    Import parameter DAY_IN is of type sy-datum (that inturn is data element SYDATUM of data type DATS - same as 0CALDAY). Not sure why error is being thrown. Any idea? Thanks.
    Edited by: SAP_BOY on Dec 4, 2009 5:26 PM

    Hi,
    I think It will not identify ,though you have  (data element SYDATUM of data type DATS - same as 0CALDAY).Check it out by assigning it through a variable of type D.
    Data I_CALDAY TYPE D.
    Hope it may work out.
    Regards,
    Indu

  • How to capture errors when a Function module is called as BACKGROUND TASK

    How to capture errors when a Function module is called as BACKGROUND TASK?.Please advise.
    FUNCTION ZRPM_DELETE_PROJECT_DATA_API.
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(IV_EXTERNAL_ID) TYPE  RPM_TV_EXTID OPTIONAL
    *"     VALUE(IV_PROJECT_GUID) TYPE  RPM_TV_GUID OPTIONAL
    *"     VALUE(FLAG) TYPE  BOOLEAN OPTIONAL
    *"  EXPORTING
    *"     VALUE(EV_RC) TYPE  I
    *"     VALUE(EV_MSG) TYPE  STRING
    *"     VALUE(ET_MSG) TYPE  RPM_TT_MESSAGES
      IF flag = cl_rpm_co=>sc_true.
        Call function 'RPM_DELETE_PROJECT_DATA' IN BACKGROUND TASK
          EXPORTING
            IV_EXTERNAL_ID  = IV_EXTERNAL_ID
            IV_PROJECT_GUID = IV_PROJECT_GUID
          IMPORTING
            EV_RC           = EV_RC
            EV_MSG          = EV_RC
            ET_MSG          = ET_MSG.
        COMMIT WORK.
      ELSE.
        CALL FUNCTION 'RPM_DELETE_PROJECT_DATA'
          EXPORTING
            IV_EXTERNAL_ID  = IV_EXTERNAL_ID
            IV_PROJECT_GUID = IV_PROJECT_GUID
          IMPORTING
            EV_RC           = EV_RC
            EV_MSG          = EV_MSG
            ET_MSG          = ET_MSG.
      ENDIF.
    ENDFUNCTION.
    In above code how to capture 'EV_RC' when FM is called as background task.

    Prakash,
    CALL FUNCTION IN BACKGROUND TASK allows no IMPORTING parameters, so that your code will produce a syntax error.
    The calling program can only handle errors of remote function calls (RFC) if these are either
    - synchronous RFC  (that is CALL FUNCTION ... DESTINATION ...) or
    - asynchronous RFC (that is CALL FUNCTION STARTING NEW TASK ... DESTINATION ...).
    Both synchronous and asynchronous RFC allow the capturing of errors by means of exceptions. But that is a different topic.

  • There seems to be an error in the function module OPEN_FORM obstructing the

    Hi,
    There seems to be an error in the function module OPEN_FORM obstructing the process.
    Some vendors are not cabaple of usinf EDI and for some reason also not willing to use TTOOL solutions (example Hewlet Packard). In those cases the supplier still would like to get purchase order electronically via e-mail. Sending POu2019s via external mail (SMTP) is basically standard function in R/3 that has been possible since the version 4.5. It is not pre-configured, so (almost) all the required elements needs to be configured.
    When we send the output message through ME9F t'code i facing the problem in the above FM.
    Please help me how to solve this.
    Vijay

    Got you, the digital display for Cupertino and Frankfurt are wrong too.
    Submit feedback:
    http://www.apple.com/feedback/iphone.html

  • Error EU 802: Function Module does not exist

    Hello everyone!
    While running a DTP, I'm getting the following error:
    EU 802: Function Module RSD_YPERSON_TXT_GET does not exist
    Anyone has any idea what this is about?
    Thanks in advance for your responses!
    Best Regards,
    Luís.

    Hi,
    I have resolved this issue. Turns out that I was mapping a source field INPER (In-Period) directly to 0CALMONTH. The problem is that this source field can have more than 12 periods per year.
    The error message was totally misleading... there's SAP for you
    Points assigned for the effort.
    Best regards,
    Luís.

  • Error Error 6 in function module RSS_PROGRAM_GENERATE

    Hello Experts,
    When I attempt to run the extract checker for datasource, 0material_LPRH_HIER I receive the following error: Error 6 in function module RSS_PROGRAM_GENERATE.
    I referred to the oss notes 328948. But the note is addressing to lower versions of R/3.
    I am working on ECC 6.0 and no way that note is helpful to me. I did check for the previous posts addressing this issue and i said already those posts refer to the older version of R/3.
    I did check for the previous post and all are addressing to the lower version of release.
    KK

    This is the reply I got from SAP:
    The error error 6 RSS_PROGRAM_GENERATE is more related to Hierarchy .
    Are you creating a hierarchy data source if so you need to use
    RSA1HCAT report .But normally you will not get any errors when you
    create the data source by your own .
    705212--> Syntax error in the generated extraction program
    Please use the program RSA1HCAT in SE38 to check your hierarchy.

  • Error 6 in function module RSS_PROGRAM_GENERATE

    Hi friends,
    While testing the extraction of a hierarchy data source (0CMMT_ITEM_FMCI_PU_HIER) from RSA3, I encountered the above error. I looked into some notes and it was not of much help for me. Please let me know if someone have come across this error and know the solution.
    Thanks and Regards
    Subray Hegde

    Hi,
    look at oss note 705212:
    Syntax error in the generated extraction program   Symptom
    You notice the error by one of the following symptoms:
    The loading of transaction data from an R/3 system terminates with a syntax error in the generated extraction program. The monitor displays the error messages:
                            R3027 "Error & during the generation of the data transfer program"
                            RSM340 "Error in the source system"
    The extraction within the extractor checker terminates with error message <b>RJ028 "Error 6 in function module RSS_PROGRAM_GENERATE".</b>The activation of transfer rules ends in BW with error message RG102 "Syntax error in GP$ERR$, row... (-> long text)" from the source system. Usually, the diagnosis in the long text of the error message is: "...could not be interpreted. Possible error causes: Incorrect notation or... "
    Other terms
    OLTP, extractor, data extraction, DataSource, Service API, SAPI,
    R3 027, R3 27, RSM 340, RJ 028, RJ 28
    Reason and Prerequisites
    The error only occurs in the source system, if this contains Basis Release 3.1I and Service API (SAPI) 3.0C Support Package 6. SAPI 3.0C Support Package 6 is contained, for example, in PI 2003.1 Support Package 7 (see attached composite SAP note 673002).
    Solution
    To correct the problem you need service API 3.0C Support Package 7 in the affected source system. The attached composite SAP note 704971 explains in which software components service API 3.0C is contained, and what the corresponding Support Packages of these components are.
    Alternatively, you can also copy the advance correction from the appendix.
    /manfred

  • Error message for function module

    I have created a custom function module. I have activated it. But when i'm trying to use it in a program it is showing an error. The function module has 'TABLES' but it is showing error as:
    "field "TABLES" is unknown. It is neither in one of the specified tables nor defined by a DATA statement".
    Please help me!!
    Thank you.

    Hello Titan,
    Generally you get these kind of syntax errors when there is some problem with the format of the program. Please recheck the format of the program in which you are calling the newly created function module. Please check if there are any erroneous '.' or ',' in the program before the 'Tables' partameter of the function module.
    Please verify the same.
    Regards,
    Pavan

  • Errors in Update Function Modules

    Hi Gurus,
    Please provide me the ways to handle Errors in Update Function Modules.
    (I.e. I should export errors from Update Function Module)
    Warm Regards,

    Use Raise statement ...
    FUNCTION-POOL CSTR.
    FUNCTION STRING_SPLIT.
      IF STRING NA DELIMITER.
        RAISE NOT_FOUND.
      ENDIF.
    ENDFUNCTION.
    Regards,
    Santosh

  • Error executing custom function module

    Hi all,
    am trying to read a function module form my java code as below.
    There is no problem with the function module.
    I think there is some problem with the java code that is written. I am sure the problem lies with the  TABLES IT_PRODUCT_DATA STRUCTURE  ZOG_ITEM_SCREENSTR.
    Function module parameters and signature.
    FUNCTION ZGET_CUST_ORDERGUIDE_ITEMDATA.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(IV_ORDER_GUID) TYPE  CRMT_OBJECT_GUID OPTIONAL
    *"     VALUE(IV_CUSTOMER) TYPE  BU_PARTNER
    *"  TABLES
    *"      IT_PRODUCT_DATA STRUCTURE  ZOG_ITEM_SCREENSTR
    Java Code that is Implemented is attached above.
    public ArrayList fetchOrderGuide(String customerNumber) {
              ArrayList itemList = new ArrayList();
                                       ItemSalesDoc itemSalesDoc = new ItemSalesDoc();
              if (log.isDebugEnabled()) {
                   log.debug("inside ZAdminLogin");
              try
              JCoConnection aJCoCon = (JCoConnection) getConnectionFactory().getConnection(com.sap.isa.core.eai.init.InitEaiISA.FACTORY_NAME_JCO,
                                                                                                 com.sap.isa.core.eai.init.InitEaiISA.CON_NAME_ISA_STATEFUL);
                   try
                        try
                             JCO.Function zFetchSalesOrderFunctionModule = aJCoCon.getJCoFunction("ZGET_CUST_ORDERGUIDE_ITEMDATA");
                             // set the import values
                             Table zItemsTable = new Table("ITEMS");
                                       //zPackagesTable.addColumn(Table.TYPE_STRING,"HUI");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JOGITEM");
                             zItemsTable.addColumn(Table.TYPE_INT,"JPRUOM");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JPRSEQ");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JOGDESC");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JLINE");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JOGNR");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JPACK");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JSIZE");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JBRAND");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JWEEKAVG");
                             zItemsTable.addColumn(Table.TYPE_STRING,"JDELFLAG");
                             JCO.ParameterList importParams = zFetchSalesOrderFunctionModule.getImportParameterList();
                             importParams.setValue("BP-104", "IV_CUSTOMER");
                             aJCoCon.execute(zFetchSalesOrderFunctionModule);
                             JCO.Table zRtItems = zFetchSalesOrderFunctionModule.getTableParameterList().getTable("IT_PRODUCT_DATA");
                                            int numberOfPackages = zRtItems.getNumRows();
                                            if (log.isDebugEnabled()) {
                                                 log.debug("number of packages " + numberOfPackages);
                                            if (numberOfPackages > 0)
                                                 for (int j=0; j<numberOfPackages; j++)
                                                      TableRow itemRow = zItemsTable.insertRow();
                                                      //itemRow.setRowKey(new TechKey(zRtItems.getString("EXIDV")));
                                                      //packageRow.getField("HUI").setValue(zGoods.getString("EXIDV"));
                                                      itemRow.getField("JOGITEM").setValue(zRtItems.getString("OGITEM"));
                                                      itemRow.getField("JPRSEQ").setValue(zRtItems.getString("PRSEQ"));
                                                      itemRow.getField("JOGDESC").setValue(zRtItems.getString("OGDESC"));
                                                      itemRow.getField("JLINE").setValue(zRtItems.getString("LINE"));
                                                      itemRow.getField("JOGNR").setValue(zRtItems.getString("OGNR"));
                                                      itemRow.getField("JPACK").setValue(zRtItems.getString("PACK"));
                                                      itemRow.getField("JSIZE").setValue(zRtItems.getString("SIZE"));
                                                      itemRow.getField("JBRAND").setValue(zRtItems.getString("BRAND"));
                                                      itemRow.getField("JWEEKAVG").setValue(zRtItems.getString("WEEKAVG"));
                                                      itemRow.getField("JDELFLAG").setValue(zRtItems.getString("DELFLAG"));
                                                      zRtItems.nextRow();
                        catch(JCO.AbapException abapException)
                             //Exception thrown, user is not valid
                             if(log.isDebugEnabled())
                                  log.debug(  abapException.getKey());
                   catch (Exception ex)
                        if (log.isDebugEnabled()) {
                             log.debug(ex);
                   finally
                        aJCoCon.close();
              catch(BackendException beeEx)
                   if(log.isDebugEnabled())
              return itemList;     
    LOGDETAILS
    ZGET_CUST_ORDERGUIDE_ITEMDATA:: - IN: INPUT * IV_CUSTOMER='BP-104' IV_ORDER_GUID='00000000000000000000000000000000'
    Oct 9, 2008 6:48:41 AM,507 SAPEngine_Application_Thread[impl:3]_7 Error com.sap.isa.core.eai.sp.jco.JCoConnectionStateful Error occcurred in EAI layer "com.sap.mw.jco.JCO$Exception: (106) JCO_ERROR_RESOURCE: Trying to access row values in a table which does not have any rows yet".
    [EXCEPTION]
    com.sap.mw.jco.JCO$Exception: (106) JCO_ERROR_RESOURCE: Trying to access row values in a table which does not have any rows yet
                at com.sap.mw.jco.JCO$Record.checkRowCapacity(JCO.java:12354)
                at com.sap.mw.jco.JCO$Record.getString(JCO.java:12827)
                at com.sap.mw.jco.JCO$Field.getString(JCO.java:11055)
                at com.sap.isa.core.eai.sp.jco.JCoUtil.paramIterator(JCoUtil.java:412)
                at com.sap.isa.core.eai.sp.jco.JCoUtil.logCall(JCoUtil.java:382)
                at com.sap.isa.core.eai.sp.jco.JCoUtil.logCall(JCoUtil.java:236)
                at
    All helpful answers will be rewarded heavily

    hi,
    first of all you do not set the import values for your table correct. You should do something similar like this:
    Function myFunction = connection.getJCoFunction(Z_FM");
    Table myTable = myFunction.getTableParameterList().getTable("Z_TABLE");
    for(int i=0; i<2; i++) {
        myTable.appendRow();
                        myTable.setValue(value1,"VALUE1");
                        myTable.setValue(value2,"vALUE2");
                   connection.execute(myFunction);
    Did you debug your java class? You should check at which point your java class throws the error.
    Regards
    Michael

  • Error while executing Function Module UNIT_CONVERSION_WITH_FACTOR.

    Hi experts:
        I'm trying to use the UNIT_CONVERSION_WITH_FACTOR Function Module on
    BW but an error message appears, I searched for Notes on the SAP
    Marketplace but only found a single note that describes the same
    situation that we're experiencing (SAP Note 1333415), the thing is that
    such a note is applicable for SAP BASIS version 702 but I'm using SAP
    BASIS version 700.
    Steps for Reconstruction    
    - On transaction SE37 call the u201CUNIT_CONVERSION_WITH_FACTORu201D Function
    Module.
    - Click on the u201CTest/Executeu201D button (or press the F8 key).
    - Enter the following values:
       o ADD_CONST = 0
       o DENOMINATOR = 1
       o INPUT = 20
       o NUMERATOR = 1568
    - Click on the u201CExecuteu201D button (or press the F8 key).
    - The Exception u201CTYPE_INVALIDu201D is reached and the following message
    appears: u201CUse a number field for field OUTPUTu201D.
    I also tried to use this Function Module on R/3 and the result was the same.
    Do you have any suggestion to fix this error?
    Thanks in advance for your help,
    Francisco Milán.

    Hi Francisco,
    Check with SAP Note No. 854978.
    Hope this would help you.
    Rgds,
    Mohit

  • Error while activating function module

    Hi,
    I copied a standard SAP function module L_TO_CREATE_DN.
    When i activated the function group it throws an error saying that " Field "I_COMMIT_WORK" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement".
    All the global data has been copied properly in the TOP include but still while activating the function group we are getting the above said error.
    If anyone has encountered same kind of issue.......Please guide.
    Thanks and regards,
    Ramesh

    I was also facing the same issue, when I tried copying just 1 or 2 FM's from that FG L03B.
    Finally, I copied the whole function group, including all FM's into Z FG, and FM's, and it got activated w/o any hitches. Looks like there is lot of dependency between the includes and FM's code.
    Regards
    Deepthi

  • Error while calling function module to start form

    Hello Experts .
    First i make my data selection. Then i will get the name of the generated function module. Then i call FP Job open. up to here all is ok. But when i call the generated function module. There comes the popup error message. The text on this popup is SAP <SystemID>:System message,   Workprocess restarts. Session deleted" (or similar, I only get the german text "PBI: SAP-Systemnachricht: Workprozess druchgestartet (Modus abgebrochen)).
    I dont know why.
    Can anybody help?
    Regards
    Chris

    -> Executing Test Report FP_TEST_00 works correct. i see a pdf.
    ->Excecuting Test Report FP_CHECK_DESTINATION_SERVICE works correct
    FP_JOB_CLOSE is not called in my report.
    -> Executing Testreport:FP_TEST_IA_01  I get the error message:'
    ADS: com.adobe.ProcessingException: Could not retrieve a password for credential: ReaderRights(200.101).'

  • Error while activation Function module for generic data extraction

    Hi,
    I have created a generic data source ZMATERIAL in which i have selected the Extraction by Function module. I copied the function module RSAX_BIW_GET_DATA_SIMPL to ZMATERIAL_FM, but when i activate this module it gives me error
    REPORT/PROGRAM statement missing, or program type is I (INCLUDE).
    The main program of the function "Z_BWGENDATAMATERIAL" does not begin with "FUNCTION-POOL".
    Please help me in this.

    Hi Dipika,
                  I think a similar issue is discussed
    Refer this thread
    REPORT/PROGRAM statement missing, or program type is I (INCLUDE).
    Compiling INCLUDE progam
    question related to includes
    question related to includes
    Hope these helps
    Regards
    Karthik

Maybe you are looking for