cancel
Showing results for 
Search instead for 
Did you mean: 

Purpose of Input & Output Parameters in Program Line of Smartforms ???

sagar_ranasingh
Participant
0 Kudos

Hi Gurus,

i am new To SmartForms, i have a basic Doubt , please share your concepts.

I created a form and having a window where i am displaying a value in a TEXT .

in Program lines , i written code like this. --

 data : text  type char20.
    if sfsy-copycount = '001' .
         text = 'Bank Copy' .
   elseif sfsy-copycount = '002' .
         text = 'Customer copy' .
   else.
         text = 'User Copy' .
   endif . 

.

in the Text window, am displaying the value as &TEXT&

Instead of declaring TEXT variable in Global Definition, i defined here in Program lines as this variable will be used in this window only. But system giving me Error Field "TEXT" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement.

But when declared again in Global definition. its giving message, "TEXT" has already been declared.

my point is why i need to Define Globally, when i am not giving any input , and its value will be used as locally only in this window only ?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

All variables to be printed in a smartforms have to be global data, that means they are defined in GLOBAL DATA or belong to the INTERFACE of the smartforms.

After generating the smartform the system creates a function module (you call in your program) so, just like for the sapscript, only the global data can be printed,

the global data of the driven program, that means the global data of the function generated for the smartform

Max

Edited by: max bianchi on Aug 16, 2011 12:31 PM

sagar_ranasingh
Participant
0 Kudos

Hi Biran.

I have already declared a field MATNR in form interface as its the parameter value i am passing to the form.

From my driver program i have to pass this value to the EXPORT parameter of the Function module.

But i am nt passing the TEXT value in the driver program.

as here for this scenario , there is no value in INPUT PARAMETER of Program lines, as i am not using any INPUT for TEXT value calculation.

????

Edited by: sagar singh on Aug 16, 2011 4:32 PM

Answers (3)

Answers (3)

Former Member
0 Kudos

Max told you all what is to know about this, tho i´m trying to tell you the same in a slightly modified way, so you maybe can understand it the better.

When your smartform gets activated, a function module will be generated.

A program line in your smartform will be a form routine in your generated function module.

The form routine can have an interface, which is exactly the one you are declaring in those fields above it.

Like you sure know, you can only call a form routine with already existing variables.

regards

sagar_ranasingh
Participant
0 Kudos

Hi Floriana.

as you said *A program line in your smartform will be a form routine in your generated function module.

The form routine can have an interface, which is exactly the one you are declaring in those fields above it.*

Can i check the form routine in my smart form Function module for the same ?? How to check the Form routine , in source code of that Function module ???

thanks

Former Member
0 Kudos

Hi

If you want to transfer the value stored in TEXT variable of your driven program, than it has to be transfered by interface

Have you done it?

Else you can include that code in your smartform, than TEXT has to be a global data (defined in global definition section)

These are the 2 options

Max

sagar_ranasingh
Participant
0 Kudos

Hi

I am not transferring the value stored in TEXT variable from driver program., The only interface parameter is MATNR field from program to FORM. and i am passing that correctly . and also MATNR field has been declared in FORM INTERFACE

Hey my FORM is behaving well as i declared the TEXT variable in Global Definition .

But my doubt was , if i am declaring the same TEXT variable only in PROGRAM LINES (Not in Global Definition), and using that in OUTPUT PARAMETERS of program lines , its giving me error .

That TEXT variable is used only in that window , so There only i declared as u can say LOCAL Declaration..

i didnt get clear idea, but got that i have to declare the variables that i use in INPUT /OUTPUT Parameters of PROGRAM LINES in GLOBAL DEFINATIONS Only.

anyways thnks for your help

Former Member
0 Kudos

Hi Sagar,

Click on below link :

[http://help.sap.com/saphelp_470/helpdata/en/1c/f40c58ddf311d3b574006094192fe3/frameset.htm]

BR

Dep

Former Member
0 Kudos

Hi,

the field TEXT needs to be interfaced somehow between your coding logic to the section where you place it on the screen. Using a global variable is an excellent way of doing this.

My suggestion, if you want to make sure that this TEXT will not be used anywhere else: give the field a proper name, i.e V_TEXT_HEADER. That will help the programmers that will be working with this smartform as well.

Roy