SAPUI5 formatter function with two parameters

Suppose we have a text field where the value depends on another value, in this case we have to pass the two values in the formatter.

See the example below:

Textfield should be like this:
<Text text=”{ parts : [ ‘var1’, ‘var2’ ], formatter: ‘.formatter.approverName’ }”/>

and the formatter code is:

approverName : function (sPosition, sName) {
	if (sPosition === 'GR Admin') {
		return "Custom";
	}
	return sName;
},

 

Posting date to SAP via OData using SAPUI5 Datepicker

Suppose that you have a datepicker sapui5 control and you want to pass the value of the datepicker to be posted to SAP using oData

<DatePicker id=”travelDate” />

var travelDate = this.byId('travelDate');
var dateVal = travelDate.getDateValue();

var dateFormat = sap.ui.core.format.DateFormat.getDateTimeInstance({pattern : "yyyy-MM-ddTKK:mm:ss" });
var dateOdataVal = dateFormat.format(dateVal);

Then use the dateOdataVal in your oData values

Export drupal 7 views as excel xlsx

To export drupal 7 views as xlsx files or other types like xls and cvs you can use two modules.

first one is https://www.drupal.org/project/views_data_export

and for xlsx support you need https://www.drupal.org/project/views_data_export_phpexcel

 

Just enable the two modules and create your Data Extract view, and attach it to any page or block view

How to find bad a node that makes search indexing to fail in Drupal 7

To find out which node is causing the indexing problem you have to modify the following in “modules/node/node.module”

 

function node_update_index() {
  $limit = (int)variable_get('search_cron_limit', 100);

  // Store the maximum possible comments per thread (used for ranking by reply count)
  variable_set('node_cron_comments_scale', 1.0 / max (link is external)(1, db_result(db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}'))));
  variable_set('node_cron_views_scale', 1.0 / max (link is external)(1, db_result(db_query('SELECT MAX(totalcount) FROM {node_counter}'))));

  $result = db_query_range("SELECT n.nid FROM {node} n LEFT JOIN {search_dataset} d ON d.type = 'node' AND d.sid = n.nid 
                            WHERE d.sid IS NULL OR d.reindex <> 0 
                            ORDER BY d.reindex ASC, n.nid ASC", 0, $limit);

  while ($node = db_fetch_object($result)) {
    watchdog ('cron', "indexing node {$node -> nid}"); // ADD THIS LINE
    _node_index_node($node);
  }
}

After that go to “/admin/config/system/cron” to find the cron jobs, there you will find a job called “search_cron” , click on run then go to the logs to find which node is causing the problem

Common reason for the problem
Normally this problem happens because of some bad php in a node or because of a drupal_goto call in some php.

People often recommend disabling the module “PHP Filter”, clearing the cache, running cron, then enabling it again.and other solutions also recommend you try to reduce the number of items you index when cron runs.

Consume SAP ODATA Service using php on linux

Run: yum install php-xml
After that check if PHP CURL and PHP XSL extensions are installed and enabled on the server

copy the content of framework folder to /opt/odataphp (you can choose another path)

in php.ini add the following:
include_path = “/opt/odataphp”

;OData SDK for PHP Library Path
ODataphp_path = “/opt/odataphp”

then restart your httpd: service httpd restart

On linux you will face this error:
Failed opening required ‘Resource\Messages.php’

to fix this go to odataphp/Common/ACSUtil.php and change the ‘\’ to ‘/’ in the require_once statements at the begining
require_once ‘Resource\Messages.php’;
require_once ‘Common\Collection.php’;
. .
etc

make it:
require_once ‘Resource/Messages.php’;
require_once ‘Common/Collection.php’;
. .
etc

PHPDataSvcUtil.php

Suppose we have the following Odata service path:

http://username:password@URL:8044/sap/opu/odata/sap/MYSERVICE_SRV/SERVICEDataSet

To generate the proxy use the following:

php /opt/odataphp/PHPDataSvcUtil.php /uri=http://username:password@URL:8044/sap/opu/odata/sap/MYSERVICE_SRV /out=/home/tassaf/testodata.php

How to replace SAP Fiori Launchpad logo

To change your fiori launchpad logo you have to create your custom theme using the Theme Designer (/UI5/THEME_DESIGNER), there you can upload your own logo and background.

 

But if you face problems in the image upload then you can replace the logo by uploading your custom image with the same name and replace the original logo in the mime.

to do that:

Go to (SE80 -> MIME Repository) under the path /sap/public/bc/ui5/LIBRARIES/VER/lib_version/com.sap.ui5.core/META-INF/resources/sap/ui/core/mimes/logo/

 

then replace the logo image with your custom one.