New Features in WDA as of EP2 – Part 1

June 17, 2010

 

In this series of blogs I will cover some of the new features in WDA available in Enhancement Pack 2.

Panels

In part 1 of the series I am going to talk about Panels. Panels are essentially the replacement for Tray and Group.

At this stage I assume that anyone reading this blog knows how to create a simple WDA. If not then might I suggest you check out Thomas Jung’s superb blogs which can be found here.

Creating the Panels

Swapping Root Element

Creating a panel in WDA is simple. The first step is the swap the root element in your view. This is achieved by right clicking on the ‘ROOTUIELEMENTCONTAINER’ the selection ‘Swap Root Element’.

This will act as the container for individual Panels.

swap_root_element

Select the type ‘PanelStack’.

swap_panel_stack

Although I created the PanelStack by swapping the ROOTUIELEMENTCONTAINER this PanelStack can be created anywhere in the view.

Root Element Properties

The elements in the table are generally set by default but it’s always worth double checking.

Property

Value

CollapseMode toHorizontalLine
stackDesign tab
Inserting Panels

Once the container is created we can add the individual panels. Each panel will represent a tab.

To insert the panel click on the new ROOTUIELEMENT and select ‘INSERT PANEL’.

insert panel

Repeat this process as many times as necessary depending on the number of tabs required.

panels 

Panel Properties

Property

Value

Layout FlowLayout
contentDesign Fill
Title “Name of the Panel”
Finished Product

OK, this is what the finished product will look like.

ie_panels_view

Features

OK, now that I have shown how to create a Panel I should explain some of the features of Panels.

CRM UI

The visual design of the PanelStack / Panel is the same as in CRM. This is to provide more consistency for the end user for these two UI frameworks.

Dynamic Titles

One of the key features of panel is that titles can be changed by the user.

dynamic_title_small

Order of the Panels

Another key feature of panels is that the order of the panels can be changed by the user with the use of Drag’n’Drop.

drag_n_drop

This features give the user more freedom with the screen layout.

An example of this is is the OVP component of FPM.

Note: The OVP component is only available as of Netweaver 700 EHP 2.

Consuming ABAP Web Services in ADOBE Flex

May 1, 2010

For a while now I have been keen to play around with ABAP Web Services.  As I have an understanding of ADOBEs Flex, albeit a small one, I thought why not use that.

Therefore in this Blog I will to discuss consuming ABAP Web Services, in Flex.

I have built an application in Flex for retrieving flight info from SFLIGHT which then allows the user to book one of the flights. It’s a very basic application but was fun nonetheless.

For ease of reading I have broken this blog down into 3 sections. These being.

  1. SAP
  2. FLEX
  3. Execution

Also, as per the norm, my demos will be based around SAPs flight model.

SAP

Prerequisite

Before a Web Service is created we create a function module from which we create the Web Service.

Although I am not going to go over the creation of the FM here there are a couple of things I will point that that must be done before we can proceed.

clip_image002

The Processing type in the FM has to be set to Remote-Enabled Module

All the Parameters in the Function Module, be it importing or exporting or any other type, need to have the ‘Pass Value Enabled‘ flag set.

clip_image004

Creating the Web Service

OK, time to create the Web Service. The best and easiest way to this is, in my opinion, is via transaction SE80. For me I find it easier to work directly with the function group.

clip_image006

OK, to start the process. SAP has graciously? provided a wizard to help through the steps in creating the Web Service.

To start the wizard right click in the function group and select ‘Create->Web Service‘.

clip_image008

The Wizard will now popup and prompt for the service definition (IE: its name) and description. Enter the details and click on “Continue

clip_image010

The function group is pre-populated for you but it is advisable to also make sure that “Mapping of names” is selected. Click on “Continue”.

clip_image012clip_image013

At this stage we selection the function modules that we want to create the Web Services for.  In my example I have selected both. Click on “Continue”.

clip_image015

At this stage I tend to accept the proposed values but it’s just a personal preference. What I will stress though is that “Deploy Service” should be selected here otherwise further work will be required later down the line. Click on “Continue”.

clip_image017

This next step is self-explanatory. Click on “Continue”.

clip_image019

Right, at this stage we are ready to let SAP create the Web Service for us. Just click on “Complete” and SAP will work it’s magic.

clip_image021

OK, once SAP has finished creating the Web Service the following screen will appear.

clip_image023

Getting the WSDL URI

OK, at this stage we could commence our Flex development but I would like to show one last important part of the whole process. This is how to get the WSDL URI.

To get the URI we need to use transaction SOAMANAGER. This transaction is the replacement for WSADMIN & WSCONFIG which are obsolete as of NW04s SP14.

Note: Please read the transaction document for more information.

When SOAMANAGER is executed it will launch the default browser, this is because it is a WebDynpro application.

soa_manager

Ok, when the WebDynpro application is loaded select he “Application and Scenario Communication” tab. Then within this window click on “Single Service Administration”.

This will bring up the “Web Service Administration” screen. Here you enter the same of the service just created in the search pattern and click on “Go”.

webservice_data

The next step is to display the details of the service. This is achieved by highlighting the Web Service and clicking on “Apply Selection”.

apply_selection

When the details of the Service come the next step is to click on “Open WSDL document for selected binding”.

details_of_service_def

The next step is the important part. A new window will open containing the WSDL. The contents are not what we are after, the URI is.

wsdl_uri 

Ok, so that’s it for the SAP side of things. Time now for some FLEXing.

Flex

OK, I am not going to go into too much detail about the in’s and out’s of Flex programming. I am just going to cover off the essentials to be able to consume the Web Services.

OK, let’s not procrastinate any further. The first step is to create a Flex Project. Before I start I just want to make it clear that I am not going to spend too much time on FLEX programming. This is, after all an SAP community.

Project

create_flex_project

There are two kind of projects that can be created, a Web application which runs in Flash Player or a Desktop application which runs in Adobe Air.   For this example the latter has been used.

flex_application_type

Ok, now we have created the project it’s time to bind the data from SAP.

Selection Parameters

OK, so on our selection screen we have two fields, City From and City To, these need to be bound with the fields in the webservice.

The following excerpt shows how this is done.

binding_parameters_flex

Calling the WebService

Calling the WebService from FLEX is very simple. All we need to do is give the WebService an ID, the WDSL URI, the operation and the format.

Below is the code used in this example.

call_ws

Results from SAP

Right, now that we have called the WSDL we need to manage the data being returned. We do this by binding the data to a DataGrid.

Below is the code used in this example.

binding_datagrid 

Creating the Air Application

OK, now it’s time to test this application. Although this application can be tested from within the Flex Builder we might as well go ahead and create a desktop application.

Create the installation file

flex_export_release_build

flex_export_release_build_2

digital_signature

Install the AIR Application

air_application_install 

Execution

Right, we are now ready to test this application.

Just to prove it does work here is the SFLIGHT data in my NSP system.

sflight_entries

AIR Selection Screen

data_entry_screen

Results back from SAP

data_entry_screen_results

Booking details entry screen

personal_details_entry  

booking_reference

Booking details in SAP

booking_in_sap

Acknowledgement

I’d like to thank my friend and SAP Mentor Jim Spath for being my Mentor and helping me become a better blogger.

He has been invaluable to me in helping me out with this blog.

I’d also like to thank another good friend and SAP Mentor, Alvaro Tejedo aka Blag. He advised on which books on FLEX were worth checking out.

The Little SE80 of Horrors

August 11, 2009
What

Of late I have been doing lot’s of debugging and during such time I have come across some, how shall I put it, interesting code.

Why

On a couple of occasions I posted screen shots of the offending code on Twitter. One of my fellow Twitterers, who is a legend in his own right, Thorsten Franz (http://bit.ly/DULRI) Tweeted back and said I should Blog about this so that is exactly what I am doing.

I expect that this blog will stir some memories in others and get them to share their experiences with interesting code.

I suspect I will end up moving this Blog to a Wiki to allow others to update it and add their stories

Findings

From what I have found so far it’s clear that most of the developers have neither had any formal training in ABAP programming or have either read books or spoken to other developers who are living in the past and don’t give a damn about a programs performance. They just make it work regardless of how it looks under the bonnet.

My Rules

For me there are some rules that I stick to when writting a program, these are:

1) It works, well Duh!

2) Perfomance is optimal.

3) The code is easy to read and the logic is easy to follow.

4) Use the latest methodologies where applicable.

The "Interesting" Code

Right, here are a few of the clangers that I have discovered so far. 

Here the developer is clearly paranoid about making sure the data is passed to l_ekko.

uhm

Here, it appears that no one other than the mentioned users are allowed to execute this code. This is SAP standard BTW.

image

Ok, here the developer has an issue with clearing the work area and internal table. I love the fact that he clears the table even though the table and work area are declared just prior to them being cleared.

image

And just in case they weren’t cleared in the previous two attempts the developer clears them another couple of times for good luck! Good on ya Mr Developer. 

image

Here we have a developer who hasn’t quite understood the user of move-correspnding. 

This is the type declaration for the internal table. 

image

This is the data select into the internal table.

image

For this next piece of code I don’t actually have words to describe my thoughts on it. It makes me want to cry.

image

again, the same developer from above example.

image

Closing Statement

Well, that’s just a few examples of what I have come across so far.

I think it would be a good idea to create a WIKI of horror code depending on the feedback I get from this blog. Hopefully I won’t have offended to many people. My intention was just to share some interesting code.

Vamsi’s Chicken Curry

August 4, 2009

Being British I am a huge fan of curries. Don’t get me wrong though, I am not your stereo typical Brit who insists on drinking 10 pints beforehand and then sets out to impress his mates buy eating the hottest curry available, usually a Phal if you ask nicely. 

That, to me, is just a waist and will be regretted the following day. To me it’s all about the different flavours that can be found in a curry.

So, a while back, I asked a good friend of mine, Vamsi Krishna Koganti from Tenali, Andhra Pradesh in Southern India, to share one of his curry recipes with me. We mutually decided that we would start off with a chicken curry specific to his region.

I just hope I to do Vamsi justice by sharing his chicken curry recipe here.

Right, here we go.

Ingredients

6 tables spoons of vegetable oil

2 large brown onions, chopped

2 tablespoons of puréed Garlic

2 tablespoons of puréed Ginger

3 tablespoons of plain Greek yoghurt

1 cinnamon stick (broken into small pieces)

2 stars of anise

8 cloves

Fresh chopped coriander

1 1/2 tablespoons of Red Chilli powder

2 teaspoon ground turmeric

2 tablespoons ground coriander

1 teaspoons ground cumin

1 fresh red chilli ( finely chopped)

1 bay leaf

2 cardamom pods

Water

Salt

Preparation

This dish requires that the chicken be marinated for a least two hours prior cooking.

To make the marinade cut the chicken into pieces, put in a bowl and add 2 tablespoons of vegetable oil, yoghurt, 1 tablespoon of chilli powder, ginger, garlic, ground coriander, ground cumin and 1 teaspoon of ground turmeric. Mix well and place in the fridge for at least two hours.

02082009100

Whilst this is in the fridge chop the onions and fresh red chilli and store in preparation for the cooking later.

Cooking

Heat 4 tablespoons of vegetable oil over medium high heat. Add the cinnamon stick, cloves, stars of anise, crushed cardamom pods, bay leaf and fry them for about two minutes. Just enough time for the natural oils in the spices to be released.

Add the chopped onions and fry for 5 minutes.

02082009101

Add the chopped fresh chilli and 1 teaspoon of ground turmeric and fry for a further 10 min or until the onions and fresh chilli are soft.

02082009102

Add the chicken and fry for 5 minutes.

Add about a cup to a cup & 1/2 of water, salt to taste and steam the chicken until cooked. Usually about 15 – 20 minutes. It doesn’t matter if too much water is added as this can be steamed off. You just need to adjust the cooking time to reflect that.

Note: This is best done in a pot rather than a frying pan.

02082009103 

After about 5 mins add one tablespoon of oil and 1/2 a tablespoon of chilli powder and stir through.

After a further 10 mins add the fresh coriander and stir through. Steam for a further 5 mins.

Dish out the dish and enjoy.

Finished Dish

02082009106 

Serve with rice and parota.

02082009105

Enjoy!

Old School Programming Techniques

July 20, 2009

Part 1 – Multiple Tab Selection Screen in Module Pool Programming

For the past few years much of my time has been spent working on the newer and funkier programming techniques within SAP, such as WDA and ABAP OO, so when I was recently asked to do some dialog programming it dawned on me that I had not done done such programming in a long time.  And needed to get my head around the whole concept again.

It was likely that I wasn’t alone so why not blog about it. For two reasons, one, it gave me a chance to write down what I had done for future reference and two, share my experiences with others.

What

A tab is a useful way breaking up screens into separate sections. For example breaking a selection screen into Ticket and Contract Data.

contract_tab

tickets_tab

Why

Using tabs on busy, over crowded selection screen is a great way of making the selection screen tidier and aesthetically more pleasing to the user.

How

OK, so now we have see what is it and why we use it. Now we need to learn how to build it.

1) create a control for the tabstrip. This should always be created in the Top Include of the program. The type will always be of type TABSTRIP.

control_declaration

2) Create the tabstrip control on the screen via transaction SE51.

Click on icon tabstrip icon then size the Tabstrip control to the required size. The default number of tabs is always defaulted to two.

tabstrip_ctrl

Give the tabstrips a meaningful name and double click on the first tabstrip.

The screen painter attributes box will pop up.

screen_painter_attributes

Enter a function code and a Ref Field. The Red Field needs to be the same for all tabs.

Repeat this for all the tabs making sure a different function code is used for each tab.

3) In the PBO (Process Before Output) module set the default tab. This will depend on the tab selected by the user. This is why we maintain the Function Code.

How this is done is by setting the field ACTIVETAB of the tabstrip control to the Function code selected by the user.

set_tasb

4) In the PBO (Process Before Output) we call the Subscreen including the current screen number and program name.

call_subscreen

5) In the PAI (Process After Input) event we need to also declare the tabstrip control.

pai

That’s it’s. You should now have a working selection screen with multiple tabs.

Have fun.

SAP Netweaver Trial Version License Renewal

July 4, 2009

Like many others I downloaded the latest version of the trial SAP Netweaver 7.01. And at the end of the 30 day trial I needed to renew the license. This blog covers that process.

Throughout  the 30 day trial you will be notified of how many days remain of your trial period. Once this period expires an error messages will appear at logon.

image

Hardware ID (HWID)

When requesting a new license key you will need to provide a Hardware ID (HWID).

If you do not know your HWID do not panic. You can this by following these simple steps:

1) Go to the DOS promt and change the directory:

C:\usr\sap\NSP\SYS\exe\uc\NTI386.

Note: This may differ is you have installed your SAP system in different directory.

image

2) Enter the command ‘saplicense –get’. This will return the HWID of the trial system.

image

Requesting the Key from SAP

Go the URL below and enter the requested details.

https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/minisap/minisap.htm

image

It’s vital that the correct System ID is entered. In this case NSP.

image

Installing the new License Key

Once submitted the key should take less that an hour to arrive at the designated email address. Once the key arrives the next step is to install it.

When the key arrives log onto the trial version on SAP Client 000 using user SAP* and password 06071992.

Go to transaction SLICENSE click on image

image

Click on image and chose the file received from SAP.

The file should look like this:

image

If the installation the License Key is successful the following message will pop up:

image

And that’s it, you should be able to access your Trial Version on SAP for another 90 days.

Note: The license can be renewed more than once.

Red Wine

June 2, 2009

This is somewhat off subject but I felt I had to blog about it. A few colleagues and I go out every wednesdy for dinner. The reason being a lot of us are interstate (working away from home) and need to escape the confinds of our hotel rooms / units.

From the onset of the project we all bought an entertainment books for Adelaide http://www.entertainmentbook.com.au/ which are great value for money.

One of our goals was to try the local red wines as they are rumored to be rather good. So, in the past two weeks and I have two very good Shirazs and these are http://www.b3wines.com.au/2005_shiraz.htm and http://www.dowiedoole.com/wines/2006-reserve-shiraz/. So, in closing for those who happen to be able to get their hands on either of these wines please do so as it not only support local businesses but you will also benefit from a superb wine.

Dynamic WDA (WebDynpro ABAP)

May 22, 2009

I am just in the process of preparing a blog on Dynamic WDA but it’s taking longer than anticipated due to other commitments. Please bare with me and check back soon.


Follow

Get every new post delivered to your Inbox.