jueves, 2 de diciembre de 2010

Programming non-sense #2


One of my hobbies is to get ABAP to make things that were not really planned in the design of the language...so when I learned how to put colors on ALV cells...I always had the idea to make something using that...so, I came out with a Paint like.

In this scenario, we have 4 available colors, that get activated by doing a doble click on each cell...if the cell is empty...it's color change...if we double click again...the color changes again...and so on until we hit the cell is empty again, so we can start all over again.

Here's a pic, so you can know what I'm talking about...


And this is the source code...I hope you like it -;)


REPORT zalv_painting NO STANDARD PAGE HEADING.

TYPE-POOLS: abap.
CLASS lcl_event_receiver DEFINITION DEFERRED.

DATA: it_fieldcatalog TYPE lvc_t_fcat,
wa_fcat TYPE lvc_s_fcat,
dataref TYPE REF TO data,
new_line TYPE REF TO data,
l_fieldname TYPE string,
data_catalog TYPE REF TO data,
t_stable TYPE STANDARD TABLE OF
lvc_s_stbl WITH HEADER LINE,
ct_fieldcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo,
gs_variant TYPE disvariant,
custom_container TYPE REF TO
cl_gui_custom_container,
it_color TYPE TABLE OF lvc_s_scol,
it_color_aux TYPE TABLE OF lvc_s_scol,
wa_color_aux TYPE lvc_s_scol,
it_celltab TYPE lvc_t_styl,
event_receiver TYPE REF TO lcl_event_receiver,
grid1 TYPE REF TO cl_gui_alv_grid,
mycontainer TYPE scrfname VALUE 'CUSTOM_ALV',
ls_celltab TYPE lvc_s_styl,
wa_color TYPE lvc_s_scol,
l_color TYPE lvc_col,
l_tabix(2) TYPE c,
ok_code TYPE sy-ucomm,
x_save.

FIELD-SYMBOLS: <row> TYPE table,
<l_line> TYPE ANY,
<l_field> TYPE ANY,
<fs_catalog> TYPE lvc_s_fcat,
<fs_color> LIKE LINE OF it_color,
<fs_color_aux> LIKE LINE OF it_color_aux,
<ct_fieldcat> LIKE LINE OF ct_fieldcat.

*-----------------------------------------------------*
* CLASS LCL_EVENT_RECEIVER DEFINITION *
*-----------------------------------------------------*
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS: handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column.
ENDCLASS. "LCL_EVENT_RECEIVER DEFINITION

*-----------------------------------------------------*
* CLASS lcl_event_receiver IMPLEMENTATION *
*-----------------------------------------------------*
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_double_click.
PERFORM paint_cell USING e_row e_column.
ENDMETHOD. "handle_double_click
ENDCLASS. "LCL_EVENT_RECEIVER IMPLEMENTATION

*=====================================================*
* START-OF-SELECTION *
*=====================================================*
START-OF-SELECTION.
PERFORM create_structure.
PERFORM fill_layout.
PERFORM generate_alv_catalog.
PERFORM call_alv.
CALL SCREEN 0100.

*&----------------------------------------------------*
*& Form CREATE_STRUCTURE *
*&----------------------------------------------------*
FORM create_structure.

DO 20 TIMES.
l_tabix = l_tabix + 1.
CONCATENATE 'FIELD' l_tabix INTO l_fieldname.
wa_fcat-fieldname = l_fieldname.
wa_fcat-ref_table = 'PERF_STRING_STRUCT'.
wa_fcat-ref_field = 'DATA'.
APPEND wa_fcat TO it_fieldcatalog.
ENDDO.

wa_fcat-fieldname = 'COLOR'.
wa_fcat-ref_table = 'PERF_STRING_STRUCT'.
wa_fcat-ref_field = 'DATA'.
APPEND wa_fcat TO it_fieldcatalog.

wa_fcat-fieldname = 'COLOR_CELL'.
wa_fcat-ref_table = 'RESC_DEFAULT_ALV_FIELDS'.
wa_fcat-ref_field = 'COLORTAB'.
APPEND wa_fcat TO it_fieldcatalog.

CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcatalog
IMPORTING
ep_table = dataref
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.

ASSIGN dataref->* TO <row>.
CREATE DATA new_line LIKE LINE OF <row>.
ASSIGN new_line->* TO <l_line>.

DO 40 TIMES.
INSERT <l_line> INTO TABLE <row>.
ENDDO.

ENDFORM. " CREATE_STRUCTURE

*&----------------------------------------------------*
*& Form FILL_LAYOUT *
*&----------------------------------------------------*
FORM fill_layout.

gs_layout-sel_mode = 'A'.
gs_layout-ctab_fname = 'COLOR_CELL'.

ENDFORM. " FILL_LAYOUT

*&-----------------------------------------------------*
*& Form GENERATE_ALV_CATALOG *
*&-----------------------------------------------------*
FORM generate_alv_catalog.

CREATE DATA data_catalog TYPE lvc_s_fcat.
ASSIGN data_catalog->* TO <fs_catalog>.

CLEAR l_tabix.

DO 20 TIMES.
l_tabix = l_tabix + 1.
CONCATENATE 'FIELD' l_tabix INTO l_fieldname.
APPEND INITIAL LINE TO ct_fieldcat
ASSIGNING <ct_fieldcat>.
<ct_fieldcat>-fieldname = l_fieldname.
ENDDO.

ENDFORM. " GENERATE_ALV_CATALOG

*&------------------------------------------------------*
*& Form CALL_ALV *
*&------------------------------------------------------*
FORM call_alv.

IF custom_container IS INITIAL.
CREATE OBJECT custom_container
EXPORTING
container_name = mycontainer
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
ENDIF.

CREATE OBJECT grid1
EXPORTING
i_parent = custom_container.

CREATE OBJECT event_receiver.

SET HANDLER event_receiver->handle_double_click FOR grid1.

CALL METHOD grid1->set_table_for_first_display
EXPORTING
is_variant = gs_variant
i_save = x_save
i_default = 'X'
is_layout = gs_layout
CHANGING
it_fieldcatalog = ct_fieldcat
it_outtab = <row>.

ENDFORM. " CALL_ALV

*&----------------------------------------------------*
*& Module STATUS_0100 OUTPUT *
*&----------------------------------------------------*
MODULE status_0100 OUTPUT.

SET PF-STATUS '0100'.
SET TITLEBAR 'TITLE'.

ENDMODULE. " STATUS_0100 OUTPUT

*&----------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT *
*&----------------------------------------------------*
MODULE user_command_0100 INPUT.

ok_code = sy-ucomm.

CASE ok_code.
WHEN 'BACK' OR 'STOP' OR 'CANCEL'.
SET SCREEN 0.
LEAVE SCREEN.
ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

*&----------------------------------------------------*
*& Form PAINT_CELL *
*&----------------------------------------------------*
FORM paint_cell USING p_row
p_column.

READ TABLE <row> ASSIGNING <l_line>
INDEX p_row.
IF sy-subrc EQ 0 AND <l_line> IS ASSIGNED.
ASSIGN COMPONENT 22 OF STRUCTURE <l_line> TO <l_field>.
it_color[] = <l_field>.
READ TABLE it_color ASSIGNING <fs_color>
WITH KEY fname = p_column.
IF sy-subrc EQ 0 AND <fs_color> IS ASSIGNED.
CASE <fs_color>-color-col.
WHEN space or 2.
l_color = 1.
WHEN 1.
l_color = 4.
WHEN 4.
l_color = 5.
WHEN 5.
l_color = 6.
WHEN 6.
l_color = 2. "White
ENDCASE.

MOVE l_color TO <fs_color>-color-col.
MOVE p_column TO <fs_color>-fname.
ELSE.
l_color = 1.
MOVE l_color TO wa_color-color-col.
MOVE p_column TO wa_color-fname.
APPEND wa_color TO it_color.
ENDIF.

ASSIGN COMPONENT 22 OF STRUCTURE <l_line> TO <l_field>.
<l_field> = it_color[].

CALL METHOD grid1->refresh_table_display
EXPORTING
is_stable = t_stable.
ENDIF.

ENDFORM. " PAINT_CELL


Greetings,

Blag.

martes, 30 de noviembre de 2010

Chrstimas Sale!


Starting today and for all December...get a 25% discount in all my books!

Blag en Lulu.com

Go get this awesome sale!

Greetings,

Blag.

miércoles, 10 de noviembre de 2010

XML and RegEx again...


Today I was thinking about XML and RegEx...You can parse an XML document using RegEx, not the best way, but surely is fun...so...what about creating an XML file using RegEx? More fun for sure! -:D Of course...and just to make it clear...there are other more standard and easier ways to achieve the same: Simple Transformations, XLST Transformation y XML DOM.

But as always...this code was very fun to made -;)


TYPES: BEGIN OF TY_XML,
FIELD TYPE STRING,
END OF TY_XML.

DATA: T_DD03P_TAB TYPE STANDARD TABLE OF DD03P,
T_FILETAB TYPE FILETABLE,
T_XML TYPE STANDARD TABLE OF TY_XML.

DATA: L_FLAG TYPE C,
L_AUX TYPE STRING,
L_STRING TYPE STRING,
L_XML_LINE TYPE STRING,
DATA_TAB TYPE REF TO DATA,
SIZE TYPE I,
W_SUBRC TYPE SY-SUBRC,
W_FILE_OUT TYPE STRING.

FIELD-SYMBOLS: TYPE STANDARD TABLE,
TYPE ANY,
TYPE ANY,
LIKE LINE OF T_XML,
LIKE LINE OF T_DD03P_TAB,
LIKE LINE OF T_FILETAB.

SELECTION-SCREEN BEGIN OF BLOCK TEST WITH FRAME.
PARAMETERS:
TABNAME TYPE DD02L-TABNAME,
FILE_OUT LIKE RLGRAP-FILENAME.
SELECTION-SCREEN END OF BLOCK TEST.

START-OF-SELECTION.
PERFORM VALIDATE_TABLE USING TABNAME
CHANGING L_FLAG.
IF L_FLAG EQ SPACE.
PERFORM LOAD_TABLE_STRUCT USING TABNAME.
PERFORM LOAD_TABLE_INFO USING TABNAME.
PERFORM CREATE_XML.
PERFORM DOWNLOAD_XML.
ENDIF.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE_OUT.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = 'Seleccionar archivo'
DEFAULT_FILENAME = '*.xml'
FILE_FILTER = '*.xml'
CHANGING
FILE_TABLE = T_FILETAB
RC = W_SUBRC.

READ TABLE T_FILETAB INDEX 1
ASSIGNING .
FILE_OUT = .
W_FILE_OUT = FILE_OUT.

IF FILE_OUT IS INITIAL.
EXIT.
ENDIF.

*&------------------------------------------------------*
*& Form VALIDATE_TABLE *
*&------------------------------------------------------*
FORM VALIDATE_TABLE USING P_TABNAME
CHANGING P_FLAG.

SELECT SINGLE TABNAME
INTO P_TABNAME
FROM DD02L
WHERE TABNAME EQ P_TABNAME.
IF SY-SUBRC NE 0.
P_FLAG = 'X'.
ELSE.
CLEAR P_FLAG.
ENDIF.

ENDFORM. " VALIDATE_TABLE

*&------------------------------------------------------*
*& Form LOAD_TABLE_STRUCT *
*&------------------------------------------------------*
FORM LOAD_TABLE_STRUCT USING P_TABNAME.

CALL FUNCTION 'DDIF_TABL_GET'
EXPORTING
NAME = P_TABNAME
TABLES
DD03P_TAB = T_DD03P_TAB
EXCEPTIONS
ILLEGAL_INPUT = 1
OTHERS = 2.

ENDFORM. " LOAD_TABLE_STRUCT

*&------------------------------------------------------*
*& Form LOAD_TABLE_INFO *
*&------------------------------------------------------*
FORM LOAD_TABLE_INFO USING P_TABNAME.

CREATE DATA DATA_TAB TYPE STANDARD TABLE OF (P_TABNAME).
ASSIGN DATA_TAB->* TO .
SELECT *
FROM (P_TABNAME)
INTO TABLE .

ENDFORM. " LOAD_TABLE_INFO

*&------------------------------------------------------*
*& Form CREATE_XML *
*&------------------------------------------------------*
FORM CREATE_XML.

APPEND INITIAL LINE TO T_XML ASSIGNING .
-FIELD = ''.
APPEND INITIAL LINE TO T_XML ASSIGNING .
-FIELD = ''.
*XML Logic here!
LOOP AT ASSIGNING .
L_XML_LINE = ''.
LOOP AT T_DD03P_TAB ASSIGNING .
ASSIGN COMPONENT -FIELDNAME OF
STRUCTURE TO .
L_AUX = .
CONDENSE L_AUX NO-GAPS.
CONCATENATE -FIELDNAME '/' L_AUX
INTO L_STRING.
REPLACE REGEX '(\w+)[\/](\w+)' IN L_STRING
WITH '<$1>$2'.
CONCATENATE L_XML_LINE L_STRING INTO L_XML_LINE.
ENDLOOP.
APPEND INITIAL LINE TO T_XML ASSIGNING .
-FIELD = L_XML_LINE.
CONCATENATE -FIELD '
'
INTO -FIELD.
ENDLOOP.
*XML Logic here!
APPEND INITIAL LINE TO T_XML ASSIGNING .
-FIELD = '
'.

ENDFORM. " CREATE_XML

*&------------------------------------------------------*
*& Form DOWNLOAD_XML *
*&------------------------------------------------------*
FORM DOWNLOAD_XML.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
BIN_FILESIZE = SIZE
FILENAME = W_FILE_OUT
FILETYPE = 'DAT'
CHANGING
DATA_TAB = T_XML.

ENDFORM. " DOWNLOAD_XML



Greetings,

Blag.

jueves, 4 de noviembre de 2010

Programming non-sense #1


With this post, I want to start a small series about ABAP programs that doesn't bring any value but are fun to code -:) I believe that ABAP coding is fun...believe it or not...

Anyway...my first code, that by the way doesn't work in the best possible way, it's a clock...we simply read the system time and show it on digital form...then, we activate a temporizer that it's going to be executed every second and it's going to read again the system timeand show it on digital format...of course, as we don't have in ABAP and CLRSCR(); or an CLS, we must read every line and modify their contents.


DATA: temporizador TYPE REF TO cl_gui_timer,
hour(2) TYPE c,
minute(2) TYPE c,
second(2) TYPE c,
one(1) TYPE c,
two(1) TYPE c,
line1 TYPE string,
line2 TYPE string,
line3 TYPE string.

*----------------------------------------------------------------------*
* CLASS clock DEFINITION *
*----------------------------------------------------------------------*
CLASS clock DEFINITION.
PUBLIC SECTION.
METHODS: zero IMPORTING line TYPE string,
one IMPORTING line TYPE string,
two IMPORTING line TYPE string,
three IMPORTING line TYPE string,
four IMPORTING line TYPE string,
five IMPORTING line TYPE string,
six IMPORTING line TYPE string,
seven IMPORTING line TYPE string,
eight IMPORTING line TYPE string,
nine IMPORTING line TYPE string,
periods IMPORTING line TYPE string,
show IMPORTING number TYPE c.
ENDCLASS. "clock DEFINITION

*----------------------------------------------------------------------*
* CLASS clock IMPLEMENTATION *
*----------------------------------------------------------------------*
CLASS clock IMPLEMENTATION.
METHOD zero.
CASE line.
WHEN 1.
CONCATENATE line1 ' _ ' INTO line1 SEPARATED BY space RESPECTING BLANKS.
WHEN 2.
CONCATENATE line2 '| |' INTO line2 SEPARATED BY space RESPECTING BLANKS.
WHEN 3.
CONCATENATE line3 '|_|' INTO line3 SEPARATED BY space RESPECTING BLANKS.
ENDCASE.
ENDMETHOD. "zero
METHOD one.
CASE line.
WHEN 1.
CONCATENATE line1 ' ' INTO line1 SEPARATED BY space RESPECTING BLANKS.
WHEN 2.
CONCATENATE line2 ' |' INTO line2 SEPARATED BY space RESPECTING BLANKS.
WHEN 3.
CONCATENATE line3 ' |' INTO line3 SEPARATED BY space RESPECTING BLANKS.
ENDCASE.
ENDMETHOD. "one
METHOD two.
CASE line.
WHEN 1.
CONCATENATE line1 ' _ ' INTO line1 SEPARATED BY space RESPECTING BLANKS.
WHEN 2.
CONCATENATE line2 ' _|' INTO line2 SEPARATED BY space RESPECTING BLANKS.
WHEN 3.
CONCATENATE line3 '|_ ' INTO line3 SEPARATED BY space RESPECTING BLANKS.
ENDCASE.
ENDMETHOD. "two
METHOD three.
CASE line.
WHEN 1.
CONCATENATE line1 ' _ ' INTO line1 SEPARATED BY space RESPECTING BLANKS.
WHEN 2.
CONCATENATE line2 ' _|' INTO line2 SEPARATED BY space RESPECTING BLANKS.
WHEN 3.
CONCATENATE line3 ' _|' INTO line3 SEPARATED BY space RESPECTING BLANKS.
ENDCASE.
ENDMETHOD. "three
METHOD four.
CASE line.
WHEN 1.
CONCATENATE line1 ' ' INTO line1 SEPARATED BY space RESPECTING BLANKS.
WHEN 2.
CONCATENATE line2 '|_|' INTO line2 SEPARATED BY space RESPECTING BLANKS.
WHEN 3.
CONCATENATE line3 ' |' INTO line3 SEPARATED BY space RESPECTING BLANKS.
ENDCASE.
ENDMETHOD. "four
METHOD five.
CASE line.
WHEN 1.
CONCATENATE line1 ' _ ' INTO line1 SEPARATED BY space RESPECTING BLANKS.
WHEN 2.
CONCATENATE line2 '|_ ' INTO line2 SEPARATED BY space RESPECTING BLANKS.
WHEN 3.
CONCATENATE line3 ' _|' INTO line3 SEPARATED BY space RESPECTING BLANKS.
ENDCASE.
ENDMETHOD. "five
METHOD six.
CASE line.
WHEN 1.
CONCATENATE line1 ' _ ' INTO line1 SEPARATED BY space RESPECTING BLANKS.
WHEN 2.
CONCATENATE line2 '|_ ' INTO line2 SEPARATED BY space RESPECTING BLANKS.
WHEN 3.
CONCATENATE line3 '|_|' INTO line3 SEPARATED BY space RESPECTING BLANKS.
ENDCASE.
ENDMETHOD. "six
METHOD seven.
CASE line.
WHEN 1.
CONCATENATE line1 '_ ' INTO line1 SEPARATED BY space RESPECTING BLANKS.
WHEN 2.
CONCATENATE line2 ' | ' INTO line2 SEPARATED BY space RESPECTING BLANKS.
WHEN 3.
CONCATENATE line3 ' | ' INTO line3 SEPARATED BY space RESPECTING BLANKS.
ENDCASE.
ENDMETHOD. "seven
METHOD eight.
CASE line.
WHEN 1.
CONCATENATE line1 ' _ ' INTO line1 SEPARATED BY space RESPECTING BLANKS.
WHEN 2.
CONCATENATE line2 '|_|' INTO line2 SEPARATED BY space RESPECTING BLANKS.
WHEN 3.
CONCATENATE line3 '|_|' INTO line3 SEPARATED BY space RESPECTING BLANKS.
ENDCASE.
ENDMETHOD. "eight
METHOD nine.
CASE line.
WHEN 1.
CONCATENATE line1 ' _ ' INTO line1 SEPARATED BY space RESPECTING BLANKS.
WHEN 2.
CONCATENATE line2 '|_|' INTO line2 SEPARATED BY space RESPECTING BLANKS.
WHEN 3.
CONCATENATE line3 ' _|' INTO line3 SEPARATED BY space RESPECTING BLANKS.
ENDCASE.
ENDMETHOD. "nine
METHOD periods.
CASE line.
WHEN 1.
CONCATENATE line1 ' ' INTO line1 SEPARATED BY space RESPECTING BLANKS.
WHEN 2.
CONCATENATE line2 ' * ' INTO line2 SEPARATED BY space RESPECTING BLANKS.
WHEN 3.
CONCATENATE line3 ' * ' INTO line3 SEPARATED BY space RESPECTING BLANKS.
ENDCASE.
ENDMETHOD. "periods
METHOD show.
CASE number.
WHEN 0.
zero( EXPORTING line = '1' ).
zero( EXPORTING line = '2' ).
zero( EXPORTING line = '3' ).
WHEN 1.
one( EXPORTING line = '1' ).
one( EXPORTING line = '2' ).
one( EXPORTING line = '3' ).
WHEN 2.
two( EXPORTING line = '1' ).
two( EXPORTING line = '2' ).
two( EXPORTING line = '3' ).
WHEN 3.
three( EXPORTING line = '1' ).
three( EXPORTING line = '2' ).
three( EXPORTING line = '3' ).
WHEN 4.
four( EXPORTING line = '1' ).
four( EXPORTING line = '2' ).
four( EXPORTING line = '3' ).
WHEN 5.
five( EXPORTING line = '1' ).
five( EXPORTING line = '2' ).
five( EXPORTING line = '3' ).
WHEN 6.
six( EXPORTING line = '1' ).
six( EXPORTING line = '2' ).
six( EXPORTING line = '3' ).
WHEN 7.
seven( EXPORTING line = '1' ).
seven( EXPORTING line = '2' ).
seven( EXPORTING line = '3' ).
WHEN 8.
eight( EXPORTING line = '1' ).
eight( EXPORTING line = '2' ).
eight( EXPORTING line = '3' ).
WHEN 9.
nine( EXPORTING line = '1' ).
nine( EXPORTING line = '2' ).
nine( EXPORTING line = '3' ).
ENDCASE.
ENDMETHOD. "show
ENDCLASS. "clock IMPLEMENTATION

*----------------------------------------------------------------------*
* CLASS lcl_event_handler DEFINITION *
*----------------------------------------------------------------------*
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: on_timer FOR EVENT finished OF cl_gui_timer
IMPORTING sender.
ENDCLASS. "lcl_event_handler DEFINITION

*----------------------------------------------------------------------*
* CLASS lcl_event_handler IMPLEMENTATION *
*----------------------------------------------------------------------*
CLASS lcl_event_handler IMPLEMENTATION.
METHOD on_timer.
DATA: g_clock TYPE REF TO clock.

IF NOT g_clock IS BOUND.
CREATE OBJECT g_clock.
ENDIF.

CLEAR: line1, line2, line3.

hour = sy-uzeit+0(2).
one = hour+0(1).
g_clock->show( EXPORTING number = one ).
two = hour+1(1).
g_clock->show( EXPORTING number = two ).
g_clock->periods( EXPORTING line = '1' ).
g_clock->periods( EXPORTING line = '2' ).
g_clock->periods( EXPORTING line = '3' ).
minute = sy-uzeit+2(2).
one = minute+0(1).
g_clock->show( EXPORTING number = one ).
two = minute+1(1).
g_clock->show( EXPORTING number = two ).
g_clock->periods( EXPORTING line = '1' ).
g_clock->periods( EXPORTING line = '2' ).
g_clock->periods( EXPORTING line = '3' ).
second = sy-uzeit+4(2).
one = second+0(1).
g_clock->show( EXPORTING number = one ).
two = second+1(1).
g_clock->show( EXPORTING number = two ).

READ LINE 1.
MODIFY LINE 1 FIELD VALUE line1 FROM line1.
READ LINE 2.
MODIFY LINE 2 FIELD VALUE line2 FROM line2.
READ LINE 3.
MODIFY LINE 3 FIELD VALUE line3 FROM line3.

sender->run( ).
ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
CREATE OBJECT temporizador.
SET HANDLER lcl_event_handler=>on_timer FOR temporizador.

temporizador->interval = 1.
temporizador->run( ).

DATA: g_clock TYPE REF TO clock.
CREATE OBJECT g_clock.

hour = sy-uzeit+0(2).
one = hour+0(1).
g_clock->show( EXPORTING number = one ).
two = hour+1(1).
g_clock->show( EXPORTING number = two ).
g_clock->periods( EXPORTING line = '1' ).
g_clock->periods( EXPORTING line = '2' ).
g_clock->periods( EXPORTING line = '3' ).
minute = sy-uzeit+2(2).
one = minute+0(1).
g_clock->show( EXPORTING number = one ).
two = minute+1(1).
g_clock->show( EXPORTING number = two ).
g_clock->periods( EXPORTING line = '1' ).
g_clock->periods( EXPORTING line = '2' ).
g_clock->periods( EXPORTING line = '3' ).
second = sy-uzeit+4(2).
one = second+0(1).
g_clock->show( EXPORTING number = one ).
two = second+1(1).
g_clock->show( EXPORTING number = two ).

WRITE:/ line1.
WRITE:/ line2.
WRITE:/ line3.


Greetings,

Blag.

jueves, 28 de octubre de 2010

VTech's V.Reader...for Geek kids


I usually don't write about kids stuff...but this time I have to make an exception...you'll see...my daughter loves my IPhone and that's a good thing...she learned to use the touch screen, enter the program I download specially for her and stuff...but when I need to check my mail, read a book or make a phone call...it's not that funny and cute anymore -;)

So, the other day my wife and I were looking for some toys for our daughter...a toy laptop actually...and we just get freeze when we discover the VTech's V.Reader, a geeky little toy with guess what...touch screen! and the most important thing for us...it reads stories, with graphics, games, dictionary...what else could be asked for? I grabbed my credit card and bought it right away...along with a Dora the Explorer game -:)

Yesterday, she used it for the first time...and I can tell you, when I took my IPhone out, she didn't even look at it, she just wanted to watch and listen the story all over again...best gift we ever gave her...we can't be more happy -:D

But sure...the magic never stops...if you have an SD Card, you can go online, register you V.Reader and get 6 coins that you can use to download more stories! 1 coin per story, so basically you have a free game cartridge, and 6 games to download...





If your kid is 2 to 6 years...then this is a perfect Christmas present...that's for sure -;)


viernes, 22 de octubre de 2010

Good resumes...bad resumes...and resumes from Hell?


While attending SAP Inside Track Newton Square 2010, my good friend Jon Reed from Jonerp.com told me about this book "Resumes from Hell". At first...I didn't knew what to expect, but the name really caught my attention...I was decided to buy it, but as the SAP Community and The Fellowship of the SAP Mentors in so strong, Jon gave me the book for free...along with his signature and a great message -:)



So, I read the book...and it really blown my mind away...those are real resumes created but real people...and as reality is stranger than fiction...those resumes are the worst I have ever seen...some of them are going to make smile, other are going to make you laugh and some others are going to want you to pick up the guy and punch him in the face (You can't hit a lady you know...).

I really enjoyed reading the book, because by seeing how crappy some resumes can be, you can actually took your own and start doing some gardening that would lead to at least...a decent one -:)

You can...sorry...you must buy this book...so here's the link:

Buy Resumes from Hell!

Greetings,

Blag.

viernes, 15 de octubre de 2010

With a little help from my friends...


I think it's good karma, to once in a while write a post sending thanks to all the people that for better or for worse have helped me to become the professional I am today...of course...I can put them all...but a small list is better than nothing -:)

Not in particular order...just...thank you so much for being my friends! And please, don't stop bugging me when it comes to help me out -;)

* Marilyn Pratt
* Jim Spath
* Nigel James
* Leonardo de Araujo
* Craig Cmehil
* Jon Reed
* Dennis Howlett
* Abesh Bhattacharjee
* Sue Keohan
* Mark Finnern
* Aslan Noghre-kar

Greetings,

Blag.

jueves, 19 de agosto de 2010

Again...trying to loose some weight -:P


I you follow and read my blog...I really hope you do...you might remember this blog This post sucks I know that where I stated that I was trying to loose some weight by using Wii Sports on a regular basis...well...as supposed...it was a mayor fail -:(

So...a couple of days ago, I bought myself Wii Fit Plus! in an attempt to of course loose weight and to be able to run a little experiment...just like last time...but...this time is for real -;) While I must admit that Wii Sports made me sweat...nothing can be compared to Wii Fit Plus...it's really a killer! -:D So many exercises for so many types of goals...loose weight, correct your posture, get a better balance...


So...my goal is to loose 8 kilos in 3 months...later on I will post my statistics, so you know how good I'm doing...

Of course, I could post a before and after picture of myself...so you might notice the difference...is there's any LOL but I'm sure it will be hell of difference -;)

The trick is to do the training for at least 30 minutes per day and only eat salads at night...because let's face it...by eating 5 or 6 quesadillas or two cheese sandwiches I wasn't going to loose a single gram...

Greetings,

Blag.

lunes, 16 de agosto de 2010

System Optimizer - Clean your PC


Being a developer and a blogger means that I install a lot of stuff in my computer, some are good stuff, some aren't and sometimes when I uninstall some of those not so good software, some things still get stuck in my laptop, causing the system to get slow or instable...which is of course not good at all...

I been testing a great product called System Optimizer by a company called Digeus Software.

Of course I have tried a lot of cleaners and system fixers before, but System Optimizer provide me a full set of tools that really improves my system in a fast and smooth way...which is something that really makes me happy -;)

Of course, you might like to see some screenshots...






Divided in categories, the software offers a tool for every performance and security task we might need to perform. While you might achieve the same by using separate tools, with this you have everything in one place.

As you can see...so many options are offered, so now you don't have an excuse to use a slow computer anymore -;) Mine is running better than ever -:D

Greetings,

Blag.

martes, 13 de julio de 2010

TripIt.com listens...


Yesterday I was kinda angry...I'm supposed to make a trip to Bathurst, New Brunswick, Canada for work...so the first thing I did was to go to TripIt and tried to add a trip.

At first I got confused as I saw this...


Australia? Where my boss is sending me? That's pretty far from Montreal! So I checked my flight tickets...and of course...I wasn't going to Australia...so I tried again...


Unable to resolve? Where I was going? To a hidden place? So angry as I was I posted this on Twitter...


So...after a long day of hard work...I went home...when I was going to into the elevator, I got an email on my IPhone...from TripIt!!!


So they actually listen to me...even when I didn't tweet them directly...even when I didn't use a hashtag...even when I'm just a regular Geek trying to make a living...

This time, TripIt really surprise me as they use Twitter as a real tool for customer support...kudos for TripIt and kudos for Ruth who was kind enough to read my tweet and actually make something about it.

After this...and as soon as I can...I'm going Pro on TripIt -;)

Greetings,

Blag.

miércoles, 2 de junio de 2010

When in Montreal...


By now, you must know this (I already told everyone LOL)...I'm currently living in Montreal, Canada. It's been a week and 3 days so far for me...but it seems like ages, since my wife and daughter are not with me at this moment...anyway, I'm going back to Lima, Peru to pick them up and get back here to sunny (Ok...sunny by now) Montreal.

I had already gone to work, took the subway, go to do shopping, make my own meals, clean my apartment, do my laundry...so I can say, I feel pretty much comfortable in here -;)

What I like about Montreal? Well...it's a warm city (I'm taking about the people, I gotta live the winter yet), multi-cultural, fully gastronomic and peaceful.

I should post more of my Canadian adventures soon...so stay tuned -;)

Greetings,

Blag.

sábado, 15 de mayo de 2010

Blagbert - The Graphic Novel available now!


Are you a Blagbert fan? Then you can't miss this great opportunity to buy Blagbert - The Graphic Novel


Greetings,
Blag.

jueves, 13 de mayo de 2010

Turning your BlackBerry into a Kindle for the poor


So...you're too cheap to buy an Amazon Kindle and even more cheaper to buy an Apple IPad?

Well...that's not my case -:) It's just that as you may know or going to discover...I'm moving to Montreal, Canada with my family. My Peruvian CrackBerry which is locked will turn into a useless cellphone...so I had two simple options...sold it here or just dump it into the trash...Gladly I found out a third and more elegant solution...

I installed quite time ago this great software called Mobipocket Reader which allows you to read files in a variety of formats...if you, like me, stand to read in the small BlackBerry screen, then this software is for you.

So, with the Mobipocket Reader installed (and of course a big selection of nice books), we just need to start deleting all the things we are not going to use anymore...like games, GMail client (Actually all Google Stuff) and so on...why? Simple...I'm not going to have a carrier in Canada...I'm not going to have an Internet provider...why I would like to keep all those applications that are nothing without the web?

Delete everything and just keep the essentials...this way you're going to have a more useful and quick device to read books and took pictures -;)

Almost forgot...I'm going to have a brand new IPhone waiting for me to be hacked W00T!

Greetings,

Blag.

jueves, 15 de abril de 2010

uCertify's Spring sale


You might recall that some time ago I published the post uCertify - Certifications made easy..., well, today they mail me telling me that they are offering a Spring sale discount of 20% that will last until April 20th, so you better hurry -;)

Simply type SPRING as the discount during checkout.

Greetings,

Blag.

jueves, 8 de abril de 2010

The marathon man strikes again...


Last year I wrote a post called Kudos to Craig Cmehil and FMR24H!!! about Craig Cmehil and his 24 marathon Friday Morning Report to support Doctors without Borders.

This year, the marathon man strikes again...and hell yeah I'm going to be there to support him! -:D Be sure to check him out Agenda for FRM24 starting Friday 9, April with a very nice list of guest (most of them, friends of mine) so there's even more reason to help him in his great crusade.

Last year was interesting, funny and very geeky -:) So I'm sure this year is going to be even better...so prepare your internet connection, a six pack of Red Bulls and your credit card (You must give something to the Doctors without Borders...don't be cheap LOL).

Greetings,

Blag.