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

Multiple input value for one import parameter in RFC

Former Member
0 Likes
3,003

Hi,

I am making simple RFC as for the import parameter we can use any filed but as we can enter only one input value for one parameeter I want to know how to make an import parameetr with features as select option so that we can enter more than one value for single fields like I want to read sales data for order type OR20, OR , OR10 for this I have onlye One import fileds in RFC.

regards,

zafar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,825

Hi,

In your FM (if it is a Z FM), use the TABLES parameter.

In that, there table should be of type RVBELN. (In case you want to pass SALES ORDER in the format of a select-option).

So while calling the FM, you can directly pass your select-option variable to this FM, in the tables parameter.

RVBELN is a structure (consisting of four fields, just like select-option, for sales order)

There are other structures (in the format of a range / select-option) available in standard sap, and you can use them in the FM. If it is not there, you can easily consturct one in the dictionary using the four fields

SIGN - CHAR1

OPTION - CHAR2

LOW - as required by the field / data element

HIGH - as required by the field / data element

hope this helps.

regards,

amit m.

9 REPLIES 9
Read only

Former Member
0 Likes
1,825

Hi can u help on this issue.

regards,

zafar

Read only

Former Member
0 Likes
1,826

Hi,

In your FM (if it is a Z FM), use the TABLES parameter.

In that, there table should be of type RVBELN. (In case you want to pass SALES ORDER in the format of a select-option).

So while calling the FM, you can directly pass your select-option variable to this FM, in the tables parameter.

RVBELN is a structure (consisting of four fields, just like select-option, for sales order)

There are other structures (in the format of a range / select-option) available in standard sap, and you can use them in the FM. If it is not there, you can easily consturct one in the dictionary using the four fields

SIGN - CHAR1

OPTION - CHAR2

LOW - as required by the field / data element

HIGH - as required by the field / data element

hope this helps.

regards,

amit m.

Read only

0 Likes
1,825

Hi Amit,

The table / strucutr e which u have given is a range like high to low i want to know about selection option like if i use Range table If i enter Low 1 and High 10 it will take all 1 to 10 as input i want to give input onl like 1 , 3 , 5 and 10 like this how to perform this .

regards,

zafar

Read only

0 Likes
1,825

Hi,

If you enter 1 to 10 on screen, in the select option,

and if you pass this select-option to the FM,

then inside the FM, it will consider all 1,2,3,...10.

(Range / select-option / range like structure - is meant for that only)

Inside the FM, you will have to write select query using the syntax IN.

regards,

amit m.

Read only

0 Likes
1,825

Hi amit,

It is OK inside the FM i will write IN syntax but for in syntax how to enter the IN value from import parameter if i use parameter i can eneter only signle value if i use Range strucutre it will take all values from LOW to high how to enter value from import parameter .

regards,

zafar

Read only

0 Likes
1,825

Hi,

In the FM definition, we do not have to use the TAB IMPORT. Rather we have to use the tab TABLES.

Inside the TABLES tab,

put the parameter name as eg. VBLNR LIKE RVBELN.

Select-option is nothing but an internal table behind the scenes. Similar is the RVBELN.

So whatever is there in the select-option (single value, multiple values, exclude values, etc).... the full internal table of select-option will get passed (using TABLES) to the FM. Inside the FM you can use IN, as if the variable VBLNR was a select-option.

regards,

amit m.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,825

Hello Amit,

As per the OP's req. he has to use the TABLES as the interface parameter but i prefer to use the structure SELOPT instead of RVBELN

I will define as:

T_RANGE LIKE SELOPT

Cheers,

Suhas

Read only

0 Likes
1,825

Hi suhas,

That can be done, but the issue is the length of the LOW and HIGH. Selopt is GENERAL. - 24 characters.

So inside FM when we do select query, it may not match with the table field of VBELN (bcos of prefixed 000 characters, length etc) and might not give proper results. That is why SAP has made many range structures for many important fields.

regards,

amit m.

Read only

Former Member
0 Likes
1,825

Hi Zafar,

Create 2 import parameters

lv_low

lv_high

Not through the RFC call pass 2 values.. low & high value.. lets say u have passed lv_low = 2 & lv_high = 15.

Now you want the select query to process records which has values 2 , 5, 7, 9 .. 11, 13 & 15.. which means lv_low + 1 logic

So in the FM declare a range variable

Ranges : r_val for ztable-value.

r_val-sign = 'I'.
r_val-option = 'EQ'.
r_val-low = lv_low.
append r_val.

lv_low = lv_low + 1.
if lv_low < lv_high.
r_val-low = lv_low.
append r_val.

endif.

otherwise.if u want to select based on low & high value...

r_val-sign = 'I'.
r_val-option = 'EQ'.
r_val-low = lv_low.
r_val-high = lv_high.
append r_val.


select * from ztable where val in r_val.

Thanks,

Best regards,

Prashant