2010 Jan 11 12:05 PM
hello all,
i am using perform statement under a report but problem is that when i m giving further perfor in the form of that perform then it is giving error *Field "VAR" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement. .
even i have defined it in form ABC. plz help.
Code:
select matnr from mara into table itab where matnr in matnr.
if sy-subrc = 0.
perform abc.
endif.
**********
form abc.
data : var type i.
if itab-matnr = 'TEST1'.
perform xyz.
else.
perform mno.
endif.
endform.
************
form xyz.
if var = '9'.
clear : var.
endif.
endform.
**************
form mno.
endform.
****************
regards saurabh.
2010 Jan 11 11:42 PM
Hi Saurabj,
As you have declared the variable u2018varu2019 inside the formu2026endform u201CABCu201D, it becomes local to the perform and can not be accessed outside the scope of this subroutine. To make it available to the outer world there are 2 ways:
1. You may use using and changing whenever you are calling any perform (XYZ or MNO) inside u201CABCu201D.
e.g: Perform XYZ (or MNO) using var.
2. You may declare the variable u2018varu2019 as global variable and itu2019s scope remains valid for the entire program.
Personally I would suggest you to go for local variable so that after the use, the memory gets cleared.
Thanks,
Pritam
Edited by: PRITAM MOHANTY on Jan 11, 2010 3:43 PM
hello all,
i am using perform statement under a report but problem is that when i m giving further perfor in the form of that perform then it is giving error *Field "VAR" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement. .
even i have defined it in form ABC. plz help.
Code:
select matnr from mara into table itab where matnr in matnr.
if sy-subrc = 0.
perform abc.
endif.
**********
form abc.
data : var type i.
if itab-matnr = 'TEST1'.
perform xyz.
else.
perform mno.
endif.
endform.
************
form xyz.
if var = '9'.
clear : var.
endif.
endform.
**************
form mno.
endform.
****************
regards saurabh.
2010 Jan 11 12:08 PM
Hi,
If u want to use variables of abc in other forms then take them there by using, 'USING' or 'CHANGING with the perfom statement.
Regards,
Surinder
2010 Jan 11 12:08 PM
saurabh,
data : var type i.,make this a global declaration ie don't declare it within the FORM but outside the FORM as a global varaible.
Kiran
2010 Jan 11 12:09 PM
Hi saurabh,
The error is coming inside this code
form xyz.
if var = '9'.
clear : var.
endif.
endform.
So either declare a new local variable here with name var.
Or
move the declaration of var
form abc.
data : var type i. "<------------- this line
outside of the form, at a global level.
hope this helps.
regards,
amit m.
2010 Jan 11 12:11 PM
The variable you are using in the cascaded perform, is a local variable.
Try perform ith addition 'Using'.
2010 Jan 11 11:42 PM
Hi Saurabj,
As you have declared the variable u2018varu2019 inside the formu2026endform u201CABCu201D, it becomes local to the perform and can not be accessed outside the scope of this subroutine. To make it available to the outer world there are 2 ways:
1. You may use using and changing whenever you are calling any perform (XYZ or MNO) inside u201CABCu201D.
e.g: Perform XYZ (or MNO) using var.
2. You may declare the variable u2018varu2019 as global variable and itu2019s scope remains valid for the entire program.
Personally I would suggest you to go for local variable so that after the use, the memory gets cleared.
Thanks,
Pritam
Edited by: PRITAM MOHANTY on Jan 11, 2010 3:43 PM