Tuesday, 28 June 2011

flames

as a developer, there are really times na walang ginagawa sa office. at during those times eh talaga namang napakahirap magpangap na gawing kapakipakinabang ang idle time. hay.. kaya eto, naisip kong gumawa ng "flames" na program.

sa mga di nakaka alam ng flames na love game, paki google na lang. anyway, eto ang aking flames na program:

*&---------------------------------------------------------------------*
*& Report YFLAMES
*&
*&---------------------------------------------------------------------*

REPORT yflames.

DATA: gv_count TYPE i,
gv_result TYPE char1,
gv_total TYPE i.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: p_name1 TYPE char50,
p_name2 TYPE char50.
SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.

CLEAR gv_count.

PERFORM get_count USING p_name1 p_name2
CHANGING gv_count.

PERFORM get_result USING gv_count
CHANGING gv_result.

WRITE: /3 p_name1, ' - ', gv_result.

gv_total = gv_total + gv_count.

PERFORM get_count USING p_name2 p_name1
CHANGING gv_count.

PERFORM get_result USING gv_count
CHANGING gv_result.

WRITE: /3 p_name2, ' - ', gv_result.

gv_total = gv_total + gv_count.

PERFORM get_result USING gv_total
CHANGING gv_result.

WRITE: /3 p_name1, p_name2, ' - ', gv_result.

*&---------------------------------------------------------------------*
*& Form GET_COUNT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_NAME text
*----------------------------------------------------------------------*
FORM get_count USING p_name1 p_name2
CHANGING p_count.
DATA: lv_length TYPE i,
lv_letter TYPE char1,
lv_index TYPE i,
lt_result_tab TYPE match_result_tab,
ls_result TYPE match_result.

lv_length = strlen( p_name1 ).

CLEAR: lv_index, p_count.

DO lv_length TIMES.
lv_letter = p_name1+lv_index(1).
IF lv_letter IS NOT INITIAL.
FIND ALL OCCURRENCES OF lv_letter IN p_name2
RESULTS lt_result_tab.
IF lt_result_tab IS NOT INITIAL.
p_count = p_count + 1.
ENDIF.
ENDIF.
lv_index = lv_index + 1.
ENDDO.

ENDFORM. " GET_COUNT
*&---------------------------------------------------------------------*
*& Form GET_RESULT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_COUNT text
*----------------------------------------------------------------------*
FORM get_result USING p_count
CHANGING p_result.
DATA: lv_result TYPE i.

lv_result = p_count MOD 6.

CASE lv_result.
WHEN 1.
p_result = 'F'.

WHEN 2.
p_result = 'L'.

WHEN 3.
p_result = 'A'.

WHEN 4.
p_result = 'M'.

WHEN 5.
p_result = 'E'.

WHEN 6 or 0.
p_result = 'S'.

ENDCASE.

ENDFORM. " GET_RESULT

its not enough para maubos ko ang 8 hours, pero kung sino sinong crush ko ang naisip ko para itry. pinaka nagustuhan ko ung result namin ni John Lloyd Cruz dahil "S" kami.. meaning sweethearts!

No comments:

Post a Comment