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

Problem on dynamic assignment?

Former Member
0 Likes
971

As you know, we can use statement like var1 = '(program)objectname', and assign (var1) to <fs>,

I tried, and succeed in function module, but when I use it in prog2, and in prog1, I submit prog2, it does not work.

can this usage only be available in function module?

1 ACCEPTED SOLUTION
Read only

alex_cook
Active Participant
0 Likes
928

Howdy,

By performing the SUBMIT you are creating a new logical unit of work (LUW) and hence the dynamic assignment will fail.

To achieve the same result you can utilise techniques like function module global memory, export/import to memory ids or shared memory access (SHMA).

Cheers

Alex

8 REPLIES 8
Read only

alex_cook
Active Participant
0 Likes
929

Howdy,

By performing the SUBMIT you are creating a new logical unit of work (LUW) and hence the dynamic assignment will fail.

To achieve the same result you can utilise techniques like function module global memory, export/import to memory ids or shared memory access (SHMA).

Cheers

Alex

Read only

Former Member
0 Likes
928

Hi, thanks for your answer.

As the document said, this usage can be access in a same internal session,

and as I know, when use submit/call transaction, both are in a internal session.

so what's 's difference between logical unit of work and internal session?

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
928

Hello,

When you SUBMIT a program(PROG2), it will be executed in a separate internal session.

You can access the global variables of the program loaded in the same internal session via the ASSIGN statement. Hence in case of SUBMIT the ASSIGN will fail.

You can make use of the ABAP memory to EXPORT / IMPORT the values between the calling & the called programs.

BR,

Suhas

Read only

Former Member
0 Likes
928

Hi Saha,

When you SUBMIT a program(PROG2), it will be executed in a separate internal session.

You means the ABAP Runtime Framework will teminate current session(PROG1), and start a new separate internal session?

How about SUBMIT AND RETURN?

It also teminate the session of PROG2 and back to PROG1?

As I understand, a opened internal session(a window) is always in the same internal session,

so it caused me this question.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
928

Hello Yan,

1. If you don't use the RETURN addition the internal session of the calling program(PROG1) is (kind of)overwritten by that of the called program(PROG2).

2. If you use SUBMIT ... AND RETURN, the internal session of the calling program(PROG1) is retained.

In both these cases the called program(PROG2) is executed in a new internal session.

BR,

Suhas

PS: I'll strongly recommend you to read the F1 documentation on SUBMIT. It is very well documented there.

Read only

alex_cook
Active Participant
0 Likes
928

As I understand, a opened internal session(a window) is always in the same internal session,

so it caused me this question.

Hence the problem - an internal session is not the same as a user session (eg a window).

Cheers

Alex

Read only

Former Member
0 Likes
928

The addition AND RETURN starts the executable program in a new internal session. The session for the calling program is retained. Once program access is completed, program execution for the calling program continues after the SUBMIT statement.

The label in name can also have the form (PROG)DOBJ for internal use only, where PROG is the name of an ABAP program and DOBJ is the name of a global data object of this program. If the program PROG is loaded during execution of the statement ASSIGN in the same internalmode as the current program, the data object (PROG)DOBJ is searched for in this program, and the field symbol points to this data object after the object has been successfully assigned.

Conbine the two part, I can get the answer.

So thanks all your information.

Read only

alex_cook
Active Participant
0 Likes
928

Probably the terminology Internal Session is more accurate - when a SUBMIT is executed a new internal session is created.

Apologies for the confusion.