05-31-2015 12:21 AM
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
05-31-2015 8:12 AM
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
05-31-2015 7:30 AM
Hi Arman,
It is not possible to access Global variables from ABAP program.
05-31-2015 8:12 AM
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
05-31-2015 8:14 AM
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
05-31-2015 1:28 PM
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
06-01-2015 1:47 AM
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.
06-01-2015 6:21 AM
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?
06-01-2015 6:54 AM
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
06-01-2015 7:34 AM
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.
06-02-2015 1:18 AM
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.
06-02-2015 6:30 AM
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