Maximo Open Forum

 View Only

Error adding compatible unit to CU estimate using Maximo API

  • 1.  Error adding compatible unit to CU estimate using Maximo API

    Posted 10-14-2024 17:12

    I am using the Maximo REST API to update compatible unit (CU) estimates (CUs are part of the Maximo T&D industry solution). I am using the SYNC method to update existing CU estimates, using the primary key values in the JSON message body. For example, here is the message body of a message that successfully updates the descriptions on the CU estimate header, the estimate version and the station:

    {
        "requestnum": "1007",
        "description": "HDS_CUESTIMATE2 update test 2024-09-21-1",
        "orgid": "EAGLENA",
        "plusdestversion": [
            {
                "requestnum": "1007",
                "estversion": 1,
                "description": "Design estimate version update 2024-09-21-1",
                "plusdstation": [
                    {
                        "requestnum": "1007",
                        "estversion": 1,
                        "description": "Design station 1 2024-09-21-1",
                        "stationkey": 1,
                        "station": "1",
                        "siteid": "BEDFORD",
                        "plusdstndetail": [
                            {
                                "requestnum": "1007",
                                "estversion": 1,
                                "quantity": 20.0,
                                "stndetailkey": 1,
                                "cuseq": 1,
                                "cuname": "TESTCU2",
                                "expandflag": false,
                                "workfunction": "I",
                                "cuversion": 1,
                                "parameterset": 0,
                                "station": "1",
                                "siteid": "BEDFORD",
                                "plusdstndetailid": 302
                            }
                        ]
                    }
                ],
            }
        ],
        "siteid": "BEDFORD"
    }

    I now need to add a new CU item to an the existing station. Here is the JSON message:

    {
        "siteid": "BEDFORD",
        "requestnum": "1007",
        "plusdestversion": [
            {
                "estversion": 1,
                "plusdstation": [
                    {
                        "stationkey": 1,
                        "plusdstndetail": [
                            {
                                "_action": "Add",
                                "parameterset": "0",
                                "station": "1",
                                "cuname": "TESTCU3",
                                "status": "ACTIVE",
                                "quantity": "5.0"
                            }
                        ]
                    }
                ]
            }
        ]
    }

    This API call generates a 400 error. Here is the output in SystemOut.log:

    [9/21/24 14:24:35:275 EDT] 00000163 SystemOut     O 21 Sep 2024 14:24:35:275 [ERROR] [MXServerc1] [CID-MXOSLC-4477] BMXAA6714E - The data for the next record in the mboset could not be retrieved for the SQL query select * from plusdcu  where and cuname =  'TESTCU3'  and cuversion = 1 OPTION (FAST 1000)  . See the log file for more details about the error.
    com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'and'.
        at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:265) ~[sqljdbc.jar:?]
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1676) ~[sqljdbc.jar:?]
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteCursored(SQLServerStatement.java:2074) ~[sqljdbc.jar:?]
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:881) ~[sqljdbc.jar:?]
        at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:802) ~[sqljdbc.jar:?]
        at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7730) ~[sqljdbc.jar:?]
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:3786) ~[sqljdbc.jar:?]
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:268) ~[sqljdbc.jar:?]
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:242) ~[sqljdbc.jar:?]
        at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeQuery(SQLServerStatement.java:724) ~[sqljdbc.jar:?]
        at psdi.mbo.MboSet.getNextRecordData(MboSet.java:3375) [businessobjects.jar:?]
        at psdi.mbo.MboSet.fetchMbosActual(MboSet.java:2983) [businessobjects.jar:?]
        at psdi.mbo.MboSet.fetchMbos(MboSet.java:2940) [businessobjects.jar:?]
        at psdi.mbo.MboSet.getMbo(MboSet.java:2130) [businessobjects.jar:?]
        at psdi.mbo.MboSet.isEmpty(MboSet.java:4455) [businessobjects.jar:?]
        at psdi.plusd.app.plusdcuest.PlusDFldStationDetailCUVersion.validateCuVerStatus(PlusDFldStationDetailCUVersion.java:226) [businessobjects.jar:?]
        at psdi.plusd.app.plusdcuest.PlusDFldStationDetailCUVersion.validate(PlusDFldStationDetailCUVersion.java:76) [businessobjects.jar:?]
        at psdi.mbo.MboValue.validate(MboValue.java:1757) [businessobjects.jar:?]
        at psdi.mbo.MboValue.setValue(MboValue.java:939) [businessobjects.jar:?]
        at psdi.mbo.MboValue._setValue(MboValue.java:1153) [businessobjects.jar:?]
        at psdi.mbo.MboValue.setValue(MboValue.java:1138) [businessobjects.jar:?]
        at psdi.mbo.Mbo.setValue(Mbo.java:2733) [businessobjects.jar:?]
        at psdi.plusd.app.plusdcuest.PlusDFldStationDetailCUName.action(PlusDFldStationDetailCUName.java:254) [businessobjects.jar:?]
        at psdi.mbo.MboValue.validate(MboValue.java:1783) [businessobjects.jar:?]
        at psdi.mbo.MboValue.validate(MboValue.java:1660) [businessobjects.jar:?]
        at psdi.mbo.Mbo.validateAttributes(Mbo.java:5148) [businessobjects.jar:?]
        at psdi.mbo.Mbo.validate(Mbo.java:4686) [businessobjects.jar:?]
        at psdi.iface.mos.MosProcessImpl.checkValidateErrors(MosProcessImpl.java:2443) [businessobjects.jar:?]
        at psdi.iface.mos.MosProcessImpl.setAdditionalTableData(MosProcessImpl.java:1761) [businessobjects.jar:?]
        at psdi.iface.mos.MosProcessImpl.createChildrens(MosProcessImpl.java:990) [businessobjects.jar:?]
        at psdi.iface.mos.MosProcessImpl.createChildrens(MosProcessImpl.java:1002) [businessobjects.jar:?]
        at psdi.iface.mos.MosProcessImpl.createChildrens(MosProcessImpl.java:1002) [businessobjects.jar:?]
        at psdi.iface.mos.MosProcessImpl.fillMaximoTables(MosProcessImpl.java:827) [businessobjects.jar:?]
        at psdi.iface.mos.MosProcessImpl.processExternalData(MosProcessImpl.java:360) [businessobjects.jar:?]
        at psdi.iface.mos.MosProcessImpl.processObjectStructureService(MosProcessImpl.java:255) [businessobjects.jar:?]
        at psdi.iface.mic.MicService.processObjectStructureData(MicService.java:934) [businessobjects.jar:?]
        at psdi.iface.mic.MicService.processOSLCAsJSON(MicService.java:638) [businessobjects.jar:?]
        at com.ibm.tivoli.maximo.oslc.provider.OSPOSTRouteHandler.handleRequest(OSPOSTRouteHandler.java:914) [businessobjects.jar:?]
        at com.ibm.tivoli.maximo.oslc.provider.MaximoOslcProviderServlet.handleRoute(MaximoOslcProviderServlet.java:1300) [commonweb.jar:?]
        at com.ibm.tivoli.maximo.oslc.provider.MaximoOslcProviderServlet.processPostPut(MaximoOslcProviderServlet.java:1412) [commonweb.jar:?]
        at com.ibm.tivoli.maximo.oslc.provider.MaximoOslcProviderServlet.doPost(MaximoOslcProviderServlet.java:266) [commonweb.jar:?]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:595) [javax.j2ee.servlet.jar:?]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) [javax.j2ee.servlet.jar:?]
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1233) [com.ibm.ws.webcontainer.jar:?]
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:782) [com.ibm.ws.webcontainer.jar:?]
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:481) [com.ibm.ws.webcontainer.jar:?]
        at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178) [com.ibm.ws.webcontainer.jar:?]
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136) [com.ibm.ws.webcontainer.jar:?]
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97) [com.ibm.ws.webcontainer.jar:?]
        at com.ibm.tivoli.maximo.filter.UnSupportedMethodBlockFilter.doFilter(UnSupportedMethodBlockFilter.java:60) [commonweb.jar:?]
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195) [com.ibm.ws.webcontainer.jar:?]
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91) [com.ibm.ws.webcontainer.jar:?]
        at psdi.webclient.system.filter.HttpXFrameOptionsFilter.doFilter(HttpXFrameOptionsFilter.java:38) [classes/:?]
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195) [com.ibm.ws.webcontainer.jar:?]
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91) [com.ibm.ws.webcontainer.jar:?]
        at psdi.webclient.system.filter.MTContextFilter.doFilter(MTContextFilter.java:53) [classes/:?]
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195) [com.ibm.ws.webcontainer.jar:?]
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91) [com.ibm.ws.webcontainer.jar:?]
        at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71) [log4j-web-2.17.1.jar:2.17.1]
        at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195) [com.ibm.ws.webcontainer.jar:?]
        at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91) [com.ibm.ws.webcontainer.jar:?]
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:967) [com.ibm.ws.webcontainer.jar:?]
        at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107) [com.ibm.ws.webcontainer.jar:?]
        at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87) [com.ibm.ws.webcontainer.jar:?]
        at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:952) [com.ibm.ws.webcontainer.jar:?]
        at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817) [com.ibm.ws.webcontainer.jar:?]
        at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:213) [com.ibm.ws.webcontainer.jar:?]
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463) [com.ibm.ws.runtime.jar:?]
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530) [com.ibm.ws.runtime.jar:?]
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316) [com.ibm.ws.runtime.jar:?]
        at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:287) [com.ibm.ws.runtime.jar:?]
        at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) [?:CCX.CF [o2228.02]]
        at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113) [?:CCX.CF [o2228.02]]
        at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175) [com.ibm.ws.runtime.jar:?]
        at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) [com.ibm.ws.runtime.jar:?]
        at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) [com.ibm.ws.runtime.jar:?]
        at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) [com.ibm.ws.runtime.jar:?]
        at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) [com.ibm.ws.runtime.jar:?]
        at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) [com.ibm.ws.runtime.jar:?]
        at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) [com.ibm.ws.runtime.jar:?]
        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892) [com.ibm.ws.runtime.jar:?]

    It looks like the generated SELECT query is missing a criteria before the "AND". What is causing this error? Am I not setting one or more attributes correctly in the message?

    -Theo Pozzy


    #Integrations

    ------------------------------
    Theo Pozzy
    OneGas
    ------------------------------


Newest Episode
Ep. 5 | Make Manage Feel Like Home with Configuration, Not Customization

Watch Steven Shull and Phil Runion discuss how IBM Maximo Manage teams can make the system feel more familiar, useful, and aligned to their business through configuration instead of customization.

MORE by Naviam Episode 5 cover
Watch Episode 5
Also available: Ep. 4 | System Properties in IBM Maximo