cancel
Showing results for 
Search instead for 
Did you mean: 

Pass information to SMARTFORM using EXPORT TO MEMORY

Former Member
0 Kudos

Hi everyone!

I have a Z program that calls 'BAPI_GOODSMVT_CREATE'. This BAPI prints a Z Smartform. So, I have to pass an additional data to this Smartform, but I can't change its interface (IMPORT / EXPORT / TABLES) because it is called by the BAPI (standard code). I am trying to use EXPORT TO MEMORY statement from my initial Z program. When I debug, the command works well, with SY-SUBRC = 0. When I try to retrieve this information in Smartform, using IMPORT FROM MEMORY, occurs an error (SY-SUBRC = 4).

Do anyone know if the IMPORT / EXPORT TO MEMORY command works in this situation ( PROGRAM -> BAPI -> SMARTFORM )?

Thank you!

<MOVED BY MODERATOR TO THE CORRECT FORUM>

Edited by: Alvaro Tejada Galindo on Jan 14, 2010 2:46 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Carlos,

In case memory ID is not working (may be bcos of session / internal session etc),

then one option is to use

EXPORT ... to DATABASE ID... (please see F1 help on this).

Your value will get saved in a database table and using IMPORT... FROM DATABASE ID...

will fetch you the data.

Since it is quite possible that multiple users can run this report at any point of time, you can construct a dynamic memory ID which is unique all times and accordingly apply the logic while exporting as well as importing. After importing you can as well delete this so that it does not build up in database.

hope this helps.

regards,

amit m.

Former Member
0 Kudos

Hi, Amit!

It works perfectly!

I checked help for command with DATABASE option and I implemented like this:


PROGRAM
EXPORT l_verid FROM l_verid TO DATABASE indx(za) id INDXKEY.


SMARTFORM
IMPORT l_verid TO l_verid FROM DATABASE indx(za) id INDXKEY.
DELETE FROM DATABASE indx(za) ID indxkey.

Thanks to all!

Answers (3)

Answers (3)

Former Member
0 Kudos

I will try to use the EXPORT TO DATABASE..

Thanks!

Edited by: Carlos Werberich on Jan 14, 2010 2:45 PM

Former Member
0 Kudos

Hi, Frisoni!

The code is:

Z PROGRAM

DATA: l_verid TYPE verid.

l_verid = 'TEST_DATA'.

EXPORT l_verid TO MEMORY ID 'ZLSV_MOVEMENT_SF_LVERID'.

After the export, sy-subrc = 0 (success)

SMARTFORM

DATA: l_verid TYPE verid.

CLEAR l_verid.

IMPORT l_verid FROM MEMORY ID 'ZLSV_MOVEMENT_SF_LVERID'.

After the import, sy-subrc = 4 (error)

I used many variations in sintax of the EXPORT / IMPORT commands and nothing worked.

I also tried with SET PARAMETER / GET PARAMETER, and these commands didn't work too.

Maybe the BAPI in the middle of the process is creating a new area in SAP memory, or a new thread... But I have no idea what is happening.

Thanks!

guilherme_frisoni
Contributor
0 Kudos

Carlos,

try to set a breakpoint in your Smartform FM.

When stops (if stop), check abap stack in debug to see if your calling program is there. If it is, you can get your value using field-symbols.

But it seems some funcion is called in another task, try to find BAPI and SMARTFORM call to check it.

Regards,

Frisoni

guilherme_frisoni
Contributor
0 Kudos

Hi,

it should work.

Paste your code for export and import here.

But remember, variable names must be the same in EXPORT and IMPORT command.

Regards,

Frisoni