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: 

difference between parameter and parameters

Former Member
0 Kudos

Hi all

Can any body tell me the difference between <b>parameter</b> and <b>parameters</b>.

Thanks

srini

1 ACCEPTED SOLUTION

former_member386202
Active Contributor
0 Kudos

Hi,

PARAMETERS

Syntax

PARAMETERS {para[(len)]}|{para [LENGTH len]}

[type_options]

[screen_options]

[value_options]

[ldb_options].

Effect

Declaration of a para parameter of length len. Parameters are components of a selection screen that are assigned a global elementary data object in the ABAP program and an input field on the selection screen.

The name of the para parameter may contain a maximum of eight characters. This statement is permitted in the global declaration part of executable programs, function groups and module pools. In function groups and module pools it is only permitted within the definition of a independent selection screen. In executable programs, it is otherwise automatically assigned to the standard selection screen.

The length len can only be specified if the data type specified in type_options is generic regarding the length (c, n, p, and x). The length len must be specified as a numeric literal or as a numeric constant within the corresponding interval ranges. If len is not specified, the length is set to 1 for a generic data type, or else it is set to the length of the data type. As of Release 6.10, it is possible to specify the length using the LENGTH addition.

In detail, the PARAMETERS statement has the following effect:

The statement declares a global variable para of the specified length in the program. The type of the data object is specified in type_options.

On the current selection screen, an input field with the same name and a suitable external data type is created in a new line at position 35. The length of the input field is aligned with the length of the parameter. The maximum length of the input field is 132. The maximum visible length of the input field is between 39 and 45, depending on the nesting depth in blocks with frames. If the len length is greater than the maximum visible length, the content is displayed as movable.

In front of the input field, in the first possible position, an automatically generated output field is displayed as a description, whose length is between 23 and 30 depending on the nesting depth in blocks with frames. The output field contains either the name of the para parameter or the selection text to which the parameter is assigned in the text elements of the program. If the user requests field or input help on the output field using the F1 or F4 function keys, the same output is displayed as when the input field itself is selected.

The attributes of the elements on the selection screen can be influenced in screen_options and with the SELECTION-SCREEN statement.

Before the selection screen is sent, the content of the para data object is transported to the input field on the selection screen and a convertion routine may be executed. If the length of the parameter is greater than 132, the content is truncated from the right. Settings regarding the content of the input field can be made in value_options. After a user action on the selection screen, the content of the input field is transported to the data object and the content of character-type fields is converted into uppercase by default. Afterwards, a conversion routine may be executed. Various selection screen events are triggered after the transport.

If parameters are defined in the selection include in the logical database, additional ldb_options additions are necessary or possible.

... [PARAMETER-TABLE ptab]

[EXCEPTION-TABLE etab]... .

Extras:

1. ... PARAMETER-TABLE ptab ...

2. ... EXCEPTION-TABLE etab ...

Effect

These additions assign actual parameters to the formal parameters of the function module and return values to the non-class-based exceptions - with the help of the internal tables ptab and etab.

Addition 1

... PARAMETER-TABLE ptab ...

Effect

Using PARAMETER-TABLE, actual parameters can be assigned to all the formal parameters of the called function module. For ptab, a sorted table of the table type ABAP_FUNC_PARMBIND_TAB or of the line type ABAP_FUNC_PARMBIND from the ABAP type group must be specifid. The table must be specified for the execution of the CALL FUNCTION statement for each non-optional formal parameter and can contain exactly one line for each optional formal parameter. The columns of the table are:

NAME of the type c of length 30

for the name of the appropriate formal parameter in uppercase letters. If a formal parameter is specified that does not exist, an exception is raised, which can be handled.

KIND of the type i

for the type of formal parameter. KIND must contain the value of the following constants of the ABAP type group.

- ABAP_FUNC_EXPORTING for input parameters

- ABAP_FUNC_IMPORTING for output parameters

- ABAP_FUNC_CHANGING for input/output parameters

- ABAP_FUNC_TABLES for table parameters

If the type specified from the caller perspective does not match the actual type of the formal parameter, an exception is raised, which can be handled.

VALUE of the type REF TO data

as a pointer to a suitable actual parameter. The data object to which the reference variable in VALUE points is assigned to the formal parameter specified in NAME.

TABLES_WA of the type REF TO data

as a pointer to a suitable work area if the column KIND contains the value ABAP_FUNC_TABLES. If TABLES_WA is not initial, the data object to which the reference variable in TABLES_WA points is passed to the header line of the table parameter specified in NAME.

The columns NAME and KIND form the unique key of the table ptab.

Addition 2

... EXCEPTION-TABLE etab ...

Effect

Using EXCEPTION-TABLE, return values can be assigned to exceptions of the called function module that are not marked as exception classes in the Function Builder. For etab, a hash table of the table type ABAP_FUNC_EXCPBIND_TAB or of the line type ABAP_FUNC_EXCPBIND from the ABAP type group must be specified. The table can contain exactly one line for each non-class-based exception of the function module during the execution of the CALL FUNCTION statement. The columns of the table are:

NAME of the type c of length 30

for the name of the appropriate exception or ERROR_MESSAGE,

or OTHERS in uppercase letters.

VALUE of the type i

for the numeric value that is to be available after handling of the exception specified in NAME in sy-subrc

MESSAGE of the type REF TO data

(not yet at the moment).

The column NAME is the unique key for the table etab.

Example

Call of the function module GUI_DOWNLOAD with dynamic parameter transfer. The name of the function module is specified in the funct string and the interface is supplied with data through the internal tables ptab and etab.

TYPE-POOLS abap.

DATA: line TYPE c LENGTH 80,

text_tab LIKE STANDARD TABLE OF line,

filename TYPE string,

filetype TYPE c LENGTH 80,

fleng TYPE i.

DATA: func TYPE string,

ptab TYPE abap_func_parmbind_tab,

ptab_line TYPE abap_func_parmbind,

etab TYPE abap_func_excpbind_tab,

etab_line TYPE abap_func_excpbind.

func = 'GUI_DOWNLOAD'.

filename = 'c:\temp\text.txt'.

filetype = 'ASC'.

ptab_line-name = 'FILENAME'.

ptab_line-kind = abap_func_exporting.

GET REFERENCE OF filename INTO ptab_line-value.

INSERT ptab_line INTO TABLE ptab.

ptab_line-name = 'FILETYPE'.

ptab_line-kind = abap_func_exporting.

GET REFERENCE OF filetype INTO ptab_line-value.

INSERT ptab_line INTO TABLE ptab.

ptab_line-name = 'DATA_TAB'.

ptab_line-kind = abap_func_tables.

GET REFERENCE OF text_tab INTO ptab_line-value.

INSERT ptab_line INTO TABLE ptab.

ptab_line-name = 'FILELENGTH'.

ptab_line-kind = abap_func_importing.

GET REFERENCE OF fleng INTO ptab_line-value.

INSERT ptab_line INTO TABLE ptab.

...

etab_line-name = 'OTHERS'.

etab_line-value = 10.

INSERT etab_line INTO TABLE etab.

CALL FUNCTION func

PARAMETER-TABLE

ptab

EXCEPTION-TABLE

etab.

CASE sy-subrc.

WHEN 1.

...

...

ENDCASE.

Regards,

Prashant

2 REPLIES 2

former_member386202
Active Contributor
0 Kudos

Hi,

PARAMETERS

Syntax

PARAMETERS {para[(len)]}|{para [LENGTH len]}

[type_options]

[screen_options]

[value_options]

[ldb_options].

Effect

Declaration of a para parameter of length len. Parameters are components of a selection screen that are assigned a global elementary data object in the ABAP program and an input field on the selection screen.

The name of the para parameter may contain a maximum of eight characters. This statement is permitted in the global declaration part of executable programs, function groups and module pools. In function groups and module pools it is only permitted within the definition of a independent selection screen. In executable programs, it is otherwise automatically assigned to the standard selection screen.

The length len can only be specified if the data type specified in type_options is generic regarding the length (c, n, p, and x). The length len must be specified as a numeric literal or as a numeric constant within the corresponding interval ranges. If len is not specified, the length is set to 1 for a generic data type, or else it is set to the length of the data type. As of Release 6.10, it is possible to specify the length using the LENGTH addition.

In detail, the PARAMETERS statement has the following effect:

The statement declares a global variable para of the specified length in the program. The type of the data object is specified in type_options.

On the current selection screen, an input field with the same name and a suitable external data type is created in a new line at position 35. The length of the input field is aligned with the length of the parameter. The maximum length of the input field is 132. The maximum visible length of the input field is between 39 and 45, depending on the nesting depth in blocks with frames. If the len length is greater than the maximum visible length, the content is displayed as movable.

In front of the input field, in the first possible position, an automatically generated output field is displayed as a description, whose length is between 23 and 30 depending on the nesting depth in blocks with frames. The output field contains either the name of the para parameter or the selection text to which the parameter is assigned in the text elements of the program. If the user requests field or input help on the output field using the F1 or F4 function keys, the same output is displayed as when the input field itself is selected.

The attributes of the elements on the selection screen can be influenced in screen_options and with the SELECTION-SCREEN statement.

Before the selection screen is sent, the content of the para data object is transported to the input field on the selection screen and a convertion routine may be executed. If the length of the parameter is greater than 132, the content is truncated from the right. Settings regarding the content of the input field can be made in value_options. After a user action on the selection screen, the content of the input field is transported to the data object and the content of character-type fields is converted into uppercase by default. Afterwards, a conversion routine may be executed. Various selection screen events are triggered after the transport.

If parameters are defined in the selection include in the logical database, additional ldb_options additions are necessary or possible.

... [PARAMETER-TABLE ptab]

[EXCEPTION-TABLE etab]... .

Extras:

1. ... PARAMETER-TABLE ptab ...

2. ... EXCEPTION-TABLE etab ...

Effect

These additions assign actual parameters to the formal parameters of the function module and return values to the non-class-based exceptions - with the help of the internal tables ptab and etab.

Addition 1

... PARAMETER-TABLE ptab ...

Effect

Using PARAMETER-TABLE, actual parameters can be assigned to all the formal parameters of the called function module. For ptab, a sorted table of the table type ABAP_FUNC_PARMBIND_TAB or of the line type ABAP_FUNC_PARMBIND from the ABAP type group must be specifid. The table must be specified for the execution of the CALL FUNCTION statement for each non-optional formal parameter and can contain exactly one line for each optional formal parameter. The columns of the table are:

NAME of the type c of length 30

for the name of the appropriate formal parameter in uppercase letters. If a formal parameter is specified that does not exist, an exception is raised, which can be handled.

KIND of the type i

for the type of formal parameter. KIND must contain the value of the following constants of the ABAP type group.

- ABAP_FUNC_EXPORTING for input parameters

- ABAP_FUNC_IMPORTING for output parameters

- ABAP_FUNC_CHANGING for input/output parameters

- ABAP_FUNC_TABLES for table parameters

If the type specified from the caller perspective does not match the actual type of the formal parameter, an exception is raised, which can be handled.

VALUE of the type REF TO data

as a pointer to a suitable actual parameter. The data object to which the reference variable in VALUE points is assigned to the formal parameter specified in NAME.

TABLES_WA of the type REF TO data

as a pointer to a suitable work area if the column KIND contains the value ABAP_FUNC_TABLES. If TABLES_WA is not initial, the data object to which the reference variable in TABLES_WA points is passed to the header line of the table parameter specified in NAME.

The columns NAME and KIND form the unique key of the table ptab.

Addition 2

... EXCEPTION-TABLE etab ...

Effect

Using EXCEPTION-TABLE, return values can be assigned to exceptions of the called function module that are not marked as exception classes in the Function Builder. For etab, a hash table of the table type ABAP_FUNC_EXCPBIND_TAB or of the line type ABAP_FUNC_EXCPBIND from the ABAP type group must be specified. The table can contain exactly one line for each non-class-based exception of the function module during the execution of the CALL FUNCTION statement. The columns of the table are:

NAME of the type c of length 30

for the name of the appropriate exception or ERROR_MESSAGE,

or OTHERS in uppercase letters.

VALUE of the type i

for the numeric value that is to be available after handling of the exception specified in NAME in sy-subrc

MESSAGE of the type REF TO data

(not yet at the moment).

The column NAME is the unique key for the table etab.

Example

Call of the function module GUI_DOWNLOAD with dynamic parameter transfer. The name of the function module is specified in the funct string and the interface is supplied with data through the internal tables ptab and etab.

TYPE-POOLS abap.

DATA: line TYPE c LENGTH 80,

text_tab LIKE STANDARD TABLE OF line,

filename TYPE string,

filetype TYPE c LENGTH 80,

fleng TYPE i.

DATA: func TYPE string,

ptab TYPE abap_func_parmbind_tab,

ptab_line TYPE abap_func_parmbind,

etab TYPE abap_func_excpbind_tab,

etab_line TYPE abap_func_excpbind.

func = 'GUI_DOWNLOAD'.

filename = 'c:\temp\text.txt'.

filetype = 'ASC'.

ptab_line-name = 'FILENAME'.

ptab_line-kind = abap_func_exporting.

GET REFERENCE OF filename INTO ptab_line-value.

INSERT ptab_line INTO TABLE ptab.

ptab_line-name = 'FILETYPE'.

ptab_line-kind = abap_func_exporting.

GET REFERENCE OF filetype INTO ptab_line-value.

INSERT ptab_line INTO TABLE ptab.

ptab_line-name = 'DATA_TAB'.

ptab_line-kind = abap_func_tables.

GET REFERENCE OF text_tab INTO ptab_line-value.

INSERT ptab_line INTO TABLE ptab.

ptab_line-name = 'FILELENGTH'.

ptab_line-kind = abap_func_importing.

GET REFERENCE OF fleng INTO ptab_line-value.

INSERT ptab_line INTO TABLE ptab.

...

etab_line-name = 'OTHERS'.

etab_line-value = 10.

INSERT etab_line INTO TABLE etab.

CALL FUNCTION func

PARAMETER-TABLE

ptab

EXCEPTION-TABLE

etab.

CASE sy-subrc.

WHEN 1.

...

...

ENDCASE.

Regards,

Prashant

Former Member
0 Kudos

correct one <b>parameters</b> when used in selection screen

there is nothing called <b>parameter</b> as such.