cancel
Showing results for 
Search instead for 
Did you mean: 

【Extending Fiori App Error】Opportunity can't be displayed in Custom Opportunity App after loading

wakky
Explorer
0 Kudos

Hi All,

I am following this document 'How to Extend Fiori Applications' to extend a Fiori app.

I'm trying to add two custom fields(date type& pull down text type) in My Opportunities App.

After I load Custom App, I can display opportunity in Custom Opportunity App.

But when I select other opportunity, I can't display opportunity and opportunity field is empty.

The console in Google Chrome diplay error message.

Kindly advice me proceed further.

1.After add  fields, I try to access Custom App. Then I select other opportunity

2.I can't diplay opportunity & opportunity field is empty

-Console Error message in Google Chrome-

Uncaught TypeError: Cannot read property 'results' of undefined   Component-preload.js:5

sap.ca.scfld.md.controller.BaseDetailController.extend.bindInfoAndProducts Component-preload.js:5

(anonymous function) Component-preload.js:5

p sap-ui-core.js:16_ ODataModel.js:6

(anonymous function) ODataModel.js:6

(anonymous function) datajs.js:17

o9

-System Environment-

Frontend server: NW731

CRM Backend: CRM 7.0 EhP2

Components: UIX02CRM SP01 and GBX02CRM SP01 Downport app

Development Tool:Eclipse Version: Juno Service Release 2 Build id: 20130225-0426

Eclipse plugin:SAP NetWeaver Gateway Productivity Accelerator (GWPA),UI Development Toolkit for HTML5,Fiori Toolkit

Thanks & regards,

Yuki

Accepted Solutions (1)

Accepted Solutions (1)

jamie_cawley
Advisor
Advisor
0 Kudos

Hi Yuki,


Load your app and then select the Network tab of the dev tools of your browser.  When you select the problematic item you should see the request made in the network tab.  Verify that the request response has the related information in it to successfully bind your fields.


If everything on the data side looks ok, can you post your code?


Regards,

Jamie

SAP - Customer Experience Group

wakky
Explorer
0 Kudos

Hi Jamie,

Thank you for your response.

I've checked to the network tab.

The one error in network tab is 'Component-preload.js is not found'.

But I don't need to create a Component-preload.js file in case of this Extending App.

I only set to add the code in Component.js & specific view xml(S3&S4&S5.view.xml) file.

Standard Fiori Applications work fine.

Do I understand correctly?

-Network tab-

-Component.js-


jQuery.sap.declare("zcus.crm.opportunity.Component");

// use the load function for getting the optimized preload file if present
sap.ui.component.load({
name: "cus.crm.opportunity", 
url: jQuery.sap.getModulePath("zcus.crm.opportunity") + "/../CRM_OPPRTNTY" // provide parent project url
// we use a URL relative to our own component; might be different if
// extension app is deployed with customer namespace
});


cus.crm.opportunity.Component.extend("zcus.crm.opportunity.Component", {
metadata: {
  version : "1.0",
  config : {
   "sap.ca.i18Nconfigs": {
    "bundleName":"zcus.crm.opportunity.i18n.i18n"
   },
           
   "sap.ca.serviceConfigs": [{
              name: "CRM_OPPORTUNITY",
              masterCollection : "Opportunities",
              serviceUrl: "/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/",
              isDefault :true,
              countSupported : true,
        useBatch : true,
        mockDataSource : jQuery.sap.getModulePath("zcus.crm.opportunity") + "/model/metadata.xml"
         }]
  },

  customizing: {
  "sap.ui.viewExtensions": {
   "cus.crm.opportunity.view.S5": {
    "opportunityCreateContentBottomExtension": {
     className: "sap.ui.core.Fragment",
     fragmentName: "zcus.crm.opportunity.view.opportunityCreateContentBottomExtensionCustom",
     type: "XML",
    },
   },

   "cus.crm.opportunity.view.S4": {
    "opportunityEditContentBottomExtension": {
     className: "sap.ui.core.Fragment",
     fragmentName: "zcus.crm.opportunity.view.opportunityEditContentBottomExtensionCustom",
     type: "XML",
    },
   },

   "cus.crm.opportunity.view.S3": {
    "opportunityInfoTabContentBottomExtension": {
     className: "sap.ui.core.Fragment",
     fragmentName: "zcus.crm.opportunity.view.opportunityInfoTabContentBottomExtensionCustom",
     type: "XML",
    },
   },
  },

  }  
}
});

Regards,

Yuki

jamie_cawley
Advisor
Advisor
0 Kudos

Hi Yuki,

Are you using mock data?

If not, look for the odata request made that would supply the data for your problematic binding when this issue is occurring.

The call to

sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/


for the needed collection.


Check the results of this to verify that it supports the binding, otherwise check if the mock data has the field defined for that selection.


If you are still having issues please post your fragment code.


Regards,

Jamie

SAP - Customer Experience Group

wakky
Explorer
0 Kudos

Hi Jamie,

Thank you for your response.

I'm not using mock data.It means that test data.

Do I check below URI in /IWFND/GW_CLIENT?

'sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/'

*/IWFND/GW_CLIENT

I’m not sure about the method of checking  the results of this to verify that it supports the binding.

Would you tell me?

Regards,

Yuki

jamie_cawley
Advisor
Advisor
0 Kudos

In your first screenshot you are showing that the binding of your custom fields work when Opportunity Test is selected.  You also have the browser dev tools open showing the console which has no errors.  Get your browser back in this state.  You will notice that there is a network tab in the dev tools too.  If you select this and then select Opportunity Test2 you will see the network calls it makes to get the opportunity information, as well as your custom data.  You can right click the request and open it in a new tab so you can verify the response.  Provide this response and the fragment you defined for your custom fields.

Regards,

Jamie

SAP - Customer Experience Group

wakky
Explorer
0 Kudos

Hi Jamie,

Thank you for your response.

I've checked network tab in dev tool.

1.Select Opportunity Test2

2.The post request display in network tab.

3.Right click the request and open it in a new tab

4.Check new tab

-tab message-


<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">

<code>005056A509B11ED199D8826D151FC0FE</code>

<message xml:lang="ja">

The specified HTTP method is not allowed for the resource identified by the Data Service Request URI

</message>

<innererror xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">

<transactionid>0D5254E4BDCDF1E1B68F00155DD2460A</transactionid>

<timestamp>20141015100013.5460000</timestamp>

<Error_Resolution>

<SAP_Transaction>

Run transaction /IWFND/ERROR_LOG on SAP NW Gateway hub system and search for entries with the timestamp above for more details

</SAP_Transaction>

<SAP_Note>

See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)

</SAP_Note>

</Error_Resolution>

</innererror>

</error>


Regards,

Yuki

jamie_cawley
Advisor
Advisor
0 Kudos

Instead of opening the request in a new tab, with it selected choose the response tab and you should see the results of the request.  Provide this and the fragment code.

Regards,

Jamie

wakky
Explorer
0 Kudos

Hi Jamie,

I provide below the results of the request in responce tab.

-Resulet of the request-

*Resule detail*

--ejjeeffe0
Content-Type: application/http
Content-Length: 19267
content-transfer-encoding: binary

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 19115
dataserviceversion: 2.0
cache-control: no-cache, no-store
pragma: no-cache

{"d":{"__metadata":{"id":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/Opportunities(guid'00155DD2-460A-1ED... Test2","StartDate":"\/Date(1363910400000)\/","ClosingDate":"\/Date(1382400000000)\/","ExpectedSalesVolume":"300","CurrencyCode":"JPY","SalesStageCode":"","SalesStageText":"","ChanceOfSuccess":"000","PriorityCode":"4","PriorityText":"低位","ProspectNumber":"LZZZZZ10","ProspectName":"UNIT顧客③ / 兵庫県神戸市中央区","UserStatusCode":"E0001","UserStatusText":"未処理","ForecastRelevance":true,"MainContactId":"8999900","MainContactName":"","EmployeeResponsibleNumber":"10010","EmployeeResponsibleName":"大田 一郎 / 東京都千代田区大手町","SalesIntention":"30","CompletionDate":"\/Date(1398729600000)\/","Notes":{"__deferred":{"uri":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/Opportunities(guid'00155DD2-460A-1ED...":"マネージャ 営業","UpdateDate":"\/Date(1412812800000)\/","UpdateTime":"PT14H30M41S","UpdateField":"DESCRIPTION","UpdateFieldText":"トランザクションテキスト","OldValue":"TEST案件11","NewValue":"Opportunity Test2"},{"__metadata":{"id":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/OpportunityChangeDocs(HeaderGuid=gui...":"見込売上","OldValue":"                 0.03","NewValue":"                 3.00"},{"__metadata":{"id":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/OpportunityChangeDocs(HeaderGuid=gui...":"案件開始日付","OldValue":"2013/03/21","NewValue":"2013/03/22"},{"__metadata":{"id":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/OpportunityChangeDocs(HeaderGuid=gui...":"換算レート日付","OldValue":"2013/03/21","NewValue":"2013/03/22"},{"__metadata":{"id":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/OpportunityChangeDocs(HeaderGuid=gui...":"価格設定日付","OldValue":"2013/03/21","NewValue":"2013/03/22"},{"__metadata":{"id":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/OpportunityChangeDocs(HeaderGuid=gui...":"見込売上","OldValue":"         2,850,000.00","NewValue":"                 0.03"},{"__metadata":{"id":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/OpportunityChangeDocs(HeaderGuid=gui...":"通貨","OldValue":"USD","NewValue":"JPY"},{"__metadata":{"id":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/OpportunityChangeDocs(HeaderGuid=gui...":"見込売上","OldValue":"                 1.85","NewValue":"         2,850,000.00"},{"__metadata":{"id":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/OpportunityChangeDocs(HeaderGuid=gui...":"通貨","OldValue":"JPY","NewValue":"USD"},{"__metadata":{"id":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/OpportunityChangeDocs(HeaderGuid=gui...":"営業フェーズ","OldValue":"意思決定","NewValue":""},{"__metadata":{"id":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/OpportunityChangeDocs(HeaderGuid=gui...":"見込売上","OldValue":"           850,000.00","NewValue":"                 1.85"},{"__metadata":{"id":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/OpportunityChangeDocs(HeaderGuid=gui...":"営業フェーズ開始","OldValue":"2013/03/21","NewValue":"2014/09/30"},{"__metadata":{"id":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/OpportunityChangeDocs(HeaderGuid=gui...":"通貨","OldValue":"","NewValue":"JPY"},{"__metadata":{"id":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/OpportunityChangeDocs(HeaderGuid=gui...":"換算レート日付","OldValue":"0000/00/00","NewValue":"2013/03/21"},{"__metadata":{"id":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/OpportunityChangeDocs(HeaderGuid=gui...":"価格設定日付","OldValue":"0000/00/00","NewValue":"2013/03/21"},{"__metadata":{"id":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/OpportunityChangeDocs(HeaderGuid=gui...":"ユーザステータス","OldValue":"","NewValue":"未処理"},{"__metadata":{"id":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/OpportunityChangeDocs(HeaderGuid=gui... Status","OldValue":"","NewValue":"エラーあり"},{"__metadata":{"id":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/OpportunityChangeDocs(HeaderGuid=gui... Status","OldValue":"","NewValue":"未処理"}]},"Competitors":{"results":[]},"SalesTeam":{"__deferred":{"uri":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/Opportunities(guid'00155DD2-460A-1ED...":"製品1","Quantity":"11","Unit":"PC","NetValue":"0","TotalExpectedNetValue":"0","ProcessingMode":"","CurrencyCode":"JPY"}]},"Statuses":{"__deferred":{"uri":"http://*hostname*:*port*/sap/opu/odata/sap/ZCRM_OPPORTUNITY_SRV/Opportunities(guid'00155DD2-460A-1ED..."}}}}
--ejjeeffe0--

Regards,

Yuki

jamie_cawley
Advisor
Advisor
0 Kudos

Please add your view fragment code.

Regards,

Jamie

SAP - Customer Experience Group

wakky
Explorer
0 Kudos

Hi Jamie,

-fragment code-(Extending S3.view.xml)


<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:ui="sap.ui.layout" xmlns:layout="sap.ui.layout" xmlns:ca="sap.ca.ui" controllerName="cus.crm.opportunity.view.S3">

<ui:form.SimpleForm id="opportunityCustomField_form">

       <ui:content>

         <Label id="opportunityCompletionDate_label2" text="{i18n>COMPLETION_DATE}"></Label>

         <Text id="opportunityCompletionDate_Text2" text="{path:'json>/CompletionDate' , formatter: 'cus.crm.opportunity.util.Formatter.dateFormatter'}"></Text>

         <Label id="opportunitySalesIntention_Label2" text="{i18n>SALES_INTENTION}"></Label>

         <Text id="opportunitySalesIntention_Text2" text="{path:'json>/SalesIntention'}"></Text>

       </ui:content>

    </ui:form.SimpleForm>

</core:FragmentDefinition>

Regards,

Yuki

jamie_cawley
Advisor
Advisor
0 Kudos

In your "sap.ca.serviceConfig" you set useBatch to true, try setting this to false and test your app.

Regards,

Jamie

SAP - Customer Experience Group

wakky
Explorer
0 Kudos

Hi Jamie,

Thank you for your response.

This issue is fixed.

Why does this issue is fixed to set useBatch to false??

In addtion, wolud you explain or provide document the below option about "sap.ca.serviceConfigs"?

-isDefault :true or false

-countSupported : true or false

-useBatch : true or false

-mockDataSource : jQuery.sap.getModulePath("custom app name") + "/model/metadata.xml"

Regards,

Yuki

jamie_cawley
Advisor
Advisor
0 Kudos

Setting the usebatch property to true at the service layer is effecting how the s3 controller is processing the response.  ServiceConfig just give you the ability to provide an extended service or an additional one see

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/80ec8772-9b7b-3110-6999-f0f326fed...

Regards,

Jamie

SAP - Customer Experience Group

wakky
Explorer
0 Kudos

Hi Jamie,

Thank you for your update.

Regards,

Yuki

Answers (0)