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: 

Accessing Global Definitions within Program

Former Member
0 Kudos

Hello!

I would like to access the value of variables defined in Global Definitions of a smartform (as the following image shows) within my ABAP program. Does anyone know how it would be possible?

Thanks,

Arman

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Accessing global variables of a program was discussed in the forum, e.g:

With smartforms there's another tricky issue, generated program name in to 'partner' namespace.

To access variable of a simple program:

ASSIGN ('(lv_progname)lv_varname') TO <lv_data>.

Code in smartform is defined in the function group, so you need to add SAPL prefix to f.group's name.

Also generated function module is in the 'partner' namespace - SAPL goes after /xxx/ prefix.

Example for lv_progname:

/1BCDWB/SF00000118 need to be changed into  /1BCDWB/SAPLSF00000118

Regards,

Radek

10 REPLIES 10

Former Member
0 Kudos

Hi Arman,

It is not possible to access Global variables from ABAP program.

Former Member
0 Kudos

Hi,

Accessing global variables of a program was discussed in the forum, e.g:

With smartforms there's another tricky issue, generated program name in to 'partner' namespace.

To access variable of a simple program:

ASSIGN ('(lv_progname)lv_varname') TO <lv_data>.

Code in smartform is defined in the function group, so you need to add SAPL prefix to f.group's name.

Also generated function module is in the 'partner' namespace - SAPL goes after /xxx/ prefix.

Example for lv_progname:

/1BCDWB/SF00000118 need to be changed into  /1BCDWB/SAPLSF00000118

Regards,

Radek

balaji_nandikolla
Participant
0 Kudos

Hi Arman,

Off the top of my head, one option to access them is - STACK ACCESS.

But I would like to know, what is the exact requirement -- why do you want to access the global variables' values?

Regards,

Balaji

0 Kudos

hi

smartform itself is called by a program. so you can call your program via the program which calls smartform. in this way you can transfer the variable values

regards

anurag

0 Kudos

what is the timing of the access you need to make? Is 'your' program the driver program of the smartform? If so you maybe able to use the approach Radek has suggested. If not and you arer talking about another program which runs independently of the smartform but slightly later you may be able to 'export' the values of the variables you require to memory and then import them from memory in your program.

matt
Active Contributor
0 Kudos

Arman Sheikholeslami wrote:

Hello!

I would like to access the value of variables defined in Global Definitions of a smartform (as the following image shows) within my ABAP program. ...

Once again we have someone stating their preferred solution and wanting to know how to make it work. What is your actual requirement? What is the technical issue that you think accessing the global definitions will solve?

Former Member
0 Kudos

Hello everyone,

Thank you for your comments and solutions.

Actually, I have a Z-report, which provides the results either in a smartform format, or it exports all the results into an Excel file.

Since in either formats the output is identical, and that the smartform part is already implemented, I want to reuse the variable definitions of the smartform in the code that I am developing to export the output into the Excel.

Basically, I can develop everything from scratch, however, I though that there might be a better way!

Thank you,

Arman

former_member185054
Active Participant
0 Kudos

hi arman,

Are you using driver program to push data to smartform? if so then directly call gui_download and pass your final table.

With regards,

sampath kumar.

former_member186741
Active Contributor
0 Kudos

The form(subroutine) could be put in an abap program(your driver maybe) and used from both the smartform and the excel export section. So basically change your smartfrom to execute an external form in the initialization section (rather than the form in the smartfrom which should now be deleted) and code the export section to use the same form. There is no need to share global variables just use common code at different times.

former_member206650
Active Participant
0 Kudos

Hi ,

if the smartform is called inside the program then if u want to access the global variable you can write a program line and assign it to the export variable .this export variable should be defined in the form interface's export parameters..

hope it helps