Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

calling a standard subroutine and setting global fields

Former Member
0 Likes
1,562

Hallo ...

I am calling a subroutine in program A(standard program ) from a program B . there are a set of global fields in program A that i need to first set before i call this subroutine from Program B. is it posible to set these fields from program B. (since i cannot do much on the program A side as it is standard).?

Can some one suggest how can set these fields . some of these fields are flags and some normal fields. Not all the fields have parameterd ids. any idea how can i set thses fields from program B ?????

Help will be appriciated

Thanks

Hallo ...

I am calling a subroutine in program A(standard program ) from a program B . there are a set of global fields in program A that i need to first set before i call this subroutine from Program B. is it posible to set these fields from program B. (since i cannot do much on the program A side as it is standard).?

Can some one suggest how can set these fields . some of these fields are flags and some normal fields. Not all the fields have parameterd ids. any idea how can i set thses fields from program B ?????

Help will be appriciated

Thanks

6 REPLIES 6
Read only

Former Member
0 Likes
1,240

can someone help?

Read only

0 Likes
1,240

any idea?

Read only

sreekanthgo
Contributor
0 Likes
1,240

Hi,

I think it may not be possible to change the global variables of one program form another program.

Can you enhance the standard program using Enhancement spots?

Thanks,

Sreekanth

Read only

Former Member
0 Likes
1,240

Hello,

there are two choices:

(1) You can add a form to program A, if the standard program lets you implement user-defined code. For example, in program SAPMV45A you use a certain include to implement user-defined forms. You can define a form which takes the actual values of the fields in program A which you want to change as parameter. The form then changes the fields (from within the form, the fields are visible and changable). You can call this form by using PERFORM your_form IN program_A.

(2) You can use a "dirty assign": Refer to the F1 help of the ASSIGN statement for more information about that. Sample may look like this (note the brackets and apostrophes):

ASSIGN ('(PROGRAM_A)GLOBAL_FIELD') to <fs_proga_global_field>.

However, the assign only works when program A has already been loaded into the internal mode during runtime. This means before doing the ASSIGN, any code of program A must have been executed in the current internal mode.

Hope this helps,

David

Read only

Former Member
0 Likes
1,240

Hi this is possible if your program A run and call B inside it.

now u can change the value using field symbols in explicit enhancment if you dont hav any implicit enh or user exit

cheers

Read only

venkat_o
Active Contributor
0 Likes
1,240

Hi, <li>You can call standard program subroutine without changing code in std program. <li>You need to create two program as i created below.

report ZTEST_PROGRAM.
data: x type p,
      y type p.
x = 1.
y = 2.
perform get_changed_values using x CHANGING y.
WRITE:/ x,y.
*&---------------------------------------------------------------------*
*&      Form  get_changed_values
*&---------------------------------------------------------------------*
form get_changed_values  using    p_x
                changing p_y.
 p_y = p_y + p_x + 1.
endform.                    " get_changed_values
REPORT ztest_notepad.
data: x type p,
      y type p.
x = 2.
y = 3.
perform get_changed_values(ZTEST_PROGRAM) using x CHANGING y.
WRITE:/ x,y.
<li>Run program ztest_notepad program and check the values. I hope that it solves your problem. Thanks Venkat.O