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

Memory Export/Import

Former Member
0 Likes
1,250

I need to modify some SAP code. To make it easier for upgrades, I have decided to put this modification into a Z-include. However, I need to pass some data into this include. It tried the following but it is giving me an error in the include:

  export document to MEMORY ID 'RET'.
  include zretention_LRWCLF01.

The code in the include is as follows:

import document from MEMORY ID 'RET'.

Here it is giving me an error saying that "Document is unknown". What am I doing wrong?

Regards,

Davis

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,221

Hi,

Check whether Document is globally declared or not. if not you need to decalre in the indclude .

11 REPLIES 11
Read only

Former Member
0 Likes
1,222

Hi,

Check whether Document is globally declared or not. if not you need to decalre in the indclude .

Read only

0 Likes
1,221

It isn't global to the include (SAP's include). It is local to the form inside the include. Is this the issue?

Davis

Read only

0 Likes
1,221

Yes...it should be.

Read only

0 Likes
1,221

Hi Davis,

Please let me know whether you are calling your local program from SAP standard program using any user-exit?.

Best Regards,

Krishna

Read only

0 Likes
1,221

I am doing this call from a standard SAP include. I am having to do this in order to get a user-exit to work as we need it.

When I added the data statements, it told me that "Document is already declared". I am now in a loop with it as I can't declare it yet I can't "not declare it". I also get an error saying: "Statement is not accessible" on the Import statement.

Regards,

Davis

Read only

0 Likes
1,221

Can you post your custom include and also note where you call it from the SAP include?

Rob

Read only

0 Likes
1,221

Sure.

Right now my include only has a few lines:

import document from MEMORY ID 'RET1'.
import t_accit from MEMORY ID 'RET2'.
t_accit[] = document-item[].

This include is located in form Document_Change in include LRWCLF01 (line 1037) just after the BADI calls.

Below is the code I have added to the SAP Include:

* Begin Modification for Retention
  export document to MEMORY ID 'RET1'.
  export t_accit to MEMORY ID 'RET2'.
  include zretention_LRWCLF01.
* End Modification for Retention

Regards,

Davis

Edited by: Davis on Jan 19, 2009 12:51 PM

Read only

0 Likes
1,221

Rather than just the three statements in your include, try making it a form with using and changing. Then call the form where you currently have the include. You can put the include statement at the top of the SAP include.

Rob

Read only

0 Likes
1,221

Rob,

That is such an obvious idea that I never thought of it. That should fix the issue.

Thanks,

Davis

Read only

nkr1shna
Contributor
0 Likes
1,221

Hi Davis,

Please check whether your EXPORT command was successful first, check SY-SUBRC when export is done.

EXPORT.. IMPORT works if program session is same, make sure you are calling IMPORT.. EXPORT in the same session (sequence of programs in one go.. like batch program).

Best Regards,

Krishna

Read only

Former Member
0 Likes
1,221

Hi,

When do you get this error ? Probably when you tried to do a syntax check or activate the include.

Since the variable document is not global, the visibility of this variable will only be limited to the subroutine ( form ...endform) . Therefore you will need to declare a variable with the name document in the include zretention_LRWCLF01 in order to get this working.

I think an include is loaded only at runtime hence it is not recognizing the document variable which is why you get this error.

Second option is to declare it in a global user exit include.

regards,

Advait