Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Extending My Quotations Error

Hi Experts,

We are trying to extended our standard app - My Quotations. Basically we added a new button that will create a sales order if the quotation doesn't have a sales order attached to it yet. If the quotation already has a sales order, he can view the sales order number.

We implemented an FM that will create the sales order whenever the button is clicked. We can successfully create the sales order in the backend but we are encountering an error whenever we edit the quotation.

Below is the error. The SalesOrder property is coming from the last view.

the Odata service call (/sap/opu/odata/sap/ZLORD_MY_QUOTATION_SRV/QuotationHeaderSet('20000027')) on the previous page does have a SalesOrder property to it.

But on the next Odata service call (/sap/opu/odata/sap/ZLORD_MY_QUOTATION_SRV/QuotationSet) doesn't have a SalesOrder property. I wonder if we also need to extend this odata service call.

Also on the have this error when the app calls /sap/opu/odata/sap/lord_my_quotation_srv/ActionSet

Below is our code

manageSalesOrderFields: function() {

     alert("manageSalesOrderFields");

     var salesOrderId = "";

    

     //hide all fields

        view.byId("salesOrderLabel").setVisible(false);

        view.byId("salesOrderText").setVisible(false);

        view.byId("triggerSalesOrderLabel").setVisible(false);

        view.byId("triggerSalesOrderButton").setVisible(false);

    

        $.getJSON("/sap/opu/odata/sap/zlord_my_quotation_srv/QuotationHeaderSet('" + quotationId + "')",

       

       

        function(data) {

            alert("enterHere");

            salesOrderId = data.d.SalesOrder;

            alert(salesOrderId);

            if (salesOrderId !== "" ){

                view.byId("salesOrderLabel").setVisible(true);

                view.byId("salesOrderText").setVisible(true);

            }else{

                view.byId("triggerSalesOrderLabel").setVisible(true);

                view.byId("triggerSalesOrderButton").setVisible(true);

                view.byId("triggerSalesOrderButton").detachPress(sap.ui.controller("...").createSalesOrder);

                view.byId("triggerSalesOrderButton").attachPress(sap.ui.controller("...").createSalesOrder);

            }

        });

  },

    createSalesOrder: function () {

            var createSalesOrderDialog = new sap.m.Dialog("createSoDialog", {

        title: "Create Sales Order",

        icon: "sap-icon://sales-order",

        content: [

        new sap.ui.core.HTML({content:"<p style='margin:0;padding: 16px;'>Do want to create a sales order?</p>"})

        ],

        buttons:[

        new sap.m.Button({

        text: "Yes",

        press : function() {

               var oModel = new sap.ui.model.odata.ODataModel('/sap/opu/odata/sap/zlord_my_quotation_srv/');

                            var oParameter = {

                                "QuotationID" : quotationId

                            };

               oModel.callFunction('/CreateSalesOrder', 'GET', oParameter, 'null',

                   function (oData, oResponse) {

                                    var responseMessage = JSON.stringify(oResponse.body);

                                    var responseMessageStart = responseMessage.search('<d:Message>');

                                    var responseMessageEnd = responseMessage.search('</d:Message>');

                                    responseMessage = responseMessage.substring(responseMessageStart + 11, responseMessageEnd);

                                   

                                    //show MessageToast

                                    sap.m.MessageToast.show(responseMessage);

                                    view.byId("triggerSalesOrderLabel").setVisible(false);

                                    view.byId("triggerSalesOrderButton").setVisible(false);

                                   

                                    console.log(responseMessage);

                                },

                                function (oError) {

                                    sap.m.MessageToast.show('Error - see log');

                                    console.log(oError);

                                }

                        );

        createSalesOrderDialog.close();

        createSalesOrderDialog.destroy();

        }

        }),

        new sap.m.Button({

        text: "No",

        press : function() {

        createSalesOrderDialog.close();

        createSalesOrderDialog.destroy();

        }

        })

        ]

        });

            createSalesOrderDialog.open();

     },

If anyone has an idea with this error, it will be a great help to us.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question