Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

help in OO

Former Member
0 Likes
616

Hi,

i have this code and i have to use it in many FM (same function group) there is a way to use it in object oriented ?

i new to abap object.

PERFORM qua TABLES periods USING sy-datum.
  READ TABLE periods INTO wa_periods INDEX 1.
  PERFORM quar TABLES periods USING wa_periods-low.
  READ TABLE periods INTO wa_periods INDEX 8.
  PERFORM quar TABLES periods USING wa_periods-low.
  SORT periods BY low.
  DELETE ADJACENT DUPLICATES FROM periods.


  LOOP AT periods ASSIGNING <fs_periods>.
    IF sy-tabix < 8.
      APPEND : <fs_periods> TO periods1.
    ENDIF.
    IF sy-tabix > 9.
      APPEND : <fs_periods> TO periods2.
    ENDIF.
  ENDLOOP.

Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
573

you can create method with internal table periods as your input parameter

Do you just want to convert this bit alone into OO?

Hi,

i have this code and i have to use it in many FM (same function group) there is a way to use it in object oriented ?

i new to abap object.

PERFORM qua TABLES periods USING sy-datum.
  READ TABLE periods INTO wa_periods INDEX 1.
  PERFORM quar TABLES periods USING wa_periods-low.
  READ TABLE periods INTO wa_periods INDEX 8.
  PERFORM quar TABLES periods USING wa_periods-low.
  SORT periods BY low.
  DELETE ADJACENT DUPLICATES FROM periods.


  LOOP AT periods ASSIGNING <fs_periods>.
    IF sy-tabix < 8.
      APPEND : <fs_periods> TO periods1.
    ENDIF.
    IF sy-tabix > 9.
      APPEND : <fs_periods> TO periods2.
    ENDIF.
  ENDLOOP.

Regards

3 REPLIES 3
Read only

Former Member
0 Likes
574

you can create method with internal table periods as your input parameter

Do you just want to convert this bit alone into OO?

Read only

0 Likes
573

Hi Sriram Chandran ,

yes this is what i wont,

to convert this bit alone into OO.

.

Regards

Read only

Former Member
0 Likes
573

i wouldn't bother with all that.

I would just create a new function module with that code. Add the appropriate IMPORTING/EXPORTING/TABLES parameters and you're ready to go.

Otherwise, you can just create a new INCLUDE program and store the code there. Then, whenever you need to call that code, just put


INCLUDE zyour_include_name

it doesn't have to be difficult.