2008 Apr 04 11:42 PM
Hi all,
What's the best way of assigning values in the caller program to some global variables defined in the TOP include of a different function group? The one way I know of, which is to create a new function module in the target function group and pass the data via import parameters is not feasible for our development because that would be considered a standard code modification.
The problem can be described as follows:
Caller Function Group : A
Program: caller_program
Pseudo code:
gv_var_1 = 'A'
call function 'USE_GV_VAR'
Called (Target) Function group : B
Top include : LBTOP
LBTOP Code: Data: gv_var_1(1).
Function Module: USE_GV_VAR
USE_GV_VAR Code: if gv_var_1 == 'A'
....
Thanks!!
Jay
2008 Apr 05 4:37 AM
Hi Jay,
One idea could be:
1. Create a new Z-Function group.
2. copy your two function modules from Group A and group B to the Z-group under the name with prefix Z.
3. both TOP-includes have to be combined properly (I guess you can't use both TOP include together. This caused naming problems - probably?!)
Then you have access to all the TOP-fields.
Think about it. May be it works; or it gives you another idea for a solution.
Have luck,
Heinz
Hi Jay,
One idea could be:
1. Create a new Z-Function group.
2. copy your two function modules from Group A and group B to the Z-group under the name with prefix Z.
3. both TOP-includes have to be combined properly (I guess you can't use both TOP include together. This caused naming problems - probably?!)
Then you have access to all the TOP-fields.
Think about it. May be it works; or it gives you another idea for a solution.
Have luck,
Heinz
2008 Apr 05 4:37 AM
Hi Jay,
One idea could be:
1. Create a new Z-Function group.
2. copy your two function modules from Group A and group B to the Z-group under the name with prefix Z.
3. both TOP-includes have to be combined properly (I guess you can't use both TOP include together. This caused naming problems - probably?!)
Then you have access to all the TOP-fields.
Think about it. May be it works; or it gives you another idea for a solution.
Have luck,
Heinz
2008 Apr 07 4:47 PM
Hello Heinz,
Accessing the variable by name is not the concern, but to access and assign value to the variable that is in the roll area of Function Group of B. Even Function Group A can make use of a variable named gv_var_1, it is in the roll area of A, not B. Hence when the function module in B is called, the variable gv_var_1 there is still initial.
Jay
2008 Apr 07 4:51 PM
You need to have some function module in function group B to modify that variable of function group B.
You can not alter its value from different function group. However you can access its value by using calling stack . For example:
DATA: GW_FIELD(60) TYPE C,
L_WBSTK TYPE VBUK-WBSTK.
FIELD-SYMBOLS: <GW_WBSTK_VAL> TYPE VBUK-WBSTK.
CLEAR: GW_FIELD, L_WBSTK.
MOVE '(SAPMV50A)XVBUK-WBSTK' TO GW_FIELD.
ASSIGN (GW_FIELD) TO <GW_WBSTK_VAL>.
IF <GW_WBSTK_VAL> IS ASSIGNED.
L_WBSTK = <GW_WBSTK_VAL>.
ENDIF.
G@urav.
2008 Apr 10 2:28 PM
Thank you, Gaurav. I needed this hint just today. Saved me from making a modification.
Frank
2015 Jun 01 12:38 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |