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

Parameter Table

Former Member
0 Likes
1,137

Hi Experts,

Can anybody tell me wht exactly is a Parameter Table?

Thanks in advance

3 REPLIES 3
Read only

Former Member
0 Likes
998

Hi ,

Unlike subroutines and function modules, a dynamic method call allows you to pass the actual parameters dynamically as well. To do this, you use the additions PARAMETER-TABLE and EXCEPTION-TABLE of the CALL METHOD statement:

CALL METHOD ... PARAMETER-TABLE ptab

EXCEPTION-TABLE etab.

The parameter table ptab must be a hash table of the table type ABAP_PARMBIND_TAB or of the line type ABAP_PARMBIND. These types are defined in the ABAP Dictionary. The table has the following three columns:

· NAME for the name of the formal parameter

· KIND for the type of parameter passing

· VALUE of the type REF TO DATA for the value of the actual parameter

The NAME column is the unique table key. For each non-optional parameter you must fill exactly one line of the internal table. For each optional parameter you can do this, but are not forced to.

The type of parameter passing is determined in the declaration of the method called for each formal parameter. The contents of the KIND column may therefore be initial. If you want to check the type of parameter passing at runtime, you can assign one of the following constants from the global class CL_ABAP_OBJECTDESCR to the KIND column:

· CL_ABAP_OBJECTDESCR=>EXPORTING for EXPORTING parameters

· CL_ABAP_OBJECTDESCR=>IMPORTING for IMPORTING parameters

· CL_ABAP_OBJECTDESCR=>CHANGING for CHANGING parameters

· CL_ABAP_OBJECTDESCR=>RECEIVING for RECEIVING parameters

The descriptions depend on the view of the caller. If the specified and actual parameter types differ, the system generates the catchable runtime error DYN_CALL_METH_PARAM_KIND. You can also use the entries in the KIND column as an additional key, for example, to read all imported values after the method call.

Please reward if useful.

Read only

p291102
Active Contributor
0 Likes
998

Hi,

Entering a Parameter Table

Suppose we want to study the relationship between current and temperature for several shots taken under similar conditions. We have the data in the following table. Shot Current Temperature

83001 400 2.1

83002 410 2.2

83003 450 3.0

83004 430 2.8

83005 445 2.9

First let's create a database with these values in it. We'll call the database TESCAL, and the parameters SHOT, IP, and TE. All data are stored in character format and cannot exceed 12 characters.

$ LOCUS

Database? TESCAL

Edit,Print,Plot,Regress,...? E

TESCAL not found. Create it? Y

Parameter? SHOT

Parameter? IP

Parameter? TE ;

SHOT? 83001 400 2.1 ;

SHOT? 83002 410 2.2 ;

SHOT? 83003 450 3.0 ;

SHOT? 83004 430 2.8 ;

SHOT? 83005 445 2.9 ;

SHOT? \X

To create a parameter table:

Edit option? <AE>: CP

New table name? <>: COOLPLASMAS

Alias? <>: C

To define the parameter names, data formats and lengths:

Parameter and Format? < >: SHOT

Data type? <real>:

\* Options are:

1) Integer

2) Real (or float)

3) Char

Data type? <real>: I

Length in bytes (2, 4, or <=132 for CHAR)? <>: 4

Parameter, format, length? <SHOT>: IP R 4

Parameter, format, length? <SHOT>: TE R 4

Parameter, format, length? <SHOT>: COMMENT C 132

Parameter, format, length? <SHOT>:

COMMENT IP SHOT TE

; to write parameters to the database.

Parameter, format, length? <SHOT>: ;

Specify the permits:

\* Options are:

1) Retrieve permission to all

2) Private access

3) Define access rights individually

Select access rights for COOLPLASMAS <D>: RE

Enter records:

SHOT? <NODATA>: 83001

IP? <NODATA>: 400

TE? <NODATA>: 2.1

COMMENT? <NODATA>: "'Good shot; no disruptions.'"

SHOT? <NODATA>: ;

SHOT? <83001>: 83002 410 2.2 "'Medium good shot.'" ;

SHOT? <83001>: 83003 450 3.0 """Excellent shot.""" ;

insert into COOLPLASMAS (SHOT,IP,TE,COMMENT)

values (25001,800,35,'Good shot; no disruptions.')

Note that character data is entered between "' and '" or between """'s.

(The ; is used to indicate the end of the list of parameters and the end of the individual records. Until the ; is typed, the record is not stored. \X exits from the program.)

Thanks,

Shankar

Read only

Former Member
0 Likes
998

thanks