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

Program Called or executed directly.

Former Member
0 Likes
1,164

Hi Guys,

I have developed program A and I am calling the program A in another program B.

Now I have to code in program A for two different behavior for the below two scenarios

1. When called by the program B or other programs

2. When it is directly executed. - via selection screen

Is there any System variables (I have checked all but none is suitable) or any other way.

Regards,

Prabhu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,119

Hi,

I feel you can use 'MEMORY ID' for this. When you are calling the Program A from program B, before submitting use exprt to set the value in memory id. And check this value before executing the part of program which yo want to execute when it is called from another program.

Regards,

Ranjit Thakur.

6 REPLIES 6
Read only

Former Member
0 Likes
1,120

Hi,

I feel you can use 'MEMORY ID' for this. When you are calling the Program A from program B, before submitting use exprt to set the value in memory id. And check this value before executing the part of program which yo want to execute when it is called from another program.

Regards,

Ranjit Thakur.

Read only

viquar_iqbal
Active Contributor
0 Likes
1,119

Hi

You can use flags . export the flags to memory when your submitting from B then import and check them in A .

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,119

Hi,

As you have create a program PROGRAM A which needs to be called in other programs say PROGRAM B. So to do so you can use code in PROGRAM B to call PROGRAM A:-


SUBMIT <program_a> WITH <parameter_name> = <parameter_value>
                        <parameter_name> = <parameter_value>
                        <parameter_name> = <parameter_value>
                        "and so on for all parameters in program a
                        AND RETURN. "use return if you wat to return control from program a back to program b

Hope this helps you.

Regards,

Tarun

Read only

keerthy_k
Product and Topic Expert
Product and Topic Expert
0 Likes
1,119

Hi,

This can be done using SET/GET parameters. See while u are executing the program B and calling the Program A using the submit statement then just do as follows:

DATA: L_flg type c.

SUBMIT......

l_flg = 'X'.

SET PARAMETER ID 'FLG' FIELD l_flg. --> in the program B.

Now in program A..u can just do as follows:

DATA: L_flg type c.

GET PARAMETER ID 'FLG' FIELD l_flg.

now check for the value of l_flg..

IF l_flg IS NOT INITAIL.

This means it is called from the other program B

ENDIF.

And if l_flg is initial...it is directly executed.

Hope this will help u..

keerthi

Read only

Former Member
0 Likes
1,119

Use syntax like.

export val into memory id '001'.

and Import val from memeory id '001'.

thankyou.

Read only

former_member222860
Active Contributor
0 Likes
1,119

Check with

sy-repid