cancel
Showing results for 
Search instead for 
Did you mean: 

how to pass select option value to function module while using service call

Former Member
0 Kudos

Hi,

I have select-option in my WD application. To collect data based on user input im using service call. How to pass this select option values to my RFC.

rgds

sudhanshu

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Refer to this below article on how to use & set default values in a WDA Select option.

http://divulgesap.com/blog.php?p=NjY=

Hope it helps.

Cheers,

Ravi

saket_abhyankar
Active Participant
0 Kudos

Hi,

If I have understood your prob correctly, you need to proceed as follows:

Collect the data from select options into range table using following code:


  DATA: rt_matnr TYPE REF TO data.
  FIELD-SYMBOLS: <fs_matnr> TYPE table.

" Retrieve data from select option
  rt_matnr = wd_this->z_handler->get_range_table_of_sel_field( i_id = 'MATNR').    " Replace z_handler and 'MATNR' with your attribute name and field id
" Assign it to a field symbol
  ASSIGN rt_matnr->* TO <fs_matnr>.

Then arrange the data from table <fs_matnr> in importing or table parameter of RFC. Call the RFC by passing data.

I hope this will help.

Regards,

Saket.

Former Member
0 Kudos

Hi,

Thank s for your reply. In fact im doing similar with following variation:

i) collected range values using get_range* method.

ii) separate low and high values as:

read table <field2> index 1 into wa_range.

vert2_low = wa_range-low.

vert2_high = wa_range-high.

(Please note that in RFC I have taken two importing parameter as s_vert_lo and s_vert_hi)

iii) Now setting these RFC attribute as:

lo_el_importing->set_attribute(

EXPORTING

name = `S_VERT_LO`

value = vert2_low ).

and

lo_el_importing->set_attribute(

EXPORTING

name = `S_VERT_HI`

value = vert2_high ).

iv) In RFC im having my query as :

select <fld list> from BUT000 into table itab where vertical in r_vert.

Here, r_vert is a range defined as:

ranges r_vert for <fld refrence>

r_vert-sign = 'I'.

r_vert-option = 'BT'.

r_vert-low = S_VERT_LO.

r_vert-high = S_VERT_HI.

append r_vert.

Issue here is with ranges. if im passing both low and high values it is fine but if only low value being passed it is not giving me any record.

Please suggest.

Rgds

Sudhanshu

Former Member
0 Kudos

If you want to pass only low then you need to do like this-

r_vert-sign = 'I'.
r_vert-option = 'EQ'.
r_vert-low = S_VERT_LO.
append r_vert.

Hope this helps.

Cheers,

Ravikiran

saket_abhyankar
Active Participant
0 Kudos

Hi,

Try to proceed as follows:

You are filling the internal table r_vert as:



ranges r_vert for <fld refrence>
r_vert-sign = 'I'.
r_vert-option = 'BT'.
r_vert-low = S_VERT_LO.
r_vert-high = S_VERT_HI.
append r_vert.

Just make a check over high value before filling range table as:



if S_VERT_HI is initial.

r_vert-sign = 'I'.
r_vert-option = 'EQ'.                  " Option will be 'EQ' instead of 'BT'
r_vert-low = S_VERT_LO.

else.

r_vert-sign = 'I'.
r_vert-option = 'BT'.
r_vert-low = S_VERT_LO.
r_vert-high = S_VERT_HI.

endif.

append r_vert.

Then proceed with the select query. In short use option value 'EQ' when only low value is passed. Hope this will help.

Regards,

Saket.