Application Development 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: 

Memory Issues

Former Member
0 Kudos

Hi Everyone,

I am having an issue storing and retrieving values from memory.

I have a program which runs as per a scheduled job 3 times a day, the selection screen contains a parameter for company code. The same program can also be executed manually by another user with the same company code as in the scheduled job.

I want to stop the foreground program if there's a job running with the same company code.

This is what I have done in the code.....

PARAMETER : P_BUKRS TYPE BUKRS OBLIGATORY.

Data : V_BUKRS TYPE BUKRS.

IMPORT V_BUKRS from MEMORY ID 'ZCC'.

IF V_BUKRS IS INITIAL.

EXPORT V_BUKRS TO MEMORY ID 'ZCC'.

<<i>Further processing</i>>

ELSEIF NOT V_BUKRS IS INITIAL.

IF V_BUKRS EQ P_BUKRS.

*****ERROR MESSAGE*****

ENDIF.

ENDIF.

I don't know whether the code that I have written is correct or not. I executed the program in the background then immediately I run the program in foreground using another user ID. The IMPORT statement doesn't fetch the value from MEMORY and hence the program is failing.

Can anyone please help me on this?

Thanks.

Kalyan.

3 REPLIES 3

former_member194669
Active Contributor
0 Kudos

Hi,

MEMORY is user specific LUW.

So you need to store the BUKRS in custom table at starting of the program and then after completion of the program you need to delete the entry from this table.

If the program runs you need to validate with this table


But here is the catch. if the program terminate in between execution, at least you need to provide proper message along with your company code it had started run. becuase if it terminate in middle of execution you have entry in the custom table of the BUKRS forever, this need to handle properly.

0 Kudos

Hi a®s,

Thanks for your quick reply. In fact this was the same solution that I too had in mind in case the memory thing doesn't work. It seems that I will have to implement this solution.

Again thanks!!.

Kalyan.

0 Kudos

If you create an entry in a custom table to handle this, you will eventually run into problems when the program fails and leaves the table in the wrong state. A simpler approach is simply to create and test a lock argument.

Rob