07-10-2007 4:29 PM
Hi,
Anybody give a info how to convert this to OO
if not i_ymethdrt[] is initial.
loop at i_ymethdrt into wa_ymethdrt.
if wa_ymethdrt-docdes is initial.
move c_y to v_dflag.
perform f_update_error_records using c_ymet c_e '261'
text-023 text-125
wa_ymethdrt-docdes space space space.
endif.
endloop.
else.
move c_y to v_dflag.
perform f_update_error_records using c_ymet c_e '261'
text-023 text-125
text-126 space space space.
endif.
Sa_R
07-10-2007 4:43 PM
Well, the only part that you could make OO or leverage a static class and method would be the PERFORM call. In which case, you can simply define a local class in your program with a method and its signature and simply call it.
So it would be something like this.
report zrich_0001.
*---------------------------------------------------------------------*
* CLASS lcl_app DEFINITION
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
class lcl_app definition.
public section.
class-methods: f_update_error_records
importing im_val1 type string
im_val2 type string
im_val3 type string
im_val4 type string
im_val5 type string
im_val6 type string
im_val7 type string
im_val8 type string
im_val9 type string.
endclass.
*---------------------------------------------------------------------*
* CLASS lcl_app IMPLEMENTATION
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
class lcl_app implementation.
method f_update_error_records.
* Do whatever you need to do.
endmethod.
endclass.
start-of-selection.
* perform f_update_error_records using c_ymet c_e '261'
* text-023 text-125
* wa_ymethdrt-docdes space space space.
call method lcl_app=>f_update_error_records
exporting
im_val1 = c_ymet
im_val2 = c_e
im_val3 = '261'
im_val4 = text-023
im_val5 = text-125
im_val6 = wa_ymethdrt-docdes
im_val7 = space
im_val8 = space
im_val9 = space.
Again, this isn't true OO concepts, but rather simply implementing your code using the modularization technigue of classes/methods.
REgards,
RIch Heilman
07-10-2007 4:41 PM
Hi
It depends on what you wish to managa by OO:
CLASS ERROR DEFINITION.
PUBLIC-SECTION.
CLASS-METHODS: UPDATE_ERROR
IMPORTING PARAM1 TYPE ....
ENDCLASS.
CLASS ERROR IMPLEMANTATION.
METHOD UPDATE_ERROR.
.......................
ENDMETHOD.
ENDCLASS.
if not i_ymethdrt[] is initial.
loop at i_ymethdrt into wa_ymethdrt.
if wa_ymethdrt-docdes is initial.
move c_y to v_dflag.
CALL METHOD ERROR=>UPDATE_ERROR
EXPORTING PARAM1 = c_ymet
....................
endif.
endloop.
else.
move c_y to v_dflag.
CALL METHOD ERROR=>UPDATE_ERROR
EXPORTING PARAM1 = c_ymet
....................
endif.
Max
07-10-2007 4:43 PM
Well, the only part that you could make OO or leverage a static class and method would be the PERFORM call. In which case, you can simply define a local class in your program with a method and its signature and simply call it.
So it would be something like this.
report zrich_0001.
*---------------------------------------------------------------------*
* CLASS lcl_app DEFINITION
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
class lcl_app definition.
public section.
class-methods: f_update_error_records
importing im_val1 type string
im_val2 type string
im_val3 type string
im_val4 type string
im_val5 type string
im_val6 type string
im_val7 type string
im_val8 type string
im_val9 type string.
endclass.
*---------------------------------------------------------------------*
* CLASS lcl_app IMPLEMENTATION
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
class lcl_app implementation.
method f_update_error_records.
* Do whatever you need to do.
endmethod.
endclass.
start-of-selection.
* perform f_update_error_records using c_ymet c_e '261'
* text-023 text-125
* wa_ymethdrt-docdes space space space.
call method lcl_app=>f_update_error_records
exporting
im_val1 = c_ymet
im_val2 = c_e
im_val3 = '261'
im_val4 = text-023
im_val5 = text-125
im_val6 = wa_ymethdrt-docdes
im_val7 = space
im_val8 = space
im_val9 = space.
Again, this isn't true OO concepts, but rather simply implementing your code using the modularization technigue of classes/methods.
REgards,
RIch Heilman