‎2014 Jan 28 1:37 PM
Hello,
is it possible to substitute a function module with OO-method? If yes are there any examples how this could work?
Many thanks in advance.
Ella
‎2014 Jan 28 2:25 PM
Hi Ella,
please specify if you speak about specific code or if you are searching for an Oo method that replace a useful function.
regards
Fred
‎2014 Jan 28 2:43 PM
Hello Fred,
I'd like to substitute the code in the include EXIT_SAPLRSAP_001 of FM EXIT_SAPLRSAP_001 with a Oo method.
Kind regards
Ella
‎2014 Jan 28 2:56 PM
Ella,
when you use user-exit, you use not Oo, you have to use FM.
If you want to play with Oo you have to use BADI. You could find your BADI using SE18 transaction and create a new implementation using SE19
CMOD / SMOD -> FM
SE18/SE19 -> Oo
regards
Fred
‎2014 Jan 28 3:06 PM
Fred,
I can't generate a class and method and call it in the function module? Why not?
kind regards
Ella
‎2014 Jan 28 3:12 PM
Why ?
if you want to have multi implementation of your code you could create include with FORM inside. and in the include of the function made a PERFORM ... IN PROGRAM ... IF FOUND
so if you have problem with multi code and multi abapor you will not break your productive system ..
is it your problem ?
Fred
‎2014 Jan 28 3:16 PM
Sure you can. In EXIT_SAPLRSAP_001 in its "Z" include you can code any implementation you want. You can create global class and call its methods there without problem
For example:
CASE I_DATASOURCE
WHEN 'Z1'.
zcl_abc=>z1( EXPORTING data_you_need_work_with ).
WHEN 'Z2'.
zcl_abc=>z2( EXPORTING data_you_need_work_with ).
ENDCASE.
But not sure if static calls are good for this use.
‎2014 Jan 28 3:24 PM
I know there is more than one way to skin a cat. And our solution should be with classes and methods. I know this is not the prevalent solution. Are there any technical criteria which speak against this?
Ella
‎2014 Jan 28 3:38 PM
Hi Tomas,
thanks for your reply. I have a further question: How could I define the tables of the tab "tables" to the method?
Thanks and kind regards
Ella
‎2014 Jan 29 11:28 AM
In method you can define it either as Importing, Exporting, Changing or Returning parameter. And TYPE parametr as "table type".
Which can be defined more ways:
- in DDIC (SE11) data type "Table type"
- in class itself, there is Types tab in SE24 (direct type entry) or in code of class definition:
TYPES: tt_sometable TYPE TABLE OF structure.
‎2014 Jan 28 2:39 PM
Hi,
If there is no class and method which suits your requirement then,
you can create a custom class in se24 and method . you can define your code in method and then you can call class and method in the program.
‎2014 Jan 28 2:47 PM
‎2014 Jan 28 3:01 PM
With the realized solution we have problems with transport and if the code is incorrect all extractors can't be loaded. I know there is a possibility to create for every extractor an own function module. But my boss want to have a solution with classes and methods.
‎2014 Jan 29 11:48 AM
Hi Ella,
1 ) Create a custom BADI with class and interface.
2) The class whould have the method with similar code as that of FM.
3) Create BADI implementation
4) Create an include in the user EXIT.
5) Inside the include call the BADI by GET BADI and invoke the required method.
Thanks
Saurabh