Application Development and Automation 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: 
Read only

Error in Form and Perform

Former Member
0 Likes
1,144

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,056

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.

5 REPLIES 5
Read only

Former Member
0 Likes
1,056

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

Read only

kiran_k8
Active Contributor
0 Likes
1,056

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

Read only

Former Member
0 Likes
1,056

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.

Read only

Former Member
0 Likes
1,056

The variable you are using in the cascaded perform, is a local variable.

Try perform ith addition 'Using'.

Read only

Former Member
0 Likes
1,057

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