1

I want to pass my own datatype to a form - but it doesn´t work:

TYPES: BEGIN OF my_type,
     v1 TYPE i,
     v2 TYPE i,
   END OF my_type. 


PERFORM calc using ...some parameters... .

FORM calc using ...some parameters... .

DATA values TYPE my_type " <- ERROR type my_type does not exist

...some code...

ENDFORM.
neox2811
  • 87
  • 5
  • 2
    I suspect you might have a typo in your original code. The pseudo-code you show in the question should work. – Gert Beukema Nov 13 '17 at 16:38
  • the original code is located in a function module - does this make any difference? – neox2811 Nov 13 '17 at 19:42
  • 1
    Yes. A function module is its own programm (the name is SAPL...function group name...). Each function module is its own include. There is no relation between a normal report and a function group. If you need to share a type definition you should define it as a global type in SE11. (Maybe a shared include will also work. But I'm not sure and I don't recommend it). – knut Nov 13 '17 at 20:20
  • 2
    Please post an actual example of the code that is not working, not some snippet that has been abbreviated to irrelevance. – vwegert Nov 13 '17 at 21:33
  • @knut thx, se11 helped me. I defined my structure as global type. Now I can use it in the function module. – neox2811 Nov 14 '17 at 12:29
  • I made an answer of my comment. You may accept it and the question is answered. Is your code inside a function group or is your code splitted in function group and function module. – knut Nov 14 '17 at 15:37

1 Answers1

0

Remark: Based on more information in comments: The code is defined in a function module.

A function module is its own programm (the name is SAPL...function group name...). Each function module is its own include.

If you define a type in a report, a function module can't know the type definition. If you need to share a type definition between a reports and function modules (groups), you should define it as a global type in SE11.

If you run your code only inside a function module, you may define types in the top include of the function group. But you should not use this definition in the function module interfaces.

knut
  • 27,320
  • 6
  • 84
  • 112