Business

Home / Archive by category "Business" (Page 4)

UI5 – ValueHelpRequest with the storage functionality

Well, for those of you that don’t really care about the technical nuances of UI5, you’ll be happy to know that I can give it a rest for a bit after today.  Now, this took me way more time than it should have.  I kept looking for elegant solutions to solve this, and at the end of the day, I really should have just kept it simple (it’s ultimately what worked).  So, the issue with the valuehelprequest is that it doesn’t send back a text value, rather it sends back and object.  This object has Tokens and other pieces.  Well, since I”m using the storage method to save this to the browser so it can be saved for the user, storage can NOT write an object.  It pretty much has to be JSON text.  It initially took me some time to figure out why it stopped saving anything to my browser.  Once I finally figured out the cause, then I went into solution mode.

My first idea (that spent entirely too much time on) was to build a simple JSON model and assign that model to my storage object.  Well, I didn’t really think it through, since a JSON model is an object itself…  but I tried for a while with arrays, JSON, etc…  Needless to say, this approach did not work for me.  Finally, I decided to just convert it to a text string.  Even this took a little time, since I needed to figure out keys to use in order to be able to read it back without the possibility of random data screwing it up (and it could still happen… but it’s at least unlikely).

So, I chose to capture it in the following format:

Key%%%Text;;; Key%%%Text;;;  for as many search criteria as the user entered.

Then, when I come back, I can read the method I wrote about yesterday to get all the values I needed to create a filter or to re-write the values into the input fields.  I used a simple while loop to get it back:

iLen = val.length;
while (iLen > 0) {
iEnd = val.indexOf(“%%%”);
sKey = val.slice(0, iEnd);
val = val.slice(iEnd + 3, iLen);
iEnd = val.indexOf(“;;;”);
sText = val.slice(0, iEnd);
val = val.slice(iEnd + 3, iLen);
iLen = val.length;
// call my method from yesterday’s post
oTok = ProxProdSup.util.Formatter.getFilters(sKey, sText);
//  then either create tokens for the input field or create filters.

Thanks for reading,

UI5 – Translating the ValueHelpRequest into filters

I’ve been talking a lot about this lately, because quite frankly, I feel like I fought really hard to figure this out and I couldn’t find anything online to really help me out.  So today, I’m gonna talk about converting the valuehelprequest output into something I could use to create filters.  A little background first.  I have a settings page that has a bunch of possible filters for my master/detail list.  I pull my list, then I can apply these filters.  Well, up till now, everything has been a straight single value text or date input.  Now, suddenly with this new trick, I could have multiple values, and I could have exclusions, or other operations.  The thing that sucks, is that these do NOT seem to automatically translate into something the filter could read.  So I needed to spend some time to see what all the options were.  At the end of the day, here’s what I came up with:

I’ll talk a little about what’s going on, then you can read the code for yourself.  I played with the help request and I found 10 distinct scenarios that I needed to account for.  Then to either recreate a token (I’ll talk about this challenge tomorrow) or to apply it to the filter, I needed 4 additional values that I couldn’t extact from the token.

First off, the token provides you to pieces of data (at least that you can easily get to).  Key & Text.  Now, the interesting thing is that in most of the operations, Text contains all of the details.  Let me show what each thing looks like:

  1. Equal to a value has 2 options:
    1. key: 1000, text: is just a description
    2. key: range_X, text: =1000 (this means that the value is 1000)
  2. Next, the exclusion.  Key: range_X, Text: !(=1000)
  3. Less than: Key: range_x, Text: <1000
  4. Less than equal to: Key: range_x, Text: <=1000
  5. Greater than: Key: range_x, Text: >1000
  6. Greater than equal to: Key: range_x, Text: >=1000
  7. Starts with: Key: range_x, Text: 1000*
  8. Ends with: Key: range_x, Text: *1000
  9. Contains: Key: range_x, Text: *1000*
  10. Between: Key: range_x, Text: 0000…1000

The following code is just using some string comparisons to figure out which case, then get the values needed for filtering & token recreation. (I apologize for the formatting, but you get the idea).  At the very end, I’m just returning a simple object with the list of fields I need to extract.  Otherwise, it’s just a bunch of imbedded if/else statements.

var iLen, iStr, iEnd, sOp, sVal1, sVal2, sEx;
iLen = sText.length;
// total of 10 scenarios
// if sKey contains range_ then need to check for operations
// 1. else, return rSign = EQ, sVal1 = sKey, sVal2 = “”
if (!sKey.match(“range_”)) {
sOp = “EQ”;
sEx = false;
sVal1 = sKey;
sVal2 = “”;
}

// next check for different cases
if (sKey.match(“range_”)) {
// 1. alternate method for EQ single value
if (sText.startsWith(“=”)) {
sOp = “EQ”;
sEx = false;
sVal1 = sText.slice(1, iEnd);
sVal2 = “”;
} else {
// 2. NE sText[1] = !
if (sText.startsWith(“!”)) {
iStr = 3;
iEnd = iLen – 1;
sOp = “NE”;
sEx = true;
sVal1 = sText.slice(iStr, iEnd);
sVal2 = “”;
} else {
// < or <=
// 3. sText[1] = < and sText[2] != “=” then LT
if (sText.startsWith(“<“)) {
iStr = 1;
iEnd = iLen;
sOp = “LT”;
sEx = false;
sVal1 = sText.slice(iStr, iEnd);
sVal2 = “”;
} else {
// 4. sText[1] = <, sText[2] = “=”, then LE
if (sText.startsWith(“<=”)) {
iStr = 2;
iEnd = iLen;
sOp = “LE”;
sEx = false;
sVal1 = sText.slice(iStr, iEnd);
sVal2 = “”;
} else {
// > or >=
// 5. sText[1] = > and sText[2] != “=” then GT
if (sText.startsWith(“>”)) {
iStr = 1;
iEnd = iLen;
sOp = “GT”;
sEx = false;
sVal1 = sText.slice(iStr, iEnd);
sVal2 = “”;
} else {
// 6. sText[1] = >, sText[2] = “=”, then GE
if (sText.startsWith(“>=”)) {
iStr = 2;
iEnd = iLen;
sOp = “GE”;
sEx = false;
sVal1 = sText.slice(iStr, iEnd);
sVal2 = “”;
} else {
// * or *X* or X}
// 7. sText[1] = *. then EndsWith
if (sText.startsWith(“*”)) {
iStr = 1;
iEnd = iLen;
sOp = “EndsWith”;
sEx = false;
sVal1 = sText.slice(iStr, iEnd);
sVal2 = “”;
} else {
// 8. sText[1] != *, if sText[length] = * then StartsWith
if (sText.endsWith(“*”)) {
iStr = 0;
iEnd = iLen – 1;
sOp = “StartsWith”;
sEx = false;
sVal1 = sText.slice(iStr, iEnd);
sVal2 = “”;
} else {
// 9. sText[1] = *. sText.endsWith(*)
if (sText.startsWith(“*”) && sText.endsWith(“*”)) {
iStr = 1;
iEnd = iLen – 1;
sOp = “Contains”;
sEx = false;
sVal1 = sText.slice(iStr, iEnd);
sVal2 = “”;
} else {
// 10. if “…” then between BT
// sVal1 = everything before …
// sVal2 = evertoToken after …
if (sText.match(“…”)) {
iStr = 0;
iEnd = sText.indexOf(“…”);
sOp = “BT”;
sEx = false;
sVal1 = sText.slice(iStr, iEnd);
iStr = sText.lastIndexOf(“…”) + 3;
iEnd = iLen;
sVal2 = sText.slice(iStr, iEnd);
}
}
}
}
}
}
}
}
}
}
}
var aTok = {
key: sKey,
text: sText,
op: sOp,
exclude: sEx,
val1: sVal1,
val2: sVal2
};
return aTok;

Thanks for reading,

UI5 – Dynamically call ValueHelpRequest functionality

As promised, this is a continuation of yesterday’s post.  So to recap, I was able to use the code from SAP to recreate their example, and convert it to use my service.  This was the first hurdle, but certainly not the biggest.  Now that it worked in a very simple, static way, I needed to add it to my dynamic application.  By that I mean, my input fields are all created in the controller based on a custom table.  The table defines the fields to add on the fly.  This means that assigning the valueHelpRequest needed to be just as dynamic.  Here were the gotchas:

  1.  calling the method to call the valuehelprequest had to be done in-line.  Because the method for valueHelpRequest happens during the creation of the element, the input field doesn’t “technically” exist as it is being called.  So I needed to write this method as a function within the creation of the MultiInput element.  See below for a code example:

***********************************************************************************************

var that = this;
oLayout.addContent(new sap.m.MultiInput({
maxLength: 20,
enableMultiLineMode: true,
valueHelpRequest: function(evt) {
var sSearch, sDesc;
var sField = evt.getSource().getId();
this.theTokenInput = sap.ui.getCore().byId(sField);
this.theTokenInput.setEnableMultiLineMode( sap.ui.Device.system.phone);
this.aKeys= [“Key”, “Desc”];
// this.theTokenInput.setTokens(this.aTokens);
var oConfig = sap.ui.getCore().getModel(“config”).getProperty(“/results”);
for (var j = 0; j < oModel.length; j++) {
if (oModel[j].Field === sField) {
sSearch = oModel[j].SearchHelp;
sDesc = oModel[j].Descr;
}
}
this.aItems = sap.ui.getCore().getModel(sSearch).getProperty(“/results”);

sap.ui.controller(“ProxProdSup.view.Settings”).onValueHelpRequest(this.theTokenInput, this.aKeys, this.aItems, sDesc);
},
id: oModel[i].Field,
})
);

**********************************************************************************************

please note, in my example above, I have a model with the field name, description and the help service to call..  Also, this all occurs within the Settings view.  I still need to make some small adjustments to allow this to happen in any of my views.

the method onValueHelpRequest was my next obstacle, but relatively easy once I figured out what each piece of the code was doing.  Most of it was copied directly from the UI5 example (see yesterday’s post if you can’t find it yourself).  Minor tweaks, but nearly all of the code is the same except for hardcoded values (like company code are changed to variables).

So far so good…  I know had a working and dynamic search help.  However, it still didn’t do much.  I needed to update my filter code to interpret these new things called tokens (which lead to some strange dumps and a few infinite loops along the way…)  I’ll talk about those next week.

Thanks for reading,

SAP and Apple – What does this mean?

Now, when I first heard the news that SAP and Apple were going to partner up, I was a little confused.  In my brain, I know that every partnership needs to provide a win-win, otherwise why bother doing it.  So I started chatting with my buddy Jeff to see if I could figure out the “Why” of this deal.  Now, in my eyes, I clearly see why Apple wants it.  Apple already makes one of the most dominant mobile platforms out there.  Let’s face it, the number or iPhones, iPads, iWatches etc. is staggering.  What Apple hasn’t fully dominated “yet” is the business world.  While everyone may have an iPhone, it isn’t always the corporate standard.  So often you either have to bring your own device, and fight with IT to support all of the business apps you need to run, or you carry 2 phones.  Now, with SAP’s dominance in the business world, it makes a great fit for Apple.  They suddenly look like the SAP preferred vendor, so it increases their chances of becoming the corporate standard device.  What do they really need to give up?  an SDK? some native apps?  Of course this is a win for Apple.

Now, where I still struggle is what’s in it for SAP?  now, I’m still working my way through the mobility class in OpenSAP, so I might be missing something (and I’d love to hear from anyone that could clarify it).  SAP has invested HEAVILY in the whole new UI5, Fiori, Persona’s etc.  So they are working to rebrand their tired old look.  In the exercises I’ve done for the class, I’ve been able to make my apps work on Apple devices without any issues.  I think there are some additional hoops (like needing to be an Apple Developer) to do some of the advanced stuff, and there isn’t an SDK readily offered by Apple, like there is with Android.  However, when I read the stories, it sounds like SAP is planning to do more with native apps on Apple.  I guess this confuses me because why go to Native when you can do a Hybrid application?  And especially when SAP has invested a lot of time and effort into developing this whole platform.  While native “might” be better, it is also a lot more effort to design the same thing on multiple platforms.  I personally was very impressed with the Hybrid model because now I could develop something once that is responsive, works on the browser, iOS, Android, and Windows.

I’d love to hear your take on the whole thing.  Is native really that valuable?  Is there something in this for SAP that I’m missing?

Thanks for reading,

UI5 – Using the ValueHelpDialog

Well, as usual, this adventure took a lot longer to figure out than I expected.  I walked into this thinking, I just want to add the equivalent of F4 to my UI5 application.  It took a little digging to find the “right” way to do this.  The first method I found was this:

http://scn.sap.com/blogs/ui5-for-abap/2013/06/25/how-to-implement-value-help-f4-with-sap-ui5

I was excited, this step by step would be perfect.  However, during one of my OpenSAP classes, they talked about NOT using the sap.ui.commons library, as it is no longer being enhanced.  So, short story, I found a way, but it wasn’t really the smart way to implement going forward.  Luckily for me, the service on the backend of the gateway was pretty straightforward.  I decided to create 2 examples.  One for plant and one for order type.  This way I could test how dynamic I could make this…  But I’ll talk more about that in another post.  Today, I just want to talk about getting the ValueHelpDialog working in a static method.  This took more effort than I expected.  I finally found an example in the UI5 library to get me started.

https://sapui5.netweaver.ondemand.com/explored.html#/entity/sap.m.MultiInput/samples

So, I set and mimicked this example.  One of the big things, don’t forget the “sap.ui.comp” library.  I fought weird syntax errors until I figured it out :).  Once I got their JSON example working in my model, I began to deconstruct it, at least enough to input my own gateway model into the results, change the table etc…

Tomorrow, I’ll take about making it dynamic…  this took way longer than I expected, but only because I keep adding new functionality…  more tomorrow.

Thanks for reading,

ERP in the Cloud? is SAP too late to the game?

I was recently chatting with someone, and they asked me if I had heard of a company called RAMCO ERP.  I hadn’t, so I took at their website.  It’s quite an impressive landscape they offer, and it’s totally on the cloud.  They appear to have taken the pain out the transactions.  They allow you to email in a request, and convert it (much like an Idoc) into a transaction.  They focus being adaptive, totally cloud based and obviously mobile.  So this begs the question, if they already have this platform up and running (and according to what I read in their website they do), is SAP too late to the party???

Well, the obvious answer to the question is, “it depends”.  Being a consultant, I still love this answer, because it’s usually true.  So, here is how I see it.  If you are a new enterprise and you have the choice between a solution built in the cloud, for the cloud, adaptive to the business and more, or you could just the industry giant that was built on-premise, and is moving that large system to the cloud…  who would you choose?  Now, I love SAP.  I wouldn’t be where I am today without their software, but I’d choose the cloud in a heartbeat and here’s why.  If I’m a small business, I want a small footprint, I want easy transaction strings, I want everything configurable, and want things to look nice…  not like the 1970’s gray screen that’s been cleaned up.  Now, let’s look at the flip side of this question.  I’m a company that already uses SAP, but I want to roll things out to my smaller divisions, well, I would clearly stick with what I know.  It already manages the rest of my business and want everything to communicate seamlessly.

So, I guess the answer is that SAP isn’t too late to the party…  but they hurry up and get there before all the cake is gone.  Companies like RAMCO have the opportunity to really cash in on the small to midsize market because I’m guessing the price tag is probably south of SAP and I’m guessing the processes are not nearly as strict as you typically see in SAP.  I’m very curious to see where Cloud ERP goes, and who starts making a real showing.  I’m personally thinking I need to look closer at what RAMCO does in the service world.  It could be a natural evolution for me 🙂

Thanks for reading and as always, I’d love to hear you thoughts on this trend,

Happy Memorial Day

Being a former military person, this day still holds special fondness for me.  Not because of my own service, but because of seeing and knowing how much others have sacrificed.  One of the very important things to remember is that it doesn’t matter how you feel about war, or how you feel about our country being involved in the conflict.  Always remember, anyone in the military has volunteered to serve our nation.  It’s the politicians that decide who we go to war with and where we send our soldiers.  They simply follow orders and risk their lives.  Do NOT confuse the soldiers with the political agenda of wars, conflicts or actions.  The soldiers still deserve our respect and gratitude.  Save your disdain for the politicians.

If you see any military people, be sure to tell them thank you.  Maybe buy their coffee, or do whatever.  But let them know you appreciate their service.

Thanks for reading,

Gateway Services – Post Issues

Well, it pays to test everything.  I had all my operations working just fine, then I went and refreshed my test system, along with all my little settings.  Well, needless to say, I missed something.  in my EHP7 system, I created my SICF service exactly the same as my ECC 6.0 system.  Unfortunately, this doesn’t work the same.  If you are having issues getting your post to work because of your CSRF token, be sure to check the following:

  1.  Make sure that you do NOT have a user name/password set in the service. This will stop tokens from being generated, so no PUT or POST statements will work.

Once I found that, I ran into one other issues.  I was getting an error message pointing to SM21.  It turned out, in my random experimenting to the fix the previous issue, I turned on the GUI settings to active.  This causes errors for gateway services.  Be sure this is set to no value.

Hope this helps you,
Thanks for reading,

SAP UI5 Mobile – Getting the Emulator to Work

Today, I ran into yet another struggle.  I guess this is what happens when you take a class that is a year old.  When technology keeps changing but documentation doesn’t keep up.  Well, today, I got as far trying to run a test app on an Android emulator.  After my struggle with getting the Hybrid Application Toolkit up and running, I should have expected this.  Well, now I was able to get things running.  Running it on an Android Emulator was an option.  However, it would compile for a while, then just die.  As I started digging through the log, I finally found it was having trouble launching some Nexus device.

I dug through the documentation, and unfortunately, the version of Android studio used a year ago looks very different than the version I installed.  Go figure.  The fix…

you must start a project, or open a project in order to get the AVD (Android Virtual Device) manager.  Once you can get into the device manager, I found that the default device was missing some prerequisites.  I deleted the existing device, and recreated it.  It told me what component I was missing.  I installed it, and now the emulator fires up, no problem. (well, except for some new authorization issue on the device for my application.  It’s always something, but I’m making progress.

thanks for reading,

Mobile UI5 – Registration

Well, I’m making good headway, but I’m finding that this OpenSAP class isn’t as good at walking you through if you are a newbie (like I am).  Last night, I spent way too much time trying to get past the registration screen on my application.  I kept entering in my HCP password, and it kept telling me there was  registration error.

I finally discovered that you can’t access hcpms (hana cloud platform mobile services) unless you add the add specifically to HCPMS.  Cool, now I come to find that this name has changed on the application.  It used to be Mobile Services, it has now been renamed to Development and Operations.  Thanks for the heads up SAP.  Anyway, I’m back in business.

I hope this little tidbit might help you if you are new to the mobile arena as I am,

thanks for reading,