cancel
Showing results for 
Search instead for 
Did you mean: 

What for? (2nd part global declaration in transformation)

Former Member
0 Kudos

Hi Experts,

does anybody know, what for is the 2nd part global declaration in a routine of a transformation?

Myself I'm a developer, so I can differ between global and local declaration in a class-definition. But the second possibility to declare variables is outside of class-definition and class-implementation.

I checked start routine, end routine and character/ keyfigure routine. I can see both of the declaration. Does it makes any sence to use this declaration?

***************************************************

$$ begin of global - insert your declaration only below this line -

... "insert your code here

$$ end of global - insert your declaration only before this line -

$$ begin of 2nd part global - insert your code only below this line *

... "insert your code here

$$ end of 2nd part global - insert your code only before this line *

***************************************************

Thanks in advance.

Greets Nico

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Nico

The usage of 1st global decleration or 2nd global area depends on scenarios.

If you have multiple data packages and u need to declare a global variable that can be used for all records in a single package then u should use data declerations with 'DATA'. This can be written in either 1st global area or the second.

But if you need to declare a global variable that can be accessed by the entire request (all packages),

then u need to use data declerations with 'CLASS-DATA'. This can be written in only in the first global area.

Former Member
0 Kudos

Hi Lijo,

first, thank you for you answer.

I'm not sure if I got it.

If you want to use a global variable for all packages that will be processed, I have to declare a CLASS-DATA. That means the instance of the class won't be deleted the whole data package.

If I want to use a global variable that will be used in character/ keyfigure routine it's sufficient to declare DATA in 1st or 2nd part of declaration.

I understand it in a way, that the second declaration part is redundant. Is it right?

Thanks in advance.

Greets Nico

Former Member
0 Kudos

As far as i know... this is the only difference. Whether the second global area is redundant or not depends on how u use it. Normally people use the second global area for all global declerations and the first global area is used only when there is a CLASS-DATA decleration.

But in ur case you use the first global area for all declerations. So may be u can consider it redundant.

Answers (2)

Answers (2)

darryl_goveas3
Participant
0 Kudos

This message was moderated.

0 Kudos

I'm also searching for the SAP intent with this area (2nd part global). I was thinking of using this area for defining and implementing my own local classes. How does that strike you?