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

SmartForms - Input & Output Parameters of Program Lines

Former Member
0 Likes
11,383

When I create a program line in my form, I need to add Input Parameters and Output Parameters in its General Attributes tab. I want to know what the standard of filling this two kinds of parameters is. Many thanks!

1 ACCEPTED SOLUTION
Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
7,567

It does compile into a subroutine but if you look at the FM code you'll see that the routine actually doesn't have USING / CHANGING as one would expect. From what I've seen, these input/output parameters are just used in the syntax check. E.g. you can't use a variable if you don't put it in one of those (I'm pretty sure it doesn't even matter which side you put in). It's a good practice to put the read variables in input and changed variables in output, but it's not really enforced, from what I've seen.

19 REPLIES 19
Read only

Former Member
0 Likes
7,567

Hi,

You can search for this on Google instead of asking this on SCN.

Read only

0 Likes
7,567

I tried but unfortunately didn't get appropriate answer.

Read only

0 Likes
7,567

I will appreciate it if you could tell me the answer.

Read only

0 Likes
7,567

program lines is to do your custom logic or any other requirement in it. Basically you enter what value you going to read in the input parameters and what is the value you going to change/update in the export parameters...

Read only

0 Likes
7,567

Hi,

Though you must have got your answer till now, still for your reference please visit the below link. This will definetely give you a better idea.

http://help.sap.com/saphelp_nw04s/helpdata/en/a3/80bae8dfd911d3b576006094192fe3/content.htm

http://saptechnical.com/Tutorials/Smartforms/GlobalDefinitions/Define.htm

Read only

former_member300076
Participant
0 Likes
7,567

Hi,

When you are creating a SMARTFORM, a function module wil be generated for it. A program line will be correspond to a form routine in your generated Function Module.

This program line can have Input and Output Parameters. You have to put in the input your global data from your SF you want to use in those lines. In the output simply put the same variables you put in the input.

Regards

Sam

Read only

0 Likes
7,567

Hi, Sam! Thank you for your answer! But I can't understand why "In the output simply put the same variables you put in the input". Is it necessary that I copy all parameters of Input Parameters to Output Parameters?

Read only

0 Likes
7,567

Hi,

Not necessarily , you have to put in the output only the variables that have been modified in your program line.

Read only

0 Likes
7,567

Hi Shelwin,

In your Program lines code, u need to have parameters as input and whatever processing u do, u can get them as output. 

I have 2 pseudo codes below for your understanding.

A = 10. ( Global Variable as Input )

Add 10 to A.

Write A ( output )

**********************************

A = 10. ( Global Variable as Input )

Add 10 to A.

B = A.

Write B ( output )

Please revert in case of issues.

Thanks

Vivek

Read only

0 Likes
7,567

hi Shelwin,

Not necessary to have all the input parameters copied in the output parameters. Think of these like your import and export parameters. Since the program lilnes will create a local environment which can access variables and data present/defined inside the program lines. If you wish to access your global data in these program lines, then you need to define those in input parameters. Similarly, if you want to return your data from local environment to global, u need to define them in the output parameters. For, Eg, you based on the Material Number you want to check for some condition in ZABCD table. If condition is true you want to set V_FLAG 'X' else 'Y'. To access Material number inside program lines you will define V_MATNR(global variable) in the input parameters. Inside the program line you will select the data from ZABCD and according to condition set V_FLAG (this is global variable). Now this value wioll be reflected in the rest of the smartform only if you define this variable in the output parameter.

Hope this clears your doubts.

Please revert if otherwise.

Regards,

DN.

Read only

0 Likes
7,567

Hi, Sam & Vivek & Deepak!

Sometimes I only put the global variable which is modified in the program line to the Input Parameters.

As is the same to Vivek's second pseudo code and illustrated below, the global variable gt_item is modified by sorting but is not listed in Output Parameters. And it works! That is, sorted gt_item is reflected in the rest of smartform! I thought gt_item should be listed in Output Parameters. Could you tell me why?

Read only

0 Likes
7,567

hi Shelwin,

Can you please check there is up-down arrow key next to the parameters field. you can only see two parameters but there can be more which you can see by scrolling.

Please check and confirm.

Regards,

DN,.

Read only

0 Likes
7,567

Hi, Deepak! Sorry for no response for such a long time. I confirm that there are no more parameters below in the Output Parameters. And it is my great confusion.

Read only

Former Member
0 Likes
7,567

Input parameters are will have data and output parameters will have the changed data for the smartform . Those are global variables which we can declare in Global Data.

we can declare local variables also inside the program lines using DATA keyword.

thanks,

Vishnu

Read only

Former Member
0 Likes
7,567

Hello shelwin,

In program line we normally do our coding in with in the sf .in  Input Parameters we need to provid the vale which are going to use with in this programe line (like input value)and after any changes we need to show that value in some text node or in other way those fields are in output paramentr.

eg-if i select material text from mara,i need to pass Matnr as my input to the select qury so here in inputpara pass tablename-martnr and in output use internal tablename-maktx.if u not pass the correct input and output parameter its ll show syntex error.

Thanks,

Sam

Read only

Former Member
0 Likes
7,567

hi shelwin,

                     in smartform's generally you will be getting some sort of input from drive program or from global data-initialization, Depending on the input You will write custom logic according to the requirement of which you have print on form.

                    the input fields/variables which are required to write custom logic are written in input parameters and fields/variables which has to be changed or updated or newly inserted are to be written in output parameters 

             here gw_ekko-bukrs is the input coming from work area gw_ekko and gw_j_tmocomp is the output field to be pretend in form.


Read only

venkateswaran_k
Active Contributor
0 Likes
7,567

Hi

In smartform - Program lines

  • Primarily, The input and output parameters are the variables that are going to be used in the Program logic.
  • The Input and output parameters defeniton is the best practice in order to understand the logic if some one reads the code
  • The variables defined in both the section will works any way, ie the variables you are changing in the code, is not necessarly be defined in out parameters,  I can be in input parameters also.
  • However it is a best practice

Regards,

Venkat

Read only

arindam_m
Active Contributor
0 Likes
7,567

Hi,

The Global Parameters defined in the smart form interface passed into the smart form and used to pass data are visible across the form (Form interface & Global definitions).

Also, there is a scope to define parameters in smart forms apart from the Global Parameters. This can be done with data statements.

Now the program lines NODE is actually a subroutine when this Smart from is compiled hence the need to have Input and Output Parameters.

Check the link below:

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

Cheers,

Arindam 

Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
7,568

It does compile into a subroutine but if you look at the FM code you'll see that the routine actually doesn't have USING / CHANGING as one would expect. From what I've seen, these input/output parameters are just used in the syntax check. E.g. you can't use a variable if you don't put it in one of those (I'm pretty sure it doesn't even matter which side you put in). It's a good practice to put the read variables in input and changed variables in output, but it's not really enforced, from what I've seen.