简体   繁体   中英

JCO transmits erroneous parameters to “CSAP_MAT_BOM_MAINTAIN”

I am trying to call the function module "CSAP_MAT_BOM_MAINTAIN" to create a BOM in SAP but i get error.

    IFunctionTemplate ft = mRepository.getFunctionTemplate("CSAP_MAT_BOM_MAINTAIN");
    System.out.println(" Functional Template Created ");
      
    if (ft == null){return;}
        
    JCO.Function function = ft.getFunction();
    JCO.ParameterList importparams =function.getImportParameterList();
    
    //  Setting HeadData Structure Information
    
    //importparams.setValue("C000000609", "CHANGE_NO");
    importparams.setValue("CPF10104", "MATERIAL");
    importparams.setValue("1", "BOM_USAGE");
    importparams.setValue("0001", "PLANT");
    importparams.setValue("01", "ALTERNATIVE");
    importparams.setValue("11.11.2011", "VALID_FROM");      
    importparams.setValue("X", "FL_COMMIT_AND_WAIT");
    importparams.setValue("X", "FL_BOM_CREATE");
    importparams.setValue("X", "FL_NEW_ITEM");
    importparams.setValue("X", "FL_COMPLETE");
    importparams.setValue("X", "FL_DEFAULT_VALUES");
    
    JCO.Structure headStructure = importparams.getStructure("I_STKO");
    headStructure.setValue("01", "BOM_STATUS");
    headStructure.setValue("1", "BASE_QUAN");
    headStructure.setValue("KG", "BASE_UNIT");
    headStructure.setValue("BOM01", "BOM_GROUP");

    JCO.Table stpo = function.getTableParameterList().getTable("T_STPO");
    stpo.appendRow();
    stpo.setValue("BOM Position 2.1", "ITEM_TEXT1");
    stpo.setValue("L", "ITEM_CATEG");
    stpo.setValue("L", "ID_ITM_CTG");
    stpo.setValue("0010", "ITEM_NO");
    stpo.setValue("0010", "ID_ITEM_NO");
    stpo.setValue("13", "COMP_QTY");
    stpo.setValue("KG", "COMP_UNIT");
    stpo.setValue("00000001", "ITEM_NODE");
    stpo.setValue("00000001", "ITEM_COUNT");
    stpo.setValue("000000000000000000", "DEP_LINK");
    stpo.setValue("12345-R6000001", "COMPONENT");       
    //stpo.setValue("12345-R6000001", "ID_COMP");
    
    JCO.Table stpu = function.getTableParameterList().getTable("T_STPU");
    stpu.appendRow();
    stpu.setValue("0", "POINTER");
    stpu.setValue("00000000", "STLKN");
    stpu.setValue("0010", "STPOZ");
    stpu.setValue("0001", "UPOSZ");
    stpu.setValue("46", "UPMNG");
    stpu.setValue("T1", "EBORT");

I get error:

Exception in thread "main" com.sap.mw.jco.JCO$AbapException: (126) ERROR: Terminate processing.

After searching over the internet i found that this error comes when we have wrong input params. But i am unable to find the error.

Please note that i have limited knowledge about ABAP programming.

Can any one help me?

(126) ABAP EXCEPTION: An exception has been thrown by a function module in the remote system.

I think you should carefully review all of these new parameters, since one is causing a bug in your function.

If you have access to the SAP system, you can run transaction ST22 to get a detailed error log. However, you may need to de-bug within SAP as per Raj's suggestion.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM