on 2018 Sep 07 2:22 PM
HI All,
I have requirement where i need to show months in sorted order in drop down box in sap design studio 1.6(like January, February.....) I have Month_no object with values 1-12 and month with values January, February,March...., if i apply sorting on Month_no, months are getting sorted on order in edit initial view, but in dashboard when i bind month_name object to dropdwon box, sorting gets disturbed.(it sorted on text, like August, April...) my data source is s4 hana view. please help me to resolve this in design studio level.
Hi
I've managed with below code.
var v_month = ["January","February","March","April","May","June","July","August","September","October","November","December"];
var v_year = Convert.stringToInt(APPLICATION.getInfo().dateNowInternalFormat.substring(0,4));
var v_mon = APPLICATION.getInfo().dateNowInternalFormat.substring(4,6);
var var_fp =Convert.stringToInt(v_mon);
if (Convert.stringToInt(DROPDOWN_1.getSelectedValue()) < v_year)
{
var_fp = 12;
}
else{var_fp=Convert.stringToInt(v_mon);}
DROPDOWN_2.removeAllItems();
var str = "";
v_month.forEach(function(element, index) {
if (index < var_fp){
DROPDOWN_2.addItem(index+1+"", element);
str=str+index+",";
}
});
DROPDOWN_2.setSelectedValue(str+"");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mustafa,
Thanks for reply,
It is S4 hana CDS view and its custom view.
could you put some light on how to get single dimension with key and text in s4 hana CDS custom view for month object in order to sort the month in dropdown box.
Tx,
kaka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here are some relevant links:
https://blogs.sap.com/2018/03/18/create-an-analytical-model-based-on-abap-cds-views/
Hi Kaka,
The problem is that your key and text values for month are separate fields, so when you bind Month to the dropdown box, there is no way to associate the Month No key for sorting purposes.
What type of view is your S4 HANA data source: a CDS view or a Calculation View? Is it one of the standard S4 HANA virtual data model views, or is it a custom view. If it is the latter then the view has been modelled incorrectly. Instead of modelling Month No and Month as separate fields, only a single dimension should be modelled with key and text associated.
Regards,
Mustafa.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
71 | |
10 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.