Quantcast
Channel: ABAP Development
Viewing all 948 articles
Browse latest View live

EXCEL With XML

$
0
0

Hi Friends

 

I would like to share some knowledge on how to generate an EXCEL file with designs and features of our interest.

 

I am working for a manufacturing company that naturally concentrates on dealers.So we have to develop applications that allow dealers(users) to upload and to download huge amount of data of various kinds in database/local system.

 

This is the reason we have to provide the provision of uploading and downloading excel sheet.I came across this method of creating an excel file and felt it as very helpful and easy to use.

 

Navigation guide
Introduction To Interface
        Document Creation
Properties Creation
         Column Creation
           Data Passing
            Downloading
             Uploading
              Examples

 

Introduction To Interface


The Interface we use to design Excel using XML is IF_IXML_ELEMENT.

 

Read following link to understand this interface in detail:SAP Library - XML- Library

 

 

 

Document Creation


A) The code shown below is a default code is written to create an excel document using XML method in ABAP.


a) Creating the DOM Object Model.


   l_document = l_ixml->create_document( ).


b) Create Root Node Workbook.


   l_element_root  = l_document->create_simple_element( name = 'Workbook'  parent = l_document ).
   l_element_root->set_attribute( name = 'xmlns'  value = 'urn:schemas-microsoft-com:office:spreadsheet' ).


c) Create Name Space for spread sheet.
  

   ns_attribute = l_document->create_namespace_decl( name = 'ss'  prefix = 'xmlns'  uri = 'urn:schemas-microsoft-com:office:spreadsheet' ).
   l_element_root->set_attribute_node( ns_attribute ).


d) Create Name Space for excel.


   ns_attribute = l_document->create_namespace_decl( name = 'x'  prefix = 'xmlns'  uri = 'urn:schemas-microsoft-com:office:excel' ).
   l_element_root->set_attribute_node( ns_attribute ).




Properties Creation


B) To set the properties like font size,styles,alignments,protection etc...we have to use following code.



a) Create node for document properties.
  

   r_element_properties = l_document->create_simple_element( name = 'TEST_NODE'  parent = l_element_root ).
   l_value = sy-uname.
   l_document->create_simple_element( name = 'Author'  value = l_value  parent = r_element_properties  ).



b) Creating Styles.


   r_styles = l_document->create_simple_element( name = 'Styles'  parent = l_element_root  ).


  • Style with ID as 'Header'


   r_style  = l_document->create_simple_element( name = 'Style'   parent = r_styles  ).
   r_style->set_attribute_ns( name = 'ID'  prefix = 'ss'  value = 'Header' ).


Cell Output Representation:

 

Header

 

 

c) Setting Cell color with style 'Header'.

  • We can set the interior color of a cell.
  • We have options of Pattern for the color as Solid,stripes etc.
  • In below example we use SILVER color code.
  • And color 'Pattern' is 'Solid'. 


Example:

r_format  = l_document->create_simple_element( name = 'Interior' parent = r_style  ).
r_format->set_attribute_ns( name = 'Color'   prefix = 'ss'  value = '#C0C0C0' ).
r_format->set_attribute_ns( name = 'Pattern' prefix = 'ss'  value = 'Solid' ).


Cell Output Representation:

Exterior colour.PNG

Solid Sliver Cell

Horzstripes cell.PNG

Horizontal Stripes Cell




d) Setting Font style of 'Header'


  • We can set the font size by using IDs Bold,Italic and Underline.
  • If value = '1' then the font style will be applied.
  • If value = '0' then the font style will not be applied.
  • Text color also can be specified with ID = 'Color' and value = 'HTML color code'.
  • In our below example we have Color code for 'RED'.


Example:

r_format  = l_document->create_simple_element( name = 'Font'  parent = r_style  ).
r_format->set_attribute_ns( name = 'Color'   prefix = 'ss'  value = '#FA0606' ).
r_format->set_attribute_ns( name = 'Italic'  prefix = 'ss'  value = '1' ).


Cell Output Representation:

Interior colour.PNG

    Italic Red Text

Bold font.PNG

    Bold Red text



d) Alignment settings of 'Header'.


  • Horizontal and Vertical alignments of text can be set.
  • Here in below example we are setting horizontal alignment as 'Center'.
  • And vertical alignment is set as 'Center'.
  • 'Wrap Text' property is active as value = '1'.

 

Example:

r_format  = l_document->create_simple_element( name = 'Alignment'  parent = r_style  ).
r_format->set_attribute_ns( name = 'horizontal'  prefix = 'ss'  value = 'Center' ).

r_format->set_attribute_ns( name = 'Vertical'  prefix = 'ss'  value = 'Center' ).
r_format->set_attribute_ns( name = 'WrapText'  prefix = 'ss'  value = '1' ).


Cell Output Representation:



VH Center alignment.PNG

vertical =  'Center' and horizontal = 'Center'


VH right alignment.PNG

vertical =  'Center' and horizontal = 'Right'


 



















Australian SAP User Group Conference 2014

$
0
0

SAP Australia User Group Conference 2014 – Hilton Hotel, Sydney

 

image001.jpg

 

One thing that Australia has in abundance, apart from deserts and deadly wildlife, is SAP conferences. I was lucky enough to be presenting at the Australian SAP User Group conference in Sydney the other week, and I thought I would share some of the content from this event with you. In the past I have moaned and groaned and waffled on for ages about my dislike for blogs which purport to talk about SAP conference but which in reality talk about the food, and show pictures of dustbins, and list all the exciting cool people that the author met. Naturally this blog is going to be nothing like that.

 

Monday 8th of September

 

Upon arrival at the conference the first thing one’s eyes are drawn to is the exceptional quality of the dustbins. Set in a stunning silver style, with a crisp black bin bag, these beauties are capable of going from zero to sixty miles an hour in four seconds, if you were to throw one off a cliff.

 

Breakfast

 

To kick off the day we are served pigeon with warm foie gras, foie gras sorbet, beetroot, cocoa beans with a protruding pigeon leg immersed in Banyuls sauce. The unique pigeon taste and flavor blends well with the silken foie gras. For after’s we have a doughnut. This lavish fried treat is filled with Dom Perignon champagne jelly, and is topped with a 24-carat gold leaf, white chocolate flowers dusted in gold and edible diamonds.

 

International SAP Executive Update – Paul Young, GVP Customer Strategy, SAP AG

 

After having assorted top ten singles in the eighties such as “Love of the Common People” Paul Young then went on to become a high ranking member of software company SAP and became Scottish also. In this talk he brought to our attention that SAP have a product called HANA. To be serious for a second the main message here, which was to be repeated throughout the conference was that just doing the same thing as before really fast, whilst good, is not what HANA is all about. The point is to try and do things that you could not do before because they were in the “too hard” basket.

One interesting – and horrifying – theme that kept coming up throughout this conference is about how big companies want to get as much information about you as possible. The example given here was Disney theme parks where you buy some sort of wrist bracelet and if you wear it you get assorted benefits but in return the Disney corporation track you in real time and analyse everywhere you go and everything you buy, how long you stand in queues for certain rides etc.. A full scale 1984 type of thing and people are willing to pay to have this done to them.

The aim of the so called “big data” then seems to be to (a) predict what someone is going to do next with an aim to making money out of them and the next stage would be (b) to influence/control what someone is going to do next with the aim of making money out of them.

 

Next cab off the rank was Ray Wang, founder of Constellation Research. The previous keynote was naturally SAP focused, Ray talked in much broader terms about where technology is taking the world.

 

Morning Tea

 

To calm us down after the keynote speeches out comes an eel dish that reflects the so-called evolution technique, where the fish is cooked in two ways: as a slow-cooked technique requiring six and a half hours at 65 degrees, and the convention grilling. The dish is served with herbs, garlic and reduction sauce of eel juices and citrus, with potatoes coated with pepper powder on the side, and pan fried kangaroo loins.

There were a large number of SAP mentors in attendance at this conference, such as Graham Robinson, Jocelyn Dart, Professor Paul Hawking, Tony de Thomasis, and Greedy Smith from the pop group “Mentor as Anything”. Morning tea is a good opportunity to swap business cards with them and talk about HANA and UI5.

 

Next was a forty minute advert for IBM disguised as a keynote speech. The good thing about SAP conferences these days is that there is very little of this now, it used to be almost every speech was an advert at SAPPHIRE type events.

 

Then it was breakout time where you decide what you want to see. There were no less than five tracks, so you were spoilt for choice – you can always tell when a conference is going to be good when it is difficult to decide which presentation you want to see. I plumped for solution manager to start off with, and David Noack from SAP talked about how to best manage two major releases a year. I cannot talk for other companies, but where I work we put changes into production every week, so change management is more of an ongoing process than managing two great big big bangs each year.

 

Lunch

 

image002.png

 

The first day’s lunch consists of a sensational beef dish that comes from a 7-year-old dairy cow, which is slaughtered in front of our eyes and then cooked right on a table in the middle of the exhibitor hall on a hot stone. Once done, it is served with potato crisps, mushrooms and buttery bone marrow, with an accompaniment of tandoori crocodile, all washed down with port which has been guarded by eunuchs on top of a mountain in deepest Transylvania for 100 years.

 

I am a big fan of BRF+ so next I went to see Jocelyn Dart talk about why SAP has felt the need to have no less than three different business rules engines, and which one should you use. SAP is always doing this sort of thing, offering you multiple ways to achieve the same thing. In this case we have the ABAP based BRF+ which started life in Business One and is now part of the ECC 6.0 system, we have a Java based equivalent which uses technology acquired by SAP and naturally there is a HANA rules engine as well.

 

Then came what was for me the highlight of the conference which was Graham Robinson doing a session on UI5. He had no slides at all, he spent the whole time coding live, as he changed the code you saw what the result was in the UI5 application being played with. UI5  is not as scary as all that, once you get over the fact that you have to program the front end in JavaScript (a concept which makes traditional ABAP people shake with fear) things become a lot more straightforward.

 

Afternoon Tea

 

To complement the bowls of sweets we have chocolate made from Venezuela's rare Porcelana Criollo bean, topped with Tahitian Gold Vanilla Caviar and edible gold flakes together with vegemite on toast. Also we have Louis XIII de Remy Martin Cognac which comes in a hand blown sugar Fleur-de-Lis.

There were a large number of fictional characters from eth middle ages in attendance at this conference, such as Bill Brewer, Jan Stewer, Peter Gurney, Peter Davy, Dan'l Whiddon, Harry Hawke, Old Uncle Tom Cobley and all.Afternoon tea is a good opportunity to swap business cards with them and talk about HANA and UI5.

 

Then it was my turn to wow the audience with a talk on “secret” things you never knew were inside your SAP system. SAP used to have a split between new functionality delivered via enhancement packs, and bug fixes delivered via support stacks. Recently this has changed such that enhancements packs only come out every two years instead of annually, but in the meantime new functionality gets sneaked in via support stacks. Two examples are the ABAP Test Cockpit which came along as part of a support stack, and every support pack adds more tests to the code inspector, and the BOPF (Business Object Processing Framework) which is a major chunk of functionality which arrived via support stacks are opposed to being part of an enhancement pack.

 

To end the day we have another keynote, this time by David Roberts who is a top dog accountant at USA Company “Under Armour”. They have all former sports stars working for them, and so they do not have meetings they have “huddles”. How they work is to start of someone shouts out “Will you protect this house?” and everyone has to shout “I Will!” at the top of their voice. Then someone else shouts out “How much do you want it?” and the correct response is “I want it so much, I want t more than I want to breathe”. And this is the accountants. I shudder to think what sales and marketing do in their meeting equivalents.

 

Network Drinks

 

image003.png

 

To wash down the glasses of Henri Jayer Richebourg Grand Cru wine from Cote de Nuits in France are some fresh lobsters with select shellfish in summer vegetables, heads of fresh bulbs mixed with herbs in bubbly, light vinaigrette and a meat pie.This meat pie contains Wagyu beef fillet, Chinese matsutake mushrooms, winter black truffles, and French bluefoot mushrooms. Two bottles of vintage 1982 Chateau Mouton Rothschild wine are used in the gravy and the crust is covered in edible gold leaf.

 

Tuesday 9th

 

Breakfast

 

Todays breakfast includes bacon from rare pig breeds, truffle, watercress, saffron and an egg all cooked in truffle oil, sprinkled with real gold dust and served between a bun, along with caviar and a selection Louis Roderer Cristal Brut 2000 champagne sherbet and Madagascar chocolate cake with Moët très fine Champagne No. 7. The breakfast included a croissant covered in edible gold and jewels, Bar le Duc hand-seeded redcurrant jam, Kopi Luwak coffee, and a champagne and Chambord cocktail. All this was served from a bottle covered in gold and encrusted with real pearls and diamonds.

 

After that we staggered into the auditorium to hear the first of two keynotes, starting off with Alan Capes from the Canadian National Railways. That organisation is a gigantic success story, moving from almost going down the gurgler to becoming one of the most profitable railways companies in the world, and a large part of this is attributed to use of IT systems i.e. SAP.

 

Then we had a non SAP related keynote, Professor Hugh Durrant-Whyte from the Australian ICTA Research Centre of Excellence talked about how to use the nebulous concept of “big data” to actually make a difference in the real world – one example was the mapping that was ben done (somehow) of the entire layout of Australia many kilometers under the surface. What is being looked for are rocks that glow naturally hot, so a hole can be drilled and the heat transformed into renewable power. The same principle is naturally even more important to mining companies

 

Morning Tea

 

Fresh langoustines served on the SAP booth table alive, and “seared’ with a knife 15 minutes before the delegate devours it, which is a style that’s beyond a guarantee of freshness.

 

There were a large number of Hollywood movie stars in attendance at this conference, such as Brad Pitt, Matt Damon, Julia Roberts, George Clooney, Harrison Ford and Betty Boop. Morning tea is a good opportunity to swap business cards with them and talk about HANA and UI5.

 

Then there was one of the best attended sessions of the conference, in which Simon Kemp talked about and demonstrated the “Fiori Launchpad” which is new and shiny and everyone liked the look of it. I might be burnt at the stake for saying this, but this is an evolution of the “user menu” concept which has been around a long time in SAP, this time you customize lots of boxes all over the initial screen, each of which launches a fancy UI5 transaction (or something else). I feel sorry for anyone demonstrating this, as they keep getting asked the “is this the end of the SAP portal?” question, along with “is this the end of ESS/MSS?”. No-one wants to answer that question, but if I were a life assurance salesman the the SAP Portal came to me as a customer I would think twice.

 

Lunch

 

image004.png

 

A crunchy-tender-juicy-heady suckling pig served with tomato balls or “bolao” and pools of tomato jelly, with confit garlic to decorate the plate, and a crunchy funnel web spider sauce.

 

The former Prime Minister of Australia, said last year the Australian mining boom is over, but if it is no-one has told mining company Fortescue Metals. The CIO of that company, Vito Forte, gave a keynote speech, starting off with the growth figures for the company over the last few years, which is quite startling. Some of my colleagues went to Western Australia last year and showed me photographs of the sea being filled with ships, all waiting for the tide to change so they could take that days output to China or India or wherever. Fortescue metals is clearly a company which takes advantage of the latest SAP innovations, and the CIO talked about making sure the IT department is not the “department of no”.

 

The next keynote was from the CIO of Fairfax Media, a company which is being forced to reinvent itself for the digital age, as traditional media sectors like printed newspapers go into terminal decline. He showed a chart of some recent research which suggested that just 4% of people looked at adverts in printed newspapers, and yet companies still spend 18% pf their advertising budget on such things. He is all too horribly aware that this is just because “we have always done it this way” and one day companies will wake up.

 

Afternoon Tea

 

The final meal of the day is Duck Consommé served with what they call corn silk, with chocolate, vanilla purée, rice and apple, and deep fried emu in a beer batter.

 

There were a large number of rock starts in attendance at this conference such as Jimmi Hendrix, Freddie Mercury, Michael Jackson, John Lennon and Buddy Holly. Afternoon tea is a good opportunity to swap business cards with them and talk about HANA and UI5.

 

SAP Mentor Tony de Thomasis talked about the various tools available to you when preparing for an SAP upgrade. He is not a big fan of “technical” upgrades, and subscribes to the view that you should take advantage of new features as soon as they become available, a message that was repeated by the various CIOs of forward looking companies who spoke at this conference.

This was a very hands on type of presentation, with live demonstrations as opposed to power point slides. I noticed when an error message popped up it referred to SAP GUI version 740, which I did not think was out yet, and he considered showing  us the version 5 of the NWBC but decided against it as it is still too flaky. As it turns out these will be released on 8th of October 2015.

 

The final talk of the day was from Katrin Pietsch from SAP talking about the “customer connection program”. SAP provide many free services to their customers, the general idea is that if there is a piece of functionality that is not present in standard SAP then if you band together in a group (like a user group) then chances are you can get SAP to add it to the standard product. As an example think of all the “repairs” you make to the standard system – if a large number of companies are making the exact same change then why not tell SAP. An example I can think of is the ERS transaction MRRL. The transaction date defaults to todays date, which is crazy, so I have seen a large number of companies  make a “repair” to the standard transaction so you can specify the transaction date. Instead of five hundred companies making the same modification and then having to go through the SPAU pain at upgrade time, why not tell SAP and see if they can’t add that field as standard?

 

To end the conference we had a foot long bratwurst infused with hundred-year-old Louis XIII cognac and topped with fresh lobster, picante sauce and Kobe beef seared in olive and truffle oil, washed down with the world's oldest cocktail, created with 1788 Clos de Griffier Vieux Cognac, 1770 Kummel Liqueur, 1860 Dubb Orange Curacao and early 20th century Angostura Bitters.

 

All in all a wonderful conference, packed with fascinating SAP demonstrations, good food, and excellent dustbins.

 

Cheersy Cheers

 

Paul

 

Possibly the most important design pattern of them all (MVC)

$
0
0

Who should read this?

First and foremost, if you don't know what a design pattern is, then this blog is most certainly targeted at you.

 

Secondly those who don't really understand the Model View Controller (MVC) design pattern should also keep on reading.

 

What is the MVC?

My intention was never to write a blog on what it is or how to implement it.  There is heaps of content on the internet and also on SCN.  A simple search and you can find tons of stuff out there.  It's been around for ages, in fact it's older than me, so it's pretty old.

 

Here are some of my favourites:

http://blog.codinghorror.com/understanding-model-view-controller/

http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller

 

Where you are going wrong?

I've worked at quite a few clients over the years and it never ceases to amaze me at the number of developers unaware of MVC & it's importance to SAP frameworks.  Even more horrifying is the number of developments/extensions I have seen that break this pretty straight forward design pattern. 


The most classic example of this is those who code business logic within the UI (a view). This results in two very frustrating outcomes

  • Data input via other views (i.e. via middleware) will not have the same business validation logic and as result the application data may be corrupted
  • Validation logic has been duplicated in multiple views. Maintainance requires double the effort and if not managed could result in inconsistencies.

.

 

Why should I learn it?

It's the same pattern that keeps cropping up again and again and it does not appear to be going away any time soon...

 

BSP - http://help.sap.com/saphelp_nw70ehp2/helpdata/en/0f/ab3a3c9ca75402e10000000a114084/content.htm

ABAP WebDynpro - https://help.sap.com/saphelp_nwce72/helpdata/en/47/b467c028912972e10000000a42189b/content.htm

OpenUI5 - https://openui5.hana.ondemand.com/#docs/guide/91f233476f4d1014b6dd926db0e91070.html

 

So if you don't know MVC, you really can't say you know these frameworks and even worse are potentially using them incorrectly.

 

Many non SAP programming languages incorporate frameworks built on this concept and the sooner you spot it the easier it will be for you to adopt a particular framework and the less likely you are to fall into one of the pitfalls described in previous section. 

 

Cleaner Code

The ability to have a clean separation of code, that promotes code reuse is fantastic.  So much so that I find myself using this priniciple even when writing ABAP reports.  The ability to plug in different views makes it quick to extend the logic to expose the report data as an e-mail, alv, file download, etc.  And is abundantly clear to anyone maintaining it on where to make changes.

 

One final note

Please, please, please.  If you don't understand it and before you attempt to create or extend any more content, take some time out to learn this pattern.  Your collleagues, your employers and everyone who works with your code will forever appreciate it. 

ABAP Trapdoors: R-F-Conversion on a STRING

$
0
0

Welcome back to another ABAP Trapdoors article. It’s been a while – I’ve posted my last article in 2011. In the meantime, I’ve collected a number of interesting topics. If you’re interested in the older articles, you can find the links at the end of this article.

 

A few weeks ago, I had to code some seemingly simple task: From a SAP Business Workflow running in system ABC, a sub-workflow with several steps had to be started in another system, or even a number of other systems. Since a BPM engine was not available, I decided to use simple RFC-enabled function modules to raise workflow events in the target system. The sub-workflows can then be started via simple object type linkage entries. While this approach works quite well for my simple scenario, I ran into an altogether unexpected issue that took me quite a while to figure out.

 

There are two function modules to raise the workflow events: SAP_WAPI_CREATE_EVENT and SAP_WAPI_CREATE_EVENT_EXTENDED. In my case, I used the extended function module because I was working with class-based events. So the call basically was

 

  CALL FUNCTION 'SAP_WAPI_CREATE_EVENT_EXTENDED' DESTINATION l_rfcdest    EXPORTING      catid             = 'CL'      typeid            = 'ZCL_MY_CLASS'      instid            = l_instid      event             = 'MY_EVENT'    ... 

To my surprise, it did not work - the system kept telling me that the event M does not exist. After spending a considerable time debugging and scratching my head, I finally identified the issue. Since it can be tricky to reproduce this particular issue, here is a very simple function module to demonstrate the actual problem:

 

FUNCTION ztest_rfc_echo.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     VALUE(I_INPUT_VALUE) TYPE  STRING
*"  EXPORTING
*"     VALUE(E_OUTPUT_VALUE) TYPE  STRING
*"----------------------------------------------------------------------  e_output_value = i_input_value.

ENDFUNCTION.

(If you want to try this for yourself, make sure that the function module is RFC-enabled.)

This is no more than a simple value assignment – Text goes in, text comes out, right? Let’s see. Here is a demo program to check it out:

 

REPORT ztest_rfc_conversion.

DATA: g_value TYPE string.

START-OF-SELECTION.

  CALL FUNCTION 'ZTEST_RFC_ECHO'    EXPORTING      i_input_value  = 'This is a C literal'    IMPORTING      e_output_value = g_value.  WRITE: / '1:', g_value.  CALL FUNCTION 'ZTEST_RFC_ECHO'    EXPORTING      i_input_value  = `This is a STRING literal`    IMPORTING      e_output_value = g_value.  WRITE: / '2:', g_value.  CALL FUNCTION 'ZTEST_RFC_ECHO' DESTINATION 'NONE'    EXPORTING      i_input_value  = 'This is a C literal'    IMPORTING      e_output_value = g_value.  WRITE: / '3:', g_value.  CALL FUNCTION 'ZTEST_RFC_ECHO' DESTINATION 'NONE'    EXPORTING      i_input_value  = `This is a STRING literal`    IMPORTING      e_output_value = g_value.  WRITE: / '4:', g_value.

 

In this program, the function module is called twice within the same session and twice starting a new session, using both a character literal and a string literal (note the difference between 'X' and `X`!). And the output is:

 

output.png

 

As you can easily see, the character literal is chopped off after the first character, but only if the function module is called via RFC. The same thing happened in my original program since the parameter EVENT of the function module SAP_WAPI_CREATE_EVENT_EXTENDED is of type STRING.

 

I considered this a bug, especially since neither SLIN nor the code inspector warned about this issue. As a good SAP citizen, I created a SAPnet ticket. After a lengthy discussion, I was told

There is no "implicit conversion" in RFC, therefore application need to adjust(or choose) a proper data types for calling/receiving RFMs.

In the end, this problem is very similar to the one explained by Jerry Wang in his blog a few weeks ago – another trapdoor in the development environment you constantly have to keep in mind when doing RFC programming if you want to avoid being reduced to a single character with a lot of trouble…

 

Older ABAP Trapdoors articles

Controlled multi-threading in ABAP

$
0
0

You may have been in a situation where you have to process multiple objects. When you do this sequentially, it'll take some time before that processing finishes. One solution could be to schedule your program in background, and just let it run there.

But what if you don't have the luxury to schedule your report in background, or what if the sheer amount of objects is so large that it would take a day to process all of them, with the risk of overrunning your nightly timeframe and impacting the daily work.

 

Multi Threading

It would be better if you could actually just launch multiple processing blocks at the same time. Each block could then process a single object and when it finishes off, release the slot so the next block can be launched.

That could mean that you could have multiple objects updated at the same time. Imagine 10 objects being processed at once rather than just one object sequentially. You could reduce your runtime to only 10% of the original report.

 

It's actually not that hard. If you create a remote enabled function module, containing the processing logic for one object, with the necessary parameters, you can simply launch them in a new task. That creates a new process (you can monitor it in transaction SM50) which will end as soon as your object is processed.

 

Newtask.png

 

Here's a piece of pseudo-code to realise this principle.

data: lt_object type whatever. "big *** table full of objects to update

 

 

 

while lt_object[] is not initial.

     loop at lt_object assigning <line>.

 

          call function ZUPDATE starting new task

               exporting <line>

               exceptions other = 9      

 

          if sy-subrc = 0.

               delete lt_object.

          endif.

     endloop.

endwhile.


Something like that.

Notice how there's a loop in a loop, to make sure that we keep trying until every object has been launched to a process. Once an object has been successfully launched, remove it from the list.

 

Queue clog

But there's a catch with that approach. As long as the processing of an individual object doesn't take up too much time, and you have enough DIAlog processes available, things will work fine. As soon as a process ends, it's freed up to take on a new task.

 

But what if your processes are called upon faster than they finish off? That means that within a blink of an eye, all your processes will be taken up, and new tasks will be queued. That also means that no-one can still work on your system, because all dialog processes are being hogged by your program.

queue clog.png

* notice how the queue is still launching processes, even after your main report has already ended.

 

You do not want that to happen.

 

First time that happened to me was on my very first assignment, where I had to migrate 200K Maintenance Notifications. I brought the development system to its knees on multiple occasions.

The solution back then was double the amount of Dialog processes. One notification process finished fast enough before the main report could schedule 19 new tasks, so the system never got overloaded.

 

Controlled Threading

So what you want, is to control the number of threads that can be launched at any given time. You want to be able to say that only 5 processes may be used, leaving 5 more for any other operations. (That means you could even launch these mass programs during the day!)

But how do you do that?

 

Well, you'll have to receive the result of each task, so you can keep a counter of active threads and prevent more from being spawned as long as you don't want them to.

 

caller:

data: lt_object type whatever. "big *** table full of objects to update

 

 

 

while lt_object[] is not initial.

     loop at lt_object assigning <line>.

          call function ZUPDATE starting new task

               calling receive on end of task

               exporting <line>

               exceptions other = 9      

      

          if sy-subrc = 0.

               delete lt_object.

               add 1 to me->processes

          endif.

     endloop.

endwhile.

receiver

RECEIVE RESULTS FROM FUNCTION 'ZUPDATE'.

substract 1 from me->processes

 

This still just launches all processes as fat as possible with no throtling. It just keeps the counter, but we still have to do something with that counter.

And here's the trick. There's a wait statement you can use to check if the number of used processes is less than whatever you specify.

But this number is not updated after a receive, unless you logical unit of work is updated. And that is only done after a commit, or a wait statement.

But wait, we already have a wait statement, won't that update it?

Why yes, it will, but than it's updated after you waited, which is pretty daft, cause then you're still not quite sure whether it worked.

 

so here's a trick to get around that.

caller:

data: lt_object type whatever. "big *** table full of objects to update

 

 

while lt_object[] is not initial.

     loop at lt_object assigning <line>.

 

 

          while me->processes <= 5.

               wait until me->processes < 5.

          endwhile.

 

 

          call function ZUPDATE starting new task

               calling receive on end of task

               exporting <line>

               exceptions other = 9      

 

 

          if sy-subrc = 0.

               delete lt_object.

               add 1 to me->processes

          endif.

     endloop.

endwhile.

 

That'll keep the number of threads under control and still allow you to achieve massive performance improvements on mass processes!

 

Alternatives

Thanks to Robin Vleeschhouwer for pointing out the Destination groups. Starting your RFC in a specific destination group, your system administrators can control the number of processes in that group. The downside is that it's not as flexible as using a parameter on your mass-processing report, and you have to run everything past your sysadmins.

 

Another sweet addition came from Shai Sinai under the form of bgRFC. I have to admit that I actually never even heard of that, so there's not much I can say at this point in time. Except, skimming through the doco, it looks like something pretty nifty.

How to call Invoice as a PDF in SAPGUI

$
0
0

Let’s consider that we have two screens with screen numbers 2000 and 3000.


Screen 2000 contains table control which displays the list of invoices and if we double click on any invoice number that particular invoice should get displayed in Screen 3000 in PDF format.


Here calling the Invoice in PDF means calling the standard Invoice Smartform which is LB_BIL_INVOICE. Below is the function module which is used to transfer the data from driver program (RLB_INVOICE) to smartform.


1.jpg

For the above function module we need to pass the values to mandatory import parameters IS_BIL_INVOICE, IS_NAST and IS_REPEAT so that we will get JOB_OUTPUT_INFO as an export parameter which is required to generate PDF file.


Passing values to IS_BIL_INVOICE


IS_BIL_INVOICE is of type LBBIL_INVOICE which is a deep structure and this need structure needs to filled with valid data in order to display the invoice details on the Smartform layout.



2.jpg

When we execute Tcode VF03 to display invoice details an entry will be created in NAST table when an output type is triggered and we have a field OBJECT KEY (OBJKY) in that entry, which is VBELN for V3 application. Based on the entries in NAST table the data will get populated into the structure IS_BIL_INVOICE. By using the below function module we can create the entries into this deep structure.


3.jpg

Here in the above function module the import parameter IF_BIL_NUMBER refers to NAST-OBJKY, IF_PARVW refers to NAST-PARVW, IF_PARNR refers to NAST-PARNR and IF_LANGUAGE refers to NAST-SPRAS.


Based on the object key (VBELN ) fetch the record from NAST table and pass those respective fields to import parameters of the above function  module.

5.jpg

The import parameter IS_PRINT_DATA_TO_READ is the structure to Select Tables to be Complete for Printing SmartForms.


After getting the IS_BIL_INVOICE as an export parameter. Pass this structure to smartform function module to get OTFDATA (JOB_OUTPUT_INFO-OTFDATA).

6.jpg

Now we have OTF Date, the next step is to convert this OTF into PDF by using the below function module.

7.jpg

The next step is to convert pdf to xstring and further convert this Xstring to binary data so that SAPGUI can use this binary data to display the invoice in PDF format. Please go through the below code for clear understanding.


8.jpg

Select the ‘Respond to double click’ checkbox in table control in screen painter of screen 2000 and assign a function code say ‘PICK’. In the PAI event of Screen 2000 write the below code.


9.jpg

10.jpg


11.jpg


12.jpg

Write the below code in the PBO of screen 3000.


14.jpg

17.jpg

Write below code in the PAI of screen 3000.

18.jpg

REFERALS:

 


This link is very useful for clear understanding on how to read OTF data in Adobe Reader (PDF format ). I have even used some of the content from this link to put all the data together.

 

               This link contains everything about PDF files in SAP.

 

  • Refer to standard driver program RLB_INVOICE .



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

Your feedback is highly appreciated, Thank you,

                                                                                                                                                                                                                  Untitled-1.jpg

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




Step by step guide to enhance/update Vendor Master and generate idocs - Part1

$
0
0

I recently worked on a project which entailed enhancing vendor master, updating CREMAS04 Idoc with a new segment for custom records and finally being able to generate IDOCS with new segment when these custom fields of (added to )vendor master are updated. In this 3 part blog I will try to cover the development effort required to achieve the aforementioned functionality in detail.

 

The entire development effort can be classified into three sections as follows:

1) Extending the vendor master

2) Enhancing the CREAMS04 basis type to include the new segment.

3) Enhancing method VMD_EI_API->MAINTAIN( ) method to programmatically update vendor master tables (LFA1, LFB1, LFM1, LFM2 .. ).

 

  1. Extending the vendor master.

        Extending vendor master involves enhancing the vendor master database table and vendor master screen. For the purpose of this blog I am going        to enhance LFA1 (vendor master general - header level ) table with custom fields.

    • Step 1: Carry out steps listed under step ‘Adoption of Customer’s Own Master Data Fields’. Follow this configuration path to reach this step.

     SAP IMG->Financial Accounting->Accounts Receivable and Accounts Payable->Vendor Accounts->Master Data->Preparations for Creating Vendor Master Data->Adoption of Customer's Own Master Data Fields.

SPRO_patch_to_modification_free_enhancement.png

    • Step 2:Execute step 'Prepare Modification-Free Enhancement in Vendor Master Record' step.

In this step you specify the screen group and screen number associated with the new vendor master fields.

Screengroup for venodr master.pngScreenNumber_for_vendor_master.png

    • Step 3:Execute step "Business Add-In: Process of Master Data Enhancements'.

             This steps allows user to create a implementation for BADI - VENDOR_ADD_DATA. In my example I am just activating the custom screen group

              Add on , However this BADI provides other methods to query data for add on fields, save data to table other then vendor master, initialize add-              on append structure ( discussed later ) and much more.

              BADI_VENDOR_ADD_DATA.png

                Implement badi venodor add data.png

    • Step 4:Execute the Business Add-In: customer subscreen step next.

                This steps allows for creation of implementation of BADI- VENDOR_ADD_DATA_CS. This badi provides methods to manipulate the screen elements of subscreen which are all associated with the screen-group declared in previous group. It also provides methods to set values to and read values from the screen fields on the subscreens.

                A filer with the screen group has to be specified before methods of this BADI can implemented.

               BADI_VENDOR_ADD_CS_FILTER.png

               BADI_VENDOR_ADD_CS_IMPLEMENTATION.png

    • Step 5:Next, LFA1 has to be enhanced with append structure consisting of custom fields which will show up on the new subscreen (9030 in this case).

               To do this, go to SE11 and open definition of table LFA1. Click on 'Append Structure..' option and then click on 'Create' to create new                append structure. Since for this demo IDOCS have to be created for any change in values stored in these custom fields. Make sure that the 'Change document' option is turned on at the data element level .

               Save all changes and active.

 

                Create a new append structure.png

                   Append structure with change documents.png

    • Step 6:The Next Step involves adding the fields from append structure to the custom subscreen (accessible via XK** transaction ).

               Execute transaction SE51 and create a new subscreen for program and screen number specified above ( step 4 and step2 respectively: program: SAPMZMSW_VEND_EPA, Screen: 9030 ).

               Create subscreen for new vendor fields.png

                  Click on the 'Dictionary/Program fields window' button to select the append structure fields from LFA1 table structure.

                  Select custom fields from append structure.png

                    Arrange the fields on the layout screen and save all changes.

                  Arrange screen layout for subscreen.png

    • Step 7: In this example the above added screen fields are all display only fields, hence no  PBO is necessary. However to populate these fields for display, LFA1 needs to be declared as a global variable (TABLES) in the dynpro program. Standard processing routing will automatically populate the LFA1 structure with value in the database. Since the screen elements created above all refer to the LFA1 structure they values will automatically be passed to the screen fields and display.

               LFA1 declaration in dynpro program.png

    • Step 8: Finally if all the steps are correctly followed you should be able to view a vendor in XK03 and see the subscreen that was added in the above step. However since all the fields on this subscreen are newly added fields they will all be empty. In the next part of this series, I will go over the steps required to  update the LFA1 structure from an external source.

                XK03_screen1.png

                XK03_screen2.png

ABAP News for 7.40, SP08 - ABAP Core Data Services (CDS)

$
0
0

Recap

 

With ABAP 7.40, SP05 the ABAP Core Data Services, short ABAP CDS,  were introduced. The ABAP Core Data Services implement the general CDS concept of SAP (that is also available for HANA as HANA CDS) for AS ABAP. They use a DDL to define CDS views that implement a semantic data model in the ABAP Dictionary.

 

The power of ABAP CDS is, that it is open, meaning database independent (with some exceptions if the databases do not yet cover all the functionalities as e.g. views with parameters). You can use the DDL of ABAP CDS in Eclipse based ADT to create rather complex views that exceed the capabilities of the classical database views created in SE11 by far. Technically, from the source code of a CDS view, a classical database view is generated. We call this the CDS database view. You can display the fields of this view in SE11 but not change them. Especially, you can see the real database object - the SQL view - that is created from the view definition on the database in SE11. But this CDS database view serves mainly the internal technical purpose to realize the view in the dictionary. You can, but you should not use it in ABAP programs. Instead, you work with the CDS entitiy, whose name is defined behind DEFINE VIEW. Only the entity carries the full capabilities of the CDS view, like semantical information, client handling, connection to authority checks (planned), and so on. You can use the CDS entity behind TYPE for declaring work areas and in Open SQL in ABAP programs.

 

You use these views for the famous code push down in order to put more analytic work to the database. If the functionality of a view is only needed once, of course you can still use Joins, SQL expressions, subqueries, ... in Open SQL for this code push down. But if you want to reuse a view, need semantical or technical capabilities of CDS that exceed those of Open SQL (but we try to keep the technical capabilities on the same level, e.g., CDS knows UNION, Open SQL will know UNION with SP12) or you just want to push down the full data model to the database, you use CDS. And in fact I've seen very, very extensive sophisticated views already now (oh boy ...).

 

But I'm a simple mind, not a business modelling guru. In order to understand the basics, I work with simple examples. Just to give you two of those:

 

@AbapCatalog.sqlViewName: 'DEMO_CDS_JOIN'

define view demo_cds_scarr_spfli

  (id, carrier, flight, departure, destination)

  as select from spfli

            join scarr on scarr.carrid = spfli.carrid

     { key spfli.carrid,

       key scarr.carrname,

       key spfli.connid,

       spfli.cityfrom, 

       spfli.cityto }

 

This is a simple join as you could also define it in classical SE11. The name of the CDS entity is demo_cds_scarr_spfli and the name of the generated CDS database view is DEMO_CDS_JOIN. One difference to a classical view is the fact, that a CDS entity that uses client dependent data sources is client dependent by default but never has a client field. The client handling is done implicitly without shining through here.

 

Another view, that does exactly the same as the above one but shows a new kind of modelling capability:


@AbapCatalog.sqlViewName: 'DEMO_CDS_ASSOC'

define view demo_cds_association

  (id, carrier, flight, departure, destination )

  as select from spfli

            association [1..1] to scarr as spfli_scarr

              on $projection.carrid = spfli_scarr.carrid

     { key spfli.carrid,

       key spfli_scarr.carrname,

       key spfli.connid,

       spfli.cityfrom, 

       spfli.cityto }

 

The join is replaced by an association, which is a more elegant way to code reusable joins. Associations can be adressed inside the view using path expressions (spfli_scarr.carrname is the most simple one) and can be published (not shown here) for usage in other views and in Open SQL (planned for SP12).

 

In an ABAP program you can read the views with Open SQL:

 

SELECT *
       FROM demo_cds_association
       ORDER BY id, carrier, flight
       INTO TABLE @DATA(result1).

SELECT *
       FROM demo_cds_scarr_spfli
       ORDER BY id, carrier, flight
       INTO TABLE @DATA(result2).

ASSERT result1 = result2.

 

To find out more, see the CDS documentation (it contains an authorization concept already, but the release of that was postponed to SP12).

 

After this recap, now the most important

 

News for CDS with 7.40, SP08

 

Besides many smaller enhancements, the most important news are:

 

Many new built-in functions

 

Besides the function already introduced with SP05, you can use standard functions as COALESCE, CONCAT, REPLACE, ABS, DIV, DIVISION, FLOOR, MOD and ROUND now and as in Open SQL the searched CASE was introduced.

 

Special functions  CURRENCY_CONVERSION, UNIT_CONVERSION und DECIMAL_SHIFT allow you to deal with data of the (in)famous SAP specific dictionary types CURR, CUKY, QUAN and UNIT.

 

 

@AbapCatalog.sqlViewName: 'DEMO_CDS_CRRCNV'

  define view demo_cds_currency_conversion

   with parameters to_currency:abap.cuky(5),

                   exc_date:abap.dats

   as select from demo_prices

   { id,

     currency_conversion( amount => amount,

                          source_currency => currency,

                          round => 'X',

                          target_currency => :to_currency,

                          exchange_rate_date => :exc_date,

                          error_handling => 'SET_TO_NULL' ) as amount,

     :to_currency as currency }

 

 

Parameter views

 

On databases that support it (not all up to now, but SAP HANA does) you can add importing parameters to a view that can be used in the SELECT statement of the view and that can be supplied when using the view in Open SQL.

 

Example for such a view:

 

@AbapCatalog.sqlViewName: 'DEMO_CDS_PARA'

define view demo_cds_parameters

  with parameters p_distance_l:S_DISTANCE,

                  p_distance_o:S_DISTANCE,

                  p_unit:S_DISTID

  as select from spfli         

            { key carrid,

              key connid,

                  cityfrom,

                  cityto,

                  distance,

                  distid }

            where distid = :p_unit and

                           distance between :p_distance_l

                                        and :p_distance_o;

 

Usage in Open SQL:

 

IF cl_abap_dbfeatures=>use_features(

     EXPORTING

        requested_features =

          VALUE #( ( cl_abap_dbfeatures=>views_with_parameters ) ) ).

  SELECT *

         FROM demo_cds_parameters( p_distance_l = @from_distance,

                                   p_distance_o = @to_distance,

                                   p_unit       = @unit )

         ORDER BY carrid, connid

         INTO TABLE @DATA(result).

      cl_demo_output=>display( result ).

ELSE.

  cl_demo_output=>display(

    'Database system does not support views with parameters' ).

ENDIF.

 

 

Extending views

 

Classical views delivered by SAP or partners can be extended with the well known clasical append views. In order to achieve the same for CDS views a new DDL statement is introduced:

 

@AbapCatalog.sqlViewAppendName: 'DEMO_CDS_EXTENS'

extend view demo_cds_original_view with demo_cds_view_extension

  { spfli.distance,

    spfli.distid as unit };

 

It adds new fields to the existing view fields. Technically, a classical append view - its name defined behind the annotation @AbapCatalog.sqlViewAppendName - is generated in the ABAP Dictionary for that purpose.

 

 

 

 

 

 

 

 

 

 

 


Project Object - Vendor Contacts (create and edit)

$
0
0

Hi community!

 

I have come across the need to have a vendor contact created (you know, those contacts you find in XK01/2/3), and, to my disbelief, really the only possible way to do this programatically, is with a batch input!!

 

Well, not anymore. I have created a class that allows you to create and edit vendor contacts (deleting might be easy as well, but I haven't looked into it yet). Also, it should be fairly easy to extend this to create customer contacts as well. If that's what you need, go ahead and try to do it Ideally, there should be a generic "contact" class, and a subclass for vendor and customer contacts.

 

The most basic way to create a vendor contact is to use static method CREATE_CONTACT and populate vendor number (LIFNR) and last name (NAME1) in structure IM_HEADER_CONTACT_DATA. After that, it's up to you to figure out how to use it

 

You will find the nugget for the class under folder PURCHASE_TO_PAY/VENDOR_CONTACT of project object, here.

 

If you have any questions, feel free to ask, but don't expect 24/7 technical support, that doesn't come for free

 

Best regards,

Bruno

 

DISCLAIMER

 

This is not, by any means, a finished "commercial product". It still definitely needs a lot of work to be a final stable solution. However, it should be a great starting point to whatever you need. If you do some work on it and feel like sharing an improved version of this, please let me know.

 

Thanks.

Export internal table to Excel with XLSX Workbench

$
0
0
related page 1
related page 2


NOTE: Before beginning, the XLSX Workbench functionality must be available in the your system.

 

Let's use standard demo report BCALV_GRID_DEMO is available in the every system (the report demonstrates how to use ALV-Grid control). We will export an output table to the Excel based form.

 

1 PREPARE A PRINTING PROGRAM.

 

1.1 Copy standard demo report BCALV_GRID_DEMO to the customer namespace, for example Z_BCALV_GRID_DEMO :

IMAGE_4.PNG

 

1.2 In the copied report, add new button to GUI-status 'MAIN100':

IMAGE_5.PNG

 

1.3 In the report line number 40, insert next code to processing the new OK-code :

IMAGE_7.PNG

 

1.4 Activate objects:

IMAGE_8.PNG

 

2 PREPARE A FORM.

 

2.1 Launch XLSX Workbench, and in the popup window specify a form name TEST_GRID , and then press the button «Process»:

IMAGE_9.PNG

Empty form will be displayed:

IMAGE_10.PNG

2.2 Push button444_19_2.PNGto save the form.

 

 

2.3 Assign context FLIGHTTAB to the form:

IMAGE_12.PNG

 

2.4 Add new sheet to a form:

IMAGE_14.PNG

 

2.5 Assign created Sheet to worksheet in the Excel-template:

IMAGE_17.PNG

 

 

2.6 Add a Pattern (HEADER LINE) to the Sheet:

IMAGE_26.PNG

 

 

2.7 Add a Loop to the Sheet:

IMAGE_29.PNG

 

2.8 Set context binding for created Loop:

IMAGE_23_.PNG

 

 

2.9 Add a Pattern (POSITION) to the Loop:

IMAGE_32.PNG

 

2.10 Add a Values to the Pattern (POSITION):

IMAGE_37.PNG

 

2.11 Make markup in the Excel template:

IMAGE_38.PNG

 

2.12 Set template binding for Pattern (HEADER LINE). To do it, you have to perform next steps successivery:
  • Select node PATTERN_HEADERLINE in the tree of the form structure;
  • Select cells range A1:I1 in the Excel template;
  • Press a button IMAGE_39.PNG located in the item «Area in the template» of the Properties tab.

IMAGE_42.PNG

 

 

2.13 Set template binding for Pattern (POSITION). To do it, you have to perform next steps successivery:
  • Select node PATTERN_POSITION in the tree of the form structure;
  • Select cells range A2:I2 in the Excel template;
  • Press a button IMAGE_39.PNG located in the item «Area in the template» of the Properties tab.
IMAGE_43.PNG

 

2.14 Set template binding for Values. To do it, you have to perform steps, described in the previous item. Mapping is figured below:
  • CORRID           (cell: A2)
  • CONNID           (cell: B2)
  • FLDATE            (cell: C2)
  • PRICE              (cell: D2)
  • CURRENCY     (cell: E2)
  • PLINETYPE      (cell: F2)
  • SEATSMAX      (cell: G2)
  • SEATSOCC      (cell: H2)
  • PAYMENTSUM (cell: I2)


2.15 Finally, you have to set template binding as figured below:

IMAGE_47.PNG

 

2.16 Activate form by pressing button444_30.PNG.

 

 

 

3 EXECUTION.


Run your report Z_BCALV_GRID_DEMO; ALV-grid will be displayed :

IMAGE_48.PNG


Press button444_43.PNGto export Grid to Excel form :

IMAGE_49.PNG


Create and Email a Decorated Excel using HTML

$
0
0

Excel Creation Methods :

Today there are a number of methods to create a formated Excel file like Standard FMs, IXML Interface, OLE, Using XML syntax , Using HTML syntax and few  more Interfaces ( available over Code Share Pages )..!!


Flexibility and Ease of Use :

Well, taking about  Ease of use, I would always prefer Standard FMs.


But the problem with Mr. FM is, there stiffness. I mean they are not really flexible enough to fulfill my business needs. My Business Team always thinks, creating an Excel thru SAP is equivalent to creating an Excel thru MS Office..!! ;(

Basically FMs creates Excel, which are more sort of fixed format file..!!


Next comes IXML interfaces, they are obviously flexible but I find them a bit bulky interms of Memory ComPlexity..!! Probalby, because you need to instnciate a Class and then set its attribute before using just a simPle Style, font or a new color../!! My business asks for a highly decorated Excel..!! Seems tough this way..!!


OLE ,, really tough stuff to deal with, once OLE starts to create Excel,, I usually move out of my desk, m sure, it will take a handsome amount of time..!!

Yes, Mr. OLE is really laZy, just like me. Takes too much of time for Excel creation..!!


So, I will oPt for XML or HTML Syntax out of all the available candidates..!!


Hmmm, I didnt talked about the other interfaces, actually I could not dare to PeeP inside,, My SAP has emPowered me with some beautiful tools.

No need to look at something else..!!


The HTML Way :

Create all you want using HTML Tags and Syntax, download it in a XLS file format and Now its ready to use..!!

As simPle, as a two minute noodle,, well.. Yes it is..!! lol

 

You can create a Table, Paint it easily, with the color, your near and dear wants..!!

<TABLE>

<td colspan =4>

<div><font size =5>Test Excel</font></div>

</TD>

</TR>

<tr>

<td colspan =9>

<font size =5>Excel Details</font>

</TD>

</TR>

 

 

HTML Tutorial will tell in detail about the HTML Syntax..

 

 

Create the Excel using your tags, keep them in an internal table or better in a String..!!

 

Use ,,

 

cl_bcs_convert=>string_to_solix with code page 4103..!!

 

Create the Doc Object using

 

cl_document_bcs=>create_document with tye 'RAW'..

 

Add the Excel attachment using document->add_attachment, with tye 'xls'..

 

Now, set_document,, add recipient  and then send document

 

For Mail sending area, Object report BCS_EXAMPLE_7 is also helpful..!!

 

Comments and Rectification :

Kindly put your comments, which can help me to further add values to blogs..!!

My mentors and guides over SDN, kindly rectify me if I am wrong somewhere..!!


Thanking You All..!!

Easy Excel-creation from ABAP using transportable templates

$
0
0

Do you also have the requirement to provide data from your ABAP-System to an Excel workbook? Then, I hope you heard about the fantastic abap2xlsx-library by Ivan Femia. If not, you should immediately head over to their project website. For our project, it saved a tremendous amount of effort and time. Let me briefly explain why and how it’s even more easy to provide beautiful Excel download from your ABAP system.


Starting point

During the specialization of our application some years back, users and consultants together defined complex Excel files they wanted the system to be generated. As we’re using a FPM-based Webdynpro user interface, we could not rely on using the GUI frontend services, but hat to use the OLE-based APIs. They are not only slow, but also quite clumsy to handle and need a lot of code. In  our sample, we had used more than 5.000 lines of code in order to produce a file which was at least almost matching the requested format.


ABAP2XLSX

Searching for alternative manipulation of Excel from ABAP, I came across abap2xlsx which has a beautiful API for creation and modification of Excel files. Particularly binding tabular data into a table-entity of the workbook is incredibly efficient. After having clarified the licensing questions, we communicated how much cheaper development would be if only we could rely on our customer using Excel 2007 (or at least Excel 2003 and the compatibility pack). Talking about savings, convincing them was not too difficult.


Templating

With all the facilities given by ABAP2XLSX, it still was quite some effort to define those rich files which may comprise  more than 100 fields and some tables: For each field, you as a developer have to define a label, format the cells, rows and columns and bind the data. Also for minor graphical changes (e. g. formating) or to the texts, a developer is needed. How beautiful would it be if the business expert could just provide a new version of a template? It would not even be required that the template layout remains if named cells would be used for filling the  template. We therefore decided to split up the provisioning of a the initial Excel as a view and the controller logic to fill it (which is in general a good idea).

template.png

Some sample template designed by a "business user" observer the beautiful formatting...


The MIME Repository as template store

Having got a prepared template by a business user, one important question remained: How to store, access and manage the lifecycle of a template? Of course, you could simply put the file into the filesystem of your application server, but there’s a much better option: The MIME Repository is a tool integrated into the ABAP workbench for managing storage of binary data. You can simply create an own folder for your application and upload your template-files to it. This give you

  • A transportable object which integrates into the deployment (transportation) of your ABAP-application
  • Authorization mechanism in order to limit who’s allowed to access and update which template
  • A nice separation of the presentation and the logic (though of course you might have to bridge some shortages with respect to i18n, depending on your customer)

MIME_rep_se80.png

The MIME-repository UI in SE80 - and the uploaded template


There’s an ABAP-API in order to load the binary content from which you create the ZEXCEL-object. You could for example use a factory:

METHOD create_from_mime_repository.  

  DATA lv_mime_file TYPExstring. 
  DATA lo_excel_reader TYPEREF TO zif_excel_reader.  
  DATA lx_excel TYPEREF TO zcx_excel.

    cl_mime_repository_api=>get_api()->get( 
          EXPORTING        i_url                  =  iv_mime_path           
          IMPORTING        e_content              = lv_mime_file           
          EXCEPTIONSOTHERS=8). 

    IF sy-subrc <>0.   
     RAISE EXCEPTIONTYPE zcx_excel
          EXPORTING error = |File could not be found in MIME repositoy at { iv_mime_path }|. 
    ENDIF.  

    CREATE OBJECT lo_excel_reader TYPE zcl_excel_reader_2007.   

     TRY.        "Instantiate the Excel object on the basis of the binary date from the MIME-Repository
         ro_excel = lo_excel_reader->load( i_excel2007 = lv_mime_file ).   
    CATCH zcx_excel INTO lx_excel.    "excel loading error      
      RAISE EXCEPTIONTYPE zcx_excel          
               EXPORTING error = |File at { iv_mime_path } could not be interpreted as Excel file|.
    ENDTRY.

ENDMETHOD.

Having done this very small coding, you’ll see your efficiency tremendously improved: You basically need one line of code per cell into which you’d like to populate data. Not for tables though: you need at least four lines of code – for the complete table.

"Load file from MIME-path

go_excel = zcl_excel_factory=>get_instance()->create_from_mime_repository('/SAP/PUBLIC/excel_templates/Template_Sample.xlsx').

 

"Fill some elementary data into a predefined format

go_excel->get_active_worksheet()->set_cell(    
     ip_column    =2       
     ip_row       =1       
     ip_value     ='Fruits'      ).

 

"Add tabular data

go_excel->get_active_worksheet()->bind_table(     
     ip_table = gt_item
     is_table_settings =VALUE #( top_left_column ='A' top_left_row =4)  
).

filled.png


Can you do this any easier?


Feedback appreciated!

Oliver


Say Goodbye to Polling: Real-time eventing in ABAP with ABAP Channels

$
0
0

What is real-time in ABAP and why ABAP Channels?


The new technologies like Cloud, Mobility, and In-Memory open new opportunities and lead the industries to the real-time business. Become real-time business means react immediately to the market changes, provide higher responsiveness, accelerate business processes, adjust responses in real-time based on changed business conditions, deliver fast and personalized service for customers, or exploit new business chances not possible before.

 

But what does real-time mean for the running business? From the business user point of view, one of the most important definitions is low latency, meaning how fast the application responds to a click or other user interaction (independent on a computer or a mobile device). Ideally users expect that the input data is processed within milliseconds and they receive immediate responses.

 

Real-time means also always having the latest up-to-date information about application data and state (e.g. the current stock market prices, airline seat availability, latest deadlines for delivery, accurate information on inventory – value, status, receipt, location and disposition), and react in real-time to incoming events. The events can be of various nature and span from the simple notification (e.g. the vacation request was approved in the system), broadcasting (e.g. new repurchase prices are available and must be distributed to the users), process control information (e.g. delivery of sales orders took place, the billing process for customers can start) to events, which require immediate reaction (e.g. illegal trade pattern is detected). Another aspect of real-time is best support for collaborative scenarios (e.g. business users work on the same data records, collaboration platforms, interaction centers).

 

All in all developing real-time applications in ABAP is about the fast, event-driven, highly interactive and collaborative scenarios, which must be supported in ABAP applications.

 

How is it implemented in ABAP? ABAP development for SAP HANA enables real-time processing for huge amounts of business data by exploiting the strengths of In-Memory technology. Using SAPUI5/SAP Fiori on top of AS ABAP offers real-time UI experience and simplified business interactions by means of intuitive highly-responsive consistent UIs across multiple devices. The ABAP channels complete this real-time offering by supporting interactive and collaborative scenarios based on event-driven paradigm independent of database (yes, not only on HANA!) and UI (yes, it works also 'as prototype' for Dynpros!). ABAP Channels infrastructure is general available with SAP NetWeaver AS ABAP 7.40 Support Package 5 (SP05).


Real-time UI access to ABAP data with ABAP Push Channel (APC)

 

As described above, one of the important real-time characteristics is immediate access of users to the frequently changing business information and data in ABAP backend, which will support timely business insights, decision making and productivity.

 

The examples for this can be for instance bringing the irregularly and often changing product information and sale conditions to browser UI (SAPUI5, Web Dynpro ABAP, BSP) as soon as data change takes place in the ABAP backend, pushing short-lived financial data relevant for trades to the browser UI, statistics, process information (sales figures in different areas, financial statistics, manufacturing process status). In all these cases the data presentation on UI (charts, diagrams, text and numbers) must be updated immediately accordingly to the modified data in the ABAP backend.

 

In such situations in order to present the latest up-to-date information from the ABAP backend in real-time on the browser based UI most ABAP applications used polling techniques with multi-seconds intervals or refresh button periodically to get newest updates to UI. These approaches are quite resource consuming result in insufficient performance and poor user experience. The availability of real-time data in ABAP backend is unpredictable and it is unnecessary effort to make requests and open and close HTTP connections.

 

The ABAP Push Channel (APC) technology replaces such inefficient polling approach through WebSockets. ABAP Push Channel is bi-directional message based communication channel representing the WebSocket integration in ABAP, allowing e.g.to push notification to the UI as soon as data change in ABAP backend happens. This is a sign for a user to request the changed data from ABAP backend and update UI.

 

Picture2.png

 

More details about ABAP Push Channel and step-by-step guidance how to implement it in ABAP in Masoud’s Blog:

ABAPChannels Part 1: WebSocket Communication Using ABAP Push Channels.

 

 

Real-timecommunication between ABAP sessions with ABAP Messaging Channel (AMC)

 

Other aspect of the real-time behavior is reacting immediately to the events. Event-driven communication between ABAP sessions across the boundaries of ABAP application servers will streamline the business process workflow, speed up performance and reduce the rate of consumption of database resources. An ABAP application might need to identify and react to certain events in the other ABAP session as soon as they occur. Moreover an ABAP application might involve data processing in order to provide some output to be delivered to another application, running in another ABAP session and therefore has to send notification. Traditionally to realize such real-time event-driven behavior ABAP applications often poll periodically for the state information on the database. Bottleneck problems on the database may occur with numerous active polling from many ABAP applications simultaneously.

 

One of the examples of such real life situations can be long running calculations (sales statistics, loan calculations). A user may initiate a loan calculation (via asynchronous RFC) and it is running so long, that he is not any more interested in the status of calculations and the results and may want to proceed with another actions. In such case the running session (initiated e.g. by RFC) only consumes resources and the calculation must be stopped. In current implementations the ABAP application polls for the status of the calculation on the database. Another example is long running batch jobs (mass data changes, create deliveries from open sales orders, create invoices) which process data gradually. To simulate the real-time behavior, the calling ABAP session polls in short time intervals on the database for the status in order to request already processed data or get updated information.

 

Another example is the business workflow e.g. the manufacturing process, which consists of several productions steps (e.g. manufacturing of components), which are initiated in parallel by the central process (e.g. assembling) on different application servers and must report back their status as soon as they get accomplished. The central process would need to poll on the database periodically in order to get the status of the productions steps. All these situations result either in heavily loaded database by batch jobs, bottlenecks, or by resource- and time-intensive applications reducing database performance.

 

Instead of using periodically polling technique, a publish/subscribe mechanism can be used for prompt notification which can eliminate unnecessary database load. The ABAP Messaging Channel (AMC) infrastructure replaces the polling through publish/subscribe mechanism and acts as a broker for the messages exchange between different ABAP sessions, which can reside on different ABAP application servers. After ABAP sessions act as publisher and subscribers respectively, as soon as an ABAP session publishes notification to AMC, all subscriber ABAP sessions get notified.

 

Picture1.png

Picture3.png

 

More details about AMC and step-by-step guidance how to implement it in ABAP in Masoud’s Blog:

ABAP Channels Part 2: Publish/Subscribe Messaging Using ABAP Messaging Channels


Real-time collaboration with ABAP Push Channel (APC) and ABAP Messaging Channel (AMC)

 

Another essential element of the real-time business are real-time collaboration scenarios, which allow multiple users in different locations in internet to communicate instantly or work on the same business objects simultaneously sharing the same backend resources and even allowing collaborative real-time editing. Applying this to ABAP would mean for example SAPUI5 users in different ABAP sessions which reside on different ABAP application servers can communicate (send messages) and work together on the same ABAP business data records.

 

One of the business scenarios would be broadcasting and distributing of the irregularly and frequently changing business data in ABAP backend to the browser UIs of multiple users across the boundaries of the ABAP application servers (see APC use examples above)

 

Another real-time scenario would be collecting the data from any kind of hardware device (e.g. traffic control tool, medical equipment, RFID scanner, vehicle tracking control, multimedia system, etc.) in the ABAP system and display them on the UI, or react to event (robot reached its destination in the warehouse,

telephone call/chat arrived in the interaction center) in ABAP system with subsequent UI update with latest data without having to poll for the data changes.

 

In situations when multiple users work with the same data (e.g. customers or suppliers information) in the browser UI, and one user changes several data records, they must be updated immediately on all other user UIs.

 

If one goes a step further there are also scenarios of collaborative real-time editing of business object data in which multiple browser UI users have to edit jointly the data of the same ABAP object and modified data should be displayed on UI of other users in the real-time without having to lock the whole object.

 

For all these scenarios the collaboration of ABAP Push and Messaging Channels is the best choice. The publish/subscribe infrastructure of the ABAP Messaging Channels can be used with ABAP Push Channel to enable WebSocket UI clients to act as subscriber. This allows WebSocket UI clients either to receive notifications about data changes or to publish notifications requesting WebSocket UI clients to reload the data from source.

 

Picture4.png

 

More details about using AMC/APC for collaboration and step-by-step guidance how to implement it in ABAP in Masoud’s Blog:

ABAP Channels Part 3: Collaboration Scenario Using ABAP Messaging and ABAP Push Channels.

Code Review with Phabricator - an open source, software engineering platform

$
0
0

Phabricator is a collection of open source web applications that help software companies build better software. It is developed and maintained by Facebook and largely based on their own internal tools.

hero.png

 

The major components of Phabricator are:

  • Differential - a code review tool
  • Diffusion - a repository browser
  • Maniphest - a bug tracker
  • Phriction - a wiki

 

My company has a very mature Java Development team and they have been using Phabricator's Differential for their code review process for quite some time. Our ABAP team has experimented with various processes for enabling and enforcing code reviews and I recently hacked together some integration so that we can use Phabricator for our ABAP code as well. Once I've cleaned up the code and made it easy to configure without having to change a bunch of code I'll set up a project on github with everything you need to get up and running!

 

Basically the goal is to get a nice side by side comparison so that we can quickly and easily see what was changed and to be able to control the release of transport tasks by checking the status of the review. You will not be able to release tasks until the review has been accepted.

diff.PNG

 

 

 

 

Here is what our new process looks like:


You are done coding in a transport task and you are ready to have it reviewed and moved up to the test tier.

1.png

 

Open a command prompt and navigate to C:\Phabricator. When you get there, run the command sapdiff <task number>

2.png


You’ll get a popup of notepad++ and you’ll need to enter a few details:

3.png


<<Replace this line with your Revision Title>> -- This needs to be set to the task number that you are submitting for review

Reviewers – Enter the phabricator user name of the person (or people) you want to review this

4.png


Save the file, then close notepad++. The differences have now been pushed to Phabricator. You will receive an email confirming that a ‘revision’ has been opened and the reviewers will receive an email asking them to review your code.



If you forgot to submit a task for review you will get the following error when you try to release it:

7.png


If you submitted the task for review but it hasn’t been approved you will get the following message including the URL of the revision in Phabricator so you can send it off to someone to follow up if needed.

8.png


I'm pretty excited about this! It's a HUGE improvement over our old process. Hope you like it!


- Lucas


TechEd2014 – (My) focus on ABAP

$
0
0

I’d call myself an ABAP guy. Though I’ve done some Java looooong time back and occasional web development as a hobby, the only serious programming language which I’d claim myself to have mastered is ABAP. Every year, this brings me into an uncomfortable situation when going to TechEd. Hardly anyone at SAP seems to actually care about me being able to earn money with the thing(s) I know. It’s been like this for the past years in Madrid and Amsterdam and looking at the agenda, I was sure it would be no different this year. Luckily at second sight, I was wrong.

For those who could not attend, I’d like to sketch where I have encountered news from the ABAP side. Of course, I was not able to join all the sessions I’d like to have joined, so I’d appreciate reading about your personal highlights as well!


Developer’s garage – get your own ABAP System now!

On the evening before day 1, developer’s garage was opened for the first time at teched. Idea was that developers could inform themselves about how to provide cool software on the technology stacks SAP is offering: HANA Cloud Platform, WebIDEfka. River RDE and last but not least AS ABAP. I was brave enough to approach the SAP-crew waiting there despite the non-suble negative marketing for the AS ABAP. And I felt rewarded: Christopher Kaestner gave me an insight into what it takes to actually provide a stack upon which cloud systems can be deployed. Something I never cared about, but which was really interesting. And more important from a practical side, he instructed me how to use the SAP Cloud Appliance Library and how to set-up my ABAP on HANA-system using it.


While this is easy, it’s still a comparatively risky thing if you’re having your large HANA-instance run for a long time, particularly if you don’t have a real business case you’re working on but if you’re doing this merely  for personal education (about 1€/h). However, there are cheaper alternatives: There’s also a virtualized version of the AS ABAP on MaxDB which has much lower hardware-requirements (currently <25€/month). Why not develop the core of your application on another DB and start the HANA-based instance only if you’re doing the actual HANA-specific part? Anyway, it’s good style to use interfaces and alternative implementations on other databases and I believe that the actual HANA-power will only be required for few operations (just speaking of the ABAP on Hana-usecase, not of the HANA XS-developer, of course). This is how I’ll most probably try it. Once the "on MaxDB-System" is on the same SP-level (currently, it's quite old, SP02).

The cheapest variant would of course be if it was possible to get an AS ABAP trial run on a local machine and what was said in the garage leaves me in an optimistic mood that we’ll not have to wait for this another two years (I promised Christopher not to post how quickly they plan to provide this, as everything which is said at TechEd anyway is subject to change).


Key note – an ABAP container in HCP?

Many posts have already spoken about the keynote. Also I found it very refreshing but at the same time had the impression, that SAP has not forgotten its roots. Even BSEG had a short but important appearance. With respect to ABAP, there was nothing explicitly said, but promising enough, there was a slide picturing the future layering of the SAP development structure. With HANA in its core, the HCP is thePaaS-environment into which applications are being deployed: JavaEE, HANAXS, HTML5 well, and ABAP. At least according to the slide shown.

Lateron after TechEd, Bjoern Goerke unfortunately disclaimed. We might have to wait some time longer until we can actually deploy our artifacts to the HCP. I guess that enabling the TMS for multi-tenancy (multiple isolated spaces in which the workbench-objects live on the same server) might be a bit tricky.


Lectures on ABAP on HANA and Core Data Services (CDS)

Also during day 1, I attended two sessions hosted about enhancements on ABAP. Carine Tchoutouo Djomo presented very nicely various aspects of the code-to-data paradigm (aka. Code pushdown). And largely, this has nothing to do with HANA, but with the general avoidance of transport of data between the database and the application server. Majorly, this was about

  • The vast enhancements to OpenSQL
  • Tools which help analyzing performance of database access dynamically (SQLM) and to combine this is information into a check-cockpit (SWLT)
  • The new ALV for Dynpro and Webdynpro with database-based paging

Only ABAP managed database procedures, which allow to code a stored procedure inside the ABAP are specific to HANA. Currently. From a metamodel-perspective, there is no limitation to HANA as DB, but the database vendor has to implement a set of libraries in order to enable coding in its stored procedure language. And I guess SAP has to be kind enough to accept his contribution and enable a keyword for it. Whether will see the statement LANGUAGE PL_SQL in the next years might be subject to the result of the next America’s cup race.I don’t have to go more into detail here as Carine was so kind to record all the demos and make them available here on SCN.

I wish this was a common best practice for other topics as well.Briefly addressed in this session were also the mighty Core Data Services. This new artefact which can be modeled in eclipse replaces DDIC views. Of course, you’ll still be able to use se11-based DB views also after 7.40, but CDS-views are so much more powerful. Basically you can model the FROM-clause of your OpenSQL statically. Without limitations to inner-joins, join-on-join etc. But acutally, a CDS-view is much more powerful as it also allows to define structured data-relations: A view always has a “flattened” result-structure. Within a CDS-view, also associations can be defined so that to me a CDS-view seems to be the ideal artifact for providing an OData service.To me, this CDS-core is the most powerful change in ABAP during the past years and a major reason to upgrade to 7.40. However, with respect to its extended capabilities, I’m a bit sceptical:

 

  • CDS supports annotations which can be interpreted by a CDS-consumer, e. g. whether an attribute can be used as keyfigure in some analytical artifact. Honestly, I don’t like this with respect to layering: The consumer should be attributing characteristics to CDS-entities, not the other way round.
  • CDS is being positioned as the access layer for any kind of consumer who wants to get data out of the system. However, there are other technologies at “higher” architectural layers which serve a similar purpose. Most important to me: SADL, the service adaptation definition language. It can also build views on top of various artifacts including DB tables, but also more rich entities such as BOPF business objects. This is also necessary from my point of view as particularly for write-accesses further data transformation or validation might be necessary which CDS by its nature cannot provide. In addition, not all data is persisted. For this case, CDS support various expression types (aggregations, case-statements). But not every transient information can be determined using them – or the resulting code would be not maintainable.

My conclusion on CDS is that I highly appreciate it for its extended viewbuilding capabilities, but I’ll not use the annotations unless required by a runtime engine.


UI5 and WebIDE

Now, last but not least, this is not an ABAP-topic, is it? No, it definitely isn’t (at least not until Björn Görke announces the ABAP-container in HCP). But it impacts the way backend applications in ABAP need to be implemented (shameless cross-link). Also, I feel that despite this beautiful new UI technology has matured, there is still a need for business applications to be developed in ABAP. I simply cannot imagine a productive way of building backends for business applications with integration to SAP products (e. g. the business suite) with the same efficiency as in ABAP. And this is not only about the actual laguage and ABAP runtime: The toolsets around business needs (roles and authorization, software logistics, integrated testing, output management, customizing, business rules, …) are very well established and even if not technologically brilliant in some places, they are known to SAP operations teams. What I’m particularly missing in this new technological layer is some application level framework like BOPF which helps to modularize semantically and which reduces the tasks of the developer on developing “business logic” – since this still is what most SAP-projects are being instantiated for.

So in my opinion, UI5 and the surrounding technology canhelp to play to the strengths of each technology: Implement, deploy and manage "business logic" with ABAP, really separate the UI, decouple via Gateway and have the zillions of JavaScript developers who don't need to know about ABAP implement beautiful UI5 user interfaces.


Conclusion

ABAP is not dead at all. In fact, it's currently being renovated not only with respect to syntax (If you have not yet read Horst Keller's blogs about SP08-Language enhancements, do that right now), but it's also getting enhanced with artifacts which allow a good integration into the other state-of-the-art-technologies by SAP (HANA, OData). For me, this means that I need to do the following:

  1. Understand SAPs current technologies and its impacts on application architecture
  2. Learn to master the interface-technologies from the ABAP-side (hoping that BOPF and SADL help me out on implementing lots of the OData-contract on my own)
  3. Understand the common architectural principles and further improve on my custom application's architecture. The patterns apply for other platforms as well - and knowing them well simplifies switching to other platforms if necessary.

Dynamic Node in Web Dynpro ALV

$
0
0

Dynamic Node in Web Dynpro ALV

 

  Dynamic programming is very helpful to provide solution for some critical business requirement in SAP GUI and this legacy is carried forward to the
dynpro era also. Here I worked on a requirement on which output table columns are not fixed. Based on material number in output all other data has been

changed based on classification maintained for that material in material master, so we cannot fix field catalog for this requirement or in web dynpro we
cannot create fixed node and attribute to map the ALV d
ata in interface controller.

 

So to achieve this following steps need to be taken care :

 

 

Step 1 :

Create an internal table which having information of field name and field type(data element) for that material, like :

 

DN1.png

 

here in this type :

 

FNAME - Hold the name of the field

FTYPE - Hold Data type for the field

 

Now based on dynamic condition fill this internal table.

 

Step 2 :

 

Create Dynamic Structure and Dynamic Table based on fields fill in above steps:

 

Here I have created a method which is having field information in table "gt_field_list".This method having 2 exporting parameter which give
reference of dynamically created data type reference of s
tructure and internal table, later you can assign these variable into field symbols for
further processing.

 

 

E_STRUCTURE -Will return reference for structure.

E_TABLE           - Will Return standard internal table reference with line type as e_structure.

 

DN2.png

 

 

Step 3

 

After getting reference of structure and table call above method in get data method and do following coding. After the below coding <f_line1> and <f_tab>
field symbols are ready to use to fill internal final data.

 

DN3.JPG

Step 4

 

Create Dynamic node in Web Dynpro Application:

 

Following code will create a node named "DYNAMIC_NODE" in root node of view.

 

Here node attributes will be added from dynamic structure "gs_structdescr"  and this structure is of same type describe in step 2   "e_structure".

 

 

DN5.png

  

Step 5 :

 

After creating dynamic node now its turn to get reference of newly created node and bind data for this node to the internal table which we filled in step 3.

 

DN1.png

 

 

Step 6:

 

After binding the table now its turn to instantiate ALV component which can be done by following steps:

DN1.png

Step 7: Executeapplication for dynamic node.

 

Thanks and Regards,

Gagan Choudha

Australian SAP Developer and Architect Conference 2014

$
0
0

 

SAP Developer and Architect Summit November 21stand 22nd November 2014

 

 

WP_20141120_001.jpg

A Dustbin

 

Introduction

Last week I had the pleasure of going to the inaugural “SAP Developer and Architect Conference” which is in essence a boiled down version of TECHED – you have all the same speakers as at the real TECHED in Berlin or Bangalore or Las Vegas (e.g. Thomas Jung) presenting the exact same content and making you do the exact same exercises. All this, at a fraction of the normal TECHED price; here in Australia the SAP developer community thought all our Christmases had come at once.

Graham Robinson challenged me at the conference to write a blog saying all the new things I had learned, and I could hardly refuse him. I did bear in mind the so called “Black and Decker” rules I had to abide by when writing about an SAP conference. These were introduced to make sure such blogs were all about the technical content of the presentations, and not what the blogger had for breakfast for example. The rules are simple, and as follows:-

·          Do not mention what you had for breakfast / morning tea / lunch / afternoon tea

·          Do not mention what you said to the taxi driver going to/from the conference

·          Do not mention or show photographs of any sort of waste disposal device – what is called a “dustbin” in the UK or a “trash can” in the USA

·          Do not mention any pop stars you may have met, in particular Stevie Winwood

 

All those rules seemed easy enough to follow, so I thought I would oblige Graham in his request.

 

Keynote

You are probably going to have to lie down before I say that the product HANA was mentioned. Is that a shock? I hope you are OK now. It was fairly strange that the speaker thought the audience would not know the names of SAP tables e.g. BSEG and so tried to keep things agnostic until the last minute. The message however comes through crystal clear – once you understand what HANA is about from a technical point of view you will understand what a sees change is coming. Oracle just does not see this yet,  maybe due to confused messages coming out of SAP, once they do they will have to bite back bug time, or face going under r – this is the proverbial “Oracle Killer”.

 

However I already knew that. What was much more interesting was the philosophy which boiled down to “don’t bother planning any of your IT projects just go ahead and do them, if they work, then pretend you planned it”.  Some people call this “agile”. This messages resonates with the Australian market, we are far more concerned with innovating at a very fast pace then making sure it works first.

SAP are clearly doing this themselves, eating their own dog food as it were – the release of SAP GUI 7.40 speaks volumes – no testing, just rush it out and see what happens.

 

First Morning

 

At some conferences you get to see people (like me) standing on stage and spouting nonsense for an hour. You have no idea if they are telling the truth or not. However if they give you a demonstration system and make you do exercises then it is clear what the product is, warts and all. I decided on a 100% exercise based stream. The first day was clearly going to be a HANA day but that is not a Bad Thing as I reckon all SAP customers will be on this eventually, once they recognise the million foot high ten mile wide elephant in the room.

 

First up, Rich Heilman from SAP talked about how to how to push down your code into the database using SQLScript. The vital point here is as follows – previously SAP recommended using CE FUNCTIONS to wrap your database quires, now they say that CE FUNCTIOBS are rubbish, they are obsolete. Naturally I cannot guarantee they will not become flavour of the month again next yaer, but that is the current state of play.

 

Morning Tea

Whilst the delegates were arriving, we were served “Balut” which is a developed duck embryo boiled alive and eaten in its egg. This dish I s really common in Southeast Asia and often served with beer. The ideal balut is 17 days in the Philippines, but Vietnamese people prefer the 19-21 days old ones.To wash this don we had “airag” which comes from Mongolia. The Mongolian fondness for horses extends past riding and eating them to milking them. The mare’s milk is stored in a cow’s stomach near the entrance of each family’s yurt, or nomadic tent, and left to ferment until it reaches close to 5% alcoholic content, just the thing for breakfast.

 

Moving onto Stevie Winwood - Stephen Lawrence "Steve" Winwood (born 12 May 1948) is an English musician whose genres include rock, blue-eyed soul, rhythm and blues, blues rock, pop rock, and jazz. A multi-instrumentalist, he can play keyboards, bass guitar, drums, guitar, mandolin, violin, and other strings.

 

Second Session

 

As I may have mentioned the HANA session lasts all day so we continue – we had some technical drawbacks like the Wi-Fi not working, and the power points not working, but all credit to the organisers they extended access to the development system for a few days after the conference was over.

 

As I do not work for SAP I can say that in some areas HANA does not yet looks as polished as the mature product will no doubt look like e.g. you have to do a direct database update to authorise your user for debugging. However this is just nit-picking the product is evolving at lightning speed and even after a few minutes you will see the benefits of HANA sticking out like a DB as we say in Australia (stands for “Data Base”).

 

Lunch

Everyone was waiting or lunch as they knew it would be “Casu Marzu” (means rotten cheese) a traditional sheep milk cheese from Sardinia, Italy. The cheese makers set the cheese outside and allow cheese flies to lay eggs inside of it. The larvae which hatch from the eggs have the job of breaking down of the cheese's fats and fermenting it, which kills them. It's unnecessary to clear those dead larvae (white worms) from the cheese before consuming. The “Casu Marzu” was banned for years and only sold on the black market, but few years ago it was declared a traditional food and now it's legal to produce and sell them, which is how this delicacy got to our conference. To wash this down we had “snake wine”. This is made in two ways, first by placing a whole venomous snake into grain alcohol for a few months until the ethanol breaks down the poisons, and then by mixing result with the blood and bile of a freshly killed snake with a shot of local brandy at the SAP booth in the exhibition hall.

 

Moving onto Stevie Winwood - Winwood was a key member of The Spencer Davis Group, Traffic, Blind Faith and Go. He also had a successful solo career with hits including "Valerie", "Back in the High Life Again" and two US Billboard Hot 100 number ones; "Higher Love" and "Roll With It". He was inducted into the Rock and Roll Hall of Fame as a member of Traffic in 2004.

 

Native HANA Development

 

In comes Thomas Jung to take us through developing a HANA application from scratch, no SAP system involved. These exercises would build on each other, starting with what I would call DDIC elements then thet ables, then the procedures, then the user interface.

 

HANA has no user interface, as indeed it should not according to the “separation of concerns” so UI5 was used as the output mechanism.

Afternoon Tea

In Australia we often have Emu Eggs for afternoon tea, but just to be different on the egg front, this time we had “Balut” which is a fairly common and unassuming street food available in both the Philipines and Vietnam. It has earned a widespread reputation as one of the all-time most interesting ethnic delicacies. Most of the eggs with which the western world is familiar with are unfertilized eggs. The “Balut”, though are fertilized duck eggs, incubated or allowed to grow invitro for a certain length of time, usually a few weeks. Peel back the shell and along with a typical soft-boiled eggy interior is also the small inert body of a fetal duck—small bones, feathers, beak and all, some more developed than others. Most accounts suggest the correct way to eat this is slurping it right from the shell with a pinch of salt. There is in addition  a right way to enjoy “Balut” which is to wash it down with “Brennevin” a type of schnapps popular throughout the Nordic countries, and in Iceland; this drink is made with fermented potatoes and caraway seeds. It is lethally strong stuff and is often drunk during the Thorrablot (the winter feast), where it is enjoyed with such delights as ram’s testicles and boiled sheep’s head.

 

After that treat we need a cocktail to calm us down and luckily we have several on offer : There’s Stool Sample: a mixture of cocoa, coffee liqueur, vodka, and cream liqueurs, strawberry syrup and fudge pieces (it’s all about the consistency, apparently); Sanitizer, a palate-cleansing mix of lychee liqueur, cherry brandy, grenadine, vodka and white rum; Urine, made with whiskey, brandy and limoncello, which comes in its own sample tube and Stomach Contents, a tipple, made with vodka and filled with chocolate pieces and Skittles.

 

Moving onto Stevie Winwood - In 2005 Winwood was honoured as a BMI Icon at the annual BMI London Awards for his "enduring influence on generations of music makers." In 2008, Rolling Stone magazine ranked Winwood #33 in its 100 Greatest Singers of All Time.Winwood has won two Grammy Awards.

 

Closing Speeches

 

First up was D.J.Adams, whom I have the pleasure of drinking with at SAP events in Bonn in Germany and Eindhoven in the Netherlands. It was almost like meeting Stevie Winwood.

 

Then we had “Dave” from “Dave’s Brewing Tours” to talk about “innovation in beer”. In Australia 97% of the market is sewn up by two brewing companies, and 190 craft brewers compete for the last 3%.  I can see the connection to IT – we are seen as a commodity, how can we make ourselves different enough to be seen as making a difference?

Usually the last talk is a bad spot to be in as everyone is waiting for the free beer, and then it suddenly occurred to me that the three Master Brewers that Dave had brought on stage would be giving out free beer all evening to us delegates, which indeed they did.

 

Second Day

 

WP_20141120_003.jpg

 

Another dustbin

 

Morning Tea

On the second day we need something to wake up – this is going to be “Ikizukuri” a sashimi made from fishes, octopus, shrimp and lobster. The chef performs the filleting without killing the animals involved and serves them up on a plate with the sliced flesh and still-beating hearts right next to the goldfish bowl in which you put your business card to win an IPAD. To wash this down we have Gilpin Family Whisky which is made from the urine of elderly diabetics. This wonderful concoction is the artistic statement of James Gilpin and unfortunately isn't sold in stores. Gilpin takes the urine of two diabetic patients daily, extracts the high sugar content, then uses that sugar in the fermentation of whisky production. You might think things could not get better than this, but afterwards we had Snake Bile Wine made from Bile extracted from a live cobra and rice wine. To make this concoction the SAP VP of marketing had to get a live cobra, cut him open, remove his gallbladder and extract the sweet, sweet bile, all live on stage whilst demonstrating SAP Luminara. He then mixed that up with rice wine and handed the result out to anyone who enjoys harnessing the power of cobra bile, which was everybody.

Gateway

This session was wonderful. This is just what I want from a conference like this, because I am an anal technical person. Gateway is the mechanism for exposing SAP data to UI5 using the Odata protocol.

This session had a clear theme – if the performance of your UI5 application is bad, here are several you can do to help it, and go through these exercises to learn how to do it yourself rather than having it spoon fed to you. This is teaching someone to fish rather than giving them a fish.

I can only presume that in some cases the generated code in transaction SEGW (ABAP Gateway Modeler) is not as good as it could be – this has been the case with any statement which says “you do not have to write a line of code since 1960.

UI5

The next gentleman did a live coding example of what UI5 looks like – for all of you ABAP programmers out there scared of horrible things like XML and JavaScipt and HTML I would say “don’t be scared – have a look – it is where near as difficult as you might think”.

Lunch

Lunch is the high spot of the day, and this fine day we had “bat paste”: this dish is made by the pre-sales team at SAP catching live bats and forcing them into a pot of boiling milk. When you're done boiling the bats alive you chop them up and mix the pieces in with your chosen variety of herbs and spices. The paste is ten applied to a dish consisting of Ox ***** and “Sannakji” which is a raw Korean dish that consists of live octopuses with sesame and sesame oil. It looks safe but the little tentacles may choke you to death if they get stuck in your throat. This was garnished with Japanese Tuna Eyeballs. To wash this down there were two lovely cocktails – firstly “Baby Mice Wine” made from rice wine and Baby mice. Traditionally a "health tonic" in Chinese and Korean cultures, baby mice are taken shortly after birth, eyes still closed, and dropped alive into a jug of rice wine. The wine is left to ferment for a few months until ready and at serving time, after the wine is imbibed, the embalmed mice are eaten. The second cocktail is the “The Kim Jong Un Nuclear Bomb” which is made from the following ingredients all mashed up in a blender:-
1 Big Mac
1 McDonald's large fries
1 McDonald's tangy BBQ sauce
1 McDonald's milk shake (chocolate, strawberry and vanilla mixed)
1 McDonald's apple pie
Vodka

Evolution of ABAP Programming

This was the icing on the cake – I had been aware of the new ABAP features for a while, but all the examples in SAP online help and on the SCN were all boring, using variables called A and B and C. This is very abstract, but SAP customers work in the real world with real variables that refer to actual things in the real world.

Thomas Jung squared this circle by not bothering with the official examples – he had written his own in ABAP and showed them to us live on stage. When someone asked “what if you do XYZ” then Thomas hanged the code there and then and ran the program….

I would advocate Googling the ABA advances in 7.40 – the bogs by Horst Keller are a wonderful start. Once you get our head around what is possible in ABAP 7.40 you will be on your knees asking the manager to upgrade the SAP system.

Afternoon Tea

For afternoon tea the first dish is the traditional Icelandic food “kaestur hakarl” which means "fermented shark". It's basically bits of stinking, rotten shark carcass. Hakarl is prepared by gutting and beheading a Greenland shark, burying it in sand for up to 12 weeks, then cutting it into strips and hanging them out to dry for a few months. After eating that, we all felt like some caviar -  luckily for us, as normal caviar is not good enough, we turn to the Mexicans who have come up with their own version “Escamoles”. These are the larvae of giant, highly venomous cockroaches. To wash this down we have “Three Lizard Liquor” - a fancy wine predominantly found in Asia which is typically produced by infusing lizards (three to be precise) into rice wine. The traditional eastern medicine theory states that this allows the lizard’s energy to be absorbed by the alcohol and thus transferred to whoever drinks it.

 

 

WP_20141120_004.jpg

 

Two more dustbins

 

Summary

 

That was a wonderful conference, giving you hands on experience of all the new technology.

 

What more could you ask for?

 

I will be 100% going to this next year, if you can reach Australia I suggest you do the same.

 

In the interim I hear there is a new book coming out next April, all about the new features in ABAP. Thomas Jung had written two books about next generation ABAP development, and the were wonderful, but he did not want to write a third, so SAP Press tried to pick the sexiest man in the universe to write a new version, and luckily they caught him between winning the 2013 Mr. Universe contest and running and “Iron Man” marathon in four minutes one second, they managed to beat all his top model girlfriends off him, and he agreed to write a book called “ABAP To The Future”. So that is good news for everybody.

 

Cheersy Cheers

 

Paul

Got an error message? The new tool PANKS is here to help you!

$
0
0

Have you ever heard of PANKS?


PANKS is an acronym that stands for Performance Assistant Note and KBAS Search and as its name implies, it’s a new tool that searches for SAP Notes and KBAS from the performance assistant based on the ABAP error code and context.


Whenever you get an error message, the Performance Assistant is there to help you:


pic1.jpg

 


This is the Performance Assistant that comes along with ABAP error messages.


pic2.jpg

 

 

Looking more closely to the Performance Assistant, you will notice there is a new button:


pic3.jpg


Click on it and you will get SAP Notes and KBAS related to the error code that are relevant to your SAP Netweaver system. In the example 3G 103:


pic4.jpg


How does PANKS work?


This is the algorithm used by PANKS to search for SAP Notes and KBAS (Source: Note 2020356):


TRANS = Transaction

ID = Message class

NNN = Message number


  1. TRANS and sy-cprog and (IDNNN or ID +NNN)
  2. TRANS and help_infos-report + (IDNNN and ID +NNN)
  3. TRANS and help_infos-dynpprog and (IDNNN or ID +NNN)
  4. TRANS and help_infos-PROGRAM and (IDNNN or ID +NNN)
  5. TRANS and help_infos-MSGV1 + (IDNNN or ID +NNN) [In case help_infos-sy_dyn = 'U']
  6. TRANSand IDNNN
  7. sy-cprog and (IDNNN or ID +NNN)
  8. help_infos-report and (IDNNN or ID +NNN)
  9. help_infos-dynpprog and (IDNNN or ID +NNN)
  10. help_infos-PROGRAM and (IDNNN or ID +NNN)
  11. help_infos-MSGV1 and (IDNNN or ID +NNN) [In case help_infos-sy_dyn = 'U']


  • If SAP Notes and / or KBAS are found in any of the steps [1-11], the rest of the steps will be omitted.
  • Different fields in our help_info-structure are filled by Screen Processor according to the current state of program at run-time. They do not need to and may not be filled at the same time.They have different meanings: program to which the screen belongs, report from which program to which screen belongs is started, program for sub screen, code from which the program to which screen belongs is started.The user can find out it via System -> Status -> sub screen for ‘Repository-data’ or via usage of ‘technical info’ button, when F1-help is clicked on the relevant screen.


What’s the advantage compared to the info that traditionally provided the performance assistant?


  • Complete integration with the SAP Notes and KBAS repository.
  • Real time, immediate documentation update. Updating the info provided in the Performance Assistant is necessary but it may take some time... Changes in KBAS and SAP Notes take immediate effect!


New PANKS makes part of a collection of tools that makes it possible to search for notes and kbas directly from the system where the issue happens:



Unlike ANST which searches for SAP correction Notes based on ABAP objects, PANKS relies on the quality of the text of the SAP Notes and KBAS, which means, some adjustments to the SAP Notes and KBAS might be needed to get the best results.


Watch the demo video demo:



Release info:


PANKS will be released with the following SAP_BASIS patches:


Release            Package name

      700                        SAPKB70032
      701                        SAPKB70117
      702                        SAPKB70217
      710                        SAPKB73120
      711                        SAPKB70115
      730                        SAPKB70213
      731                        SAPKB73115
      740                        SAPKB70110


Can’t wait for the support packages?


Apply the following note (At present, not yet translated to English):


2020356 - Suche nach SAP-Hinweisen ist in beiden Doku-Viewern nicht möglich


If you apply the note manually, take into account that it contains manual steps and that note 2080528 as to be appliedas a prerequisite. Note 2094901 is also aprerequisite for release 710.


Special thanks toNatalya Timchouk who has developed the Performance Assistant Note and KBAS Search feature and to Jesús López from our Product Support for his determination to make this possible.

Step by step guide to enhance/update Vendor Master and generate idocs - Part1

$
0
0

I recently worked on a project which entailed enhancing vendor master, updating CREMAS04 Idoc with a new segment for custom records and finally being able to generate IDOCS with new segment when these custom fields of (added to )vendor master are updated. In this 3 part blog I will try to cover the development effort required to achieve the aforementioned functionality in detail.

 

The entire development effort can be classified into three sections as follows:

1) Extending the vendor master

2) Enhancing method VMD_EI_API->MAINTAIN( ) method to programmatically update vendor master tables (LFA1, LFB1, LFM1, LFM2 .. ) - part2.

3) Enhancing the CREAMS04 basis type to include the new segment.

 

 

  1. Extending the vendor master.

        Extending vendor master involves enhancing the vendor master database table and vendor master screen. For the purpose of this blog I am going        to enhance LFA1 (vendor master general - header level ) table with custom fields.

    • Step 1: Carry out steps listed under step ‘Adoption of Customer’s Own Master Data Fields’. Follow this configuration path to reach this step.

     SAP IMG->Financial Accounting->Accounts Receivable and Accounts Payable->Vendor Accounts->Master Data->Preparations for Creating Vendor Master Data->Adoption of Customer's Own Master Data Fields.

SPRO_patch_to_modification_free_enhancement.png

    • Step 2:Execute step 'Prepare Modification-Free Enhancement in Vendor Master Record' step.

In this step you specify the screen group and screen number associated with the new vendor master fields.

Screengroup for venodr master.pngScreenNumber_for_vendor_master.png

    • Step 3:Execute step "Business Add-In: Process of Master Data Enhancements'.

             This steps allows user to create a implementation for BADI - VENDOR_ADD_DATA. In my example I am just activating the custom screen group

              Add on , However this BADI provides other methods to query data for add on fields, save data to table other then vendor master, initialize add-              on append structure ( discussed later ) and much more.

              BADI_VENDOR_ADD_DATA.png

                Implement badi venodor add data.png

    • Step 4:Execute the Business Add-In: customer subscreen step next.

                This steps allows for creation of implementation of BADI- VENDOR_ADD_DATA_CS. This badi provides methods to manipulate the screen elements of subscreen which are all associated with the screen-group declared in previous group. It also provides methods to set values to and read values from the screen fields on the subscreens.

                A filer with the screen group has to be specified before methods of this BADI can implemented.

               BADI_VENDOR_ADD_CS_FILTER.png

               BADI_VENDOR_ADD_CS_IMPLEMENTATION.png

    • Step 5:Next, LFA1 has to be enhanced with append structure consisting of custom fields which will show up on the new subscreen (9030 in this case).

               To do this, go to SE11 and open definition of table LFA1. Click on 'Append Structure..' option and then click on 'Create' to create new                append structure. Since for this demo IDOCS have to be created for any change in values stored in these custom fields. Make sure that the 'Change document' option is turned on at the data element level .

               Save all changes and active.

 

                Create a new append structure.png

                   Append structure with change documents.png

    • Step 6:The Next Step involves adding the fields from append structure to the custom subscreen (accessible via XK** transaction ).

               Execute transaction SE51 and create a new subscreen for program and screen number specified above ( step 4 and step2 respectively: program: SAPMZMSW_VEND_EPA, Screen: 9030 ).

               Create subscreen for new vendor fields.png

                  Click on the 'Dictionary/Program fields window' button to select the append structure fields from LFA1 table structure.

                  Select custom fields from append structure.png

                    Arrange the fields on the layout screen and save all changes.

                  Arrange screen layout for subscreen.png

    • Step 7: In this example the above added screen fields are all display only fields, hence no  PBO is necessary. However to populate these fields for display, LFA1 needs to be declared as a global variable (TABLES) in the dynpro program. Standard processing routing will automatically populate the LFA1 structure with value in the database. Since the screen elements created above all refer to the LFA1 structure they values will automatically be passed to the screen fields and display.

               LFA1 declaration in dynpro program.png

    • Step 8: Finally if all the steps are correctly followed you should be able to view a vendor in XK03 and see the subscreen that was added in the above step. However since all the fields on this subscreen are newly added fields they will all be empty. In the next part of this series, I will go over the steps required to  update the LFA1 structure from an external source.

                XK03_screen1.png

                XK03_screen2.png

TechEd2014 – (My) focus on ABAP

$
0
0

I’d call myself an ABAP guy. Though I’ve done some Java looooong time back and occasional web development as a hobby, the only serious programming language which I’d claim myself to have mastered is ABAP. Every year, this brings me into an uncomfortable situation when going to TechEd. Hardly anyone at SAP seems to actually care about me being able to earn money with the thing(s) I know. It’s been like this for the past years in Madrid and Amsterdam and looking at the agenda, I was sure it would be no different this year. Luckily at second sight, I was wrong.

For those who could not attend, I’d like to sketch where I have encountered news from the ABAP side. Of course, I was not able to join all the sessions I’d like to have joined, so I’d appreciate reading about your personal highlights as well!


Developer’s garage – get your own ABAP System now!

On the evening before day 1, developer’s garage was opened for the first time at teched. Idea was that developers could inform themselves about how to provide cool software on the technology stacks SAP is offering: HANA Cloud Platform, WebIDEfka. River RDE and last but not least AS ABAP. I was brave enough to approach the SAP-crew waiting there despite the non-suble negative marketing for the AS ABAP. And I felt rewarded: Christopher Kaestner gave me an insight into what it takes to actually provide a stack upon which cloud systems can be deployed. Something I never cared about, but which was really interesting. And more important from a practical side, he instructed me how to use the SAP Cloud Appliance Library and how to set-up my ABAP on HANA-system using it.


While this is easy, it’s still a comparatively risky thing if you’re having your large HANA-instance run for a long time, particularly if you don’t have a real business case you’re working on but if you’re doing this merely  for personal education (about 1€/h). However, there are cheaper alternatives: There’s also a virtualized version of the AS ABAP on MaxDB which has much lower hardware-requirements (currently <25€/month). Why not develop the core of your application on another DB and start the HANA-based instance only if you’re doing the actual HANA-specific part? Anyway, it’s good style to use interfaces and alternative implementations on other databases and I believe that the actual HANA-power will only be required for few operations (just speaking of the ABAP on Hana-usecase, not of the HANA XS-developer, of course). This is how I’ll most probably try it. Once the "on MaxDB-System" is on the same SP-level (currently, it's quite old, SP02).

The cheapest variant would of course be if it was possible to get an AS ABAP trial run on a local machine and what was said in the garage leaves me in an optimistic mood that we’ll not have to wait for this another two years (I promised Christopher not to post how quickly they plan to provide this, as everything which is said at TechEd anyway is subject to change).


Key note – an ABAP container in HCP?

Many posts have already spoken about the keynote. Also I found it very refreshing but at the same time had the impression, that SAP has not forgotten its roots. Even BSEG had a short but important appearance. With respect to ABAP, there was nothing explicitly said, but promising enough, there was a slide picturing the future layering of the SAP development structure. With HANA in its core, the HCP is thePaaS-environment into which applications are being deployed: JavaEE, HANAXS, HTML5 well, and ABAP. At least according to the slide shown.

Lateron after TechEd, Bjoern Goerke unfortunately disclaimed. We might have to wait some time longer until we can actually deploy our artifacts to the HCP. I guess that enabling the TMS for multi-tenancy (multiple isolated spaces in which the workbench-objects live on the same server) might be a bit tricky.


Lectures on ABAP on HANA and Core Data Services (CDS)

Also during day 1, I attended two sessions hosted about enhancements on ABAP. Carine Tchoutouo Djomo presented very nicely various aspects of the code-to-data paradigm (aka. Code pushdown). And largely, this has nothing to do with HANA, but with the general avoidance of transport of data between the database and the application server. Majorly, this was about

  • The vast enhancements to OpenSQL
  • Tools which help analyzing performance of database access dynamically (SQLM) and to combine this is information into a check-cockpit (SWLT)
  • The new ALV for Dynpro and Webdynpro with database-based paging

Only ABAP managed database procedures, which allow to code a stored procedure inside the ABAP are specific to HANA. Currently. From a metamodel-perspective, there is no limitation to HANA as DB, but the database vendor has to implement a set of libraries in order to enable coding in its stored procedure language. And I guess SAP has to be kind enough to accept his contribution and enable a keyword for it. Whether will see the statement LANGUAGE PL_SQL in the next years might be subject to the result of the next America’s cup race.I don’t have to go more into detail here as Carine was so kind to record all the demos and make them available here on SCN.

I wish this was a common best practice for other topics as well.Briefly addressed in this session were also the mighty Core Data Services. This new artefact which can be modeled in eclipse replaces DDIC views. Of course, you’ll still be able to use se11-based DB views also after 7.40, but CDS-views are so much more powerful. Basically you can model the FROM-clause of your OpenSQL statically. Without limitations to inner-joins, join-on-join etc. But acutally, a CDS-view is much more powerful as it also allows to define structured data-relations: A view always has a “flattened” result-structure. Within a CDS-view, also associations can be defined so that to me a CDS-view seems to be the ideal artifact for providing an OData service.To me, this CDS-core is the most powerful change in ABAP during the past years and a major reason to upgrade to 7.40. However, with respect to its extended capabilities, I’m a bit sceptical:

 

  • CDS supports annotations which can be interpreted by a CDS-consumer, e. g. whether an attribute can be used as keyfigure in some analytical artifact. Honestly, I don’t like this with respect to layering: The consumer should be attributing characteristics to CDS-entities, not the other way round.
  • CDS is being positioned as the access layer for any kind of consumer who wants to get data out of the system. However, there are other technologies at “higher” architectural layers which serve a similar purpose. Most important to me: SADL, the service adaptation definition language. It can also build views on top of various artifacts including DB tables, but also more rich entities such as BOPF business objects. This is also necessary from my point of view as particularly for write-accesses further data transformation or validation might be necessary which CDS by its nature cannot provide. In addition, not all data is persisted. For this case, CDS support various expression types (aggregations, case-statements). But not every transient information can be determined using them – or the resulting code would be not maintainable.

My conclusion on CDS is that I highly appreciate it for its extended viewbuilding capabilities, but I’ll not use the annotations unless required by a runtime engine.


UI5 and WebIDE

Now, last but not least, this is not an ABAP-topic, is it? No, it definitely isn’t (at least not until Björn Görke announces the ABAP-container in HCP). But it impacts the way backend applications in ABAP need to be implemented (shameless cross-link). Also, I feel that despite this beautiful new UI technology has matured, there is still a need for business applications to be developed in ABAP. I simply cannot imagine a productive way of building backends for business applications with integration to SAP products (e. g. the business suite) with the same efficiency as in ABAP. And this is not only about the actual laguage and ABAP runtime: The toolsets around business needs (roles and authorization, software logistics, integrated testing, output management, customizing, business rules, …) are very well established and even if not technologically brilliant in some places, they are known to SAP operations teams. What I’m particularly missing in this new technological layer is some application level framework like BOPF which helps to modularize semantically and which reduces the tasks of the developer on developing “business logic” – since this still is what most SAP-projects are being instantiated for.

So in my opinion, UI5 and the surrounding technology canhelp to play to the strengths of each technology: Implement, deploy and manage "business logic" with ABAP, really separate the UI, decouple via Gateway and have the zillions of JavaScript developers who don't need to know about ABAP implement beautiful UI5 user interfaces.


Conclusion

ABAP is not dead at all. In fact, it's currently being renovated not only with respect to syntax (If you have not yet read Horst Keller's blogs about SP08-Language enhancements, do that right now), but it's also getting enhanced with artifacts which allow a good integration into the other state-of-the-art-technologies by SAP (HANA, OData). For me, this means that I need to do the following:

  1. Understand SAPs current technologies and its impacts on application architecture
  2. Learn to master the interface-technologies from the ABAP-side (hoping that BOPF and SADL help me out on implementing lots of the OData-contract on my own)
  3. Understand the common architectural principles and further improve on my custom application's architecture. The patterns apply for other platforms as well - and knowing them well simplifies switching to other platforms if necessary.
Viewing all 948 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>