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

how to make input parameter with multiple values in function module?

Former Member
0 Likes
6,098

Hello Experts,

I want to create a function module which takes input as material number.

but how to make input parameter for material as it can take multiple material number at the time?

Regards

RH

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,130

Hello Ronny,

how to make input parameter for material as it can take multiple material number at the time?

For this you need to have a range table for Material No.(MATNR).

SAP has provided a range table for MATNR - RANGE_T_MATNR(Range Table for Data Element MATNR). You can define your input parameter for material as import param:

R_MATNR TYPE RANGE_T_MATNR

Hope this will help.

BR,

Suhas

6 REPLIES 6
Read only

faisalatsap
Active Contributor
2,130

Hi,

Use Select Options like the following and from the extension button you can give multiple values,

SELECT-OPTIONS: soregio FOR kna1-regio NO INTERVALS OBLIGATORY.

Replay if any Problem,

Kind Regards,

Faisal

Edited by: Faisal Altaf on Jan 14, 2009 12:27 PM

Read only

Former Member
0 Likes
2,130

create a range

DATA: r_matnr TYPE RANGE OF mara-matnr.

Read only

Former Member
0 Likes
2,130

Use TABLES Parameter instead of IMPORT Parameter for multiple input.

Read only

faisalatsap
Active Contributor
0 Likes
2,130

Hi,

For more detail about the select option have a look at the following code.

TABLES: kna1.

SELECT-OPTIONS: soregio FOR kna1-regio NO INTERVALS OBLIGATORY.

data: it_kan1 like STANDARD TABLE OF kna1 WITH HEADER LINE,
      wa_it_kna1 like kna1.

select * from kna1
  into CORRESPONDING FIELDS OF TABLE it_kan1
  WHERE regio in soregio. "if you will give two region using the extension buttion it will select the all records have these two regions

Kind Regards,

Faisal

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,131

Hello Ronny,

how to make input parameter for material as it can take multiple material number at the time?

For this you need to have a range table for Material No.(MATNR).

SAP has provided a range table for MATNR - RANGE_T_MATNR(Range Table for Data Element MATNR). You can define your input parameter for material as import param:

R_MATNR TYPE RANGE_T_MATNR

Hope this will help.

BR,

Suhas

Read only

faisalatsap
Active Contributor
0 Likes
2,130

Hi,

Declare and fill the range as under and then pass it to function module

ranges: rkunnr for kna1-kunnr.
rkunnr-sign = 'I'. rkunnr-option = 'EQ'.
  select kunnr from zsdo into rkunnr-low
     append rkunnr to rkunnr.
  endselect.

Use it just like Select-Option

select * from kna1
  into CORRESPONDING FIELDS OF TABLE it_kan1
  WHERE kunnr in rkunnr.

Define this Range in the "Tables" Tab in Function Module.

King Regards,

Faisal

Edited by: Faisal Altaf on Jan 14, 2009 2:19 PM