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: 

Script : global variable value is not visible in form when call from std pr

Former Member
0 Kudos

Hi,

We have declared certain gloabl variables in our print program(custom) which is being called in the layout(custom layout). In this case it is working fine but when we are trying to run it through standard SAP transaction(VL02N) by assigning the same print prog and layout in NACE we are not able to see the values of those global variables in the output.

Can anyone help us out in solving this problem.

Thanks in advance.

Sanjay

6 REPLIES 6

Former Member
0 Kudos

u declare variable in custom driver programm so i show value when u attech this programm in nace.

but when u attech standared programm to nace than it does not show because it is not dclare in standared programm.

for this u can use perform in form to dispaly ur value....

:PERFORM get_date IN PROGRAM zreport

/:USING &SALESORDER&

/:CHANGING &S_DATE&

/:ENDPERFORM

Now you can print S_DATE.

Write this code in the new ABAP program would be

REPORT zreport.

FORM get_date TABLES in_tab STRUCTURE ITCSY

out_tab STRUCTURE ITCSY .

READ TABLE in_tab INDEX 1.

SELECT some_date FROM ztab

WHERE salesorder = in_tab-value.

IF sy-subrc EQ 0.

READ TABLE out-tab INDEX 1.

MOVE ztab-somedate TO out_tab-value

MODIFY out_tab INDEX 1.

ENDIF.

ENDFORM.

Former Member
0 Kudos

When the print program is called from the standard program it calls a specific subroutine of your print program. So your other variables declared in the program will NOT be in scope at all. That is why it is not visible.

Regards,

Ravi

Note : please mark all the helpful answers

Former Member
0 Kudos

Hi Sanjay,

Put the breakpoint in your program in which you declared the global variable.See on executing the transaction VL02N,this program is caled or not.

0 Kudos

We are already having that option to export that value to memory and call again through a subroutine but we were looking out for some solution apart from this b'cuz we have a number of global variables like that and exporting all of them and again getting it back might not be a good idea.

thanks.

Former Member
0 Kudos

HI sanjay,

1. Yes u are right.

2. This happens,

bcos,

when VL02N is used,

the MAIN PROGRAM is different,

(not our Z Program)

3. Hence, our variables (global for our Z Program)

but not global for VL02N,

do not get visible in layout.

4. For such purposes,

u may have to use the concept of

EXTERNAL SUBROUTINES

5. using

PERFORM myform IN ZPROG

using a

using b

regards,

amit m.

former_member188685
Active Contributor
0 Kudos

Hi,

You need to call external subroutines to populate those global variables, in your case they are not populating at all.so try to use performs and fill them then you can see them in your output,

Regards

vijay