Skip to Content
0

Change Date Format to User's Locale in Design Studio 1.6

Apr 19 at 06:46 PM

207

avatar image

pic-1.jpg pic-2.jpg

Hello,

I am having a requirement to change the Date format according to user's locale in Design Studio.

I have defined a variable of type "String" in Global Script Variables of my Design Studio Application which is exposed as URL Parameter.

I am passing a date range in this URL parameter from Web Dynpro Application in a range in the format MM/DD/YYYY - MM/DD/YYYY e.g. 4/19/2018 - 12/31/2018.

This Is later assigned to a Bex variable (of the type interval) -

4/19/2018 - 12/31/2018 .

Now when user changes the language from browser to English UK or German DE then this gives an error message that "Value 4/19/2018 - 12/31/2018 is not a correct value ".

This Design Application is opened in a separate browser Window when a button is clicked in Web Dynpro application. User is changing language in browser window where Design Studio application is opened.

Please help if this problem can be solved? Is there any way in Design Studio application to convert it into user Locale?

pic-1.jpg (84.1 kB)
pic-2.jpg (81.5 kB)
10 |10000 characters needed characters left characters exceeded

Have you considered using the translation management tool - please see Harjeet's blog https://blogs.sap.com/2015/12/30/multilingual-design-studio-application-using-translation-management-tool/

0
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Mustafa Bensan Apr 20 at 12:39 PM
1

Hi Harry,

On further thought, I suggest you try the following code:

APPLICATION.setVariableValueExt("D0COMP_COD_CDOOI", X_COMP_CODE);
APPLICATION.setVariableValueExt("DDBG_CDOOI01", X_DBG);
var d1 = Convert.subString(X_CH_ON, 0 , 8);
var d2 = Convert.subString(X_CH_ON, 11 , 19);
DS.setFilter(<Date Dimension>, {"low": d1, "high": d2});

Regards,

Mustafa.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Dear Mustafa,

Thank You

This will then remove the possibility to enter another value of date or remove the Date values from variable.

Is there any possibility to use the Bex Variable of Type Selection Option? I created one but not sure how to pass two values of d1 and d2 to it in Design Studio.

var d1 =Convert.subString(X_CH_ON,0,8);
var d2 =Convert.subString(X_CH_ON,11,19);


pic-4.jpg (63.0 kB)
0

Hi Harry,

Unfortunately, I haven’t managed to find a range syntax that will work with a Selection Option BEx Variable. Going by some other older posts it seems there is a possibility this might not be supported in Design Studio but I can’t say for sure.

I’ll let you know if I find something concrete. There might be a mention of it in the Product Availability Matrix for Design Studio.

Regards,

Mustafa.

0
Mustafa Bensan Apr 19 at 10:44 PM
0

Hi Harry,

I am guessing you are using setVariableValueExt() to set the BEx Variable. If so, I suggest you use setVariableValue() instead and pass the date range in internal format.

Regards,

Mustafa.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Dear Experts,

Can any one help me with format to Pass Values to Bex Variable of the type Selection Options? Couldnt find it any where.

I am trying to pass two Dates D1 and D2 with Between Option in Design Studio to a Bex Variable.

pic-4.jpg (63.0 kB)
0
Harry S Apr 20 at 10:23 AM
0

Dear Mustafa,

Thanks for your response. I tried as suggested above however the value is not passed to the bex variable. Do i need to split before assigning the range to bex variable ?

I tried splitting the values in Design Studio and assign it to Bex Variable ( range type), However, didnt work. It is working if I pass only one value.

CASE 1

APPLICATION.setVariableValueExt("D0COMP_COD_CDOOI", X_COMP_CODE);
APPLICATION.setVariableValueExt("DDBG_CDOOI01", X_DBG);
var d1 = Convert.subString(X_CH_ON, 0 , 8);
var d2 = Convert.subString(X_CH_ON, 11 , 19);
APPLICATION.setVariableValue("D0CH_ON_CDIOI01", (d1+ "-" +d2));

this doesn't pass value to Bex Variable

Case 2

APPLICATION.setVariableValueExt("D0COMP_COD_CDOOI", X_COMP_CODE);
APPLICATION.setVariableValueExt("DDBG_CDOOI01", X_DBG);
var d1 = Convert.subString(X_CH_ON, 0 , 8);
var d2 = Convert.subString(X_CH_ON, 11 , 19);
APPLICATION.setVariableValueExt("D0CH_ON_CDIOI01", (d1+ "-" +d2));

this doesn't pass value to Bex Variable

CASE 3

APPLICATION.setVariableValueExt("D0COMP_COD_CDOOI", X_COMP_CODE);
APPLICATION.setVariableValueExt("DDBG_CDOOI01", X_DBG);
var d1 = Convert.subString(X_CH_ON, 0 , 8);
var d2 = Convert.subString(X_CH_ON, 11 , 19);
APPLICATION.setVariableValue("D0CH_ON_CDIOI01", d1);

With this one I can see the Date value as per User setting.

So, struggling to pass the Date Range.


pic-3.jpg (70.5 kB)
Share
10 |10000 characters needed characters left characters exceeded