Skip to Content
0

Reuse Global TYPES Declaration in Program

Sep 01, 2017 at 04:25 AM

95

avatar image
Former Member

Hello,

Is there any way to access the global types inside our exit?.

Eg : In Program MV45AZZ, global types has been declared as GY_XXX.

I need to reuse this global types inside my exit.

data : lt_table type table of ( 'SAPMV45A'(gy_xxx) ).

is there any way to reuse the types from top include?

Regards,

Karthick

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Jörgen Lindqvist Dec 11, 2017 at 07:24 AM
1

You are generally able to access things (like types or data declarations) within their scope. And "User-exit subroutines" like MV45AFZZ (if that is the one you mean) are in the scope of the main SAPMV45A. (In this case, you can use it just like you would expect: DATA: lt_table TYPE TABLE OF gy_xxx).

However if you leave the scope in your exit, like calling another program och a class where you implement the logic for your exit, then you can not.

Or if the data type you want is not on the main program level of SAPMV45A, you may not be in the scope of that data type.


Please tell us which type you want to use, where it is declared, and where you want to use it in your implementation.

Share
10 |10000 characters needed characters left characters exceeded
Iftah Peretz
Dec 09, 2017 at 05:07 PM
0

Hey,

I'm not sure I understand your problem. If you are writing code in a program that is aware of INCLUDE some_top_globals (let's assume it contains GY_XXX type) then you can use that GY_XXX type, if you are not in such program, then you can just write

INCLUDE some_top_globals.
"Your code from here onwards is aware of GY_XXX type

If I'm off point from what you meant please let me know and I'll try and adjust the answer.

Show 4 Share
10 |10000 characters needed characters left characters exceeded

"if you are not in such program, then you can just write"

No, you shouldn't reuse includes

https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abenmultiple_use_include_guidl.htm

0

Hey Horst, the link you provided (https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abenmultiple_use_include_guidl.htm) is broken.

To clarify -"if you are not in such program, then you can just write" - I meant that if you are in a program completely different and want to reuse some code from another program then you can use INCLUDE statement in such a way where you do not use include programs more than once.

0

Hi! Horst must have gotten an internal URL. This should be a working one:

https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenmultiple_use_include_guidl.htm

0

Thanks!

And as I said (better written and coherent):

"Do not use include programs more than once

Use an include program for the modularization of exactly one master program. It must not be integrated into multiple different master programs. Also, an include program should only be integrated once within a master program"

0
Sandra Rossi Dec 09, 2017 at 09:56 PM
0

You may declare the type in a new interface pool ZIF_name, and rename GY_XXX to ZIF_name=>GY_XXX everywhere it's used in SAPMV45A.

Share
10 |10000 characters needed characters left characters exceeded