Blog

Home / Archive by category "Blog"

UI5: Refresh sap.m.table when using JSON Model

This was a little command that had me stumped for while.  Like I mentioned in my previous posts, I was building a detail screen.  I had the data, and I dynamically built a table and I was able to bind it and get my model displaying in it.  Seemed like I was home free.  However, when I would back out and select another entry in my table to see the details, my tables were not refreshing.  They continued to show the same data, over and over again.  I searched the blogs and finally figured out what I was missing.

 

list.getModel().destroy();

list.bindAggregation(“items”, “/”, colIt);

list.setModel(oModelTab);

I needed to perform these 3 commands (I was missing the destroy for a while).

List is my table, colIt was my column list item that I created earlier.  Once I executed all three of these commands, my table is refreshing exactly like I needed.

Thanks for reading,

UI5: OData read parameters

This one was fun…  Like I mentioned yesterday, I was calling a separate OData service for my details.  Because the list could be long, I didn’t want to call this service for every item on the list.  Instead I chose to run it on-demand.  The trick was that I needed to be creative in my call of this service.  It had multiple expands, a filter and of course I didn’t want it to display the detail page until the service was complete.  So, here is what I did:

var mParameters = { var mParameters = {
filters: oFilters,
urlParameters: {
“$expand”: “Exp1,Exp2,Exp3…,Expn” },
success: function(oData, oResponse) {
oNotDet.setData(oData);
oView.setBusy(false);
sap.ui.getCore().setModel(oNotDet, “notdet”);
var bReplace = Device.system.phone ? false : true;
that.getRouter().navTo(“object”, {
objectId: oItem.getBindingContext().getProperty(“Qmnum”)
}, bReplace);
},
error: function(oError) {
jQuery.sap.log.info(“Odata Error occured”);
oView.setBusy(false);
}
};
oView.setBusy(true);
oModel.read(“NotHdr”, mParameters);

The big things to notice here:

Populate your filters before adding them to the parameters (this just makes it cleaner)
Enter in your urlParameters
Success function will navigate to the new view.  This makes sure the data has been received before the new view is displayed.  In my case this was required because the fields displayed were dependent on the data of the detail service.
Finally, I set the view to busy before calling the read statement, then the sucess/failure will change the setBusy to false.

Hope this is useful.  Thanks for reading,

UI5: Setting a different model within a view

Here was my scenario: I had a UI5 table that called a model.  The model had a list of notifications along with some additional information.  If you click on one of the lines, it would bring up another view, that showed all the details of the model.  The OData service for the details was a different call than for the table.  So for the new view, I needed to set a new model.  I was able to pull the data into my view within the components, but making it available on the XML was another story.  Here is what I finally did:

  1. On the detail view I added the following to a routine that gets called every visit to the view (do not put this in OnInit, or it will only be called the first time).
    1. var oViewModel = sap.ui.getCore().getModel(“notdet”);
    2. this.setModel(oViewModel);
  2. Then in the XML, I was able to use the following syntax:  {/results/0/NotifNo}
    1. for me, it was treated like an array with only one value coming back.  so I explicitly set it to 0.

I hope this can save some headaches for someone else.  I won’t soon be forgetting this.

Thanks for reading,

Juggling Priorities

Wow, it’s crazy how quickly time slips by.  I just noticed that it’s been almost a month since my last post.  Between a busy consulting engagement and some renewed interest in UI5, I realized that something can quickly be forgotten, including good habits.

It can become an easy excuse that I was too busy, or something kept “coming up”, but the reality is that we all choose our priorities.  We determine what is most important, what we want to spend our time on, and what gets our focus.  For me, I can say that I would like to have been writing more, but I realized that the past month has been spent working on some pet passions.  The biggest of those is my family, so I have no regrets.

This post is mostly to say hello and let you know that more posts will be coming soon.  In particular, I expect some stuff about UI5, as I overcome some obstacles that have been bugging me for a couple weeks now.  It’s also to remind you to consciously choose your priorities.  Often they can get chosen for you if you aren’t paying attention.  Always make sure that things like health and family take priority.  The other stuff will work itself out 🙂

thanks for reading,

 

Better Sleeping

I know this has nothing to do with business or software, but I just had to share this.  I’ve been having neck issues for the past couple months.  I’ve tried massages, chiropractors, new exercises, no exercises, but at the end of the day, I found myself every day with the same issue.  I happened to be talking to my good friend Justin a week ago, and he mentioned that I should check out a guy called Kelly Starrett and his Mobility project.  Basically, he’s been putting out videos for a while in the form of a challenge.

I started to scanning through some of them (there are quite a few) and isolated the ones talking about the neck.  Well, one of the first ones I found made a huge difference.  Sleeping: neck and Shoulders and pillows.

Well, the gist of this, is that if you want to protect your neck while sleeping, you need to kinda roll up a pillow and have it under your neck.  Otherwise you end up hunched over and just when I stopped to think about it, it’s exactly what I’ve been dealing with at night.  The first night I did it, I woke up pain free.  Unfortunately, my daily routine found the pain again later that day…  but by following this, I woke up feeling much better.  I’m still experimenting with the best combination of pillows, so I’m not there yet…  but it has certainly made a difference.  Now I’m finding that my day to day life is also aggravating my neck… so I’ll need to spend more time in this area…

Anyway, I just wanted to share it.

Thanks for reading,

Variant Configuration – My 6th E-Book

It’s hard to imagine that I’ve written 6 books now.  While the formatting portion is getting manageable, I certainly won’t say it comes easy to me.  However, it is very satisfying when I finally finish it and see that people are buying it.

My latest book has gone away from Service Management, and instead goes into my other SAP passion of Variant Configuration.  Yes, SAP Press has a book out about Variant Configuration, and I’m sure it is good.  But what I really wanted to do was put together a book that helps you model.  So this book, like my others, goes into all the nuts and bolts of each different screen and transaction.  But the real value, I think, is that I focus a lot on HOW to build up that model.  In my years of SAP, it’s easy enough to look at google, or do some trial and error.  But there was never a reference that would help me pick the best method…  there is also nothing out there that I’ve found that tells you to expect to model the same product multiple times.  ha ha ha.  If any of you have modeled in VC, you know this is often true.

Anyway, I hope you check it out.  If you do, please let me know what you think.

SAP Variant Configuration: Your Successful Guide to Modeling

Thanks for reading,

Happy 7th Birthday Alex!!!

I can’t believe it’s been 7 years since my little guy was born.  It’s been great watching him grow into the little man he has become.

Anyway, not much else to say, except I am one lucky man.

thanks for reading,

Service Management – Using the Install Base in ECC

In my travels, one of the things that companies are often looking for is an install base of their products.  It seems that the natural solution to this is using the SAP install base transactions.  After all, it is the perfect place to group things together.  You can group equipment, materials, even documents, functional location or other install bases.  So, why not use it?

Here are a couple of the major issues associated with using the Install Base within ECC.

  1. You can assign partners and partner functions.  This is standard in functional locations, but not in the install base.  A simple work around is using the external ID to become the partner number.  You would have to explicitly define your approach to say that there is an install base for each ship-to party, for example.  Not the end of the world, and this work around has been proven to work at multiple clients.
  2. There are no BAPI’s to install or dismantle components from the install base.  For this reason, I built that functionality into my Renovation product.
  3. There are no BAPI’s to create or change an install base header.  For this reason, I built that functionality into my Renovation product.
  4. There is no standard way to automatically update the install base when you ship out a new product, or receive a return of a product.  For this reason, I built that functionality into my Renovation product.  It usese a background job to collect all the specific material movements that should be tracked.
  5. There is no way to know if your end user has moved or got rid of products.  There is no fix for this.  Short of adding an IoT sensor to everything you sell, you will most likely never know what a customer does with your products.  It’s just something that will always be incomplete.
  6. Poor standard reporting.  Like many other areas of service, the reporting just doesn’t meet expectations.  This why I’ve  built a few additional reports into Renovation to make it easier to search install bases and quickly see all the products, along with warranty dates and other key information.

If you use the ECC install base today, I’d love to hear how you tackled some of these challenges.  If you would like to use the install base, but just see too many technical hurdles, let me know.  I’d love to show you what Renovation can do to help.

Thanks for reading,

ABAP – S/4 – If Line_exists

Here’s another new one I discovered.  How often you do write a few lines of code to check if something exists?  For example, a common thing I do is look for an entry in a table?  If it’s there, I need to do something, if not, I move on. For example:

read table Lt_test transporting no lines with key key1 = val1 key2 = val2.

if sy-subrc = 0.

else.

endif.

Well, in S/4, that has been condensed.

if line_exists( lt_test[key1 = val1 key2 = val2]).

else.

endif.

you get to skip the read statement.  Now, if you need the contents, this might not help as much, since you would need to extract that line anyway, but if you are purely looking for the existence, then it’s a lot cleaner.

Thanks for reading,