cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve the Image from Gateway Service using SAPUI5

former_member184238
Participant
0 Kudos

Hi,

I am getting list of products by using the below url.

https://sapes1.sapdevcenter.com/sap/opu/odata/sap/ZCD204_EPM_DEMO_SRV/Products?sap-ds-debug=true

When I click on selected Product I am getting the Product Detailed Information along with the Image.

Below is my code to navigate to detail page when click on selected Product.

productListTap : function(oEvent){

                    var oBindingContext = oEvent.getSource().getBindingContext();

                    var sTitle = oEvent.getSource().getTitle().split(" ").join("");

              sap.ui.getCore().getEventBus().publish("nav", "to", {

                    viewName: "view.Product_Details",

                    viewId: "detail." + sTitle,

                    data: {

                              bindingContext: oBindingContext

                    }

          });

          },

Below code is to display Details

I am getting the image of the product when doing like this.

Please suggest me to get the Product Id dynamically without doing Hard  code which is mentioned in box in  image.

Thanks&Regards

Sridevi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sridevi Garapati,

If you take a look at the model, there is a property called ProductPicUrl:

<d:ProductPicUrl>/SAP/PUBLIC/BC/NWDEMO_MODEL/IMAGES/HT-1000.jpg</d:ProductPicUrl>

Have you tried to bind the ProductPicUrl to the Image source, just as you have done with the other properties?

new sap.m.Image({

     src: {ProductPicUrl},

     decorative: true,

     densityAware: false

})

I hope this helps.

Kind regards

Miki von Ketelhodt

former_member184238
Participant
0 Kudos

Hi,

Thanks for your reply.

I changed the above code like this to get the Image from service.

new sap.m.Image({src : {

                                 path: "ProductPicUrl",

                                  formatter : function(fValue){

                                  var path = "https://sapes1.sapdevcenter.com"+fValue;

                                  return path;

                                    }

                          }

                  })

Then It's Working fine.

Can we change the already existed image with our new image using SAPUI5 for this Service ?

Thanks&Regards

Sridevi

Former Member
0 Kudos

Hi Sridevi,

Great, glad you managed to get it to work .

I would imagine that you would not be able to change the existing image with a new one for that service, but I am not 100% sure. I think the service is just there for testing purposes (reading not writing).

Kind regards

Miki von Ketelhodt

Answers (0)