quarta-feira, 6 de fevereiro de 2013

Unit Testing on ABAP

Hi folks,
Today i decided to publish a program that i made myself on my free times. I will explain the purpose and motivation behind it and i will share the code for everyone who want to try it.
 

Problem

In my previous company we had several periodic processes executed once a year at a specific month. Every year, we had new requirements, so we had to continually adapt our code to the new requirements. The painful part of it, was when we needed to test the code. Our customer worked with several countries with custom rules for each country and we need to test many scenarios. We needed to constantly repeat our huge test battery manually which normally could take several days to complete (more than the ones involved on the development itself).
 

eCATT

 
My first thought, was on SAP standard solution for testing. I made a "simple" proof of concept to test the capabilities around eCATT. I've remember that i've created a new system landscape container (something like this), the test script itself and the data container. Tried to explore the data container part which stores the data used on the test script. My knowledge on this tool was very low, however, i found out some problems on my proof of concept:
  • Load data from an external source
    • Embebbed data is organized in variants
    • I read somewhere that i can read the data from an excel file
  • Adapt the test script itself
    • Adapt multiple test scripts if signatures change is costy
  • eCATT is too complex for simple tasks

Motivation and Purpose

I was always fascinated with dynamic ABAP programming to push to the limits the capabilities arround ABAP code. So i started to design a tool that allowed me to both fulfill my problem around testing and enjoy programming with ABAP dynamic. My thought was reading a test script from a xml file with a simple structure easily modifiable.
Example of a test script:

 

  https://www.dropbox.com/s/uohgjk01yq47b8u/B1.xml
 



This test will call class YCL_PROJ_POSITION and method GET_POSITIONID with the parameters supplied in the example.




Functionalities

  • Generation
    • Generate an XML file for a function (or list of functions), methods, and programs
    • Allow the generation of examples on how to use
    • Allow the generation of commented types for each parameter of the function, program or method for easier introduction
 
  • XML Syntax
    • Allow the runtime substitution of variables for:
      • Dates
      • Times
  • Execution
    • Allow the generation of a PDF file at the end of the execution with the test results
    • Allow to ignore all break-points declared on the xml file.

Hands-on


Generate a file from a function


Generated file:
Execution:

Follows the link to the source-code:

https://www.dropbox.com/s/h0w9r1h2z60qeoz/Y_UNIT_TEST_XML.abap

I'm planning to create a video on how to use this. Feel free to provide your feedback if you try it
 
     
 
 

segunda-feira, 19 de novembro de 2012

How can I cancel/re-execute configuration task on NWA 7.3 which has "Currently executing" status?

 This may happen if your web session has expired during execution of configuration task which was not able to finish in the background because it needed some user input/response. The next time you login to Configuration Wizard if the server is not restarted you will see this task with "Currently executing" status which prevents you from re-executing the task. The status can be cleared by restarting the "tc~lm~ctc~cul~startup_app" application. To do this go to
http://:/nwa -> Operation Management -> Systems -> Start & Stop -> Java EE Applications
Then stop and start the application.

Reference: http://naidukyalla.blogspot.pt/2010_07_01_archive.html

terça-feira, 7 de agosto de 2012

Approve/Confirm downloads on Maintenance Optimizer

Recently, due to a misconfiguration, our Maintenance Optimizer was giving errors blocking us from performing the download and approve of software packages through Solution Manager.

Meanwhile, while digging the web,i've found a workaround to perform a mass authorization on maintenace optimizer.
Enter TCode SE37
Enter function module:
/TMWFLOW/MO_UI_BASKET_AUTHORIZ

Execute with I_OSS_RFC = SAPOSS
Note: SAPOSS must be configured in SM59 to connect to SAP Msg Server

Also your S-User must be mapped to the user currently executing the function module. In order to map it, you should use transaction AISUSER or go through SPRO->SAP Solution Manager Implementation Guide->SAP Solution Manager->SAP Partner->Software Partner->Maintain Table AISUSER

You can check the standard and correct procedure in this link:
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/304f52c1-3aae-2910-6081-8d1deace58f3?QuickLink=events&overridelayout=true

quarta-feira, 3 de março de 2010

Alert redefinition

Hi guys!
Today a colleague of mine was blocked on a javascript error.
He has dynamic forms developed in c# with a lot of asp custom controls using also some javascript. So the page only showed him an alert message saying that an error ocurred!

His question was: How to determine in which place is giving me this error so i can correct it?

Interesting one...

Next i remebered the alert redefinition function that i documented a few posts below and made some adjustments to answer that question:


window.alert=function(native)
{
return function(e){
native(e);
window.status=arguments.callee.caller;
}
}(window.alert);

function nova()
{
alert('xpto');
}

So, now anywhere i have an alert, that alert will also inform me where that alert was fired. In this case printing that information to the status bar. This routine should only be used for "debugging" purposes, for obvious reasons. In this case, there was so much JS that writing this routine was faster than using JS Debugger and digging to the code.
Anyone has a better solution?

terça-feira, 2 de fevereiro de 2010

Entering the code...

The next step is to analyse the code generated by the 'Sample' macro recording. To do that follow this steps:

1.Click ALT+F8 or the Macros button on developer tab.
2.Choose the 'Sample' macro and click edit.
3.You are now on Microsoft Visual Basic editor.You could overpass step 1 and 2 by clicking on ALT+F11 on the worksheet.
4.Now what do we see? We will see somthing similar to this:

Sub Macro1()
'
' Macro1 Macro
'

'
ActiveCell.FormulaR1C1 = "=SUM(RC[1],RC[2],RC[3])"
Range("B1").Select
ActiveCell.FormulaR1C1 = "1"
Range("C1").Select
ActiveCell.FormulaR1C1 = "2"
Range("D1").Select
ActiveCell.FormulaR1C1 = "3"
Range("D2").Select
End Sub

To limit the execution of our routine we use the 'Sub' and 'End Sub' keyword.
Every line that starts with ' is ignored by the code... It is just simply comments and you are free to write whatever you want.

ActiveCell.FormulaR1C1 = "=SUM(RC[1],RC[2],RC[3])"
This line tells that the active cell (the selected cell) is filled with the SUM formula. In our example the A1 cell is filled with the SUM formula.For now, let's just focus on the rest of the code, and then we will see what RC[1] is meant for. If you are really curious you could search on the web by R1C1-style Notation.

Range("B1").Select
Here we select B1 cell,to fill it with the value '1' remeber?

ActiveCell.FormulaR1C1 = "1"
Now we can say that the active cell (B1 cell) is filled with the value 1.

We'll do it for the rest of the cells to fill the values 2 and 3.

Recording macros

Well, the first concept to understand when learning VBA is Macros Development.
What is a macro?
Making it simple,a macro is a list of actions that the user can record to reproduce anytime later.
This concept is global to the whole Office platform, so we can for example develop Macros to write a document on Word, to do some calculations on Excel, or to estimate some times on Project.

How to start digging on Macros?
Well the first step is to enable the developer toolbar. To do that on Office 2007 you go to the Home button, right click on it, and next choose customize quick access toolbar. Then go to Popular tab and check "Show developer tab in the ribbon".
Next you will see a new tab named Developer where you can do the developer stuff.

How to record a macro?
To start recording let's make a first and simple example:
1.Click on Developer tab
2.Click on record macro
3.Name the macro as 'Sample' and click ok.
4.Select A1 cell and write =SUM( and then select B1, C1 and D1 cell and click enter.
5.It should show you 0 because you haven't filled yet the values of B1, C1 and D1.
6.Write 1 on B1, 2 on C1 and 3 on D1.
7.A1 cell should have the value 6 resulted by the sum of the previous cells.
8.Then click on stop recording on the same place you've started recording.
9.Reset your sheet by reseting the fills of each column you've filled before.
10.Select cell A1.
11.Click Macros. A list of all the macros of that worksheet should appear. Select 'Sample' and click run.

Result: All the steps that you've recorded on the macro are reproduced and the sheet is filled again.

In the next example, we will examine the code generated by this recording so don't delete this macro yet.

Here is a pretty cool video more powerfull than our simple example:
Macros

VBA samples for starters

Hi guys!
I was requested to do a small tutorial to introduce some concepts related to VBA and Visual Basic 6 programming so i took the challenge and i'm starting a small series of tutorials related to this technology!
I'm not expert on this topic so you are free to make considerations.

terça-feira, 12 de janeiro de 2010

JAVA Development recorrent problems

On the place i've worked before, and such as many other JAVA Development companies i always had some common and classic java problems such as:

-installing old versions of a product on a client
-installing software built on my machine
-promoting changes between systems
-version management
-knowing basic stuff like knowing the products that we sell and what is installed in which client
-constantly refactoring projects because conventions on naming the projects
-Having redundancy (the same project doing the same thing but with a different name replicated in the system).

I've always assumed this issues to the complexity of a solution developed in JAVA, and i always thoughted that it was a organization problem. With so many products and so many releases by product, installing the right pieces on the right clients could be a challenge in some cases.
Now i've changed my perspective about this issue. Many of this problems could be solved with a tool.

Now that i learned a little of NWDI, i can tell that it can handle very well some of this issues, saving time for development. On NWDI i can have the following:

-A centralized and maintained list of products. This is a basic requirment on all software houses. We need to know exactly what we sell to our clients.
-A centralized place for defining conventions. This solves the problem of having a document or someone saying that some type of object must have some kind of name. IDE reads this definitions from a centralized place and obligates the developer to follow the conventions defined there.
-The propagation of software is automatic. We only need to approve the software so it can follow a path defined by a team leader (usually DEV, CONS, TEST, PROD). For each system defined in the path, the team leader just needs to save the host and port for communication purposes.
-We have a centralized place where we can see in which systems is installed which software, and this place is auto-maintained by NWDI.

One thing that i can't find on NWDI is the integration with bug trackers. Let's say the customer report a problem (a business/technical issue). The only way i know to relate the problem reported by the user and the software change that corrected the issue is to name the activity (same as commit comments on CVS,SVN) the same name as the reported issue.

I'm not trying to sell NWDI and SAP didn't pay me to promote NWDI, but i would like to know the existence of this tool when i purely done JAVA developement so i can take the best practises from it.

Netweaver Development Infrastructure (NWDI) vs Team Foundation Server (TFS) vs ?

Hi all,
i'm currently learning SAP NWDI. SAP NWDI is a tool provided by SAP with the goal of providing a platform and a model for simplifying development.

When i first started looking at NWDI, my first question was:
Why do we need this when we have:

-SCM tools like SVN, CVS, GIT, VSS, Perforce, Bazaar for source control.
-MAVEN, ANT, NANT and others for building, deployment and automation purposes.
-Continuum, jUnit, nUnit, CruiseControl for continuum developement and tests.
-Eclipse,Visual Studio and many others IDE.
-Bugtrackers like Bugzilla,JIRA and others.

Well, with time passing i've started to see the light here.

Tools such as NWDI for SAP Java Development and TFS for .NET Development are intended to integrate some of these concepts into a model of development. This model provides best practises and a unified method of development.
I know that in IT area we need to continually evolve but software development needs stability. We need a model in which we can rely and covers all the needs of the market independently from the techonology used.

I don't know any tool on JAVA to integrate the tools i've talked above in the same way as NWDI or TFS. Do you know any?

Changing language, preserving content

Hi all,
This is my first post in english, and i'll try to write the following posts using English Language instead of Portuguese. The main goal to obtain here is to train my English which is a little rusty, so sorry for the mistakes

segunda-feira, 28 de setembro de 2009

Javascript closures

Bom dia!
Tal como tinha dito, irei neste post falar sobre closures. Os closures são uma das features mais importantes do javascript.
É algo dificil de explicar o que é o closure, mas vou tentar dar um exemplo totalmente académico e demonstrar a partir do exemplo:
<script>
function sum(x)
{
return function (y){
return x+y;
}
}
var sumaux=sum(5);
var result=sumaux(4);
alert(result==9); //true
</script>

Neste código, temos uma função sum que retorna uma outra função. Se repararmos "sum" leva x por parametro. À variavel sumaux fica atribuida a função anónima que leva como parametro y. A grande vantagem do closure, é que permite que sumaux, tenha em memória o valor 5 passado para o parametro x na instanciação, portanto, se executarmos sumaux (que é uma função), está irá lembrar-se do valor x pois foi instanciada com x=5.

Penso que estamos em condições agora de perceber o código abaixo:

window.alert = function(native) {
return function(e) {
native(e);
vbalert(e);
}
}(window.alert);

Esta instrução faz um conjunto de tarefas. A primeira linha é uma atribuição da função window.alert a uma função que iremos definir e que leva por parametro a variavel native(que se pretende que seja uma função). Dentro desta função iremos retornar uma outra função que vai invocar a função native com o parametro que for passado (neste caso a variavel e).
Portanto, se passarmos para a função principal o argumento native=window.alert (correspondente á ultima linha), a função que estamos a retornar irá conter:

return function(e)
{
window.alert(e);
vbalert(e);
}

Para finalizar estamos a igualar window.alert ás linhas que estão acima, ou seja, se executar window.alert('xpto'); estamos na verdade a executar as 2 linhas que estão dentro desta função anónima.

sexta-feira, 25 de setembro de 2009

Javascript com VBScript

Há dias colocaram-me uma dúvida engraçada :).
Um colega meu tinha o código todo cheio de alerts, e em vez de mostrar a caixa normal que é apresentada no javascript queria apresentar uma MsgBox do VB sem ter que alterar qualquer código.
Após alguns testes cheguei a este resultado:

<script Language="VBScript">
Function vbalert(e)
MsgBox e
End Function
</script>
<script Language="JavaScript">
function alert(e){
vbalert(e);
}
alert('windows');
</script>

O que estamos aqui a fazer é a "redefinir" a função alert do javascript para fazer chamar a função vbalert que neste caso vai despoletar uma MsgBox. Ao invés disso, poderiamos fazer mostrar uma DIV p.e. ou até utilizar o jQuery Dialog (componente do jQuery que desconhecia até então e que um colega me mostrou).

O contrário também é possivel (chamar javascript a partir do vbscript).

Mas surge agora uma questão. Visto que estamos a fazer override duma função javascript, como fariamos para extender a função nativa, isto é, preservar o que ela faz, mas adicionar comportamento nosso, neste caso invocar a nossa msgbox vb?

Aqui vai a solução:

<script language="javascript">
window.alert = function(native) {
return function(e) {
native(e);
vbalert(e);
}
}(window.alert);
<script>

O segredo aqui é o closure...No próximo post, explicarei o conceito do closure que é bastante util no javascript e explica na perfeição o funcionamento desta rotina

SVN (Subversion)

O SVN é um conhecido sistema de controlo de sources (SCM).
Antes de mais, devo explicar o que é um sistema SCM.
Um sistema SCM,consiste normalmente num servidor, que contêm um conjunto de repositórios (dados) para gestão de source code. Estes tipos de sistemas têm grandes vantagens, tais como:
-A informação encontra-se centralizada num único sitio (servidor).
-Permite gestão de versões de source code.
-Permite reposição de um determinado source code à imagem que ele estava numa determinada data.
-Permite efectuar branches e tags. Uma tag é uma imagem do código a uma determinada data, enquanto que um branch é um desenvolvimento paralelo que é efectuado para além do desenvolvimento principal (HEAD).
-Permite gestão de código por equipa. Podem estar várias pessoas a trabalhar nos mesmos projectos e até no mesmo source-code ao mesmo tempo.
-Gestão de conflitos que possam surgir com o trabalho em equipa.
-Comparação de versões de ficheiros (tipo windiff).

Para se trabalhar com o SVN em particular, aconselho-vos a visitar a página da SVN.
Aqui poderão encontrar plugins para os mais diversos IDEs nomeadamente o eclipse (é o que eu uso).

O SVN tem como intuito substituir um SCM já existente (CVS).
Para além do SVN existem ainda outros SCM tais como o perforce e o GIT que está a evoluir a olhos vistos podendo-se tornar como o SCM mais utilizado.

GIT-SCM

Para aficcionados do mundo .NET existe ainda o ANKH que poderá ser integrado no Visual Studio.

quinta-feira, 24 de setembro de 2009

HSQLDB

O HSQLDB é um sistema de base de dados bastante simples feito em java.
A base de dados fica guardada numa pasta e é portavel para qualquer lado.
Para correr a base de dados corre-se um batchcmd que inicia o servidor da base de dados ficando disponivel um url a usar numa query string para conexão.
Para introdução de dados, existe um ficheiro .sql na pasta da base de dados onde estarão os SQLs a executar.
Gostei muito principalmente pela simplicidade do sistema. É uma alternativa ao Access, Cloudscape/Derby muito viavel.
Ah e tem outra vantagem: É free!

Mais informações ver:
HSQLDB site

quarta-feira, 4 de março de 2009

Portal

Um portal é uma ferramenta integradora de apresentação que normalmente compreende as seguintes funcionalidades:

-Single Sign On (Inicio de sessão unico): consiste em autenticarmo-nos uma unica vez e transferir permissões de acesso entre aplicações.

-Personalização: consiste em permitir que o portal actue em função do utilizador que está ligado, conseguindo contextualizar a informação que mostra ao utilizador que está a ver.

-Customização: consiste em que cada utilizador consiga criar e manter as suas preferências, construindo páginas e portlets á medida.

E muitas outras. A meu ver a tecnologia portal acabará por vingar na sociedade, mas qual será a opinião dos utilizadores?
Irão estes algum dia tirar partido de todas estas funcionalidades?
Qual a compatibilidade entre um sistema tão complexo como um portal vs sistemas de produção em massa em que o objectivo passa por uma rápida,produtiva e continua introdução de dados?
O que acham?

Fiddler

Boa noite!
It's been a while!
Tinha saudades de escrever aqui no blog portanto vou tentar voltar à carga.

Actualmente estou a tentar optimizar uma página web do websphere portal e tem sido uma luta consegui-lo.
Assim sendo, aconselho a todos os web designers/programadores web, que começem a pensar no assunto performance desde a 1º linha de código digitada.

Para terem uma ideia, sem as devidas caches ligadas e sem que o código tenha qualquer optimização consigo ter páginas com 2MB de informação (imagens, CSS, JS, HTML e outros).

Para quem está com o mesmo problema que eu, aconselho a utilização de uma ferramenta de nome Fiddler juntamente com a extensão nExpert. Isto permite fazer debug ao trafego que circula na rede (HTTP e outros) ajudando a optimizar a cache de recursos e tamanhos das páginas.

terça-feira, 9 de setembro de 2008

Intenção na programação

Eis um link que achei interessante.
Embora refira bastante exemplos sobre Ruby, o aspecto genérico (e digamos... filosófico) sobre linguagens em si poderá ser um tópico de conversa interessante.

Programmer Intent or What you're not getting about Ruby and why it's the tits

domingo, 9 de dezembro de 2007

O poder da fisica na informatica

Aqui está uma aplicação impressionante!
A meu ver é o facto da fisica estar tao bem aplicada que torna esta aplicação muito fixe.

sexta-feira, 12 de outubro de 2007

Baterias de longa duração

Quantos de nós não gostariamos de ter um portátil totalmente autónomo por um dia?
Agora isso é possível não por um dia mas por 30 anos.
Cientistas do departamento de investigação da força aérea dos states descobriram forma de o conseguir.
Pelo que percebi eles não recorrem a energias nucleares nem nada que possa pôr em perigo o comum mortal :).

EU QUERO UM PORTÁTIL QUE NÃO PRECISE DE CARREGAR A BATERIA!!!!


Aqui vai mais detalhes sobre esta nova tecnologia

Betavoltaic

E fica aqui a questão... Será algum dia possivel alimentar veículos com este tipo de inovação?

ooVoo

Bem aqui estou eu com novidades do mundo da informática!
Já muitos de nós somos capazes de ter ouvido falar no ooVoo.
Para quem ainda não ouviu falar, o ooVoo é uma aplicação tipo messenger, mas com + suporte a video. Assim sendo, é possivel estarem várias pessoas numa mesma conversa de video. Mesmo a nivel de design e de inovação acho que supera o messsenger. Aqui vai o link onde poderão fazer download.
ooVoo

Depois quem quiser que me peça o contacto através do msn.