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

Regarding "Function Modules"

Former Member
0 Likes
860

Hello Friends, I am Goli Pradeep, new to this Community...

I have a doubt in Function Modules...

Program--

types: begin of tw_vbak,

vbeln type vbeln_va,

vkorg Type vkorg,

vtweg type vtweg,

end of tw_vbak,

tt_vbak type standard table of tw_vbak.

data: lw_vbak type tw_vbak,

lt_vbak type tt_vbak,

lf_vbeln type vbeln_va.

selection-screen begin of block b1 with frame title text-001.

<b>*select-options: so_vbeln for lf_vbeln.</b>

selection-screen end of block b1.

start-of-selection.

call function 'z_somefunction'

exporting

lm_vbeln = so_vbeln.

tables

ta_vbak = lt_vbak.

......................................................

...................................................... "REST OF THE PROGRAM CONTINUES

In the above program marked with '*', there generally we declare as

<b>parameters: so_vbeln type vbeln_va.</b>

but I want to pass the range of values to function which is possible through "select-options" only

I came to know that Global data in Function Modules is used for such programs...

Here my intension is to pass the select option value to the function module which contains a range of value, so now in that function module i have to fetch records from database table VBAP in that range...

so friends please guide me to solve this problem...

Message was edited by:

Pradeep Goli

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
602

Please check this:

data: vbeln_i type vbeln_va.

select-options: s_vbeln for (vbeln_i).

Kind Regards

Eswar

4 REPLIES 4
Read only

anversha_s
Active Contributor
0 Likes
602

hi,

u can create a range for that.

Define a range:

Ranges: r_field for <table>.

if not field1 is initial.
r_field-sign = 'I'.
r_field-option = 'EQ'.
r_field-option-low = field1.
append r_field.
endif.

if not field2 is initial.
r_field-sign = 'I'.
r_field-option = 'EQ'.
r_field-option-low = field2.
append r_field.
endif.

if field1 is initial and field2 is initial.
r_field-sign = 'I'.
r_field-option = 'EQ'.
append r_field.
endif.

select * from <table> where field1 in r_field.

rgds

anver

Read only

Former Member
0 Likes
602

hi Pradeep,

WELCOME TO SDN ...

Use Ranges ..

RANGES:r_balance FOR oiuh_rv_gl-gl_trans_am,
       r_prevbal    FOR oiuh_rv_cyc-yc_acct_perd_dt,
       r_currbal    FOR oiuh_rv_cyc-yc_acct_perd_dt.

Regards,

Santosh

Read only

Former Member
0 Likes
602

Hi,

you can declare "lm_vbeln" import parameter in the function module, of the type 'RSPARAMS' and pass the select option to it.

Parameter needs to be declared as a table.

This u can use it further in the program.

Thanks,

Rashmi.

Read only

Former Member
0 Likes
603

Please check this:

data: vbeln_i type vbeln_va.

select-options: s_vbeln for (vbeln_i).

Kind Regards

Eswar